diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-04 20:49:27 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-04 20:49:27 +0000 |
commit | 2e1ddfaaaeb7479c9719878f400ada9d01d3773a (patch) | |
tree | f2e35a2ea96bcecfa7499a5ec8161bd2528c22d5 /libjava/java | |
parent | a61eb77ebc7e5552d9502bc5c1ab36cf8b0f9f6f (diff) | |
download | gcc-2e1ddfaaaeb7479c9719878f400ada9d01d3773a.tar.gz |
* defineclass.cc (handleMethodsBegin): Allocate _Jv_MethodBase
pointers.
(handleMethodsEnd): Fixed error messages. Create a _Jv_JNIMethod
if the method is native.
* resolve.cc (ncode): Don't handle native methods.
(_Jv_JNIMethod::ncode): New method.
(_Jv_PrepareClass): Handle native methods.
* jni.cc (call): Renamed from _Jv_JNI_conversion_call.
Include AbstractMethodError.h.
(add_char): New function.
(mangled_name): Likewise.
* include/java-interp.h (class _Jv_JNIMethod): New class.
(class _Jv_MethodBase): New class.
(class _Jv_InterpMethod): Derive from _Jv_MethodBase.
(_Jv_InterpClass): Changed `interpreted_methods' field to type
`_Jv_MethodBase'.
* include/jvm.h (_Jv_FindSymbolInExecutable): Declare.
* java/lang/natRuntime.cc (libraries_size, libraries_count,
libraries): New globals.
(add_library): New function.
(_Jv_FindSymbolInExecutable): New function.
* java/lang/natClassLoader.cc (initiated_classes, loaded_classes):
Now static.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31790 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/lang/natClassLoader.cc | 8 | ||||
-rw-r--r-- | libjava/java/lang/natRuntime.cc | 47 |
2 files changed, 52 insertions, 3 deletions
diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 77ae9f5bd54..ba7b2c66b66 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -308,8 +308,12 @@ struct _Jv_LoaderInfo { java::lang::ClassLoader *loader; }; -_Jv_LoaderInfo *initiated_classes[HASH_LEN]; -jclass loaded_classes[HASH_LEN]; +static _Jv_LoaderInfo *initiated_classes[HASH_LEN]; +static jclass loaded_classes[HASH_LEN]; + +// This is the root of a linked list of classes + + jclass _Jv_FindClassInCache (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc index 3eabb90a60e..dd8b0d01e87 100644 --- a/libjava/java/lang/natRuntime.cc +++ b/libjava/java/lang/natRuntime.cc @@ -24,7 +24,52 @@ details. */ /* FIXME: we don't always need this. The next libtool will let us use AC_LTDL_PREOPEN to see if we do. */ const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } }; -#endif + +// We keep track of all the libraries loaded by this application. For +// now we use them to look up symbols for JNI. `libraries_size' holds +// the total size of the buffer. `libraries_count' is the number of +// items which are in use. +static int libraries_size; +static int libraries_count; +static lt_dlhandle *libraries; + +static void +add_library (lt_dlhandle lib) +{ + if (libraries_count == libraries_size) + { + int ns = libraries_size * 2; + if (ns == 0) + ns = 10; + lt_dlhandle *n = (lt_dlhandle *) _Jv_Malloc (ns * sizeof (lt_dlhandle)); + if (libraries) + { + memcpy (n, libraries, libraries_size * sizeof (lt_dlhandle)); + _Jv_Free (libraries); + } + libraries = n; + libraries_size = ns; + for (int i = libraries_count; i < libraries_size; ++i) + libraries[i] = NULL; + } + + libraries[libraries_count++] = lib; +} + +void * +_Jv_FindSymbolInExecutable (const char *symname) +{ + for (int i = 0; i < libraries_count; ++i) + { + void *r = lt_dlsym (libraries[i], symname); + if (r) + return r; + } + + return lt_dlsym (NULL, symname); +} + +#endif /* USE_LTDL */ void java::lang::Runtime::exit (jint status) |