summaryrefslogtreecommitdiff
path: root/libjava/defineclass.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-24 19:58:21 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-24 19:58:21 +0000
commit82733f8decd8b228c8152ae27fd102701250c456 (patch)
treef37c4a601e54ff85516e178f32e45db587bf62ce /libjava/defineclass.cc
parent1c681b131ccb08de78b30381f9e9bd38c144dbfa (diff)
downloadgcc-82733f8decd8b228c8152ae27fd102701250c456.tar.gz
* defineclass.cc (handleMethodsEnd): Precompute code for static
method. (handleCodeAttribute): Likewise. * resolve.cc (ncode): Use run_class for unsynchronized static methods. * include/java-interp.h (class _Jv_InterpMethod): Declare run_class. * interpret.cc (run_synch_class): Initialize class. (run) [insn_invokestatic]: Don't initialize class. [insn_anewarray]: Likewise. [insn_multianewarray]: Likewise. (run_class): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61727 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/defineclass.cc')
-rw-r--r--libjava/defineclass.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index 81de5ad7da2..001fa0131f0 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -1,6 +1,6 @@
// defineclass.cc - defining a class from .class format.
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
This file is part of libgcj.
@@ -1267,6 +1267,15 @@ void _Jv_ClassReader::handleCodeAttribute
code_length);
def->interpreted_methods[method_index] = method;
+
+ if ((method->self->accflags & java::lang::reflect::Modifier::STATIC))
+ {
+ // Precompute the ncode field for a static method. This lets us
+ // call a static method of an interpreted class from precompiled
+ // code without first resolving the class (that will happen
+ // during class initialization instead).
+ method->self->ncode = method->ncode ();
+ }
}
void _Jv_ClassReader::handleExceptionTableEntry
@@ -1302,6 +1311,16 @@ void _Jv_ClassReader::handleMethodsEnd ()
m->self = method;
m->function = NULL;
def->interpreted_methods[i] = m;
+
+ if ((method->accflags & Modifier::STATIC))
+ {
+ // Precompute the ncode field for a static method.
+ // This lets us call a static method of an
+ // interpreted class from precompiled code without
+ // first resolving the class (that will happen
+ // during class initialization instead).
+ method->ncode = m->ncode ();
+ }
}
}
else if ((method->accflags & Modifier::ABSTRACT) != 0)