Skip to content

Commit 55370b8

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm, bytecode] Fix Interpreter::Current when called for the first time outside of kThreadInGenerated state.
Fixes vm/cc/FunctionWithBreakpointNotInlined. Change-Id: Ie1e7616559c0d758477494c26f03e6ffde0b5e43 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107683 Reviewed-by: Alexander Markov <[email protected]> Reviewed-by: Régis Crelier <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent f913754 commit 55370b8

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

runtime/vm/interpreter.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ Interpreter* Interpreter::Current() {
404404
Thread* thread = Thread::Current();
405405
Interpreter* interpreter = thread->interpreter();
406406
if (interpreter == nullptr) {
407-
TransitionGeneratedToVM transition(thread);
407+
NoSafepointScope no_safepoint;
408408
interpreter = new Interpreter();
409-
Thread::Current()->set_interpreter(interpreter);
409+
thread->set_interpreter(interpreter);
410410
}
411411
return interpreter;
412412
}

runtime/vm/simulator_arm.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,12 @@ uword Simulator::FunctionForRedirect(uword redirect) {
829829

830830
// Get the active Simulator for the current isolate.
831831
Simulator* Simulator::Current() {
832-
Simulator* simulator = Isolate::Current()->simulator();
832+
Isolate* isolate = Isolate::Current();
833+
Simulator* simulator = isolate->simulator();
833834
if (simulator == NULL) {
835+
NoSafepointScope no_safepoint;
834836
simulator = new Simulator();
835-
Isolate::Current()->set_simulator(simulator);
837+
isolate->set_simulator(simulator);
836838
}
837839
return simulator;
838840
}

runtime/vm/simulator_arm64.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,12 @@ uword Simulator::FunctionForRedirect(uword redirect) {
869869

870870
// Get the active Simulator for the current isolate.
871871
Simulator* Simulator::Current() {
872-
Simulator* simulator = Isolate::Current()->simulator();
872+
Isolate* isolate = Isolate::Current();
873+
Simulator* simulator = isolate->simulator();
873874
if (simulator == NULL) {
875+
NoSafepointScope no_safepoint;
874876
simulator = new Simulator();
875-
Isolate::Current()->set_simulator(simulator);
877+
isolate->set_simulator(simulator);
876878
}
877879
return simulator;
878880
}

runtime/vm/simulator_dbc.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,12 @@ Simulator::~Simulator() {
584584

585585
// Get the active Simulator for the current isolate.
586586
Simulator* Simulator::Current() {
587-
Simulator* simulator = Isolate::Current()->simulator();
587+
Isolate* isolate = Isolate::Current();
588+
Simulator* simulator = isolate->simulator();
588589
if (simulator == NULL) {
590+
NoSafepointScope no_safepoint;
589591
simulator = new Simulator();
590-
Isolate::Current()->set_simulator(simulator);
592+
isolate->set_simulator(simulator);
591593
}
592594
return simulator;
593595
}

0 commit comments

Comments
 (0)