@@ -8551,106 +8551,52 @@ void Call1ArgStubInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
8551
8551
locs (), deopt_id (), env ());
8552
8552
}
8553
8553
8554
- LocationSummary* CoroutineInitializeInstr::MakeLocationSummary (
8555
- Zone* zone,
8556
- bool opt) const {
8554
+ LocationSummary* CoroutineInitializeInstr::MakeLocationSummary (Zone* zone,
8555
+ bool opt) const {
8557
8556
const intptr_t kNumInputs = 1 ;
8558
8557
const intptr_t kNumTemps = 0 ;
8559
- LocationSummary* locs = new (zone) LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8560
- locs->set_in (0 , Location::RegisterLocation (CoroutineInitializeABI::kCoroutineReg ));
8558
+ LocationSummary* locs = new (zone)
8559
+ LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8560
+ locs->set_in (
8561
+ 0 , Location::RegisterLocation (CoroutineInitializeABI::kCoroutineReg ));
8561
8562
return locs;
8562
8563
}
8563
8564
8564
8565
void CoroutineInitializeInstr::EmitNativeCode (FlowGraphCompiler* compiler) {
8565
- const Register kCoroutine = CoroutineInitializeABI::kCoroutineReg ;
8566
-
8567
- #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
8568
- SPILLS_LR_TO_FRAME ({});
8569
- #endif
8570
- __ PushObject (compiler::NullObject ());
8571
- __ PushRegister (kCoroutine );
8572
- __ CallRuntime (kEnterCoroutineRuntimeEntry , 1 );
8573
- __ PopRegister (kCoroutine );
8574
- __ Drop (1 );
8575
-
8576
- __ PushRegister (FPREG);
8577
- __ StoreFieldToOffset (SPREG, kCoroutine , Coroutine::native_stack_base_offset ());
8578
-
8579
- __ LoadFieldFromOffset (SPREG, kCoroutine , Coroutine::stack_base_offset ());
8580
- __ PushRegister (kCoroutine );
8581
- compiler->GenerateStubCall (source (), StubCode::CoroutineEntry (), UntaggedPcDescriptors::kOther , locs (), deopt_id (), env ());
8582
- __ PopRegister (kCoroutine );
8583
- __ StoreFieldToOffset (SPREG, kCoroutine , Coroutine::stack_base_offset ());
8584
-
8585
- __ LoadFieldFromOffset (SPREG, kCoroutine , Coroutine::native_stack_base_offset ());
8586
- __ PopRegister (FPREG);
8587
- if (!FLAG_precompiled_mode) __ RestoreCodePointer ();
8588
- if (FLAG_precompiled_mode) __ movq (PP, compiler::Address (THR, Thread::global_object_pool_offset ()));
8589
-
8590
- __ PushObject (compiler::NullObject ());
8591
- __ PushRegister (kCoroutine );
8592
- __ CallRuntime (kExitCoroutineRuntimeEntry , 1 );
8593
- __ PopRegister (kCoroutine );
8594
- __ Drop (1 );
8566
+ compiler->GenerateStubCall (source (), StubCode::CoroutineInitialize (),
8567
+ UntaggedPcDescriptors::kOther , locs (), deopt_id (),
8568
+ env ());
8595
8569
}
8596
8570
8597
- LocationSummary* CoroutineForkInstr::MakeLocationSummary (
8598
- Zone* zone,
8599
- bool opt) const {
8571
+ LocationSummary* CoroutineForkInstr::MakeLocationSummary (Zone* zone,
8572
+ bool opt) const {
8600
8573
const intptr_t kNumInputs = 2 ;
8601
8574
const intptr_t kNumTemps = 0 ;
8602
- LocationSummary* locs = new (zone) LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8603
- locs->set_in (0 , Location::RegisterLocation (CoroutineForkABI::kCallerCoroutineReg ));
8604
- locs->set_in (1 , Location::RegisterLocation (CoroutineForkABI::kForkedCoroutineReg ));
8575
+ LocationSummary* locs = new (zone)
8576
+ LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8577
+ locs->set_in (
8578
+ 0 , Location::RegisterLocation (CoroutineForkABI::kCallerCoroutineReg ));
8579
+ locs->set_in (
8580
+ 1 , Location::RegisterLocation (CoroutineForkABI::kForkedCoroutineReg ));
8605
8581
return locs;
8606
8582
}
8607
8583
8608
8584
void CoroutineForkInstr::EmitNativeCode (FlowGraphCompiler* compiler) {
8609
- const Register kCallerCoroutine = CoroutineForkABI::kCallerCoroutineReg ;
8610
- const Register kForkedCoroutine = CoroutineForkABI::kForkedCoroutineReg ;
8611
-
8612
- #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
8613
- SPILLS_LR_TO_FRAME ({});
8614
- #endif
8615
- __ PushObject (compiler::NullObject ());
8616
- __ PushRegister (kForkedCoroutine );
8617
- __ CallRuntime (kEnterForkedCoroutineRuntimeEntry , 1 );
8618
- __ PopRegister (kForkedCoroutine );
8619
- __ Drop (1 );
8620
-
8621
- __ LoadCompressedFieldFromOffset (kCallerCoroutine , kForkedCoroutine , Coroutine::caller_offset ());
8622
-
8623
- __ PushRegister (FPREG);
8624
- __ StoreFieldToOffset (SPREG, kCallerCoroutine , Coroutine::stack_base_offset ());
8625
-
8626
- __ LoadFieldFromOffset (SPREG, kForkedCoroutine , Coroutine::stack_base_offset ());
8627
- __ PushRegister (kForkedCoroutine );
8628
- compiler->GenerateStubCall (source (), StubCode::CoroutineEntry (), UntaggedPcDescriptors::kOther , locs (), deopt_id (), env ());
8629
- __ PopRegister (kForkedCoroutine );
8630
- __ StoreFieldToOffset (SPREG, kForkedCoroutine , Coroutine::stack_base_offset ());
8631
-
8632
- __ LoadCompressedFieldFromOffset (kCallerCoroutine , kForkedCoroutine , Coroutine::caller_offset ());
8633
-
8634
- __ LoadFieldFromOffset (SPREG, kCallerCoroutine , Coroutine::stack_base_offset ());
8635
- __ PopRegister (FPREG);
8636
- if (!FLAG_precompiled_mode) __ RestoreCodePointer ();
8637
- if (FLAG_precompiled_mode) __ movq (PP, compiler::Address (THR, Thread::global_object_pool_offset ()));
8638
-
8639
- __ PushObject (compiler::NullObject ());
8640
- __ PushRegister (kForkedCoroutine );
8641
- __ CallRuntime (kExitForkedCoroutineRuntimeEntry , 1 );
8642
- __ PopRegister (kForkedCoroutine );
8643
- __ Drop (1 );
8585
+ compiler->GenerateStubCall (source (), StubCode::CoroutineFork (),
8586
+ UntaggedPcDescriptors::kOther , locs (), deopt_id (),
8587
+ env ());
8644
8588
}
8645
8589
8646
- LocationSummary* CoroutineTransferInstr::MakeLocationSummary (
8647
- Zone* zone,
8648
- bool opt) const {
8590
+ LocationSummary* CoroutineTransferInstr::MakeLocationSummary (Zone* zone,
8591
+ bool opt) const {
8649
8592
const intptr_t kNumInputs = 2 ;
8650
8593
const intptr_t kNumTemps = 0 ;
8651
- LocationSummary* locs = new (zone) LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8652
- locs->set_in (0 , Location::RegisterLocation (CoroutineTransferABI::kFromCoroutineReg ));
8653
- locs->set_in (1 , Location::RegisterLocation (CoroutineTransferABI::kToCoroutineReg ));
8594
+ LocationSummary* locs = new (zone)
8595
+ LocationSummary (zone, kNumInputs , kNumTemps , LocationSummary::kCall );
8596
+ locs->set_in (
8597
+ 0 , Location::RegisterLocation (CoroutineTransferABI::kFromCoroutineReg ));
8598
+ locs->set_in (
8599
+ 1 , Location::RegisterLocation (CoroutineTransferABI::kToCoroutineReg ));
8654
8600
return locs;
8655
8601
}
8656
8602
@@ -8661,18 +8607,26 @@ void CoroutineTransferInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
8661
8607
8662
8608
#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_ARM64)
8663
8609
SPILLS_LR_TO_FRAME ({});
8664
- #endif
8610
+ #endif
8665
8611
__ PushRegister (FPREG);
8666
8612
__ StoreFieldToOffset (SPREG, kFromCoroutine , Coroutine::stack_base_offset ());
8667
8613
8668
8614
__ LoadFieldFromOffset (SPREG, kToCoroutine , Coroutine::stack_base_offset ());
8669
8615
__ PopRegister (FPREG);
8670
8616
if (!FLAG_precompiled_mode) __ RestoreCodePointer ();
8671
- if (FLAG_precompiled_mode) __ movq (PP, compiler::Address (THR, Thread::global_object_pool_offset ()));
8617
+ if (FLAG_precompiled_mode)
8618
+ __ movq (PP, compiler::Address (THR, Thread::global_object_pool_offset ()));
8672
8619
8673
- __ LoadFieldFromOffset (kToStackLimit , kToCoroutine , Coroutine::stack_limit_offset ());
8674
- __ StoreToOffset (kToStackLimit , THR, Thread::stack_limit_offset ());
8620
+ __ LoadFieldFromOffset (kToStackLimit , kToCoroutine , Coroutine::overflow_stack_limit_offset ());
8675
8621
__ StoreToOffset (kToCoroutine , THR, Thread::coroutine_offset ());
8622
+ __ StoreToOffset (kToStackLimit , THR, Thread::saved_stack_limit_offset ());
8623
+
8624
+ compiler::Label scheduled_interrupts;
8625
+ __ LoadFromOffset (TMP, THR, Thread::stack_limit_offset ());
8626
+ __ testq (TMP, compiler::Immediate (Thread::kInterruptsMask ));
8627
+ __ BranchIf (ZERO, &scheduled_interrupts);
8628
+ __ StoreToOffset (kToStackLimit , THR, Thread::stack_limit_offset ());
8629
+ __ Bind (&scheduled_interrupts);
8676
8630
}
8677
8631
8678
8632
Definition* SuspendInstr::Canonicalize (FlowGraph* flow_graph) {
0 commit comments