[multiple changes]
2003-01-14 Andrew Haley <aph@redhat.com> * decl.c (java_init_decl_processing): _Jv_NewMultiArray is a varargs function -- correct. * parse.y (patch_assignment): Copy the rhs of an assignment into a temporary if the RHS is a reference. 2003-01-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * Make-lang.in (keyword.h): Pass "-L ANSI-C" to gperf. * keyword.h: Regenerated. * All Files: Convert to ISO C style function definitions. From-SVN: r61281
This commit is contained in:
parent
4d77fda24b
commit
50cbc6057f
3 changed files with 48 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
2003-01-14 Andrew Haley <aph@redhat.com>
|
||||
|
||||
* decl.c (java_init_decl_processing): _Jv_NewMultiArray is a
|
||||
varargs function -- correct.
|
||||
|
||||
* parse.y (patch_assignment): Copy the rhs of an assignment into a
|
||||
temporary if the RHS is a reference.
|
||||
|
||||
2003-01-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* Make-lang.in (keyword.h): Pass "-L ANSI-C" to gperf.
|
||||
|
|
|
@ -810,8 +810,9 @@ java_init_decl_processing (void)
|
|||
0, NOT_BUILT_IN, NULL, NULL_TREE);
|
||||
DECL_IS_MALLOC (soft_anewarray_node) = 1;
|
||||
|
||||
t = tree_cons (NULL_TREE, ptr_type_node,
|
||||
tree_cons (NULL_TREE, int_type_node, endlink));
|
||||
/* There is no endlink here because _Jv_NewMultiArray is a varargs
|
||||
function. */
|
||||
t = tree_cons (NULL_TREE, ptr_type_node, int_type_node);
|
||||
soft_multianewarray_node
|
||||
= builtin_function ("_Jv_NewMultiArray",
|
||||
build_function_type (ptr_type_node, t),
|
||||
|
|
|
@ -12627,6 +12627,43 @@ patch_assignment (tree node, tree wfl_op1)
|
|||
DECL_INITIAL (lvalue) = new_rhs;
|
||||
}
|
||||
|
||||
/* Copy the rhs if it's a reference. */
|
||||
if (! flag_check_references && optimize > 0)
|
||||
{
|
||||
switch (TREE_CODE (new_rhs))
|
||||
{
|
||||
case ARRAY_REF:
|
||||
case INDIRECT_REF:
|
||||
case COMPONENT_REF:
|
||||
/* Transform a = foo.bar
|
||||
into a = { int tmp; tmp = foo.bar; tmp; ).
|
||||
We need to ensure that if a read from memory fails
|
||||
because of a NullPointerException, a destination variable
|
||||
will remain unchanged. An explicit temporary does what
|
||||
we need.
|
||||
|
||||
If flag_check_references is set, this is unnecessary
|
||||
because we'll check each reference before doing any
|
||||
reads. If optimize is not set the result will never be
|
||||
written to a stack slot that contains the LHS. */
|
||||
{
|
||||
tree tmp = build_decl (VAR_DECL, get_identifier ("<tmp>"),
|
||||
TREE_TYPE (new_rhs));
|
||||
tree block = build (BLOCK, TREE_TYPE (new_rhs), NULL);
|
||||
tree assignment
|
||||
= build (MODIFY_EXPR, TREE_TYPE (new_rhs), tmp, fold (new_rhs));
|
||||
BLOCK_VARS (block) = tmp;
|
||||
BLOCK_EXPR_BODY (block)
|
||||
= build (COMPOUND_EXPR, TREE_TYPE (new_rhs), assignment, tmp);
|
||||
TREE_SIDE_EFFECTS (block) = 1;
|
||||
new_rhs = block;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TREE_OPERAND (node, 0) = lvalue;
|
||||
TREE_OPERAND (node, 1) = new_rhs;
|
||||
TREE_TYPE (node) = lhs_type;
|
||||
|
|
Loading…
Add table
Reference in a new issue