Reserving an extra slot on the stack

David Lloyd david.lloyd at redhat.com
Thu Jan 25 15:23:13 UTC 2018


On Thu, Jan 25, 2018 at 9:13 AM, Andrew Haley <aph at redhat.com> wrote:
> On 25/01/18 14:59, David Lloyd wrote:
>> For an experiment I'm working on, I'd like to modify the JVM to
>> reserve one reference-sized slot (which eventually should be visible
>> to GC) on every stack frame at a fixed well-known offset (such that I
>> can reach it via Unsafe from Java-space).  But it appears that the
>> stack layout code is pretty deep in per-CPU areas.  Is there a generic
>> mechanism that I've missed?  Like some way to make the compiler act as
>> if there were one extra local variable or something like that?
>
> Each compiler does its own stack layout.  The only thing that's fixed
> is the calling convention.  To make this work you'd need to change C1,
> C2, and the template interpreter.  As it happens, the interpreter has
> an unused slot on most architectures, so you can have that for free.
> Do you actually need to test your experiment with C1 and C2?

Eventually, yes: the cache would exist for performance purposes, so
I'd want to ensure that performance is actually improved.

-- 
- DML


More information about the hotspot-dev mailing list