On Tue, 30 Jun 2026 16:58:47 GMT, Alan Bateman <[email protected]> wrote:
> JVMTI ForceEarlyReturnVoid can be used to return early from a constructor or > class initializer. Early return from a constructor with strictly-initialized > instance fields is problematic, as is early return from a class initializer > when there are strictly-initialized static fields. The proposal for the > initial integration is to keep it simple and just disallow > ForceEarlyReturnVoid to return early from a value class constructor. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). The fix looks good to me. I've posted one nit with a suggestion which is not critical. Thank you for making this update! src/hotspot/share/prims/jvmti.xml line 3401: > 3399: The implementation is unable to force the current frame to > return > 3400: (e.g. current frame is executing a native method or the > current frame is the > 3401: constructor for a value class) It is nice that the value class initializers are not impacted, so there is no need to return `OPAQUE_FRAME` for value class initializer frames. test/hotspot/jtreg/serviceability/jvmti/ForceEarlyReturn/ForceEarlyReturnValueClass.java line 55: > 53: while (!TestCase.stop) {} > 54: TestCase.finished = true; > 55: } Nit: We may need one more test case for a helper method invoked from a value object constructor. My understanding is that such methods can not initialize the value object fields. ------------- PR Review: https://git.openjdk.org/valhalla/pull/2604#pullrequestreview-4603145333 PR Review Comment: https://git.openjdk.org/valhalla/pull/2604#discussion_r3501148705 PR Review Comment: https://git.openjdk.org/valhalla/pull/2604#discussion_r3501228084
