aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-16 23:56:06 +0000
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-16 23:56:06 +0000
commit24f9b5dc58fef62def7cd11ca27d531002371800 (patch)
tree19ee2fec6dfa4cd54b604ad5600c0519440c831a
parentf50dabd17ff2bf9d2ec2bd94843d20460d48dc7c (diff)
2000-01-16 Anthony Green <green@cygnus.com>
* parse.y (build_string_concatenation): Only use StringBuffer(String) shortcut if String arg is constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31450 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/parse.c12
-rw-r--r--gcc/java/parse.y6
3 files changed, 14 insertions, 9 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index bf03a83bf4c..09d79d321f9 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2000-01-16 Anthony Green <green@cygnus.com>
+
+ * parse.y (build_string_concatenation): Only use
+ StringBuffer(String) shortcut if String arg is constant.
+
2000-01-11 Mumit Khan <khan@xraylith.wisc.edu>
* jcf-path.c: Delete PATH_SEPARATOR and DIR_SEPARATOR macros.
diff --git a/gcc/java/parse.c b/gcc/java/parse.c
index 9cb374d601e..72b64b49bdd 100644
--- a/gcc/java/parse.c
+++ b/gcc/java/parse.c
@@ -2257,7 +2257,7 @@ static const short yycheck[] = { 3,
#define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/lib/bison.simple"
+#line 3 "/home/green/cygnus/njava/i0/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2450,7 +2450,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
-#line 196 "/usr/lib/bison.simple"
+#line 196 "/home/green/cygnus/njava/i0/share/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 *.
@@ -4750,7 +4750,7 @@ case 495:
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/lib/bison.simple"
+#line 498 "/home/green/cygnus/njava/i0/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@@ -12821,9 +12821,9 @@ build_string_concatenation (op1, op2)
if (!IS_CRAFTED_STRING_BUFFER_P (op1))
{
/* Two solutions here:
- 1) OP1 is a string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)))
+ 1) OP1 is a constant string reference, we call new StringBuffer(OP1)
+ 2) OP1 is something else, we call new StringBuffer().append(OP1). */
+ if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
op1 = BUILD_STRING_BUFFER (op1);
else
{
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 0c2f6b85c56..85635082dde 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -10218,9 +10218,9 @@ build_string_concatenation (op1, op2)
if (!IS_CRAFTED_STRING_BUFFER_P (op1))
{
/* Two solutions here:
- 1) OP1 is a string reference, we call new StringBuffer(OP1)
- 2) OP1 is something else, we call new StringBuffer().append(OP1). */
- if (JSTRING_TYPE_P (TREE_TYPE (op1)))
+ 1) OP1 is a constant string reference, we call new StringBuffer(OP1)
+ 2) OP1 is something else, we call new StringBuffer().append(OP1). */
+ if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
op1 = BUILD_STRING_BUFFER (op1);
else
{