verify.cc (type::isnull): New method.
authorTom Tromey <tromey@redhat.com>
Wed, 6 Feb 2002 21:53:59 +0000 (21:53 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 6 Feb 2002 21:53:59 +0000 (21:53 +0000)
* verify.cc (type::isnull): New method.
(require_array_type): Handle case where array is null.
(verify_instructions_0) [op_arraylength]: Likewise.

From-SVN: r49555

libjava/ChangeLog
libjava/verify.cc

index ef14272..4823ecc 100644 (file)
@@ -1,3 +1,9 @@
+2002-02-06  Tom Tromey  <tromey@redhat.com>
+
+       * verify.cc (type::isnull): New method.
+       (require_array_type): Handle case where array is null.
+       (verify_instructions_0) [op_arraylength]: Likewise.
+
 2002-02-05  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
 
        * configure.in: Set up PLATFORMOBJS not PLATFORM_SPECIFIC_SOURCES.
index c9cfb88..46cee15 100644 (file)
@@ -522,6 +522,11 @@ private:
       return false;
     }
 
+    bool isnull () const
+    {
+      return key == null_type;
+    }
+
     bool isinterface (_Jv_BytecodeVerifier *verifier)
     {
       resolve (verifier);
@@ -1161,6 +1166,10 @@ private:
   // compatible with type ELEMENT.  Returns the actual element type.
   type require_array_type (type array, type element)
   {
+    // An odd case.  Here we just pretend that everything went ok.
+    if (array.isnull ())
+      return element;
+
     if (! array.isarray ())
       verify_fail ("array required");
 
@@ -2796,7 +2805,7 @@ private:
          case op_arraylength:
            {
              type t = pop_type (reference_type);
-             if (! t.isarray ())
+             if (! t.isarray () && ! t.isnull ())
                verify_fail ("array type expected");
              push_type (int_type);
            }