synchronization in gcj

Godmar Back gback@cs.utah.edu
Thu Jan 14 21:27:00 GMT 1999


Tom, thanks for your answer.
>> >>>>> "Godmar" == Godmar Back <gback@cs.utah.edu> writes:
>> Godmar> gcj uses an extra word to store a ptr to the lock associated
> Godmar> with an object.
>> Godmar> My question is then: what was your rationale, and have you
> Godmar> considered making the additional storage requirement optional
> Godmar> so that users can decide that space-time trade-off for
> Godmar> themselves.
>> I wrote this code. My rationale was that it was easy to understand
> and implement. I am definitely aware of the alternatives, and I've
> occasionally considered making this configurable. In fact, the
> runtime side of locking was written with the expectation that we'd
> want to change the representation at some later date.

 I see.
>> On the compiler side this basically amounts to getting rid of the
> extra field in the object. I believe the compiler doesn't ever
> directly reference this field.
>> On the runtime side a bit more work is required, but not very much.
>
It would certainly be simple to get rid of the field and look up the
lock object every time the lock is entered or left.
As you probably know, Java's symmetrical use of synchronization 
constructs provides the possibility for at least saving the lookup
when a monitor is left. This would require storing the address of the
lock object while it is held somewhere, presumably on the run-time stack.
How hard would that be to implement and have you considered it?
	- Godmar


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /