summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-16 23:54:22 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-16 23:54:22 +0000
commit1477256096e8bf65a05fabe51ef206ef7856868a (patch)
tree4fa6a54c6fc16fc9ab0716cf489d234d9d55e8fd /libjava/java/lang
parent6d3c6627eb9cfb499f87d9ad8af6412e06dc68f0 (diff)
downloadppe42-gcc-1477256096e8bf65a05fabe51ef206ef7856868a.tar.gz
ppe42-gcc-1477256096e8bf65a05fabe51ef206ef7856868a.zip
* java/lang/natClassLoader.cc: Moved VMClassLoader methods...
* java/lang/natVMClassLoader.cc: ...here. New file. * Makefile.in: Rebuilt. * Makefile.am (nat_source_files): Added natVMClassLoader.cc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76003 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/natClassLoader.cc108
-rw-r--r--libjava/java/lang/natVMClassLoader.cc133
2 files changed, 134 insertions, 107 deletions
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc
index 4f15930e1ae..f5f37faf58b 100644
--- a/libjava/java/lang/natClassLoader.cc
+++ b/libjava/java/lang/natClassLoader.cc
@@ -1,6 +1,6 @@
// natClassLoader.cc - Implementation of java.lang.ClassLoader native methods.
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
This file is part of libgcj.
@@ -28,7 +28,6 @@ details. */
#include <java/lang/InternalError.h>
#include <java/lang/IllegalAccessError.h>
#include <java/lang/LinkageError.h>
-#include <java/lang/ClassFormatError.h>
#include <java/lang/NoClassDefFoundError.h>
#include <java/lang/ClassNotFoundException.h>
#include <java/lang/ClassCircularityError.h>
@@ -41,111 +40,6 @@ details. */
#include <java/io/Serializable.h>
#include <java/lang/Cloneable.h>
-/////////// java.lang.ClassLoader native methods ////////////
-
-java::lang::Class *
-java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
- jstring name,
- jbyteArray data,
- jint offset,
- jint length,
- java::security::ProtectionDomain *pd)
-{
-#ifdef INTERPRETER
- jclass klass;
- klass = (jclass) JvAllocObject (&java::lang::Class::class$,
- sizeof (_Jv_InterpClass));
-
- // Synchronize on the class, so that it is not attempted initialized
- // until we're done loading.
- JvSynchronize sync (klass);
-
- // Record the defining loader. For the system class loader, we
- // record NULL.
- if (loader != java::lang::ClassLoader::getSystemClassLoader())
- klass->loader = loader;
-
- if (name != 0)
- {
- _Jv_Utf8Const *name2 = _Jv_makeUtf8Const (name);
-
- if (! _Jv_VerifyClassName (name2))
- throw new java::lang::ClassFormatError
- (JvNewStringLatin1 ("erroneous class name"));
-
- klass->name = name2;
- }
-
- try
- {
- _Jv_DefineClass (klass, data, offset, length);
- }
- catch (java::lang::Throwable *ex)
- {
- klass->state = JV_STATE_ERROR;
- klass->notifyAll ();
-
- _Jv_UnregisterClass (klass);
-
- // If EX is not a ClassNotFoundException, that's ok, because we
- // account for the possibility in defineClass().
- throw ex;
- }
-
- klass->protectionDomain = pd;
-
- // if everything proceeded sucessfully, we're loaded.
- JvAssert (klass->state == JV_STATE_LOADED);
-
- return klass;
-
-#else // INTERPRETER
-
- return 0;
-#endif
-}
-
-// Finish linking a class. Only called from ClassLoader::resolveClass.
-void
-java::lang::VMClassLoader::linkClass0 (java::lang::Class *klass)
-{
- _Jv_WaitForState (klass, JV_STATE_LINKED);
-}
-
-void
-java::lang::VMClassLoader::markClassErrorState0 (java::lang::Class *klass)
-{
- klass->state = JV_STATE_ERROR;
- klass->notifyAll ();
-}
-
-java::lang::ClassLoader *
-java::lang::VMClassLoader::getSystemClassLoaderInternal()
-{
- _Jv_InitClass (&gnu::gcj::runtime::VMClassLoader::class$);
- return gnu::gcj::runtime::VMClassLoader::instance;
-}
-
-jclass
-java::lang::VMClassLoader::getPrimitiveClass (jchar type)
-{
- char sig[2];
- sig[0] = (char) type;
- sig[1] = '\0';
- 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/java/lang/natVMClassLoader.cc b/libjava/java/lang/natVMClassLoader.cc
new file mode 100644
index 00000000000..8de0a70669e
--- /dev/null
+++ b/libjava/java/lang/natVMClassLoader.cc
@@ -0,0 +1,133 @@
+// natVMClassLoader.cc - VMClassLoader native methods
+
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/* Author: Kresten Krab Thorup <krab@gnu.org> */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <gcj/cni.h>
+#include <jvm.h>
+
+#include <java-threads.h>
+#include <java-interp.h>
+
+#include <java/lang/VMClassLoader.h>
+#include <gnu/gcj/runtime/VMClassLoader.h>
+#include <java/lang/ClassLoader.h>
+#include <java/lang/Class.h>
+#include <java/lang/Throwable.h>
+#include <java/security/ProtectionDomain.h>
+#include <java/lang/ClassFormatError.h>
+
+java::lang::Class *
+java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
+ jstring name,
+ jbyteArray data,
+ jint offset,
+ jint length,
+ java::security::ProtectionDomain *pd)
+{
+#ifdef INTERPRETER
+ jclass klass;
+ klass = (jclass) JvAllocObject (&java::lang::Class::class$,
+ sizeof (_Jv_InterpClass));
+
+ // Synchronize on the class, so that it is not attempted initialized
+ // until we're done loading.
+ JvSynchronize sync (klass);
+
+ // Record the defining loader. For the system class loader, we
+ // record NULL.
+ if (loader != java::lang::ClassLoader::getSystemClassLoader())
+ klass->loader = loader;
+
+ if (name != 0)
+ {
+ _Jv_Utf8Const *name2 = _Jv_makeUtf8Const (name);
+
+ if (! _Jv_VerifyClassName (name2))
+ throw new java::lang::ClassFormatError
+ (JvNewStringLatin1 ("erroneous class name"));
+
+ klass->name = name2;
+ }
+
+ try
+ {
+ _Jv_DefineClass (klass, data, offset, length);
+ }
+ catch (java::lang::Throwable *ex)
+ {
+ klass->state = JV_STATE_ERROR;
+ klass->notifyAll ();
+
+ _Jv_UnregisterClass (klass);
+
+ // If EX is not a ClassNotFoundException, that's ok, because we
+ // account for the possibility in defineClass().
+ throw ex;
+ }
+
+ klass->protectionDomain = pd;
+
+ // if everything proceeded sucessfully, we're loaded.
+ JvAssert (klass->state == JV_STATE_LOADED);
+
+ return klass;
+
+#else // INTERPRETER
+
+ return 0;
+#endif
+}
+
+// Finish linking a class. Only called from ClassLoader::resolveClass.
+void
+java::lang::VMClassLoader::linkClass0 (java::lang::Class *klass)
+{
+ _Jv_WaitForState (klass, JV_STATE_LINKED);
+}
+
+void
+java::lang::VMClassLoader::markClassErrorState0 (java::lang::Class *klass)
+{
+ klass->state = JV_STATE_ERROR;
+ klass->notifyAll ();
+}
+
+java::lang::ClassLoader *
+java::lang::VMClassLoader::getSystemClassLoaderInternal()
+{
+ _Jv_InitClass (&gnu::gcj::runtime::VMClassLoader::class$);
+ return gnu::gcj::runtime::VMClassLoader::instance;
+}
+
+jclass
+java::lang::VMClassLoader::getPrimitiveClass (jchar type)
+{
+ char sig[2];
+ sig[0] = (char) type;
+ sig[1] = '\0';
+ 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;
+}
OpenPOWER on IntegriCloud