This is the mail archive of the java-prs@sources.redhat.com 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]

Re: gcj/338


The following reply was made to PR gcj/338; it has been noted by GNATS.

From: green@cygnus.com
To: apbianco@cygnus.com, java-gnats@sourceware.cygnus.com, osk@hem.passagen.se
Cc:  
Subject: Re: gcj/338
Date: 10 Sep 2000 19:57:49 -0000

 Synopsis: deadlock in _Jv_FindClassInCache
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: green
 State-Changed-When: Sun Sep 10 12:57:49 2000
 State-Changed-Why:
     What's happening here is that we have a class living in both a shared library and the main program.
     
     The AbstractList class is registered when the main program starts up.  This is done through the use of the per-class static constructors.  The same thing happens when the libgcj shared library is loaded.  When the same class is registered twice we end up with a loop in the class cache (klass->next == klass).
     
     Here's one way to avoid the deadloop symptom.  It's difficult to say what the right thing to do is. 
     
     Index: java/lang/natClassLoader.cc
     ===================================================================
     RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v
     retrieving revision 1.25
     diff -u -r1.25 natClassLoader.cc
     --- natClassLoader.cc   2000/07/20 19:31:16     1.25
     +++ natClassLoader.cc   2000/09/10 19:51:49
     @@ -436,7 +436,18 @@
        for (; *classes; ++classes)
          {
            jclass klass = *classes;
     -      jint hash = HASH_UTF (klass->name);
     +      _Jv_Utf8Const *name = klass->name;
     +      jint hash = HASH_UTF (name);
     +      // In certain situations we may find ourselves registering the
     +      // same class twice (but with different implementations).  For
     +      // instance, foo.Bar may exist in two different shared
     +      // libraries.  The first class registered wins in this case, and
     +      // we proceed silently.
     +      for (jclass k = loaded_classes[hash]; k; k = k->next)
     +       {
     +         if (_Jv_equalUtf8Consts (name, k->name))
     +           return;
     +       }
            klass->next = loaded_classes[hash];
            loaded_classes[hash] = klass;
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=338&database=java

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