Commit 3fcb9d1b by Nathan Froyd Committed by Nathan Froyd

tree.h (build_call_list): Remove.

gcc/
	* tree.h (build_call_list): Remove.
	* tree.c (build_call_list): Remove.

gcc/ada/
	* gcc-interface/trans.c (call_to_gnu): Use build_call_vec instead of
	build_call_list.
	* gcc-interface/utils.c (build_function_stub): Likewise.

gcc/cp/
	* tree.c (build_min_non_dep_call_vec): Update comment.

gcc/java/
	* expr.c (expand_java_multianewarray): Use build_call_vec instead of
	build_call_list.
	(pop_arguments): Return a VEC instead of a tree.  Take a method type
	rather than a list of argument types.
	(rewrite_rule): Change signature. of rewrite_arglist member.
	(rewrite_arglist_getcaller): Update signature.
	(rewrite_arglist_getclass): Likewise.
	(maybe_rewrite_invocation): Update for rewrite_arglist change.
	(build_known_method_ref): Take a VEC instead of a tree.
	(invoke_build_dtable): Likewise.
	(expand_invoke): Update calls to pop_arguments.  Use build_call_vec
	instead of build_call_list.
	(build_jni_stub): Use build_call_vec instead of build_call_list.
	* java-tree.h (maybe_rewrite_invocation): Update declaration.
	(build_known_method_ref): Likewise.
	(invoke_build_dtable): Likewise.

From-SVN: r159548
parent 58efc3ac
2010-05-18 Nathan Froyd <froydnj@codesourcery.com>
* tree.h (build_call_list): Remove.
* tree.c (build_call_list): Remove.
2010-05-18 Jan Hubicka <jh@suse.cz> 2010-05-18 Jan Hubicka <jh@suse.cz>
* ipa-reference.c (propagate): Walk all nodes in the cleanup stage. * ipa-reference.c (propagate): Walk all nodes in the cleanup stage.
......
2010-05-18 Nathan Froyd <froydnj@codesourcery.com>
* gcc-interface/trans.c (call_to_gnu): Use build_call_vec instead of
build_call_list.
* gcc-interface/utils.c (build_function_stub): Likewise.
2010-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org> 2010-05-16 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc-interface/misc.c (gnat_handle_option): Remove special logic * gcc-interface/misc.c (gnat_handle_option): Remove special logic
......
...@@ -2623,7 +2623,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) ...@@ -2623,7 +2623,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
tree gnu_subprog_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_subprog); tree gnu_subprog_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_subprog);
Entity_Id gnat_formal; Entity_Id gnat_formal;
Node_Id gnat_actual; Node_Id gnat_actual;
tree gnu_actual_list = NULL_TREE; VEC(tree,gc) *gnu_actual_vec = NULL;
tree gnu_name_list = NULL_TREE; tree gnu_name_list = NULL_TREE;
tree gnu_before_list = NULL_TREE; tree gnu_before_list = NULL_TREE;
tree gnu_after_list = NULL_TREE; tree gnu_after_list = NULL_TREE;
...@@ -2973,11 +2973,11 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) ...@@ -2973,11 +2973,11 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual); gnu_actual = convert (DECL_ARG_TYPE (gnu_formal), gnu_actual);
} }
gnu_actual_list = tree_cons (NULL_TREE, gnu_actual, gnu_actual_list); VEC_safe_push (tree, gc, gnu_actual_vec, gnu_actual);
} }
gnu_call = build_call_list (TREE_TYPE (gnu_subprog_type), gnu_subprog_addr, gnu_call = build_call_vec (TREE_TYPE (gnu_subprog_type), gnu_subprog_addr,
nreverse (gnu_actual_list)); gnu_actual_vec);
set_expr_location_from_node (gnu_call, gnat_node); set_expr_location_from_node (gnu_call, gnat_node);
/* If it's a function call, the result is the call expression unless a target /* If it's a function call, the result is the call expression unless a target
......
...@@ -3245,12 +3245,12 @@ void ...@@ -3245,12 +3245,12 @@ void
build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
{ {
tree gnu_subprog_type, gnu_subprog_addr, gnu_subprog_call; tree gnu_subprog_type, gnu_subprog_addr, gnu_subprog_call;
tree gnu_stub_param, gnu_param_list, gnu_arg_types, gnu_param; tree gnu_stub_param, gnu_arg_types, gnu_param;
tree gnu_stub_decl = DECL_FUNCTION_STUB (gnu_subprog); tree gnu_stub_decl = DECL_FUNCTION_STUB (gnu_subprog);
tree gnu_body; tree gnu_body;
VEC(tree,gc) *gnu_param_vec = NULL;
gnu_subprog_type = TREE_TYPE (gnu_subprog); gnu_subprog_type = TREE_TYPE (gnu_subprog);
gnu_param_list = NULL_TREE;
begin_subprog_body (gnu_stub_decl); begin_subprog_body (gnu_stub_decl);
gnat_pushlevel (); gnat_pushlevel ();
...@@ -3274,7 +3274,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) ...@@ -3274,7 +3274,7 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
else else
gnu_param = gnu_stub_param; gnu_param = gnu_stub_param;
gnu_param_list = tree_cons (NULL_TREE, gnu_param, gnu_param_list); VEC_safe_push (tree, gc, gnu_param_vec, gnu_param);
} }
gnu_body = end_stmt_group (); gnu_body = end_stmt_group ();
...@@ -3282,9 +3282,8 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog) ...@@ -3282,9 +3282,8 @@ build_function_stub (tree gnu_subprog, Entity_Id gnat_subprog)
/* Invoke the internal subprogram. */ /* Invoke the internal subprogram. */
gnu_subprog_addr = build1 (ADDR_EXPR, build_pointer_type (gnu_subprog_type), gnu_subprog_addr = build1 (ADDR_EXPR, build_pointer_type (gnu_subprog_type),
gnu_subprog); gnu_subprog);
gnu_subprog_call = build_call_list (TREE_TYPE (gnu_subprog_type), gnu_subprog_call = build_call_vec (TREE_TYPE (gnu_subprog_type),
gnu_subprog_addr, gnu_subprog_addr, gnu_param_vec);
nreverse (gnu_param_list));
/* Propagate the return value, if any. */ /* Propagate the return value, if any. */
if (VOID_TYPE_P (TREE_TYPE (gnu_subprog_type))) if (VOID_TYPE_P (TREE_TYPE (gnu_subprog_type)))
......
2010-05-18 Nathan Froyd <froydnj@codesourcery.com>
* tree.c (build_min_non_dep_call_vec): Update comment.
2010-05-17 Jason Merrill <jason@redhat.com> 2010-05-17 Jason Merrill <jason@redhat.com>
* call.c (struct z_candidate): Add explicit_targs field. * call.c (struct z_candidate): Add explicit_targs field.
......
...@@ -1905,9 +1905,9 @@ build_min_non_dep (enum tree_code code, tree non_dep, ...) ...@@ -1905,9 +1905,9 @@ build_min_non_dep (enum tree_code code, tree non_dep, ...)
return t; return t;
} }
/* Similar to `build_call_list', but for template definitions of non-dependent /* Similar to `build_nt_call_vec', but for template definitions of
expressions. NON_DEP is the non-dependent expression that has been non-dependent expressions. NON_DEP is the non-dependent expression
built. */ that has been built. */
tree tree
build_min_non_dep_call_vec (tree non_dep, tree fn, VEC(tree,gc) *argvec) build_min_non_dep_call_vec (tree non_dep, tree fn, VEC(tree,gc) *argvec)
......
2010-05-18 Nathan Froyd <froydnj@codesourcery.com>
* expr.c (expand_java_multianewarray): Use build_call_vec instead of
build_call_list.
(pop_arguments): Return a VEC instead of a tree. Take a method type
rather than a list of argument types.
(rewrite_rule): Change signature. of rewrite_arglist member.
(rewrite_arglist_getcaller): Update signature.
(rewrite_arglist_getclass): Likewise.
(maybe_rewrite_invocation): Update for rewrite_arglist change.
(build_known_method_ref): Take a VEC instead of a tree.
(invoke_build_dtable): Likewise.
(expand_invoke): Update calls to pop_arguments. Use build_call_vec
instead of build_call_list.
(build_jni_stub): Use build_call_vec instead of build_call_list.
* java-tree.h (maybe_rewrite_invocation): Update declaration.
(build_known_method_ref): Likewise.
(invoke_build_dtable): Likewise.
2010-05-14 Nathan Froyd <froydnj@codesourcery.com> 2010-05-14 Nathan Froyd <froydnj@codesourcery.com>
PR 44103 PR 44103
......
...@@ -75,7 +75,7 @@ static void expand_cond (enum tree_code, tree, int); ...@@ -75,7 +75,7 @@ static void expand_cond (enum tree_code, tree, int);
static void expand_java_goto (int); static void expand_java_goto (int);
static tree expand_java_switch (tree, int); static tree expand_java_switch (tree, int);
static void expand_java_add_case (tree, int, int); static void expand_java_add_case (tree, int, int);
static tree pop_arguments (tree); static VEC(tree,gc) *pop_arguments (tree);
static void expand_invoke (int, int, int); static void expand_invoke (int, int, int);
static void expand_java_field_op (int, int, int); static void expand_java_field_op (int, int, int);
static void java_push_constant_from_pool (struct JCF *, int); static void java_push_constant_from_pool (struct JCF *, int);
...@@ -1128,18 +1128,19 @@ static void ...@@ -1128,18 +1128,19 @@ static void
expand_java_multianewarray (tree class_type, int ndim) expand_java_multianewarray (tree class_type, int ndim)
{ {
int i; int i;
tree args = build_tree_list( NULL_TREE, null_pointer_node ); VEC(tree,gc) *args = NULL;
for( i = 0; i < ndim; i++ ) VEC_safe_grow (tree, gc, args, 3 + ndim);
args = tree_cons (NULL_TREE, pop_value (int_type_node), args);
args = tree_cons (NULL_TREE, VEC_replace (tree, args, 0, build_class_ref (class_type));
build_class_ref (class_type), VEC_replace (tree, args, 1, build_int_cst (NULL_TREE, ndim));
tree_cons (NULL_TREE,
build_int_cst (NULL_TREE, ndim), for(i = ndim - 1; i >= 0; i-- )
args)); VEC_replace (tree, args, (unsigned)(2 + i), pop_value (int_type_node));
push_value (build_call_list (promote_type (class_type), VEC_replace (tree, args, 2 + ndim, null_pointer_node);
push_value (build_call_vec (promote_type (class_type),
build_address_of (soft_multianewarray_node), build_address_of (soft_multianewarray_node),
args)); args));
} }
...@@ -1931,16 +1932,28 @@ expand_java_add_case (tree switch_expr, int match, int target_pc) ...@@ -1931,16 +1932,28 @@ expand_java_add_case (tree switch_expr, int match, int target_pc)
append_to_statement_list (x, &SWITCH_BODY (switch_expr)); append_to_statement_list (x, &SWITCH_BODY (switch_expr));
} }
static tree static VEC(tree,gc) *
pop_arguments (tree arg_types) pop_arguments (tree method_type)
{ {
if (arg_types == end_params_node) function_args_iterator fnai;
return NULL_TREE; tree type;
if (TREE_CODE (arg_types) == TREE_LIST) VEC(tree,gc) *args = NULL;
int arity;
FOREACH_FUNCTION_ARGS (method_type, type, fnai)
{
/* XXX: leaky abstraction. */
if (type == void_type_node)
break;
VEC_safe_push (tree, gc, args, type);
}
arity = VEC_length (tree, typestack);
while (arity--)
{ {
tree tail = pop_arguments (TREE_CHAIN (arg_types)); tree arg = pop_value (VEC_index (tree, args, arity));
tree type = TREE_VALUE (arg_types);
tree arg = pop_value (type);
/* We simply cast each argument to its proper type. This is /* We simply cast each argument to its proper type. This is
needed since we lose type information coming out of the needed since we lose type information coming out of the
...@@ -1952,9 +1965,11 @@ pop_arguments (tree arg_types) ...@@ -1952,9 +1965,11 @@ pop_arguments (tree arg_types)
&& TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node) && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
&& INTEGRAL_TYPE_P (type)) && INTEGRAL_TYPE_P (type))
arg = convert (integer_type_node, arg); arg = convert (integer_type_node, arg);
return tree_cons (NULL_TREE, arg, tail);
VEC_replace (tree, args, arity, arg);
} }
gcc_unreachable ();
return args;
} }
/* Attach to PTR (a block) the declaration found in ENTRY. */ /* Attach to PTR (a block) the declaration found in ENTRY. */
...@@ -2079,14 +2094,14 @@ typedef struct ...@@ -2079,14 +2094,14 @@ typedef struct
const char *new_classname; const char *new_classname;
const char *new_signature; const char *new_signature;
int flags; int flags;
tree (*rewrite_arglist) (tree arglist); void (*rewrite_arglist) (VEC(tree,gc) **);
} rewrite_rule; } rewrite_rule;
/* Add __builtin_return_address(0) to the end of an arglist. */ /* Add __builtin_return_address(0) to the end of an arglist. */
static tree static void
rewrite_arglist_getcaller (tree arglist) rewrite_arglist_getcaller (VEC(tree,gc) **arglist)
{ {
tree retaddr tree retaddr
= build_call_expr (built_in_decls[BUILT_IN_RETURN_ADDRESS], = build_call_expr (built_in_decls[BUILT_IN_RETURN_ADDRESS],
...@@ -2094,19 +2109,15 @@ rewrite_arglist_getcaller (tree arglist) ...@@ -2094,19 +2109,15 @@ rewrite_arglist_getcaller (tree arglist)
DECL_UNINLINABLE (current_function_decl) = 1; DECL_UNINLINABLE (current_function_decl) = 1;
return chainon (arglist, VEC_safe_push (tree, gc, *arglist, retaddr);
tree_cons (NULL_TREE, retaddr,
NULL_TREE));
} }
/* Add this.class to the end of an arglist. */ /* Add this.class to the end of an arglist. */
static tree static void
rewrite_arglist_getclass (tree arglist) rewrite_arglist_getclass (VEC(tree,gc) **arglist)
{ {
return chainon (arglist, VEC_safe_push (tree, gc, *arglist, build_class_ref (output_class));
tree_cons (NULL_TREE, build_class_ref (output_class),
NULL_TREE));
} }
static rewrite_rule rules[] = static rewrite_rule rules[] =
...@@ -2157,7 +2168,7 @@ special_method_p (tree candidate_method) ...@@ -2157,7 +2168,7 @@ special_method_p (tree candidate_method)
method, update SPECIAL.*/ method, update SPECIAL.*/
void void
maybe_rewrite_invocation (tree *method_p, tree *arg_list_p, maybe_rewrite_invocation (tree *method_p, VEC(tree,gc) **arg_list_p,
tree *method_signature_p, tree *special) tree *method_signature_p, tree *special)
{ {
tree context = DECL_NAME (TYPE_NAME (DECL_CONTEXT (*method_p))); tree context = DECL_NAME (TYPE_NAME (DECL_CONTEXT (*method_p)));
...@@ -2190,7 +2201,7 @@ maybe_rewrite_invocation (tree *method_p, tree *arg_list_p, ...@@ -2190,7 +2201,7 @@ maybe_rewrite_invocation (tree *method_p, tree *arg_list_p,
*method_p = maybe_method; *method_p = maybe_method;
gcc_assert (*method_p); gcc_assert (*method_p);
if (p->rewrite_arglist) if (p->rewrite_arglist)
*arg_list_p = p->rewrite_arglist (*arg_list_p); p->rewrite_arglist (arg_list_p);
*method_signature_p = get_identifier (p->new_signature); *method_signature_p = get_identifier (p->new_signature);
*special = integer_one_node; *special = integer_one_node;
...@@ -2205,7 +2216,7 @@ maybe_rewrite_invocation (tree *method_p, tree *arg_list_p, ...@@ -2205,7 +2216,7 @@ maybe_rewrite_invocation (tree *method_p, tree *arg_list_p,
tree tree
build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
tree self_type, tree method_signature ATTRIBUTE_UNUSED, tree self_type, tree method_signature ATTRIBUTE_UNUSED,
tree arg_list ATTRIBUTE_UNUSED, tree special) VEC(tree,gc) *arg_list ATTRIBUTE_UNUSED, tree special)
{ {
tree func; tree func;
if (is_compiled_class (self_type)) if (is_compiled_class (self_type))
...@@ -2282,18 +2293,19 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED, ...@@ -2282,18 +2293,19 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
} }
tree tree
invoke_build_dtable (int is_invoke_interface, tree arg_list) invoke_build_dtable (int is_invoke_interface, VEC(tree,gc) *arg_list)
{ {
tree dtable, objectref; tree dtable, objectref;
tree saved = save_expr (VEC_index (tree, arg_list, 0));
TREE_VALUE (arg_list) = save_expr (TREE_VALUE (arg_list)); VEC_replace (tree, arg_list, 0, saved);
/* If we're dealing with interfaces and if the objectref /* If we're dealing with interfaces and if the objectref
argument is an array then get the dispatch table of the class argument is an array then get the dispatch table of the class
Object rather than the one from the objectref. */ Object rather than the one from the objectref. */
objectref = (is_invoke_interface objectref = (is_invoke_interface
&& is_array_type_p (TREE_TYPE (TREE_VALUE (arg_list))) && is_array_type_p (TREE_TYPE (saved))
? build_class_ref (object_type_node) : TREE_VALUE (arg_list)); ? build_class_ref (object_type_node) : saved);
if (dtable_ident == NULL_TREE) if (dtable_ident == NULL_TREE)
dtable_ident = get_identifier ("vtable"); dtable_ident = get_identifier ("vtable");
...@@ -2461,7 +2473,8 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2461,7 +2473,8 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
method_ref_index)); method_ref_index));
const char *const self_name const char *const self_name
= IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type))); = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (self_type)));
tree call, func, method, arg_list, method_type; tree call, func, method, method_type;
VEC(tree,gc) *arg_list;
tree check = NULL_TREE; tree check = NULL_TREE;
tree special = NULL_TREE; tree special = NULL_TREE;
...@@ -2568,7 +2581,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2568,7 +2581,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
just pop the arguments, push a properly-typed zero, and just pop the arguments, push a properly-typed zero, and
continue. */ continue. */
method_type = get_type_from_signature (method_signature); method_type = get_type_from_signature (method_signature);
pop_arguments (TYPE_ARG_TYPES (method_type)); pop_arguments (method_type);
if (opcode != OPCODE_invokestatic) if (opcode != OPCODE_invokestatic)
pop_type (self_type); pop_type (self_type);
method_type = promote_type (TREE_TYPE (method_type)); method_type = promote_type (TREE_TYPE (method_type));
...@@ -2577,7 +2590,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2577,7 +2590,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
} }
method_type = TREE_TYPE (method); method_type = TREE_TYPE (method);
arg_list = pop_arguments (TYPE_ARG_TYPES (method_type)); arg_list = pop_arguments (method_type);
flush_quick_stack (); flush_quick_stack ();
maybe_rewrite_invocation (&method, &arg_list, &method_signature, maybe_rewrite_invocation (&method, &arg_list, &method_signature,
...@@ -2602,8 +2615,8 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2602,8 +2615,8 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
We do omit the check if we're calling <init>. */ We do omit the check if we're calling <init>. */
/* We use a SAVE_EXPR here to make sure we only evaluate /* We use a SAVE_EXPR here to make sure we only evaluate
the new `self' expression once. */ the new `self' expression once. */
tree save_arg = save_expr (TREE_VALUE (arg_list)); tree save_arg = save_expr (VEC_index (tree, arg_list, 0));
TREE_VALUE (arg_list) = save_arg; VEC_replace (tree, arg_list, 0, save_arg);
check = java_check_reference (save_arg, ! DECL_INIT_P (method)); check = java_check_reference (save_arg, ! DECL_INIT_P (method));
func = build_known_method_ref (method, method_type, self_type, func = build_known_method_ref (method, method_type, self_type,
method_signature, arg_list, special); method_signature, arg_list, special);
...@@ -2623,7 +2636,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2623,7 +2636,7 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
else else
func = build1 (NOP_EXPR, build_pointer_type (method_type), func); func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
call = build_call_list (TREE_TYPE (method_type), func, arg_list); call = build_call_vec (TREE_TYPE (method_type), func, arg_list);
TREE_SIDE_EFFECTS (call) = 1; TREE_SIDE_EFFECTS (call) = 1;
call = check_for_builtin (method, call); call = check_for_builtin (method, call);
...@@ -2648,14 +2661,14 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED) ...@@ -2648,14 +2661,14 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
tree tree
build_jni_stub (tree method) build_jni_stub (tree method)
{ {
tree jnifunc, call, args, body, method_sig, arg_types; tree jnifunc, call, body, method_sig, arg_types;
tree jniarg0, jniarg1, jniarg2, jniarg3; tree jniarg0, jniarg1, jniarg2, jniarg3;
tree jni_func_type, tem; tree jni_func_type, tem;
tree env_var, res_var = NULL_TREE, block; tree env_var, res_var = NULL_TREE, block;
tree method_args; tree method_args;
tree meth_var; tree meth_var;
tree bind; tree bind;
VEC(tree,gc) *args = NULL;
int args_size = 0; int args_size = 0;
tree klass = DECL_CONTEXT (method); tree klass = DECL_CONTEXT (method);
...@@ -2689,10 +2702,22 @@ build_jni_stub (tree method) ...@@ -2689,10 +2702,22 @@ build_jni_stub (tree method)
build_address_of (soft_getjnienvnewframe_node), build_address_of (soft_getjnienvnewframe_node),
1, klass)); 1, klass));
/* The JNIEnv structure is the first argument to the JNI function. */
args_size += int_size_in_bytes (TREE_TYPE (env_var));
VEC_safe_push (tree, gc, args, env_var);
/* For a static method the second argument is the class. For a
non-static method the second argument is `this'; that is already
available in the argument list. */
if (METHOD_STATIC (method))
{
args_size += int_size_in_bytes (TREE_TYPE (klass));
VEC_safe_push (tree, gc, args, klass);
}
/* All the arguments to this method become arguments to the /* All the arguments to this method become arguments to the
underlying JNI function. If we had to wrap object arguments in a underlying JNI function. If we had to wrap object arguments in a
special way, we would do that here. */ special way, we would do that here. */
args = NULL_TREE;
for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem)) for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
{ {
int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem))); int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)));
...@@ -2702,24 +2727,14 @@ build_jni_stub (tree method) ...@@ -2702,24 +2727,14 @@ build_jni_stub (tree method)
#endif #endif
args_size += (arg_bits / BITS_PER_UNIT); args_size += (arg_bits / BITS_PER_UNIT);
args = tree_cons (NULL_TREE, tem, args); VEC_safe_push (tree, gc, args, tem);
} }
args = nreverse (args);
arg_types = TYPE_ARG_TYPES (TREE_TYPE (method)); arg_types = TYPE_ARG_TYPES (TREE_TYPE (method));
/* For a static method the second argument is the class. For a /* Argument types for static methods and the JNIEnv structure.
non-static method the second argument is `this'; that is already FIXME: Write and use build_function_type_vec to avoid this. */
available in the argument list. */
if (METHOD_STATIC (method)) if (METHOD_STATIC (method))
{
args_size += int_size_in_bytes (TREE_TYPE (klass));
args = tree_cons (NULL_TREE, klass, args);
arg_types = tree_cons (NULL_TREE, object_ptr_type_node, arg_types); arg_types = tree_cons (NULL_TREE, object_ptr_type_node, arg_types);
}
/* The JNIEnv structure is the first argument to the JNI function. */
args_size += int_size_in_bytes (TREE_TYPE (env_var));
args = tree_cons (NULL_TREE, env_var, args);
arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types);
/* We call _Jv_LookupJNIMethod to find the actual underlying /* We call _Jv_LookupJNIMethod to find the actual underlying
...@@ -2774,8 +2789,7 @@ build_jni_stub (tree method) ...@@ -2774,8 +2789,7 @@ build_jni_stub (tree method)
/* Now we make the actual JNI call via the resulting function /* Now we make the actual JNI call via the resulting function
pointer. */ pointer. */
call = build_call_list (TREE_TYPE (TREE_TYPE (method)), call = build_call_vec (TREE_TYPE (TREE_TYPE (method)), jnifunc, args);
jnifunc, args);
/* If the JNI call returned a result, capture it here. If we had to /* If the JNI call returned a result, capture it here. If we had to
unwrap JNI object results, we would do that here. */ unwrap JNI object results, we would do that here. */
......
...@@ -1067,14 +1067,14 @@ extern void initialize_builtins (void); ...@@ -1067,14 +1067,14 @@ extern void initialize_builtins (void);
extern tree lookup_name (tree); extern tree lookup_name (tree);
extern bool special_method_p (tree); extern bool special_method_p (tree);
extern void maybe_rewrite_invocation (tree *, tree *, tree *, tree *); extern void maybe_rewrite_invocation (tree *, VEC(tree,gc) **, tree *, tree *);
extern tree build_known_method_ref (tree, tree, tree, tree, tree, tree); extern tree build_known_method_ref (tree, tree, tree, tree, VEC(tree,gc) *, tree);
extern tree build_class_init (tree, tree); extern tree build_class_init (tree, tree);
extern int attach_init_test_initialization_flags (void **, void *); extern int attach_init_test_initialization_flags (void **, void *);
extern tree build_invokevirtual (tree, tree, tree); extern tree build_invokevirtual (tree, tree, tree);
extern tree build_invokeinterface (tree, tree); extern tree build_invokeinterface (tree, tree);
extern tree build_jni_stub (tree); extern tree build_jni_stub (tree);
extern tree invoke_build_dtable (int, tree); extern tree invoke_build_dtable (int, VEC(tree,gc) *);
extern tree build_field_ref (tree, tree, tree); extern tree build_field_ref (tree, tree, tree);
extern tree java_modify_addr_for_volatile (tree); extern tree java_modify_addr_for_volatile (tree);
extern void pushdecl_force_head (tree); extern void pushdecl_force_head (tree);
......
...@@ -9486,27 +9486,6 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL) ...@@ -9486,27 +9486,6 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL)
return t; return t;
} }
/* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE
and FN and a null static chain slot. ARGLIST is a TREE_LIST of the
arguments. */
tree
build_call_list (tree return_type, tree fn, tree arglist)
{
tree t;
int i;
t = build_vl_exp (CALL_EXPR, list_length (arglist) + 3);
TREE_TYPE (t) = return_type;
CALL_EXPR_FN (t) = fn;
CALL_EXPR_STATIC_CHAIN (t) = NULL_TREE;
for (i = 0; arglist; arglist = TREE_CHAIN (arglist), i++)
CALL_EXPR_ARG (t, i) = TREE_VALUE (arglist);
process_call_operands (t);
return t;
}
/* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE and /* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE and
FN and a null static chain slot. NARGS is the number of call arguments FN and a null static chain slot. NARGS is the number of call arguments
which are specified as "..." arguments. */ which are specified as "..." arguments. */
......
...@@ -4038,7 +4038,6 @@ extern tree build_omp_clause (location_t, enum omp_clause_code); ...@@ -4038,7 +4038,6 @@ extern tree build_omp_clause (location_t, enum omp_clause_code);
extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL); extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL);
#define build_vl_exp(c,n) build_vl_exp_stat (c,n MEM_STAT_INFO) #define build_vl_exp(c,n) build_vl_exp_stat (c,n MEM_STAT_INFO)
extern tree build_call_list (tree, tree, tree);
extern tree build_call_nary (tree, tree, int, ...); extern tree build_call_nary (tree, tree, int, ...);
extern tree build_call_valist (tree, tree, int, va_list); extern tree build_call_valist (tree, tree, int, va_list);
#define build_call_array(T1,T2,N,T3)\ #define build_call_array(T1,T2,N,T3)\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment