summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-02 15:34:28 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-02 15:34:28 +0000
commitee53d22ae98d509d005809a877536ffa3f9b4dd2 (patch)
tree0d661c151d898fb68bdb3b3911e26cc2223aaf99 /libjava
parentc9eadc1c09fd0eafb4d4fee73aa26470646063db (diff)
downloadgcc-ee53d22ae98d509d005809a877536ffa3f9b4dd2.tar.gz
* java/lang/VMClassLoader.java (loadClass): Now native.
* java/lang/natClassLoader.cc (loadClass): Implement. * prims.cc (_Jv_RunMain): Initialize ClassLoader. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72038 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/lang/VMClassLoader.java10
-rw-r--r--libjava/java/lang/natClassLoader.cc11
-rw-r--r--libjava/prims.cc6
4 files changed, 25 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 42ea2071ea0..d65c26acb4a 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -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
diff --git a/libjava/java/lang/VMClassLoader.java b/libjava/java/lang/VMClassLoader.java
index b46b545aeed..02010e7e973 100644
--- a/libjava/java/lang/VMClassLoader.java
+++ b/libjava/java/lang/VMClassLoader.java
@@ -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.
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index bfd1f095d9e..e3519f33c5b 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -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)
{
diff --git a/libjava/prims.cc b/libjava/prims.cc
index f15c24b7962..3fe65f96722 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -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);