On 13 Jul 2023, at 14:03, John Rose wrote:

> On Jul 13, 2023, at 1:52 PM, John Rose <[email protected]> wrote:
>>
>> The proposed “unification” would require us to somehow simulate larval 
>> objects in terms of today’s blank identity objects
>
> P.P.S. That’s almost possible if you declare that the new opcode makes a 
> larval value, but closing it off is very hard. You need an explicit 
> end-larval transition to adult. The verifier would have to enforce this. 
> Nightmare.

Welcome to my nightmare.  As of last Friday (the week of the JVMLS) I now 
believe the pieces fit together, in a way that is really more like a pleasant 
dream.  I’m surprised.

I’ve written up in detail how I think Remi’s suggestion can work.

https://cr.openjdk.org/~jrose/values/larval-values.html

While this is a rough note, I think all the details are present.

The last tenth of the last mile, which clinched it for me, was realizing that 
the JVM already defines an execution point, during object creation, where the 
end-larval transition must take place.  It is the JMM freeze operation.  Just 
as new can be overloaded to make both values and identity objects, the JMM 
freeze (defined as happening at return from <init>) can and should be 
overloaded to finalize both values and identity objects.  The changes to the 
verifier (which were frightening me) are quite mild after all, because existing 
rules carry the burden of separating the larval from the adult phases of the 
value object under construction.

Take a look at my write-up and see if it makes sense to you too.

— John

Reply via email to