I see: Don't use // os::current_stack_pointer(), as its result can be slightly below current // stack pointer, causing us to not alloca enough to reach "bottom".
If you really really want to get the stack pointer of the current frame, you can't put it in a function! Use magic compiler extensions via a macro. gcc and clang both have __builtin_frame_address(0). gcc BUT not clang has register uint64_t rsp asm ("rsp"); BUT that gives a slightly different value from __builtin_frame_address(0) (different register? don't know much about x86 assembly) On Thu, Jun 21, 2018 at 5:37 AM, Thomas Stüfe <thomas.stu...@gmail.com> wrote: > On Thu, Jun 21, 2018 at 1:27 PM, David Holmes <david.hol...@oracle.com> > wrote: > > On 21/06/2018 10:05 AM, Martin Buchholz wrote: > >> > >> On Wed, Jun 20, 2018 at 4:03 PM, Martin Buchholz <marti...@google.com > >> <mailto:marti...@google.com>> wrote: > >> > >> Hi David and build-dev folk, > >> > >> After way too much build/hotspot hacking, I have a better fix: > >> > >> clang inlined os::current_stack_pointer into its caller __in the > >> same translation unit___ (that could be fixed in a separate change) > >> so of course in this case it didn't have to follow the ABI. Fix is > >> obvious in hindsight: > >> > >> -address os::current_stack_pointer() { > >> +NOINLINE address os::current_stack_pointer() { > >> > >> > >> If y'all like the addition of NOINLINE, it should probably be added to > all > >> of the 14 variants of os::current_stack_pointer. > >> Gives me a chance to try out the submit repo. > > > > > > I can't help but think other platforms actually rely on it being inlined > so > > that it really does return the stack pointer of the method calling > > os::current_stack_pointer! > > > > But we only inline today if caller is in the same translation unit and > builds with optimization, no? > > ..Thomas > > > David >