mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 20:51:19 +00:00
[VM runtime] Remove broken LongJumpScope::IsSafeToJump().
Over the years, this debug-only code evolved to check that the current stack pointer is below the last exit frame, which is obviously always the case. Change-Id: I9b5e1a5462df5b3392b4541e40a9c57d33d25055 Reviewed-on: https://dart-review.googlesource.com/70960 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Régis Crelier <regis@google.com>
This commit is contained in:
parent
e87efdffb4
commit
14f3982a1f
|
@ -556,7 +556,6 @@ Interpreter::Interpreter()
|
|||
stack_limit_ = stack_base_ + OSThread::GetSpecifiedStackSize();
|
||||
|
||||
last_setjmp_buffer_ = NULL;
|
||||
top_exit_frame_info_ = 0;
|
||||
|
||||
DEBUG_ONLY(icount_ = 1); // So that tracing after 0 traces first bytecode.
|
||||
}
|
||||
|
|
|
@ -110,7 +110,6 @@ class Interpreter {
|
|||
DEBUG_ONLY(uint64_t icount_;)
|
||||
|
||||
InterpreterSetjmpBuffer* last_setjmp_buffer_;
|
||||
uword top_exit_frame_info_;
|
||||
|
||||
RawObjectPool* pp_; // Pool Pointer.
|
||||
RawArray* argdesc_; // Arguments Descriptor: used to pass information between
|
||||
|
|
|
@ -7,12 +7,10 @@
|
|||
#include "include/dart_api.h"
|
||||
|
||||
#include "vm/dart_api_impl.h"
|
||||
#include "vm/interpreter.h"
|
||||
#include "vm/isolate.h"
|
||||
#include "vm/object.h"
|
||||
#include "vm/object_store.h"
|
||||
#include "vm/os.h"
|
||||
#include "vm/simulator.h"
|
||||
|
||||
namespace dart {
|
||||
|
||||
|
@ -22,38 +20,10 @@ jmp_buf* LongJumpScope::Set() {
|
|||
return &environment_;
|
||||
}
|
||||
|
||||
bool LongJumpScope::IsSafeToJump() {
|
||||
// We do not want to jump past Dart frames. Note that this code
|
||||
// assumes the stack grows from high to low.
|
||||
Thread* thread = Thread::Current();
|
||||
uword jumpbuf_addr = OSThread::GetCurrentStackPointer();
|
||||
|
||||
#if defined(USING_SIMULATOR) && defined(DART_USE_INTERPRETER)
|
||||
#error "Simultaneous usage of simulator and interpreter not yet supported."
|
||||
#endif // defined(USING_SIMULATOR) && defined(DART_USE_INTERPRETER)
|
||||
|
||||
#if defined(USING_SIMULATOR)
|
||||
Simulator* sim = Simulator::Current();
|
||||
// When using simulator, only mutator thread should refer to Simulator
|
||||
// since there can be only one per isolate.
|
||||
uword top_exit_frame_info =
|
||||
thread->IsMutatorThread() ? sim->top_exit_frame_info() : 0;
|
||||
#else
|
||||
uword top_exit_frame_info = thread->top_exit_frame_info();
|
||||
#endif
|
||||
if (!thread->IsMutatorThread()) {
|
||||
// A helper thread does not execute Dart code, so it's safe to jump.
|
||||
ASSERT(top_exit_frame_info == 0);
|
||||
return true;
|
||||
}
|
||||
return ((top_exit_frame_info == 0) || (jumpbuf_addr < top_exit_frame_info));
|
||||
}
|
||||
|
||||
void LongJumpScope::Jump(int value, const Error& error) {
|
||||
// A zero is the default return value from setting up a LongJumpScope
|
||||
// using Set.
|
||||
ASSERT(value != 0);
|
||||
ASSERT(IsSafeToJump());
|
||||
|
||||
Thread* thread = Thread::Current();
|
||||
|
||||
|
|
|
@ -28,11 +28,6 @@ class LongJumpScope : public StackResource {
|
|||
jmp_buf* Set();
|
||||
void Jump(int value, const Error& error);
|
||||
|
||||
// Would it be safe to use this longjump?
|
||||
//
|
||||
// Checks to make sure that the jump would not cross Dart frames.
|
||||
bool IsSafeToJump();
|
||||
|
||||
private:
|
||||
jmp_buf environment_;
|
||||
StackResource* top_;
|
||||
|
|
|
@ -671,7 +671,6 @@ class TopLevelParsingScope : public StackResource {
|
|||
void Parser::ParseCompilationUnit(const Library& library,
|
||||
const Script& script) {
|
||||
Thread* thread = Thread::Current();
|
||||
ASSERT(thread->long_jump_base()->IsSafeToJump());
|
||||
CSTAT_TIMER_SCOPE(thread, parser_timer);
|
||||
#ifndef PRODUCT
|
||||
VMTagScope tagScope(thread, VMTag::kCompileTopLevelTagId);
|
||||
|
@ -1009,14 +1008,12 @@ void Parser::ParseClass(const Class& cls) {
|
|||
}
|
||||
#endif
|
||||
if (!cls.is_synthesized_class()) {
|
||||
ASSERT(thread->long_jump_base()->IsSafeToJump());
|
||||
CSTAT_TIMER_SCOPE(thread, parser_timer);
|
||||
const Script& script = Script::Handle(zone, cls.script());
|
||||
const Library& lib = Library::Handle(zone, cls.library());
|
||||
Parser parser(script, lib, cls.token_pos());
|
||||
parser.ParseClassDefinition(cls);
|
||||
} else if (cls.is_enum_class()) {
|
||||
ASSERT(thread->long_jump_base()->IsSafeToJump());
|
||||
CSTAT_TIMER_SCOPE(thread, parser_timer);
|
||||
const Script& script = Script::Handle(zone, cls.script());
|
||||
const Library& lib = Library::Handle(zone, cls.library());
|
||||
|
@ -1165,7 +1162,6 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
|||
TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
|
||||
"ParseFunction");
|
||||
#endif // !PRODUCT
|
||||
ASSERT(thread->long_jump_base()->IsSafeToJump());
|
||||
ASSERT(parsed_function != NULL);
|
||||
const Function& func = parsed_function->function();
|
||||
const Script& script = Script::Handle(zone, func.script());
|
||||
|
|
|
@ -683,7 +683,6 @@ Simulator::Simulator() : exclusive_access_addr_(0), exclusive_access_value_(0) {
|
|||
break_pc_ = NULL;
|
||||
break_instr_ = 0;
|
||||
last_setjmp_buffer_ = NULL;
|
||||
top_exit_frame_info_ = 0;
|
||||
|
||||
// Setup architecture state.
|
||||
// All registers are initialized to zero to start with.
|
||||
|
@ -1387,13 +1386,6 @@ void Simulator::SupervisorCall(Instr* instr) {
|
|||
if (IsTracingExecution()) {
|
||||
THR_Print("Call to host function at 0x%" Pd "\n", external);
|
||||
}
|
||||
|
||||
if ((redirection->call_kind() == kRuntimeCall) ||
|
||||
(redirection->call_kind() == kBootstrapNativeCall) ||
|
||||
(redirection->call_kind() == kNativeCall)) {
|
||||
// Set the top_exit_frame_info of this simulator to the native stack.
|
||||
set_top_exit_frame_info(OSThread::GetCurrentStackPointer());
|
||||
}
|
||||
if (redirection->call_kind() == kRuntimeCall) {
|
||||
NativeArguments arguments;
|
||||
ASSERT(sizeof(NativeArguments) == 4 * kWordSize);
|
||||
|
@ -1467,7 +1459,6 @@ void Simulator::SupervisorCall(Instr* instr) {
|
|||
set_register(R0, icount_); // Zap result register from void function.
|
||||
set_register(R1, icount_);
|
||||
}
|
||||
set_top_exit_frame_info(0);
|
||||
|
||||
// Zap caller-saved registers, since the actual runtime call could have
|
||||
// used them.
|
||||
|
@ -1494,7 +1485,6 @@ void Simulator::SupervisorCall(Instr* instr) {
|
|||
set_pc(saved_lr);
|
||||
} else {
|
||||
// Coming via long jump from a throw. Continue to exception handler.
|
||||
set_top_exit_frame_info(0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -85,12 +85,6 @@ class Simulator {
|
|||
// Accessor to the instruction counter.
|
||||
uint64_t get_icount() const { return icount_; }
|
||||
|
||||
// The thread's top_exit_frame_info refers to a Dart frame in the simulator
|
||||
// stack. The simulator's top_exit_frame_info refers to a C++ frame in the
|
||||
// native stack.
|
||||
uword top_exit_frame_info() const { return top_exit_frame_info_; }
|
||||
void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
|
||||
|
@ -160,7 +154,6 @@ class Simulator {
|
|||
uint64_t icount_;
|
||||
static int32_t flag_stop_sim_at_;
|
||||
SimulatorSetjmpBuffer* last_setjmp_buffer_;
|
||||
uword top_exit_frame_info_;
|
||||
|
||||
// Registered breakpoints.
|
||||
Instr* break_pc_;
|
||||
|
|
|
@ -1543,12 +1543,6 @@ void Simulator::DoRedirectedCall(Instr* instr) {
|
|||
THR_Print("Call to host function at 0x%" Pd "\n", external);
|
||||
}
|
||||
|
||||
if ((redirection->call_kind() == kRuntimeCall) ||
|
||||
(redirection->call_kind() == kBootstrapNativeCall) ||
|
||||
(redirection->call_kind() == kNativeCall)) {
|
||||
// Set the top_exit_frame_info of this simulator to the native stack.
|
||||
set_top_exit_frame_info(OSThread::GetCurrentStackPointer());
|
||||
}
|
||||
if (redirection->call_kind() == kRuntimeCall) {
|
||||
NativeArguments* arguments =
|
||||
reinterpret_cast<NativeArguments*>(get_register(R0));
|
||||
|
@ -1611,7 +1605,6 @@ void Simulator::DoRedirectedCall(Instr* instr) {
|
|||
set_register(instr, R0, icount_);
|
||||
set_register(instr, R1, icount_);
|
||||
}
|
||||
set_top_exit_frame_info(0);
|
||||
|
||||
// Zap caller-saved registers, since the actual runtime call could have
|
||||
// used them.
|
||||
|
@ -1640,7 +1633,6 @@ void Simulator::DoRedirectedCall(Instr* instr) {
|
|||
set_pc(saved_lr);
|
||||
} else {
|
||||
// Coming via long jump from a throw. Continue to exception handler.
|
||||
set_top_exit_frame_info(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,12 +81,6 @@ class Simulator {
|
|||
// Accessor to the instruction counter.
|
||||
uint64_t get_icount() const { return icount_; }
|
||||
|
||||
// The thread's top_exit_frame_info refers to a Dart frame in the simulator
|
||||
// stack. The simulator's top_exit_frame_info refers to a C++ frame in the
|
||||
// native stack.
|
||||
uword top_exit_frame_info() const { return top_exit_frame_info_; }
|
||||
void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
|
||||
|
@ -147,7 +141,6 @@ class Simulator {
|
|||
uint64_t icount_;
|
||||
static int64_t flag_stop_sim_at_;
|
||||
SimulatorSetjmpBuffer* last_setjmp_buffer_;
|
||||
uword top_exit_frame_info_;
|
||||
|
||||
// Registered breakpoints.
|
||||
Instr* break_pc_;
|
||||
|
|
|
@ -563,7 +563,6 @@ Simulator::Simulator() : stack_(NULL), fp_(NULL), pp_(NULL), argdesc_(NULL) {
|
|||
stack_limit_ = stack_base_ + OSThread::GetSpecifiedStackSize();
|
||||
|
||||
last_setjmp_buffer_ = NULL;
|
||||
top_exit_frame_info_ = 0;
|
||||
|
||||
DEBUG_ONLY(icount_ = 0);
|
||||
}
|
||||
|
|
|
@ -52,12 +52,6 @@ class Simulator {
|
|||
// High address (DBC stack grows up).
|
||||
uword stack_limit() const { return stack_limit_; }
|
||||
|
||||
// The thread's top_exit_frame_info refers to a Dart frame in the simulator
|
||||
// stack. The simulator's top_exit_frame_info refers to a C++ frame in the
|
||||
// native stack.
|
||||
uword top_exit_frame_info() const { return top_exit_frame_info_; }
|
||||
void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
|
||||
|
@ -102,7 +96,6 @@ class Simulator {
|
|||
DEBUG_ONLY(uint64_t icount_;)
|
||||
|
||||
SimulatorSetjmpBuffer* last_setjmp_buffer_;
|
||||
uword top_exit_frame_info_;
|
||||
|
||||
RawObjectPool* pp_; // Pool Pointer.
|
||||
RawArray* argdesc_; // Arguments Descriptor: used to pass information between
|
||||
|
|
Loading…
Reference in a new issue