This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[BC] Patch: FYI: remove method deferment
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Andrew Haley <aph at redhat dot com>
- Date: 17 Sep 2004 13:32:53 -0600
- Subject: [BC] Patch: FYI: remove method deferment
- Reply-to: tromey at redhat dot com
I'm checking this in on the BC branch.
With the class preparation cleanup, it is now obvious that the `ncode'
for a method is known to be set when the atable is computed. So, we
should no longer need _Jv_Defer_Resolution.
I tested this by running eclipse, the hairiest example I have handy.
Andrew, I looked at the initial java-patches note to add this, and
didn't see how you ran into the problem. If you have a test case,
send it and I'll give it a try (and fix problems if any).
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* defineclass.cc (handleCodeAttribute): Don't reference
`deferred'.
(handleMethodsEnd): Likewise.
* include/java-interp.h (_Jv_MethodBase::deferred): Removed
field.
(_Jv_Defer_Resolution): Don't declare or define.
* interpret.cc (do_create_ncode): Don't resolve deferred method
pointers.
* java/lang/Class.h (_Jv_Defer_Resolution): Don't declare.
* resolve.cc (link_symbol_table): No need to defer resolution.
Index: defineclass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/defineclass.cc,v
retrieving revision 1.35.16.5
diff -u -r1.35.16.5 defineclass.cc
--- defineclass.cc 14 Sep 2004 23:13:16 -0000 1.35.16.5
+++ defineclass.cc 17 Sep 2004 19:15:03 -0000
@@ -1276,7 +1276,6 @@
_Jv_InterpMethod *method =
(_Jv_InterpMethod*) (_Jv_AllocBytes (size));
- method->deferred = NULL;
method->max_stack = max_stack;
method->max_locals = max_locals;
method->code_length = code_length;
@@ -1335,7 +1334,6 @@
m->self = method;
m->function = NULL;
def_interp->interpreted_methods[i] = m;
- m->deferred = NULL;
if ((method->accflags & Modifier::STATIC))
{
Index: interpret.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/interpret.cc,v
retrieving revision 1.40.18.3
diff -u -r1.40.18.3 interpret.cc
--- interpret.cc 14 Sep 2004 23:21:16 -0000 1.40.18.3
+++ interpret.cc 17 Sep 2004 19:15:03 -0000
@@ -3719,16 +3719,6 @@
{
_Jv_InterpMethod *im = reinterpret_cast<_Jv_InterpMethod *> (imeth);
klass->methods[i].ncode = im->ncode ();
-
- // Resolve ctable entries pointing to this method. See
- // _Jv_Defer_Resolution.
- void **code = (void **)imeth->deferred;
- while (code)
- {
- void **target = (void **)*code;
- *code = klass->methods[i].ncode;
- code = target;
- }
}
}
}
Index: resolve.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/resolve.cc,v
retrieving revision 1.44.2.6
diff -u -r1.44.2.6 resolve.cc
--- resolve.cc 14 Sep 2004 23:13:16 -0000 1.44.2.6
+++ resolve.cc 17 Sep 2004 19:15:03 -0000
@@ -984,25 +984,10 @@
(const char*)sym.name->data,
(const char*)signature->data);
}
-#ifdef INTERPRETER
- else if (_Jv_IsInterpretedClass (target_class))
- {
- _Jv_Defer_Resolution (target_class, meth,
- &klass->atable->addresses[index]);
- if (debug_link)
- fprintf (stderr, " addresses[%d] = DEFERRED@%p (class %s@%p : %s(%s))\n",
- index,
- klass->atable->addresses[index],
- (const char*)target_class->name->data,
- klass,
- (const char*)sym.name->data,
- (const char*)signature->data);
-
- }
-#endif
}
else
- klass->atable->addresses[index] = (void *)_Jv_ThrowNoSuchMethodError;
+ klass->atable->addresses[index]
+ = (void *)_Jv_ThrowNoSuchMethodError;
continue;
}
Index: include/java-interp.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/java-interp.h,v
retrieving revision 1.23.16.2
diff -u -r1.23.16.2 java-interp.h
--- include/java-interp.h 14 Sep 2004 21:12:53 -0000 1.23.16.2
+++ include/java-interp.h 17 Sep 2004 19:15:04 -0000
@@ -87,10 +87,6 @@
// Size of raw arguments.
_Jv_ushort args_raw_size;
- // Chain of addresses to fill in. See _Jv_Defer_Resolution.
- void *deferred;
-
- friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **);
friend class _Jv_InterpreterEngine;
public:
@@ -172,35 +168,8 @@
#endif
friend _Jv_MethodBase ** _Jv_GetFirstMethod (_Jv_InterpClass *klass);
- friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **);
};
-// We have an interpreted class CL and we're trying to find the
-// address of the ncode of a method METH. That interpreted class
-// hasn't yet been prepared, so we defer fixups until they are ready.
-// To do this, we create a chain of fixups that will be resolved by
-// _Jv_PrepareClass.
-extern inline void
-_Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **address)
-{
- int i;
- jclass self = (jclass) cl;
- _Jv_InterpClass *interp_cl = (_Jv_InterpClass*) self->aux_info;
-
- for (i = 0; i < self->method_count; i++)
- {
- _Jv_Method *m = &self->methods[i];
- if (m == meth)
- {
- _Jv_MethodBase *imeth = interp_cl->interpreted_methods[i];
- *address = imeth->deferred;
- imeth->deferred = address;
- return;
- }
- }
- return;
-}
-
extern inline _Jv_MethodBase **
_Jv_GetFirstMethod (_Jv_InterpClass *klass)
{
Index: java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.63.12.11
diff -u -r1.63.12.11 Class.h
--- java/lang/Class.h 14 Sep 2004 21:12:53 -0000 1.63.12.11
+++ java/lang/Class.h 17 Sep 2004 19:15:04 -0000
@@ -394,8 +394,6 @@
friend void _Jv_PrepareMissingMethods (jclass base, jclass iface_class);
- friend void _Jv_Defer_Resolution (void *cl, _Jv_Method *meth, void **);
-
friend class _Jv_ClassReader;
friend class _Jv_InterpClass;
friend class _Jv_InterpMethod;