This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gcjx] Patch: FYI: handle interface dispatch


I'm checking this in on the gcjx branch.

Now we generate code for interface dispatch.  This is still bogus,
since we don't use the interface dispatch tables.  That will come
later.

Tom

Index: abi.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/abi.cc,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 abi.cc
--- abi.cc 9 Mar 2005 02:19:09 -0000 1.1.2.14
+++ abi.cc 24 Mar 2005 02:14:59 -0000
@@ -52,7 +52,24 @@
     }
   else if (meth->get_declaring_class ()->interface_p ())
     {
-      // FIXME: interface call.
+      // FIXME: use _Jv_LookupInterfaceMethodIdx.
+
+      tree klass_tree
+	= builtins->map_class_object (meth->get_declaring_class ());
+      tree name_tree = builtins->map_utf8const (meth->get_name ());
+      // FIXME: use our own get_descriptor().
+      tree desc_tree = builtins->map_utf8const (meth->get_descriptor ());
+
+      tree lookup_args
+	= tree_cons (NULL_TREE, klass_tree,
+		     tree_cons (NULL_TREE, name_tree,
+				build_tree_list (NULL_TREE, desc_tree)));
+
+      func = build3 (CALL_EXPR, ptr_type_node,
+		     builtin_Jv_LookupInterfaceMethod,
+		     lookup_args, NULL_TREE);
+      func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (meth_tree)),
+		     func);
     }
   else if (is_super || meth->final_p () || meth->constructor_p ())
     {
Index: decl.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/decl.cc,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 decl.cc
--- decl.cc 9 Mar 2005 01:55:02 -0000 1.1.2.14
+++ decl.cc 24 Mar 2005 02:14:59 -0000
@@ -108,6 +108,7 @@
 tree builtin_Jv_ThrowBadArrayIndex;
 tree builtin_Jv_ThrowNullPointerException;
 tree builtin_Jv_CheckArrayStore;
+tree builtin_Jv_LookupInterfaceMethod;
 tree builtin_Jv_LookupInterfaceMethodIdx;
 tree builtin_Jv_LookupJNIMethod;
 tree builtin_Jv_GetJNIEnvNewFrame;
@@ -662,6 +663,18 @@
   builtin_Jv_CheckArrayStore
     = build_address_of (builtin_Jv_CheckArrayStore);
 
+  t = tree_cons (NULL_TREE, type_class_ptr,
+		 tree_cons (NULL_TREE, type_utf8const_ptr,
+			    tree_cons (NULL_TREE, type_utf8const_ptr,
+				       void_list_node)));
+  builtin_Jv_LookupInterfaceMethod
+    = gcjx::builtin_function ("_Jv_LookupInterfaceMethod",
+			      build_function_type (ptr_type_node, t),
+			      0, NOT_BUILT_IN, NULL, NULL_TREE);
+  DECL_IS_PURE (builtin_Jv_LookupInterfaceMethod) = 1;
+  builtin_Jv_LookupInterfaceMethod
+    = build_address_of (builtin_Jv_LookupInterfaceMethod);
+
   t = tree_cons (NULL_TREE, ptr_type_node,
 		 tree_cons (NULL_TREE, ptr_type_node,
 			    tree_cons (NULL_TREE, type_jint, void_list_node)));
Index: hooks.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/hooks.hh,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 hooks.hh
--- hooks.hh 8 Mar 2005 00:45:41 -0000 1.1.2.6
+++ hooks.hh 24 Mar 2005 02:14:59 -0000
@@ -74,6 +74,7 @@
 extern GTY (()) tree builtin_Jv_ThrowBadArrayIndex;
 extern GTY (()) tree builtin_Jv_ThrowNullPointerException;
 extern GTY (()) tree builtin_Jv_CheckArrayStore;
+extern GTY (()) tree builtin_Jv_LookupInterfaceMethod;
 extern GTY (()) tree builtin_Jv_LookupInterfaceMethodIdx;
 extern GTY (()) tree builtin_Jv_LookupJNIMethod;
 extern GTY (()) tree builtin_Jv_GetJNIEnvNewFrame;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]