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: checkcast fixes


I'm checking this in on the gcjx branch.

We were calling _Jv_CheckCast under the wrong conditions, and we
weren't passing enough arguments to it.  Fixed as appended.

At this point I'm finding bugs by running gcj-dbtool and looking for
crashes.  It still crashes during startup, so some fundamental things
are broken, but it does mean gcjx is pretty far along.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* lower.cc (visit_bytecode_block) <op_checkcast>: Correctly handle
	_Jv_CheckCast.
	* tree.cc (visit_cast): Correctly handle _Jv_CheckCast.

Index: lower.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/lower.cc,v
retrieving revision 1.1.2.18
diff -u -r1.1.2.18 lower.cc
--- lower.cc 4 Apr 2005 00:52:42 -0000 1.1.2.18
+++ lower.cc 29 Apr 2005 02:59:08 -0000
@@ -1385,11 +1385,12 @@
 	  {
 	    tree value = pop (type_object_ptr);
 	    jint index = get2u (bytes, pc);
-	    tree klass = find_class (cpool->get_class (index));
+	    tree klass = build_class_ref (cpool->get_class (index));
 
 	    insn = build3 (CALL_EXPR, klass,
 			   builtin_Jv_CheckCast,
-			   build_tree_list (NULL_TREE, value),
+			   tree_cons (NULL_TREE, klass,
+				      build_tree_list (NULL_TREE, value)),
 			   NULL_TREE);
 	    TREE_SIDE_EFFECTS (insn) = 1;
 	  }
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.44
diff -u -r1.1.2.44 tree.cc
--- tree.cc 27 Apr 2005 17:38:08 -0000 1.1.2.44
+++ tree.cc 29 Apr 2005 02:59:09 -0000
@@ -1805,11 +1805,13 @@
     {
       // Reference types.  We only need to emit a cast check if the
       // types are known to be incompatible.
-      if (dest_type->assignable_from_p (expr->type ()))
+      if (! dest_type->assignable_from_p (expr->type ()))
 	{
 	  current = build3 (CALL_EXPR, gcc_builtins->map_type (dest_type),
 			    builtin_Jv_CheckCast,
-			    build_tree_list (NULL_TREE, expr_tree),
+			    tree_cons (NULL_TREE,
+				       build_class_ref (dest_type, elt),
+				       build_tree_list (NULL_TREE, expr_tree)),
 			    NULL_TREE);
 	  TREE_SIDE_EFFECTS (current) = 1;
 	}


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