This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the GCJ project. See the GCJ home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

synchronization in gcj



 Hi,

I have a question about gcj's use of synchronization.
gcj uses an extra word to store a ptr to the lock associated with an object.

While this speeds up operations such as 
a) looking up the lock
b) looking up the lock when entering it recursively
c) looking up the lock when leaving it,

it also introduces the obvious cost of having to waste 4 bytes of
memory for each object, which may be significant.

My question is then: what was your rationale, and have you considered
making the additional storage requirement optional so that users
can decide that space-time trade-off for themselves.

I believe this should be seen in the light of the fact that at least
c) can be optimized without reserving storage with each object, namely
by keeping track of matching lock/unlock pairs.

What do you think?

	- Godmar