What to do: clang-4.0 fastdebug assertion failure in os_linux_x86:os::verify_stack_alignment()

Martin Buchholz martinrb at google.com
Thu Jul 12 18:52:45 UTC 2018


>From the bug
<https://bugs.openjdk.java.net/browse/JDK-8186780?focusedCommentId=14195096&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14195096>
:

I'm thinking all of this fiddling with esp is bogus, and that
os::verify_stack_alignment() is more trouble than it's worth. But I'm still
looking for something that will be approved. How about simply checking that
__builtin_frame_address(0) is always aligned, at least with clang and gcc?


 #ifndef PRODUCT
-void os::verify_stack_alignment() {
+NOINLINE void os::verify_stack_alignment() {
 #ifdef AMD64
- assert(((intptr_t)os::current_stack_pointer() &
(StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+
+#ifdef SPARC_WORKS
+ register void *esp;
+ __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
+#else
+ // __builtin_frame_address supported by both gcc and clang
+ void *esp = __builtin_frame_address(0);
+#endif
+
+ assert(((intptr_t)esp & (StackAlignmentInBytes-1)) == 0, "incorrect stack
alignment");
 #endif
 }
 #endif


More information about the hotspot-runtime-dev mailing list