This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: tree type fixes
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 11 Jul 2005 10:27:00 -0600
- Subject: [gcjx] Patch: FYI: tree type fixes
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
This fixes the types of various trees that we build.
(I keep thinking I'll write a small pass to detect these bugs, but
never get around to it...)
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.cc (visit_assignment): Fix types.
(visit_return): Fix types.
* abi.cc (build_new): Changed type of allocation call.
* decl.cc (initialize_builtin_functions): Changed return type of
_Jv_AllocObject and _Jv_AllocObjectNoFinalizer.
Index: abi.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/abi.cc,v
retrieving revision 1.1.2.23
diff -u -r1.1.2.23 abi.cc
--- abi.cc 27 Apr 2005 17:40:36 -0000 1.1.2.23
+++ abi.cc 11 Jul 2005 16:29:24 -0000
@@ -241,27 +241,27 @@
tree allocator = builtin_Jv_AllocObject; // FIXME: finalizer
tree klass_tree = builtins->map_type (klass);
// Allocate the object.
- tree n = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (allocator)), allocator,
- build_tree_list (NULL_TREE,
- build_class_reference (builtins, current,
- klass)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (n) = 1;
+ tree call = build3 (CALL_EXPR, type_object_ptr, allocator,
+ build_tree_list (NULL_TREE,
+ build_class_reference (builtins,
+ current, klass)),
+ NULL_TREE);
+ TREE_SIDE_EFFECTS (call) = 1;
- n = build1 (NOP_EXPR, klass_tree, n);
- TREE_SIDE_EFFECTS (n) = 1;
+ call = build1 (NOP_EXPR, klass_tree, call);
+ TREE_SIDE_EFFECTS (call) = 1;
- tree mem = save_expr (n);
+ tree mem = save_expr (call);
// Call the constructor.
- n = build_method_call (builtins, current, mem, arguments, constructor,
- false);
+ tree real_call = build_method_call (builtins, current, mem, arguments,
+ constructor, false);
// Yield the new object
- n = build2 (COMPOUND_EXPR, klass_tree, n, mem);
- TREE_SIDE_EFFECTS (n) = 1;
+ tree result = build2 (COMPOUND_EXPR, klass_tree, real_call, mem);
+ TREE_SIDE_EFFECTS (result) = 1;
- return n;
+ return result;
}
tree
Index: decl.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/decl.cc,v
retrieving revision 1.1.2.21
diff -u -r1.1.2.21 decl.cc
--- decl.cc 11 Jul 2005 16:25:46 -0000 1.1.2.21
+++ decl.cc 11 Jul 2005 16:29:24 -0000
@@ -601,14 +601,14 @@
tree t = tree_cons (NULL_TREE, type_class_ptr, void_list_node);
builtin_Jv_AllocObject
= gcjx::builtin_function ("_Jv_AllocObject",
- build_function_type (ptr_type_node, t),
+ build_function_type (type_object_ptr, t),
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (builtin_Jv_AllocObject) = 1;
builtin_Jv_AllocObject = build_address_of (builtin_Jv_AllocObject);
builtin_Jv_AllocObjectNoFinalizer
= gcjx::builtin_function ("_Jv_AllocObjectNoFinalizer",
- build_function_type (ptr_type_node, t),
+ build_function_type (type_object_ptr, t),
0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_IS_MALLOC (builtin_Jv_AllocObjectNoFinalizer) = 1;
builtin_Jv_AllocObjectNoFinalizer
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.46
diff -u -r1.1.2.46 tree.cc
--- tree.cc 18 May 2005 00:10:49 -0000 1.1.2.46
+++ tree.cc 11 Jul 2005 16:29:25 -0000
@@ -872,8 +872,10 @@
if (expr)
{
expr->visit (this);
- current = build2 (MODIFY_EXPR, gcc_builtins->map_type (expr->type ()),
- DECL_RESULT (method_tree), current);
+ current = build2 (MODIFY_EXPR, TREE_TYPE (DECL_RESULT (method_tree)),
+ DECL_RESULT (method_tree),
+ convert (TREE_TYPE (DECL_RESULT (method_tree)),
+ current));
TREE_SIDE_EFFECTS (current) = 1;
}
else
@@ -1551,8 +1553,8 @@
rhs->visit (this);
tree rhs_tree = current;
// FIXME: if LHS is array, may need assign. check.
- current = build2 (MODIFY_EXPR, gcc_builtins->map_type (lhs->type ()),
- lhs_tree, rhs_tree);
+ current = build2 (MODIFY_EXPR, TREE_TYPE (lhs_tree),
+ lhs_tree, convert (TREE_TYPE (lhs_tree), rhs_tree));
TREE_SIDE_EFFECTS (current) = 1;
annotate (current, elt);
}