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: prepare 'catch' type


I'm checking this in on the gcjx branch.

We were crashing because we put a real type into a CATCH_EXPR, instead
of what we really need, which is the address of some static object.
(tree.def could really use a clarification in this area...)

This approach, as the comment indicates, may be bogus.  I'm not
entirely certain.  It does represent a change from current practice.
Perhaps it won't even work.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* tree.cc (visit_catch): Prepare catch type.

Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.16
diff -u -r1.1.2.16 tree.cc
--- tree.cc 9 Mar 2005 02:19:09 -0000 1.1.2.16
+++ tree.cc 24 Mar 2005 02:18:29 -0000
@@ -444,9 +444,18 @@
 		      BLOCK_VARS (current_block),
 		      body_tree, current_block);
 
-  current = build2 (CATCH_EXPR, void_type_node,
-		    // FIXME: must prepare the catch type properly...
-		    vtype, bind);
+  // We always emit the catch type as a pointer to a constant pool
+  // entry of type Class.  These will be linked at runtime.  FIXME: ok
+  // for C++ ABI?  Better to emit plain pointer-to-pointer-to-class?
+  // FIXME: this is an ABI change from ordinary gcj.
+  model_class *vklass = assert_cast<model_class *> (vardecl->type ());
+  vtype = build_ref_from_constant_pool (type_class_ptr,
+					class_wrapper->add (vklass));
+  // FIXME: big hack: strip the NOP and add indirection.
+  assert (TREE_CODE (vtype) == NOP_EXPR);
+  vtype = build_address_of (TREE_OPERAND (vtype, 0));
+
+  current = build2 (CATCH_EXPR, void_type_node, vtype, bind);
 }
 
 void


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