This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Java: Remove NOP_EXPR from method invocations
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Subject: Java: Remove NOP_EXPR from method invocations
- From: Jeff Sturm <jsturm at one-point dot com>
- Date: Sat, 17 Mar 2001 15:31:43 -0500 (EST)
Method inlining in the gcj frontend has never really worked. Part
of the problem is that patch_invoke() wraps the operand of a CALL_EXPR
inside a NOP_EXPR. This has the effect of hiding the function from the
integrator. It is also different from how the other frontends build
CALL_EXPRs.
I don't understand the reason for the NOP_EXPR in patch_invoke, other than
to fix the expr type. This patch eliminates it, allowing the integrator
to work and save a small bit of memory as well. The comment about
self_type seems to be historic-- class initialization is done elsewhere.
I tested this with the mainline on i686-pc-linux-gnu.
2001-03-16 Jeff Sturm <jsturm@one-point.com>
* java/parse.y (patch_invoke): Don't build a NOP_EXPR. Fix
the TREE_TYPE instead.
(check_final_variable_indirect_assignment): Expect to find decl
in a ADDR_EXPR node (instead of NOP_EXPR followed by ADDR_EXPR).
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.261
diff -u -p -r1.261 parse.y
--- parse.y 2001/03/16 06:30:27 1.261
+++ parse.y 2001/03/17 17:48:07
@@ -10265,8 +10265,9 @@ patch_invoke (patch, method, args)
abort ();
}
- /* Ensure self_type is initialized, (invokestatic). FIXME */
- func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
+ /* Fix type: must be pointer to a METHOD_TYPE.
+ (Why don't build_invokevirtual etc. get this right? FIXME) */
+ TREE_TYPE (func) = build_pointer_type (TREE_TYPE (method));
}
TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
@@ -12239,8 +12240,9 @@ check_final_variable_indirect_assignment
tree decl = TREE_OPERAND (stmt, 0);
tree fbody;
- if (TREE_CODE (decl) != FUNCTION_DECL)
- decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0);
+ /* Expect a FUNCTION_DECL or address of a FUNCTION_DECL. */
+ if (TREE_CODE (decl) == ADDR_EXPR)
+ decl = TREE_OPERAND (decl, 0);
if (TREE_CODE (decl) != FUNCTION_DECL)
abort ();
if (DECL_FUNCTION_ALL_FINAL_INITIALIZED (decl))