src/cpu/x86/vm/stubGenerator_x86_64.cpp
Print this page
rev 3149 : 7147740: add assertions to check stack alignment on VM entry from generated code (x64)
Summary: check stack alignment on VM entry on x64.
Reviewed-by:
@@ -708,10 +708,25 @@
__ ret(0);
return start;
}
+ // 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() {
+ StubCodeMark mark(this, "StubRoutines", "get_previous_sp");
+ 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()
//
// This routine is used with -Xcheck:jni to verify that native
// JNI code does not return to Java code without restoring the
@@ -3058,10 +3073,11 @@
StubRoutines::_handler_for_unsafe_access_entry =
generate_handler_for_unsafe_access();
// platform dependent
StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
+ StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
StubRoutines::x86::_verify_mxcsr_entry = generate_verify_mxcsr();
// Build this early so it's available for the interpreter. Stub
// expects the required and actual types as register arguments in