JEP 270: Reserved Stack Areas for Critical Sections

Frederic Parain frederic.parain at oracle.com
Thu Sep 24 12:31:34 UTC 2015


The problem here is the sizing of the reserved area: the size must
be sufficient to allow any annotated critical section (including
nested critical sections) to complete its execution without hitting
the Yellow Zone. If the reserved area size is not sufficient to
satisfy this property, the whole mechanism is defeated.
Computing the stack size required to execute a sequence of bytecode
is a very complex task because of the number of parameter to consider:
slot size, frame header size, interpreted vs compiled code, number of
monitors, etc. This is why by default, the reserved area is restricted
to privileged code: it has been sized to protect a number of well
identified critical sections in the JDK code. This size cannot
protect any user-defined critical section.

But an early feedback I got when I designed this solution was that
*some* applications might be interested in such mechanism to protect
their own critical sections. This is why there's a VM flag to allow
non-privileged code to use this feature, but in most (or all) cases
it requires to re-size the reserved area in order to be able to
cover all JDK critical sections, all user-defined critical sections
and any nesting combination of them. This work requires a deep
knowledge of both the application code and the Java stack implementation
in the JVM. This is clearly a flag for advanced users.

Regards,

Fred

On 24/09/2015 03:20, Vitaly Davidovich wrote:
> This is great, but it's somewhat unclear whether non-JDK code can use it.
> It mentions the annotation can be applied anywhere, but by default ignored
> for non-privileged code with a cmdline flag to override this.  So is
> non-JDK code in scope or not? If it's in scope with the flag overriden, why
> is the annotation in sun.misc? If non-JDK code isn't in scope, it's kind of
> sad.  Why is the assumption that people will use this annotation
> arbitrarily and willy-nilly?
>
> sent from my phone
> On Sep 23, 2015 8:26 PM, <mark.reinhold at oracle.com> wrote:
>
>> New JEP Candidate: http://openjdk.java.net/jeps/270
>>
>> - Mark
>>

-- 
Frederic Parain - Oracle
Grenoble Engineering Center - France
Phone: +33 4 76 18 81 17
Email: Frederic.Parain at oracle.com


More information about the hotspot-runtime-dev mailing list