This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GC problem


I've hit what looks like a GC problem while loading many classes with
the interpreter.

In scanning over the code, I think I've found the problem.  My fear is
that there's a window of opportunity for data in the constant pool to
get collected while preparing interpreted classes.  

An important array is allocated in _Jv_ClassReader::handleConstantPool:

  // the pool is scanned explicitly by the collector
  jbyte *pool_tags = (jbyte*) _Jv_AllocBytes (pool_count);
  _Jv_word *pool_data
    = (_Jv_word*) _Jv_AllocBytes (pool_count * sizeof (_Jv_word));

It gets assigned to _Jv_ClassReader::def for a while, and then
eventually stuffed into a proper class object, with the the GC header
and vtable that would enable correct explicit scanning. 

It seems that I've triggered a GC run between these two events, and
elements in my array are getting collected.  In particular, UTF8 objects
allocated like so are being written over...

      pool_data[index].utf8 = _Jv_makeUtf8Const (buffer, len);

Does this make sense?

AG

-- 
Anthony Green <green@redhat.com>
Red Hat, Inc.


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