diff options
author | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-07-07 13:11:03 +0000 |
---|---|---|
committer | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-07-07 13:11:03 +0000 |
commit | 2fdd6ce2c5dcf9c55c4a3452ef42c7f9400a033e (patch) | |
tree | 5b9696999f573cbe70d7dd465a7618959da1fc81 /gcc/java | |
parent | 8338531bb4f71b8e004370759d730da964ad102b (diff) | |
download | gcc-2fdd6ce2c5dcf9c55c4a3452ef42c7f9400a033e.tar.gz |
Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed
CALL_EXPR, to avoid order of evaluation changes.
Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (qualify_ambiguous_name): Do not use
IDENTIFIER_LOCAL_VALUE when name is a STRING_CST.
Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* check-init.c (check_init): Handle MAX_EXPR.
* expr.c (force_evaluation_order): Force method call arguments to
be evaluated in left-to-right order.
* parse.y (qualify_ambiguous_name): Loop again to qualify
NEW_ARRAY_EXPR properly.
Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (patch_invoke): Resolve unresolved invoked method
returned type.
(qualify_ambiguous_name): STRING_CST to qualify expression for
type name resolution.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27998 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 25 | ||||
-rw-r--r-- | gcc/java/check-init.c | 1 | ||||
-rw-r--r-- | gcc/java/expr.c | 35 | ||||
-rw-r--r-- | gcc/java/parse.c | 28 | ||||
-rw-r--r-- | gcc/java/parse.y | 18 |
5 files changed, 83 insertions, 24 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 7241c550861..df78c4269c0 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,28 @@ +Sat Jul 3 22:26:32 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * expr.c (force_evaluation_order): Save the COMPOUND_EXPR'ed + CALL_EXPR, to avoid order of evaluation changes. + +Fri Jul 2 17:44:08 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * parse.y (qualify_ambiguous_name): Do not use + IDENTIFIER_LOCAL_VALUE when name is a STRING_CST. + +Thu Jul 1 23:31:16 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * check-init.c (check_init): Handle MAX_EXPR. + * expr.c (force_evaluation_order): Force method call arguments to + be evaluated in left-to-right order. + * parse.y (qualify_ambiguous_name): Loop again to qualify + NEW_ARRAY_EXPR properly. + +Wed Jun 30 17:27:58 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * parse.y (patch_invoke): Resolve unresolved invoked method + returned type. + (qualify_ambiguous_name): STRING_CST to qualify expression for + type name resolution. + 1999-06-24 Andrew Haley <aph@cygnus.com> * class.c (finish_class): Whenever a deferred method is diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index 67e2524cf9b..93695368d00 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -643,6 +643,7 @@ check_init (exp, before) case GE_EXPR: case LT_EXPR: case LE_EXPR: + case MAX_EXPR: case ARRAY_REF: binop: check_init (TREE_OPERAND (exp, 0), before); diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 9beb724ea37..8998bdb3a58 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -2578,6 +2578,10 @@ process_jvm_instruction (PC, byte_ops, length) We fix this by using save_expr. This forces the sub-operand to be copied into a fresh virtual register, + + For method invocation, we modify the arguments so that a + left-to-right order evaluation is performed. Saved expressions + will, in CALL_EXPR order, be reused when the call will be expanded. */ tree @@ -2593,19 +2597,30 @@ force_evaluation_order (node) } else if (TREE_CODE (node) == CALL_EXPR || TREE_CODE (node) == NEW_CLASS_EXPR) { - tree last_side_effecting_arg = NULL_TREE; - tree arg = TREE_OPERAND (node, 1); - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) + tree arg, cmp; + + if (!TREE_OPERAND (node, 1)) + return node; + + /* This reverses the evaluation order. This is a desired effect. */ + for (cmp = NULL_TREE, arg = TREE_OPERAND (node, 1); + arg; arg = TREE_CHAIN (arg)) { - if (TREE_SIDE_EFFECTS (TREE_VALUE (arg))) - last_side_effecting_arg = arg; + tree saved = save_expr (TREE_VALUE (arg)); + cmp = (cmp == NULL_TREE ? saved : + build (COMPOUND_EXPR, void_type_node, cmp, saved)); + TREE_VALUE (arg) = saved; } - arg = TREE_OPERAND (node, 1); - for (; arg != NULL_TREE; arg = TREE_CHAIN (arg)) + + if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR) + TREE_SIDE_EFFECTS (cmp) = 1; + + if (cmp) { - if (arg == last_side_effecting_arg) - break; - TREE_VALUE (arg) = save_expr (TREE_VALUE (arg)); + cmp = save_expr (build (COMPOUND_EXPR, TREE_TYPE (node), cmp, node)); + CAN_COMPLETE_NORMALLY (cmp) = CAN_COMPLETE_NORMALLY (node); + TREE_SIDE_EFFECTS (cmp) = 1; + node = cmp; } } return node; diff --git a/gcc/java/parse.c b/gcc/java/parse.c index 0ea1eb64b85..cdb62d71b75 100644 --- a/gcc/java/parse.c +++ b/gcc/java/parse.c @@ -2212,7 +2212,7 @@ static const short yycheck[] = { 3, #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple" +#line 3 "/usr/share/misc/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. @@ -2229,7 +2229,7 @@ static const short yycheck[] = { 3, You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. @@ -2363,8 +2363,10 @@ int yydebug; /* nonzero means print parse trace */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ +#ifndef YYPARSE_PARAM int yyparse (void); #endif +#endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) @@ -2405,7 +2407,7 @@ __yy_memcpy (char *to, char *from, int count) #endif #endif -#line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple" +#line 196 "/usr/share/misc/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -4694,7 +4696,7 @@ case 495: break;} } /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple" +#line 498 "/usr/share/misc/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -9813,6 +9815,11 @@ patch_invoke (patch, method, args) if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); + + /* Resolve unresolved returned type isses */ + t = TREE_TYPE (TREE_TYPE (method)); + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t))) + resolve_and_layout (TREE_TYPE (t), NULL); if (flag_emit_class_files || flag_emit_xref) func = method; @@ -10223,7 +10230,7 @@ qualify_ambiguous_name (id) break; case NEW_ARRAY_EXPR: qual = TREE_CHAIN (qual); - new_array_found = 1; + again = new_array_found = 1; continue; case NEW_CLASS_EXPR: case CONVERT_EXPR: @@ -10301,7 +10308,8 @@ qualify_ambiguous_name (id) declaration or parameter declaration, then it is an expression name. We don't carry this test out if we're in the context of the use of SUPER or THIS */ - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) + if (!this_found && !super_found && + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) { RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; QUAL_RESOLUTION (qual) = decl; @@ -10318,15 +10326,17 @@ qualify_ambiguous_name (id) QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); } - /* We reclassify NAME as a type name if: + /* We reclassify NAME as yielding to a type name resolution if: - NAME is a class/interface declared within the compilation unit containing NAME, - NAME is imported via a single-type-import declaration, - NAME is declared in an another compilation unit of the package of the compilation unit containing NAME, - NAME is declared by exactly on type-import-on-demand declaration - of the compilation unit containing NAME. */ - else if ((decl = resolve_and_layout (name, NULL_TREE))) + of the compilation unit containing NAME. + - NAME is actually a STRING_CST. */ + else if (TREE_CODE (name) == STRING_CST || + (decl = resolve_and_layout (name, NULL_TREE))) { RESOLVE_TYPE_NAME_P (qual_wfl) = 1; QUAL_RESOLUTION (qual) = decl; diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 8abd4a7c079..4a4b3245375 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -7228,6 +7228,11 @@ patch_invoke (patch, method, args) if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) && TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t)) TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta)); + + /* Resolve unresolved returned type isses */ + t = TREE_TYPE (TREE_TYPE (method)); + if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t))) + resolve_and_layout (TREE_TYPE (t), NULL); if (flag_emit_class_files || flag_emit_xref) func = method; @@ -7638,7 +7643,7 @@ qualify_ambiguous_name (id) break; case NEW_ARRAY_EXPR: qual = TREE_CHAIN (qual); - new_array_found = 1; + again = new_array_found = 1; continue; case NEW_CLASS_EXPR: case CONVERT_EXPR: @@ -7716,7 +7721,8 @@ qualify_ambiguous_name (id) declaration or parameter declaration, then it is an expression name. We don't carry this test out if we're in the context of the use of SUPER or THIS */ - if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name))) + if (!this_found && !super_found && + TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name))) { RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1; QUAL_RESOLUTION (qual) = decl; @@ -7733,15 +7739,17 @@ qualify_ambiguous_name (id) QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl); } - /* We reclassify NAME as a type name if: + /* We reclassify NAME as yielding to a type name resolution if: - NAME is a class/interface declared within the compilation unit containing NAME, - NAME is imported via a single-type-import declaration, - NAME is declared in an another compilation unit of the package of the compilation unit containing NAME, - NAME is declared by exactly on type-import-on-demand declaration - of the compilation unit containing NAME. */ - else if ((decl = resolve_and_layout (name, NULL_TREE))) + of the compilation unit containing NAME. + - NAME is actually a STRING_CST. */ + else if (TREE_CODE (name) == STRING_CST || + (decl = resolve_and_layout (name, NULL_TREE))) { RESOLVE_TYPE_NAME_P (qual_wfl) = 1; QUAL_RESOLUTION (qual) = decl; |