verify.cc (class _Jv_BytecodeVerifier): Fixed logic.
authorTom Tromey <tromey@redhat.com>
Thu, 15 Nov 2001 00:24:38 +0000 (00:24 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 15 Nov 2001 00:24:38 +0000 (00:24 +0000)
* verify.cc (class _Jv_BytecodeVerifier) [op_dup2]: Fixed logic.
[op_dup_x2]: Likewise.
[op_dup2_x1]: Likewise.
[op_dup2_x2]: Likewise.
(branch_prepass): Added `op_newarray' case.  Updated unrecognized
instruction error.
(verify_instructions_0): Updated unrecognized instruction error.

From-SVN: r47033

libjava/ChangeLog
libjava/verify.cc

index b32af47..e8b6e88 100644 (file)
@@ -1,5 +1,13 @@
 2001-11-14  Tom Tromey  <tromey@redhat.com>
 
+       * verify.cc (class _Jv_BytecodeVerifier) [op_dup2]: Fixed logic.
+       [op_dup_x2]: Likewise.
+       [op_dup2_x1]: Likewise.
+       [op_dup2_x2]: Likewise.
+       (branch_prepass): Added `op_newarray' case.  Updated unrecognized
+       instruction error.
+       (verify_instructions_0): Updated unrecognized instruction error.
+
        * java/lang/reflect/Constructor.java (toString): Use more
        efficient form of Modifier.toString().
 
index 49bc0f4..6deb80b 100644 (file)
@@ -1314,6 +1314,7 @@ private:
          case op_putfield:
          case op_putstatic:
          case op_new:
+         case op_newarray:
          case op_anewarray:
          case op_instanceof:
          case op_checkcast:
@@ -1402,7 +1403,7 @@ private:
            break;
 
          default:
-           verify_fail ("unrecognized instruction");
+           verify_fail ("unrecognized instruction in branch_prepass");
          }
 
        // See if any previous branch tried to branch to the middle of
@@ -1915,39 +1916,90 @@ private:
          case op_dup_x2:
            {
              type t1 = pop32 ();
-             type t2 = pop32 ();
-             type t3 = pop32 ();
-             push_type (t1);
-             push_type (t3);
+             type t2 = pop_raw ();
+             if (! t2.iswide ())
+               {
+                 type t3 = pop32 ();
+                 push_type (t1);
+                 push_type (t3);
+               }
+             else
+               push_type (t1);
              push_type (t2);
              push_type (t1);
            }
            break;
          case op_dup2:
            {
-             type t = pop64 ();
-             push_type (t);
+             type t = pop_raw ();
+             if (! t.iswide ())
+               {
+                 type t2 = pop32 ();
+                 push_type (t2);
+                 push_type (t);
+                 push_type (t2);
+               }
              push_type (t);
            }
            break;
          case op_dup2_x1:
            {
-             type t1 = pop64 ();
-             type t2 = pop64 ();
-             push_type (t1);
+             type t1 = pop_raw ();
+             type t2 = pop32 ();
+             if (! t1.iswide ())
+               {
+                 type t3 = pop32 ();
+                 push_type (t2);
+                 push_type (t1);
+                 push_type (t3);
+               }
+             else
+               push_type (t1);
              push_type (t2);
              push_type (t1);
            }
            break;
          case op_dup2_x2:
            {
-             type t1 = pop64 ();
-             type t2 = pop64 ();
-             type t3 = pop64 ();
-             push_type (t1);
-             push_type (t3);
-             push_type (t2);
-             push_type (t1);
+             // FIXME
+             type t1 = pop_raw ();
+             if (t1.iswide ())
+               {
+                 type t2 = pop_raw ();
+                 if (t2.iswide ())
+                   {
+                     push_type (t1);
+                     push_type (t2);
+                   }
+                 else
+                   {
+                     type t3 = pop32 ();
+                     push_type (t1);
+                     push_type (t3);
+                     push_type (t2);
+                   }
+                 push_type (t1);
+               }
+             else
+               {
+                 type t2 = pop32 ();
+                 type t3 = pop_raw ();
+                 if (t3.iswide ())
+                   {
+                     push_type (t2);
+                     push_type (t1);
+                   }
+                 else
+                   {
+                     type t4 = pop32 ();
+                     push_type (t2);
+                     push_type (t1);
+                     push_type (t4);
+                   }
+                 push_type (t3);
+                 push_type (t2);
+                 push_type (t1);
+               }
            }
            break;
          case op_swap:
@@ -2385,7 +2437,7 @@ private:
 
          default:
            // Unrecognized opcode.
-           verify_fail ("unrecognized instruction");
+           verify_fail ("unrecognized instruction in verify_instructions_0");
          }
       }
   }