On Tue, 4 Aug 2026 15:03:27 GMT, Alan Bateman <[email protected]> wrote:

> Update JVMTI ForceEarlyReturnVoid, and the equivalent JDWP command and JDI 
> method, to specify that the operation fails if the target thread's top frame 
> is a constructor or the class initializer of a class with 
> strictly-initialized fields.
> 
> Several options have been explored for both constructors and class 
> initializers,  the details are attached to the JBS issue.
> 
> The changes are very simple.  ClassFileParser::parse_fields records if the 
> class has class has strict instance fields, as it does already for strict 
> static fields. JvmtiEnvBase::check_top_frame is changed to check if the top 
> frame is a constructor of a class with strict instance fields in the class 
> hierarchy or the initializer of a class with strict static fields. This 
> replaces the check if the top frame is a value class constructor, the interim 
> solution for the initial JEP 539 integration.
> 
> In jvmti.xml, the custom XML element `externallink` is updated to support the 
> `sup` element so a "PREVIEW" superscript can decorate links to preview APIs.
> 
> Test ForceEarlyReturnStrictInitFields is added to test ForceEarlyReturnVoid 
> when the target thread's top frame is the constructor, method, or class 
> initializer of a a class with strictly-initialized fields.
> 
> Testing: tier 1-5
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/hotspot/share/prims/jvmtiEnvBase.cpp line 2176:

> 2174: 
> 2175:   // Prevent ForceEarlyReturnVoid from returning early from the class 
> initializer of a class with
> 2176:   // strictly-initialized static fields, or a constructor of a class 
> with with strictly-initialized

Nit: Typo: s/with with/with/

src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java line 442:

> 440:      * method may be used to force a return when the virtual thread is 
> suspended
> 441:      * at an event. The target VM may support forcing a return when the 
> virtual
> 442:      * therad is suspended in other cases.

Nit: Typo: s/therad/thread/

test/hotspot/jtreg/serviceability/jvmti/ForceEarlyReturn/ForceEarlyReturnStrictInitFields.java
 line 67:

> 65:         /**
> 66:          * Starts a thread to execute the given action. The action is 
> expected to spin
> 67:          * at the given class/method. Once spinning, the thread is 
> suspsended and

Nit: Typo: s/suspsended/suspended/

test/hotspot/jtreg/serviceability/jvmti/ForceEarlyReturn/ForceEarlyReturnStrictInitFields.java
 line 513:

> 511:      * Test ForceEarlyReturnVoid when the target thread's top frame is a 
> method of a
> 512:      * class with a strictly-initialized instance field. This test 
> ensures that force
> 513:      * early is allowed when the top-frame is a method  of a classes with

Nit: Typo: /method  of a classes/method of a class/          (also, note a 
double-space)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3902350504
PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3902344600
PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3902373923
PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3902400499

Reply via email to