request for advice: safepoints in the JSR 292 spec

Rich Hickey richhickey at gmail.com
Sun Dec 12 08:02:17 PST 2010


On Dec 11, 2010, at 6:30 PM, Jim Laskey wrote:

>
> On 2010-12-11, at 4:38 PM, Rémi Forax wrote:
>
>> I think it's possible to use a synchronized block enclosing the  
>> setTargets and the corresponding syncs
>> instead of syncTargets. From my experience, changing something on a  
>> metaclass
>> often require to propagate changes on subclasses. This can't be  
>> done using atomics
>> so you already need such synchronized block.
>
> Maybe I misunderstood.  I was assuming that syncTargets was a VM  
> operation (at safepoint.)
>
>

Right.

Rémi's synchronized block only coordinates the activities of updaters.  
Other threads may, and in some cases may have to, see some of the  
setTarget results prior to the sync call, which could be a mess. The  
point of syncTargets is to make the setting and the visibility atomic,  
which synchronized cannot do.

Rich



More information about the mlvm-dev mailing list