RESOLVED FIXED 195982
[JSC] Do not create JIT related data under non-JIT mode
https://bugs.webkit.org/show_bug.cgi?id=195982
Summary [JSC] Do not create JIT related data under non-JIT mode
Yusuke Suzuki
Reported 2019-03-19 19:33:04 PDT
[JSC] Do not create JIT related data under non-JIT mode
Attachments
Patch (14.94 KB, patch)
2019-03-19 19:36 PDT, Yusuke Suzuki
no flags
Patch (29.78 KB, patch)
2019-03-20 20:14 PDT, Yusuke Suzuki
no flags
Patch (29.78 KB, patch)
2019-03-20 20:33 PDT, Yusuke Suzuki
no flags
Patch (29.88 KB, patch)
2019-03-20 20:35 PDT, Yusuke Suzuki
no flags
Patch (30.15 KB, patch)
2019-03-20 20:40 PDT, Yusuke Suzuki
mark.lam: review+
Yusuke Suzuki
Comment 1 2019-03-19 19:36:06 PDT
Yusuke Suzuki
Comment 2 2019-03-20 16:59:37 PDT
Comment on attachment 365292 [details] Patch I'll add Wasm::Thunk too.
Yusuke Suzuki
Comment 3 2019-03-20 20:14:46 PDT
Yusuke Suzuki
Comment 4 2019-03-20 20:33:39 PDT
Yusuke Suzuki
Comment 5 2019-03-20 20:35:53 PDT
Yusuke Suzuki
Comment 6 2019-03-20 20:40:46 PDT
Mark Lam
Comment 7 2019-03-21 01:47:15 PDT
Comment on attachment 365476 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365476&action=review r=me with fixes. If you haven't already done so, please also do a cloop build (build-jsc --cloop) to make sure it still builds. > Source/JavaScriptCore/jit/ExecutableAllocator.h:66 > + enum ProtectionSetting { Writable, Executable }; Looks like this is no longer used anywhere. We can delete it. > Source/JavaScriptCore/runtime/VM.cpp:195 > + ExecutableAllocator::initializeUnderlyingAllocator(); > + if (!ExecutableAllocator::singleton().isValid()) { While you're in this function, I suggest you also fix it to check getenv("JavaScriptCoreUseJIT") first (currently done below) before initializing the ExecutableAllocator. No point in doing so if getenv("JavaScriptCoreUseJIT") disallows use of the JIT. > Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp:-63 > -#if USE(ARM64_DISASSEMBLER) > - A64DOpcode m_arm64Opcode; > -#endif Undo this. See the reason below. > Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp:288 > + auto arm64Opcode = std::make_unique<A64DOpcode>(); dumpCodeBlock() is called from SigillCrashAnalyzer::analyze(), which in turn is called from a signal handler. We don't want to malloc stuff while in the signal handler. So, let's keep the A64DOpcode where it's at right now, in the SigillCrashAnalyzer. Instead, let's change Options.cpp to not enableSigillCrashAnalyzer() if the JIT is not in use. The SigillCrashAnalyzer is for analyzing JIT code that went haywire. If the JIT is not in use, we don't need to enable it, and hence, won't allocate the A64DOpcode.
Yusuke Suzuki
Comment 8 2019-03-21 10:11:00 PDT
Comment on attachment 365476 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365476&action=review >> Source/JavaScriptCore/jit/ExecutableAllocator.h:66 >> + enum ProtectionSetting { Writable, Executable }; > > Looks like this is no longer used anywhere. We can delete it. Removed. >> Source/JavaScriptCore/runtime/VM.cpp:195 >> + if (!ExecutableAllocator::singleton().isValid()) { > > While you're in this function, I suggest you also fix it to check getenv("JavaScriptCoreUseJIT") first (currently done below) before initializing the ExecutableAllocator. No point in doing so if getenv("JavaScriptCoreUseJIT") disallows use of the JIT. Right. Fixed. >> Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp:-63 >> -#endif > > Undo this. See the reason below. Done. >> Source/JavaScriptCore/tools/SigillCrashAnalyzer.cpp:288 >> + auto arm64Opcode = std::make_unique<A64DOpcode>(); > > dumpCodeBlock() is called from SigillCrashAnalyzer::analyze(), which in turn is called from a signal handler. We don't want to malloc stuff while in the signal handler. So, let's keep the A64DOpcode where it's at right now, in the SigillCrashAnalyzer. Instead, let's change Options.cpp to not enableSigillCrashAnalyzer() if the JIT is not in use. The SigillCrashAnalyzer is for analyzing JIT code that went haywire. If the JIT is not in use, we don't need to enable it, and hence, won't allocate the A64DOpcode. Nice catch! Make sense. I changed 1. Not changing SigillCrashAnalyzer.cpp 2. Calling enableSigillCrashAnalyzer from InitializeThreading instead of Options.cpp 3. Calling enableSigillCrashAnalyzer only when VM::canUseJIT() returns true.
Yusuke Suzuki
Comment 9 2019-03-21 11:58:31 PDT
And I confirmed that CLoop is built successfully.
Yusuke Suzuki
Comment 10 2019-03-21 12:14:18 PDT
Radar WebKit Bug Importer
Comment 11 2019-03-21 12:15:20 PDT
Note You need to log in before you can comment on or make changes to this bug.