RFR: 8224851: AArch64: fix warnings and errors with Clang and GCC 8.3

Nick Gasson nick.gasson at arm.com
Mon Jun 3 10:36:10 UTC 2019


Hi Andrew,

> 
> We need to know what it's used for to know which solution is right. I'm
> guessing the primary use case is asynchronous runtime stack probes, used
> by debugging tools.
> 

Yes, we also have os::stack_shadow_pages_available() which uses it to 
calculate how much space there is between the current SP and the end of 
the stack. In this case I think it's ok as long as we don't return a 
value that's *above* the actual stack pointer. And os::current_frame(), 
which constructs a `frame' object using the FP of the caller, but the SP 
will point into the frame of os::current_frame(), so it seems it's 
already inaccurate.

There's also a comment in os_linux.cpp that says "Don't use 
os::current_stack_pointer(), as its result can be slightly below current
stack pointer". So I'm wondering if we can simplify this a lot and use 
__builtin_frame_address(0) which will give us the FP in 
os::current_stack_pointer (ought to be the caller's SP - 16). Zero does 
this currently. And maybe we can replace _get_previous_fp() with 
__builtin_frame_address(1)?

Thanks,
Nick



More information about the build-dev mailing list