Problem with static fields and indirect-dispatch

Andrew Haley aph@redhat.com
Thu May 11 09:53:00 GMT 2006


Casey Marshall writes:
 > Hi, I'm seeing a problem with a 4.2.0 snapshot. The following program  
 > fails to run; without the patch mentioned, it still fails, but in  
 > `java.lang.Class.initializeClass,' not in `testbc.<clinit>'. Without  
 > the patch, it fails at line 1663 of link.cc, which is the `if' in:
 > 
 >    jstring *strp = (jstring *) f->u.addr;
 >    if (*strp)
 >      *strp = _Jv_NewStringUTF8Const ((_Jv_Utf8Const *) *strp);
 > 
 > Running this interpreted, or compiled directly works; compiling it  
 > with -findirect-dispatch and launching it with `gij' fails.

This works for me with svn HEAD.

Hmm, it looks like there was a missing line in the patch I posted.
This was in the actual checkin of the patch.  For the record, the
missing line was:

Index: libjava/gnu/gcj/runtime/natSharedLibLoader.cc
===================================================================
*** libjava/gnu/gcj/runtime/natSharedLibLoader.cc       (revision 113673)
--- libjava/gnu/gcj/runtime/natSharedLibLoader.cc       (revision 113674)
*************** _Jv_sharedlib_register_hook (jclass cls)
*** 45,49 ****
    cls->protectionDomain = curHelper->domain;
    cls->loader = curLoader;
!   cls->engine = &_Jv_soleCompiledEngine;
    curHelper->registerClass(cls->getName(), cls);
  }
--- 45,50 ----
    cls->protectionDomain = curHelper->domain;
    cls->loader = curLoader;
!   if (! cls->engine)
!     cls->engine = &_Jv_soleCompiledEngine;
    curHelper->registerClass(cls->getName(), cls);
  }

Andrew.



More information about the Java mailing list