summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-14 17:45:20 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-14 17:45:20 +0000
commit5afb5bfcd0d68cbfdc9a07d65c424fc208ff316d (patch)
treeb9dbd14f53ce12873b97ef6caeb33b3335f0e3c5 /libjava/java/lang
parentd746b29ba0a20e2debada1b48a14e7c19fb7377c (diff)
downloadppe42-gcc-5afb5bfcd0d68cbfdc9a07d65c424fc208ff316d.tar.gz
ppe42-gcc-5afb5bfcd0d68cbfdc9a07d65c424fc208ff316d.zip
2004-04-14 Andrew Haley <aph@redhat.com>
Bryce McKinlay <mckinlay@redhat.com> * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Use _Jv_LookupInterfaceMethodIdx for calls to interfaces. * include/jvm.h (_Jv_CallAnyMethodA): Add new face' arg. * testsuite/libjava.lang/InvokeInterface.java: New file. * testsuite/libjava.lang/InvokeInterface.out: New file. 2004-04-14 Bryce McKinlay <mckinlay@redhat.com> * class.c (get_interface_method_index): New function. Return dispatch index for interface method. (make_method_value): For interface methods, set index field to iface dispatch index, not DECL_VINDEX. * expr.c (build_invokeinterface): Use get_interface_method_index. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80684 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r--libjava/java/lang/reflect/natMethod.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc
index 736103b63dd..96d293bf241 100644
--- a/libjava/java/lang/reflect/natMethod.cc
+++ b/libjava/java/lang/reflect/natMethod.cc
@@ -143,14 +143,14 @@ jobject
java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
{
using namespace java::lang::reflect;
+ jclass iface = NULL;
if (parameter_types == NULL)
getType ();
jmethodID meth = _Jv_FromReflectedMethod (this);
-
jclass objClass;
-
+
if (Modifier::isStatic(meth->accflags))
{
// We have to initialize a static class. It is safe to do this
@@ -188,8 +188,11 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
throw new IllegalAccessException;
}
+ if (declaringClass->isInterface())
+ iface = declaringClass;
+
return _Jv_CallAnyMethodA (obj, return_type, meth, false,
- parameter_types, args);
+ parameter_types, args, iface);
}
jint
@@ -341,7 +344,8 @@ _Jv_CallAnyMethodA (jobject obj,
JArray<jclass> *parameter_types,
jvalue *args,
jvalue *result,
- jboolean is_jni_call)
+ jboolean is_jni_call,
+ jclass iface)
{
using namespace java::lang::reflect;
@@ -478,7 +482,10 @@ _Jv_CallAnyMethodA (jobject obj,
&& (_Jv_ushort)-1 != meth->index)
{
_Jv_VTable *vtable = *(_Jv_VTable **) obj;
- ncode = vtable->get_method (meth->index);
+ if (iface == NULL)
+ ncode = vtable->get_method (meth->index);
+ else
+ ncode = _Jv_LookupInterfaceMethodIdx (vtable->clas, iface, meth->index);
}
else
{
@@ -553,7 +560,8 @@ _Jv_CallAnyMethodA (jobject obj,
jmethodID meth,
jboolean is_constructor,
JArray<jclass> *parameter_types,
- jobjectArray args)
+ jobjectArray args,
+ jclass iface)
{
if (parameter_types->length == 0 && args == NULL)
{
@@ -621,7 +629,7 @@ _Jv_CallAnyMethodA (jobject obj,
_Jv_CallAnyMethodA (obj, return_type, meth, is_constructor,
_Jv_isVirtualMethod (meth),
parameter_types, argvals, &ret_value,
- false);
+ false, iface);
jobject r;
#define VAL(Wrapper, Field) (new Wrapper (ret_value.Field))
OpenPOWER on IntegriCloud