RE: JavaMemoryModel: RE: Question on memory models

From: Bill Pugh (
Date: Thu Jul 01 1999 - 22:40:41 EDT

[Looks like my last message got scrambled ...]

At 8:49 AM +1000 7/2/99, David Holmes wrote:
>Consider this approach to the vtable:
>- The vtable is stored in the class object
>- The vtable is initialised during class loading and initialisation


>- The first time any thread accesses an instance of a class in a way that
>would require class loading (if it hasn't yet been done) it passes through
>a synchronisation point (mutex, atomic instruction or explicit memory
>barrier). Hence no visibility or ordering problems.

I don't think there is any way to detect when a reference might be to
an object of a newly loaded class.

Consider a static field Foo.x of type Object. In thread 1, you invoke
Foo.x.toString(). Foo.x might reference an object of a class that has
been loaded since the last time thread 1 did a memory barrier. So you
can't easily tell if the vtbl entries are guaranteed to be valid.

In addition, there is also the problem that each object contains a
pointer to the vtbl/class information, and you need to worry about
that pointer being null as well.


This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email
To send a request to the list, email and put
your request in the body of the message (use the request "help" for help).
For more information, visit

This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:14 EDT