From 55370b8b17052a5a92aee61f65e12885477cbf84 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 28 Jun 2019 22:20:03 +0000 Subject: [PATCH] [vm, bytecode] Fix Interpreter::Current when called for the first time outside of kThreadInGenerated state. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes vm/cc/FunctionWithBreakpointNotInlined. Change-Id: Ie1e7616559c0d758477494c26f03e6ffde0b5e43 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107683 Reviewed-by: Alexander Markov Reviewed-by: RĂ©gis Crelier Commit-Queue: Ryan Macnak --- runtime/vm/interpreter.cc | 4 ++-- runtime/vm/simulator_arm.cc | 6 ++++-- runtime/vm/simulator_arm64.cc | 6 ++++-- runtime/vm/simulator_dbc.cc | 6 ++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc index e5f6f8a1c49..64cadecafb0 100644 --- a/runtime/vm/interpreter.cc +++ b/runtime/vm/interpreter.cc @@ -404,9 +404,9 @@ Interpreter* Interpreter::Current() { Thread* thread = Thread::Current(); Interpreter* interpreter = thread->interpreter(); if (interpreter == nullptr) { - TransitionGeneratedToVM transition(thread); + NoSafepointScope no_safepoint; interpreter = new Interpreter(); - Thread::Current()->set_interpreter(interpreter); + thread->set_interpreter(interpreter); } return interpreter; } diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc index 2cd0745f1dc..24197fec2ca 100644 --- a/runtime/vm/simulator_arm.cc +++ b/runtime/vm/simulator_arm.cc @@ -829,10 +829,12 @@ uword Simulator::FunctionForRedirect(uword redirect) { // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { - Simulator* simulator = Isolate::Current()->simulator(); + Isolate* isolate = Isolate::Current(); + Simulator* simulator = isolate->simulator(); if (simulator == NULL) { + NoSafepointScope no_safepoint; simulator = new Simulator(); - Isolate::Current()->set_simulator(simulator); + isolate->set_simulator(simulator); } return simulator; } diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc index c83579339ca..8eb8dd55cc7 100644 --- a/runtime/vm/simulator_arm64.cc +++ b/runtime/vm/simulator_arm64.cc @@ -869,10 +869,12 @@ uword Simulator::FunctionForRedirect(uword redirect) { // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { - Simulator* simulator = Isolate::Current()->simulator(); + Isolate* isolate = Isolate::Current(); + Simulator* simulator = isolate->simulator(); if (simulator == NULL) { + NoSafepointScope no_safepoint; simulator = new Simulator(); - Isolate::Current()->set_simulator(simulator); + isolate->set_simulator(simulator); } return simulator; } diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc index d3e851bec74..2a7176d76ae 100644 --- a/runtime/vm/simulator_dbc.cc +++ b/runtime/vm/simulator_dbc.cc @@ -584,10 +584,12 @@ Simulator::~Simulator() { // Get the active Simulator for the current isolate. Simulator* Simulator::Current() { - Simulator* simulator = Isolate::Current()->simulator(); + Isolate* isolate = Isolate::Current(); + Simulator* simulator = isolate->simulator(); if (simulator == NULL) { + NoSafepointScope no_safepoint; simulator = new Simulator(); - Isolate::Current()->set_simulator(simulator); + isolate->set_simulator(simulator); } return simulator; }