]> gcc.gnu.org Git - gcc.git/commitdiff
VMClassLoader.java (loadClass): Now native.
authorTom Tromey <tromey@redhat.com>
Thu, 2 Oct 2003 15:34:28 +0000 (15:34 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 2 Oct 2003 15:34:28 +0000 (15:34 +0000)
* java/lang/VMClassLoader.java (loadClass): Now native.
* java/lang/natClassLoader.cc (loadClass): Implement.
* prims.cc (_Jv_RunMain): Initialize ClassLoader.

From-SVN: r72038

libjava/ChangeLog
libjava/java/lang/VMClassLoader.java
libjava/java/lang/natClassLoader.cc
libjava/prims.cc

index 42ea2071ea01375e55cb5378c86b8d4763e2117e..d65c26acb4a3f7d5395260a834c862bcc066c59a 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-02  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/VMClassLoader.java (loadClass): Now native.
+       * java/lang/natClassLoader.cc (loadClass): Implement.
+       * prims.cc (_Jv_RunMain): Initialize ClassLoader.
+
 2003-10-02  Michael Koch  <konqueror@gmx.de>
 
        * java/net/InetAddress.java
index b46b545aeedfae5fcc7eff7b0df0e64291034e03..02010e7e9734148bd0fe8f1bb7efd3435165bda3 100644 (file)
@@ -142,20 +142,14 @@ final class VMClassLoader
   /**
    * Helper to load a class from the bootstrap class loader.
    *
-   * In libgcj, this does nothing, as the default system loader knows
-   * how to find classes that have been linked in.
-   *
    * @param name the class name to load
    * @param resolve whether to resolve it
    * @return the class, loaded by the bootstrap classloader or null
    * if the class wasn't found. Returning null is equivalent to throwing
    * a ClassNotFoundException (but a possible performance optimization).
    */
-  static final Class loadClass(String name, boolean resolve)
-    throws ClassNotFoundException
-  {
-    return null;
-  }
+  static final native Class loadClass(String name, boolean resolve)
+    throws ClassNotFoundException;
 
   /**
    * Helper to load a resource from the bootstrap class loader.
index bfd1f095d9e0eddffe7cbbe81f340d8a24e646c3..e3519f33c5b6ea2222b2008ec363a98221c8809f 100644 (file)
@@ -136,6 +136,17 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type)
   return _Jv_FindClassFromSignature (sig, NULL);
 }
 
+jclass
+java::lang::VMClassLoader::loadClass(jstring name, jboolean resolve)
+{
+  _Jv_Utf8Const *utf = _Jv_makeUtf8Const (name);
+  // FIXME: we culd make _Jv_FindClassFromSignature a template.
+  jclass klass = _Jv_FindClassInCache (utf, NULL);
+  if (klass && resolve)
+    _Jv_InitClass (klass);
+  return klass;
+}
+
 void
 _Jv_WaitForState (jclass klass, int state)
 {
index f15c24b796291332830f1f7b88ea24341a63672d..3fe65f9672291945105c9b912e33e37c6f4caa1d 100644 (file)
@@ -983,6 +983,12 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
       arg_vec = JvConvertArgv (argc - 1, argv + 1);
 #endif
 
+      // We have to initialize this fairly early, to avoid circular
+      // class initialization.  In particular we want to start the
+      // initialization of ClassLoader before we start the
+      // initialization of VMClassLoader.
+      _Jv_InitClass (&java::lang::ClassLoader::class$);
+
       using namespace gnu::gcj::runtime;
       if (klass)
        main_thread = new FirstThread (klass, arg_vec);
This page took 0.070174 seconds and 5 git commands to generate.