aboutsummaryrefslogtreecommitdiff
path: root/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_cpu/windows_x86/vm/os_windows_x86.cpp')
-rw-r--r--src/os_cpu/windows_x86/vm/os_windows_x86.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index 960ceab66..52fe243ee 100644
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -370,6 +370,26 @@ frame os::get_sender_for_C_frame(frame* fr) {
return frame(fr->sender_sp(), fr->link(), fr->sender_pc());
}
+#ifndef AMD64
+// Returns an estimate of the current stack pointer. Result must be guaranteed
+// to point into the calling threads stack, and be no lower than the current
+// stack pointer.
+address os::current_stack_pointer() {
+ int dummy;
+ address sp = (address)&dummy;
+ return sp;
+}
+#else
+// Returns the current stack pointer. Accurate value needed for
+// os::verify_stack_alignment().
+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)();
+}
+#endif
+
#ifndef AMD64
intptr_t* _get_previous_fp() {
@@ -546,3 +566,11 @@ void os::setup_fpu() {
__asm fldcw fpu_cntrl_word;
#endif // !AMD64
}
+
+#ifndef PRODUCT
+void os::verify_stack_alignment() {
+#ifdef AMD64
+ assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+#endif
+}
+#endif