classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] VMStackWalker infinite loop fix


From: Archie Cobbs
Subject: [cp-patches] VMStackWalker infinite loop fix
Date: Sun, 13 Nov 2005 16:29:49 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

I've committed the attached patch to fix an infinite loop
between VMStackWalker.getCallingClassLoader() and Class.getClassLoader().

    2005-11-13  Archie Cobbs  <address@hidden>

        * vm/reference/gnu/classpath/VMStackWalker.java (getClassLoader()):
        added to fix an infinite loop bug.
        * NEWS: note VM interface change.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com
Index: NEWS
===================================================================
RCS file: /cvsroot/classpath/classpath/NEWS,v
retrieving revision 1.104
diff -u -r1.104 NEWS
--- NEWS        2 Nov 2005 22:31:47 -0000       1.104
+++ NEWS        13 Nov 2005 22:25:48 -0000
@@ -1,3 +1,10 @@
+New in release 0.20
+
+Runtime interface changes:
+
+* New method VMStackWalker.getClassLoader() was added to avoid an infinite
+  loop between getCallingClassLoader() and Class.getClassLoader().
+
 New in release 0.19 (Nov 2, 2005)
 
 * The Swing RepaintManager has been reworked for more efficient painting,
Index: vm/reference/gnu/classpath/VMStackWalker.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/vm/reference/gnu/classpath/VMStackWalker.java,v
retrieving revision 1.5
diff -u -r1.5 VMStackWalker.java
--- vm/reference/gnu/classpath/VMStackWalker.java       2 Jul 2005 20:33:08 
-0000       1.5
+++ vm/reference/gnu/classpath/VMStackWalker.java       13 Nov 2005 22:25:51 
-0000
@@ -88,9 +88,9 @@
 
   /**
    * Get the class loader associated with the Class returned by
-   * <code>getCallingClass()</code>, or <code>null</code> if no
-   * such class exists or it is the boot loader. This method is an optimization
-   * for the expression <code>getClassContext()[1].getClassLoader()</code>
+   * <code>getCallingClass()</code>, or <code>null</code> if no such class
+   * exists or it is the boot loader. This method is an optimization for the
+   * expression <code>VMStackWalker.getClassLoader(getClassContext()[1])</code>
    * and should return the same result.
    *
    * <p>
@@ -102,7 +102,15 @@
     Class[] ctx = getClassContext();
     if (ctx.length < 3)
       return null;
-    return ctx[2].getClassLoader();
+    return getClassLoader(ctx[2]);
   }
+
+  /**
+   * Retrieve the class's ClassLoader, or <code>null</code> if loaded
+   * by the bootstrap loader. I.e., this should return the same thing
+   * as address@hidden java.lang.VMClass#getClassLoader}. This duplicate 
version
+   * is here to work around access permissions.
+   */
+  public static native ClassLoader getClassLoader(Class cl);
 }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]