aboutsummaryrefslogtreecommitdiff
path: root/libjava/defineclass.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-02-04 20:49:27 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-02-04 20:49:27 +0000
commitfacc279fc19a31c23323ce3eeac869eb14d07bda (patch)
treef2e35a2ea96bcecfa7499a5ec8161bd2528c22d5 /libjava/defineclass.cc
parenta89608cbebb11969af54ba5a5354302fab2a0b4b (diff)
downloadgcc-facc279fc19a31c23323ce3eeac869eb14d07bda.zip
gcc-facc279fc19a31c23323ce3eeac869eb14d07bda.tar.gz
gcc-facc279fc19a31c23323ce3eeac869eb14d07bda.tar.bz2
defineclass.cc (handleMethodsBegin): Allocate _Jv_MethodBase pointers.
* 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. From-SVN: r31790
Diffstat (limited to 'libjava/defineclass.cc')
-rw-r--r--libjava/defineclass.cc33
1 files changed, 24 insertions, 9 deletions
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index a439834..215fc23 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -1142,13 +1142,15 @@ void _Jv_ClassReader::handleFieldsEnd ()
-void _Jv_ClassReader::handleMethodsBegin (int count)
+void
+_Jv_ClassReader::handleMethodsBegin (int count)
{
def->methods = (_Jv_Method*)
_Jv_AllocBytesChecked (sizeof (_Jv_Method)*count);
- def->interpreted_methods = (_Jv_InterpMethod**)
- _Jv_AllocBytesChecked (sizeof (_Jv_InterpMethod*) * count);
+ def->interpreted_methods
+ = (_Jv_MethodBase **) _Jv_AllocBytesChecked (sizeof (_Jv_MethodBase *)
+ * count);
for (int i = 0; i < count; i++)
def->interpreted_methods[i] = 0;
@@ -1230,7 +1232,8 @@ void _Jv_ClassReader::handleExceptionTableEntry
(int method_index, int exc_index,
int start_pc, int end_pc, int handler_pc, int catch_type)
{
- _Jv_InterpMethod *method = def->interpreted_methods[method_index];
+ _Jv_InterpMethod *method = reinterpret_cast<_Jv_InterpMethod *>
+ (def->interpreted_methods[method_index]);
_Jv_InterpException *exc = method->exceptions ();
exc[exc_index].start_pc = start_pc;
@@ -1246,17 +1249,29 @@ void _Jv_ClassReader::handleMethodsEnd ()
for (int i = 0; i < def->method_count; i++)
{
_Jv_Method *method = &def->methods[i];
- if (method->accflags & (Modifier::NATIVE | Modifier::ABSTRACT))
+ if ((method->accflags & Modifier::NATIVE) != 0)
+ {
+ if (def->interpreted_methods[i] != 0)
+ throw_class_format_error ("code provided for native method");
+ else
+ {
+ _Jv_JNIMethod *m = (_Jv_JNIMethod *)
+ _Jv_AllocBytesChecked (sizeof (_Jv_JNIMethod));
+ m->defining_class = def;
+ m->self = method;
+ m->function = NULL;
+ def->interpreted_methods[i] = m;
+ }
+ }
+ else if ((method->accflags & Modifier::ABSTRACT) != 0)
{
if (def->interpreted_methods[i] != 0)
- throw_class_format_error ("code provided "
- "for abstract or native method");
+ throw_class_format_error ("code provided for abstract method");
}
else
{
if (def->interpreted_methods[i] == 0)
- throw_class_format_error ("abstract or native method "
- "with no code");
+ throw_class_format_error ("method with no code");
}
}