summaryrefslogtreecommitdiff
path: root/gcc/java/builtins.c
diff options
context:
space:
mode:
authorbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-20 19:53:49 +0000
committerbothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-20 19:53:49 +0000
commit85dce5fa4a312bb3b327a3ff007b6ce94efa5252 (patch)
treeba65439faed48f14d796ca4d44209a8468a5538e /gcc/java/builtins.c
parent5b46873973d795000ffba7312c486c1e424fae03 (diff)
downloadgcc-85dce5fa4a312bb3b327a3ff007b6ce94efa5252.tar.gz
* builtins.c (check_for_builtin): New function.
(build_call_or_builtin): Remove. * java-tree.h: Update accordingly. * expr.c (expand_invoke): Use build + check_for_builtin instead of build_call_or_builtin. * parse.y (patch_invoke): Likewise. This avoids needlessly creating a new CALL_EXPR node, which means we don't lose the CALL_USING_SUPER flag (which had caused jcf-write to incorrectly emit invokevirtual). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49909 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/builtins.c')
-rw-r--r--gcc/java/builtins.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 41ded8552bf..1ac37fb52f0 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -324,42 +324,30 @@ initialize_builtins ()
#include "builtins.def"
}
-/* Generate a method call. If the call matches a builtin, return the
+/* If the call matches a builtin, return the
appropriate builtin expression instead. */
tree
-build_call_or_builtin (method, func, method_arguments)
- tree method, func, method_arguments;
+check_for_builtin (method, call)
+ tree method;
+ tree call;
{
- tree method_class = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
- tree method_name = DECL_NAME (method);
- tree method_return_type = TREE_TYPE (TREE_TYPE (method));
- tree call = NULL_TREE;
-
- /* Only look if we're generating object code and optimizing. */
- if (! flag_emit_class_files && optimize)
+ if (! flag_emit_class_files && optimize && TREE_CODE (call) == CALL_EXPR)
{
int i;
+ tree method_arguments = TREE_OPERAND (call, 1);
+ tree method_class = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
+ tree method_name = DECL_NAME (method);
+ tree method_return_type = TREE_TYPE (TREE_TYPE (method));
for (i = 0; java_builtins[i].creator != NULL; ++i)
{
if (method_class == java_builtins[i].class_name.t
&& method_name == java_builtins[i].method_name.t)
{
- call = (*java_builtins[i].creator) (method_return_type,
+ return (*java_builtins[i].creator) (method_return_type,
method_arguments);
- break;
}
}
}
-
- if (call == NULL_TREE)
- {
- /* Either nothing matched, or the creator function decided not
- to inline. In either case, emit a call. */
- call = build (CALL_EXPR, method_return_type, func, method_arguments,
- NULL_TREE);
- TREE_SIDE_EFFECTS (call) = 1;
- }
-
return call;
}