This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: prepare 'catch' type
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 23 Mar 2005 19:17:10 -0700
- Subject: [gcjx] Patch: FYI: prepare 'catch' type
- Reply-to: tromey at redhat dot com
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