Changeset 283288 in webkit
- Timestamp:
- Sep 29, 2021, 5:47:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/checkpoint-osr-exit-needs-to-reload-baseline-jit-constant-pool-gpr.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/jit/JIT.cpp (modified) (1 diff)
-
Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/llint/LowLevelInterpreter.asm (modified) (3 diffs)
-
Source/JavaScriptCore/llint/LowLevelInterpreter64.asm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r283232 r283288 1 2021-09-29 Saam Barati <sbarati@apple.com> 2 3 We need to load the baseline JIT's constant pool register after OSR exit to checkpoints if we return to baseline code 4 https://bugs.webkit.org/show_bug.cgi?id=230972 5 <rdar://83659469> 6 7 Reviewed by Mark Lam and Yusuke Suzuki. 8 9 * stress/checkpoint-osr-exit-needs-to-reload-baseline-jit-constant-pool-gpr.js: Added. 10 (empty): 11 (empty2): 12 (test): 13 1 14 2021-09-29 Saam Barati <sbarati@apple.com> 2 15 -
trunk/Source/JavaScriptCore/ChangeLog
r283287 r283288 1 2021-09-29 Saam Barati <sbarati@apple.com> 2 3 We need to load the baseline JIT's constant pool register after OSR exit to checkpoints if we return to baseline code 4 https://bugs.webkit.org/show_bug.cgi?id=230972 5 <rdar://83659469> 6 7 Reviewed by Mark Lam and Yusuke Suzuki. 8 9 Consider the following: 10 - We have a CodeBlock A. 11 - DFG or FTL compiles an exit to A when A is still LLInt code. This means 12 the OSR exit code will materialize registers as if A is LLInt. 13 - We tier up A to Baseline JIT code. 14 - Now, we take the exit to A as if it's LLInt. But the checkpoint OSR exit 15 code will actually jump to the tiered up baseline code when it's done, 16 because it determines where to jump at runtime. Because of this, when 17 we return from the checkpoint code, and if we are jumping into baseline 18 code, we must always load the constant pool register. 19 - There's no need to load the metadata register because that register is 20 shared with LLInt code, and will already contain the right value. 21 22 * jit/JIT.cpp: 23 (JSC::JIT::privateCompileMainPass): 24 * llint/LLIntSlowPaths.cpp: 25 (JSC::LLInt::dispatchToNextInstructionDuringExit): 26 (JSC::LLInt::llint_slow_path_checkpoint_osr_exit_from_inlined_call): 27 (JSC::LLInt::llint_slow_path_checkpoint_osr_exit): 28 (JSC::LLInt::dispatchToNextInstruction): Deleted. 29 * llint/LowLevelInterpreter.asm: 30 * llint/LowLevelInterpreter64.asm: 31 1 32 2021-09-29 Basuke Suzuki <basuke.suzuki@sony.com> 2 33 -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r283229 r283288 270 270 sizeMarker = m_vm->jitSizeStatistics->markStart(id, *this); 271 271 } 272 273 #if ASSERT_ENABLED 274 if (opcodeID != op_catch) { 275 probeDebug([=] (Probe::Context& ctx) { 276 CodeBlock* codeBlock = ctx.fp<CallFrame*>()->codeBlock(); 277 auto* constantPool = ctx.gpr<void*>(s_constantsGPR); 278 RELEASE_ASSERT(codeBlock->baselineJITConstantPool() == constantPool); 279 auto* metadata = ctx.gpr<void*>(s_metadataGPR); 280 RELEASE_ASSERT(codeBlock->metadataTable() == metadata); 281 }); 282 } 283 #endif 272 284 273 285 if (UNLIKELY(m_compilation)) { -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r283139 r283288 2410 2410 } 2411 2411 2412 inline SlowPathReturnType dispatchToNextInstruction (ThrowScope& scope, CodeBlock* codeBlock, InstructionStream::Ref pc)2412 inline SlowPathReturnType dispatchToNextInstructionDuringExit(ThrowScope& scope, CodeBlock* codeBlock, InstructionStream::Ref pc) 2413 2413 { 2414 2414 if (scope.exception()) … … 2428 2428 BytecodeIndex nextBytecodeIndex = pc.next().index(); 2429 2429 auto nextBytecode = codeBlock->jitCodeMap().find(nextBytecodeIndex); 2430 return encodeResult( nullptr, nextBytecode.executableAddress());2430 return encodeResult(bitwise_cast<void*>(static_cast<uintptr_t>(1)), nextBytecode.executableAddress()); 2431 2431 #endif 2432 2432 RELEASE_ASSERT_NOT_REACHED(); … … 2480 2480 } 2481 2481 2482 return dispatchToNextInstruction (scope, codeBlock, pc);2482 return dispatchToNextInstructionDuringExit(scope, codeBlock, pc); 2483 2483 } 2484 2484 … … 2525 2525 } 2526 2526 2527 return dispatchToNextInstruction (scope, codeBlock, pc);2527 return dispatchToNextInstructionDuringExit(scope, codeBlock, pc); 2528 2528 } 2529 2529 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r283236 r283288 2483 2483 2484 2484 2485 if JIT 2486 macro loadBaselineJITConstantPool() 2487 # Baseline uses LLInt's PB register for its JIT constant pool. 2488 loadp CodeBlock[cfr], PB 2489 loadp CodeBlock::m_jitData[PB], PB 2490 loadp CodeBlock::JITData::m_jitConstantPool[PB], PB 2491 end 2492 2493 macro setupReturnToBaselineAfterCheckpointExitIfNeeded() 2494 # DFG or FTL OSR exit could have compiled an OSR exit to LLInt code. 2495 # That means it set up registers as if execution would happen in the 2496 # LLInt. However, during OSR exit for checkpoints, we might return to 2497 # JIT code if it's already compiled. After the OSR exit gets compiled, 2498 # we can tier up to JIT code. And checkpoint exit will jump to it. 2499 # That means we always need to set up our constant pool GPR, because the OSR 2500 # exit code might not have done it. 2501 bpneq r0, 1, .notBaselineJIT 2502 loadBaselineJITConstantPool() 2503 .notBaselineJIT: 2504 2505 end 2506 else 2507 macro setupReturnToBaselineAfterCheckpointExitIfNeeded() 2508 end 2509 end 2510 2485 2511 op(checkpoint_osr_exit_from_inlined_call_trampoline, macro () 2486 2512 if (JSVALUE64 and not (C_LOOP or C_LOOP_WIN)) or ARMv7 or MIPS … … 2506 2532 end 2507 2533 2534 setupReturnToBaselineAfterCheckpointExitIfNeeded() 2508 2535 restoreStateAfterCCall() 2509 2536 branchIfException(_llint_throw_from_slow_path_trampoline) 2537 2510 2538 if ARM64E 2511 2539 move r1, a0 … … 2529 2557 # We don't call saveStateForCCall() because we are going to use the bytecodeIndex from our side state. 2530 2558 cCall2(_llint_slow_path_checkpoint_osr_exit) 2559 setupReturnToBaselineAfterCheckpointExitIfNeeded() 2531 2560 restoreStateAfterCCall() 2532 2561 branchIfException(_llint_throw_from_slow_path_trampoline) -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r283168 r283288 445 445 move r1, sp 446 446 447 # Baseline uses LLInt's PB register for its JIT constant pool. 448 loadp CodeBlock[cfr], PB 449 loadp CodeBlock::m_jitData[PB], PB 450 loadp CodeBlock::JITData::m_jitConstantPool[PB], PB 447 loadBaselineJITConstantPool() 451 448 452 449 if ARM64E
Note:
See TracChangeset
for help on using the changeset viewer.