[vm] Get SP without using VM generated stubs.
TEST=ci Change-Id: Ie976408ff3cf5691a59081b7b405abe43d7adcc3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/493165 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
e1f76cb03e
commit
9f929d1fcf
@@ -2973,12 +2973,6 @@ void StubCodeCompiler::GenerateSubtypeNTestCacheStub(Assembler* assembler,
|
||||
});
|
||||
}
|
||||
|
||||
// Return the current stack pointer address, used to do stack alignment checks.
|
||||
void StubCodeCompiler::GenerateGetCStackPointerStub() {
|
||||
__ mov(R0, Operand(SP));
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
// Jump to a frame on the call stack.
|
||||
// LR: return address.
|
||||
// R0: program_counter.
|
||||
|
||||
@@ -3353,11 +3353,6 @@ void StubCodeCompiler::GenerateSubtypeNTestCacheStub(Assembler* assembler,
|
||||
});
|
||||
}
|
||||
|
||||
void StubCodeCompiler::GenerateGetCStackPointerStub() {
|
||||
__ mov(R0, CSP);
|
||||
__ ret();
|
||||
}
|
||||
|
||||
// Jump to a frame on the call stack.
|
||||
// LR: return address.
|
||||
// R0: program_counter.
|
||||
|
||||
@@ -2891,14 +2891,6 @@ void StubCodeCompiler::GenerateSubtypeNTestCacheStub(Assembler* assembler,
|
||||
__ ret();
|
||||
}
|
||||
|
||||
// Return the current stack pointer address, used to do stack alignment checks.
|
||||
// TOS + 0: return address
|
||||
// Result in EAX.
|
||||
void StubCodeCompiler::GenerateGetCStackPointerStub() {
|
||||
__ leal(EAX, Address(ESP, target::kWordSize));
|
||||
__ ret();
|
||||
}
|
||||
|
||||
// Jump to a frame on the call stack.
|
||||
// TOS + 0: return address
|
||||
// TOS + 1: program_counter
|
||||
|
||||
@@ -2868,11 +2868,6 @@ void StubCodeCompiler::GenerateSubtypeNTestCacheStub(Assembler* assembler,
|
||||
});
|
||||
}
|
||||
|
||||
void StubCodeCompiler::GenerateGetCStackPointerStub() {
|
||||
__ mv(A0, SP);
|
||||
__ ret();
|
||||
}
|
||||
|
||||
// Jump to a frame on the call stack.
|
||||
// RA: return address.
|
||||
// A0: program_counter.
|
||||
|
||||
@@ -3315,15 +3315,6 @@ void StubCodeCompiler::GenerateSubtypeNTestCacheStub(Assembler* assembler,
|
||||
});
|
||||
}
|
||||
|
||||
// Return the current stack pointer address, used to stack alignment
|
||||
// checks.
|
||||
// TOS + 0: return address
|
||||
// Result in RAX.
|
||||
void StubCodeCompiler::GenerateGetCStackPointerStub() {
|
||||
__ leaq(RAX, Address(RSP, target::kWordSize));
|
||||
__ ret();
|
||||
}
|
||||
|
||||
// Jump to a frame on the call stack.
|
||||
// TOS + 0: return address
|
||||
// Arg1: program counter
|
||||
|
||||
@@ -35,10 +35,8 @@ class Thread;
|
||||
#else
|
||||
#define CHECK_STACK_ALIGNMENT \
|
||||
{ \
|
||||
uword (*func)() = reinterpret_cast<uword (*)()>( \
|
||||
StubCode::GetCStackPointer().EntryPoint()); \
|
||||
uword current_sp = func(); \
|
||||
ASSERT(Utils::IsAligned(current_sp, OS::ActivationFrameAlignment())); \
|
||||
ASSERT(Utils::IsAligned(OSThread::GetCurrentStackPointer(), \
|
||||
OS::ActivationFrameAlignment())); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -140,9 +140,15 @@ void OSThread::SetName(const char* name) {
|
||||
DART_NOINLINE
|
||||
uword OSThread::GetCurrentStackPointer() {
|
||||
#ifdef _MSC_VER
|
||||
return reinterpret_cast<uword>(_AddressOfReturnAddress());
|
||||
return reinterpret_cast<uword>(_AddressOfReturnAddress()) + kWordSize;
|
||||
#elif __GNUC__
|
||||
#if defined(HOST_ARCH_RISCV32) || defined(HOST_ARCH_RISCV64)
|
||||
// RISC-V has unusual choice of FP as SP at entry (i.e., DWARF CFA).
|
||||
return reinterpret_cast<uword>(__builtin_frame_address(0));
|
||||
#else
|
||||
// Usually FP is address of saved FP, two slots from SP at entry.
|
||||
return reinterpret_cast<uword>(__builtin_frame_address(0)) + 2 * kWordSize;
|
||||
#endif
|
||||
#else
|
||||
#error Unimplemented
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace dart {
|
||||
// List of stubs created in the VM isolate, these stubs are shared by different
|
||||
// isolates running in this dart process.
|
||||
#define VM_STUB_CODE_LIST(V) \
|
||||
V(GetCStackPointer) \
|
||||
V(JumpToFrame) \
|
||||
V(RunExceptionHandler) \
|
||||
V(RunExceptionHandlerUnbox) \
|
||||
|
||||
Reference in New Issue
Block a user