Reserving an extra slot on the stack
David Lloyd
david.lloyd at redhat.com
Thu Jan 25 15:22:43 UTC 2018
On Thu, Jan 25, 2018 at 9:19 AM, Andrew Dinn <adinn 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?
> Not really. Stack layouts are, of necessity, quite tightly coupled to
> the underlying cpu and os.
>
> Can you explain what you are trying to achieve so we might perhaps be
> able better to advise on how to get there? There are so many gotchas in
> the area of GC operation and stack frame management that questions like
> "can I modify mechanism X" (where X relates to either or both topics)
> are very hard to answer. It is much easier to scope and determine a
> complete and correct response to questions like "can I achieve goal Y".
Essentially it's a one-reference cache for code which otherwise has to
iterate the stack (likely frequently). The use area is the
experimental pure-Java AccessController implementation I'm working on
[1].
[1] http://mail.openjdk.java.net/pipermail/security-dev/2017-December/016627.html
--
- DML
More information about the hotspot-dev
mailing list