mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8370500: Change windows x64 implementation of os::current_stack_pointer()
Reviewed-by: aboldtch, dholmes, kvn, adinn
This commit is contained in:
parent
5dd8a33396
commit
c3c0a676e5
@ -41,10 +41,6 @@
|
||||
do_stub(initial, verify_mxcsr) \
|
||||
do_arch_entry(x86, initial, verify_mxcsr, verify_mxcsr_entry, \
|
||||
verify_mxcsr_entry) \
|
||||
do_stub(initial, get_previous_sp) \
|
||||
do_arch_entry(x86, initial, get_previous_sp, \
|
||||
get_previous_sp_entry, \
|
||||
get_previous_sp_entry) \
|
||||
do_stub(initial, f2i_fixup) \
|
||||
do_arch_entry(x86, initial, f2i_fixup, f2i_fixup, f2i_fixup) \
|
||||
do_stub(initial, f2l_fixup) \
|
||||
|
||||
@ -541,22 +541,6 @@ address StubGenerator::generate_orderaccess_fence() {
|
||||
}
|
||||
|
||||
|
||||
// Support for intptr_t get_previous_sp()
|
||||
//
|
||||
// This routine is used to find the previous stack pointer for the
|
||||
// caller.
|
||||
address StubGenerator::generate_get_previous_sp() {
|
||||
StubId stub_id = StubId::stubgen_get_previous_sp_id;
|
||||
StubCodeMark mark(this, stub_id);
|
||||
address start = __ pc();
|
||||
|
||||
__ movptr(rax, rsp);
|
||||
__ addptr(rax, 8); // return address is at the top of the stack.
|
||||
__ ret(0);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Support for void verify_mxcsr()
|
||||
//
|
||||
@ -4083,8 +4067,6 @@ void StubGenerator::generate_initial_stubs() {
|
||||
StubRoutines::_catch_exception_entry = generate_catch_exception();
|
||||
|
||||
// platform dependent
|
||||
StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
|
||||
|
||||
StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr();
|
||||
|
||||
StubRoutines::x86::_f2i_fixup = generate_f2i_fixup();
|
||||
|
||||
@ -68,12 +68,6 @@ class StubGenerator: public StubCodeGenerator {
|
||||
// Support for intptr_t OrderAccess::fence()
|
||||
address generate_orderaccess_fence();
|
||||
|
||||
// Support for intptr_t get_previous_sp()
|
||||
//
|
||||
// This routine is used to find the previous stack pointer for the
|
||||
// caller.
|
||||
address generate_get_previous_sp();
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Support for void verify_mxcsr()
|
||||
//
|
||||
|
||||
@ -51,6 +51,8 @@
|
||||
#include "utilities/vmError.hpp"
|
||||
#include "windbghelp.hpp"
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
|
||||
#undef REG_SP
|
||||
#undef REG_FP
|
||||
@ -247,11 +249,15 @@ intptr_t* os::fetch_bcp_from_context(const void* ucVoid) {
|
||||
|
||||
// Returns the current stack pointer. Accurate value needed for
|
||||
// os::verify_stack_alignment().
|
||||
// The function is intentionally not inlined. This way, the transfer of control
|
||||
// into this method must be made with a call instruction. The MSVC
|
||||
// _AddressOfReturnAddress() intrinsic returns the address of the return PC
|
||||
// saved by that call instruction. Therefore, the stack pointer of the caller
|
||||
// just before the call instruction, is acquired by skipping over the return PC
|
||||
// slot in the stack.
|
||||
__declspec(noinline)
|
||||
address os::current_stack_pointer() {
|
||||
typedef address get_sp_func();
|
||||
get_sp_func* func = CAST_TO_FN_PTR(get_sp_func*,
|
||||
StubRoutines::x86::get_previous_sp_entry());
|
||||
return (*func)();
|
||||
return ((address)_AddressOfReturnAddress()) + sizeof(void*);
|
||||
}
|
||||
|
||||
bool os::win32::get_frame_at_stack_banging_point(JavaThread* thread,
|
||||
@ -408,11 +414,7 @@ void os::setup_fpu() {
|
||||
|
||||
#ifndef PRODUCT
|
||||
void os::verify_stack_alignment() {
|
||||
// The current_stack_pointer() calls generated get_previous_sp stub routine.
|
||||
// Only enable the assert after the routine becomes available.
|
||||
if (StubRoutines::initial_stubs_code() != nullptr) {
|
||||
assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
|
||||
}
|
||||
assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user