aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>2001-03-15 20:16:54 -0800
committerPer Bothner <bothner@gcc.gnu.org>2001-03-15 20:16:54 -0800
commit19f8e04bff25d9c494c95f994b3ec2b4cc7b7f77 (patch)
tree62cdac72d14e1cc7f91e0f2082d9bfeca1e692cf
parent3b3a1054d9f0560804265b2c27f4313d90e1aded (diff)
downloadgcc-19f8e04bff25d9c494c95f994b3ec2b4cc7b7f77.zip
gcc-19f8e04bff25d9c494c95f994b3ec2b4cc7b7f77.tar.gz
gcc-19f8e04bff25d9c494c95f994b3ec2b4cc7b7f77.tar.bz2
verify.c (verify_jvm_instructions): Better error msgs for dup.
* verify.c (verify_jvm_instructions): Better error msgs for dup. (type_stack_dup): Remove no-longer neded error check. From-SVN: r40529
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/verify.c20
2 files changed, 17 insertions, 8 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 848e175..80e2102 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2001-03-13 Per Bothner <per@bothner.com>
+
+ * verify.c (verify_jvm_instructions): Better error msgs for dup.
+ (type_stack_dup): Remove no-longer neded error check.
+
2001-03-15 Bryce McKinlay <bryce@albatross.co.nz>
* mangle.c (mangle_record_type): Rename 'from_pointer' argument
diff --git a/gcc/java/verify.c b/gcc/java/verify.c
index 5ac1d05..bb10b44 100644
--- a/gcc/java/verify.c
+++ b/gcc/java/verify.c
@@ -294,8 +294,6 @@ type_stack_dup (size, offset)
{
tree type[4];
int index;
- if (size + offset > stack_pointer)
- error ("stack underflow - dup* operation");
for (index = 0; index < size + offset; index++)
{
type[index] = stack_type_map[stack_pointer - 1];
@@ -923,12 +921,18 @@ verify_jvm_instructions (jcf, byte_ops, length)
case OPCODE_new:
PUSH_TYPE (get_class_constant (jcf, IMMEDIATE_u2));
break;
- case OPCODE_dup: type_stack_dup (1, 0); break;
- case OPCODE_dup_x1: type_stack_dup (1, 1); break;
- case OPCODE_dup_x2: type_stack_dup (1, 2); break;
- case OPCODE_dup2: type_stack_dup (2, 0); break;
- case OPCODE_dup2_x1: type_stack_dup (2, 1); break;
- case OPCODE_dup2_x2: type_stack_dup (2, 2); break;
+ case OPCODE_dup: wide = 1; index = 0; goto dup;
+ case OPCODE_dup_x1: wide = 1; index = 1; goto dup;
+ case OPCODE_dup_x2: wide = 1; index = 2; goto dup;
+ case OPCODE_dup2: wide = 2; index = 0; goto dup;
+ case OPCODE_dup2_x1: wide = 2; index = 1; goto dup;
+ case OPCODE_dup2_x2: wide = 2; index = 2; goto dup;
+ dup:
+ if (wide + index > stack_pointer)
+ VERIFICATION_ERROR ("stack underflow - dup* operation");
+ type_stack_dup (wide, index);
+ wide = 0;
+ break;
case OPCODE_pop: index = 1; goto pop;
case OPCODE_pop2: index = 2; goto pop;
pop: