src/share/vm/classfile/verificationType.hpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 











  25 enum {
  26   // As specifed in the JVM spec
  27   ITEM_Top = 0,
  28   ITEM_Integer = 1,
  29   ITEM_Float = 2,
  30   ITEM_Double = 3,
  31   ITEM_Long = 4,
  32   ITEM_Null = 5,
  33   ITEM_UninitializedThis = 6,
  34   ITEM_Object = 7,
  35   ITEM_Uninitialized = 8,
  36   ITEM_Bogus = (uint)-1
  37 };
  38 
  39 class VerificationType VALUE_OBJ_CLASS_SPEC {
  40   private:
  41     // Least significant bits of _handle are always 0, so we use these as
  42     // the indicator that the _handle is valid.  Otherwise, the _data field
  43     // contains encoded data (as specified below).  Should the VM change
  44     // and the lower bits on oops aren't 0, the assert in the constructor


 286       }
 287     }
 288   }
 289 
 290   VerificationType get_component(TRAPS) const;
 291 
 292   int dimensions() const {
 293     assert(is_array(), "Must be an array");
 294     int index = 0;
 295     while (name()->byte_at(index++) == '[');
 296     return index;
 297   }
 298 
 299   void print_on(outputStream* st) const PRODUCT_RETURN;
 300 
 301  private:
 302 
 303   bool is_reference_assignable_from(
 304     const VerificationType&, instanceKlassHandle, TRAPS) const;
 305 };


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
  26 #define SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
  27 
  28 #include "classfile/systemDictionary.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "oops/instanceKlass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/symbolOop.hpp"
  33 #include "runtime/handles.hpp"
  34 #include "runtime/signature.hpp"
  35 
  36 enum {
  37   // As specifed in the JVM spec
  38   ITEM_Top = 0,
  39   ITEM_Integer = 1,
  40   ITEM_Float = 2,
  41   ITEM_Double = 3,
  42   ITEM_Long = 4,
  43   ITEM_Null = 5,
  44   ITEM_UninitializedThis = 6,
  45   ITEM_Object = 7,
  46   ITEM_Uninitialized = 8,
  47   ITEM_Bogus = (uint)-1
  48 };
  49 
  50 class VerificationType VALUE_OBJ_CLASS_SPEC {
  51   private:
  52     // Least significant bits of _handle are always 0, so we use these as
  53     // the indicator that the _handle is valid.  Otherwise, the _data field
  54     // contains encoded data (as specified below).  Should the VM change
  55     // and the lower bits on oops aren't 0, the assert in the constructor


 297       }
 298     }
 299   }
 300 
 301   VerificationType get_component(TRAPS) const;
 302 
 303   int dimensions() const {
 304     assert(is_array(), "Must be an array");
 305     int index = 0;
 306     while (name()->byte_at(index++) == '[');
 307     return index;
 308   }
 309 
 310   void print_on(outputStream* st) const PRODUCT_RETURN;
 311 
 312  private:
 313 
 314   bool is_reference_assignable_from(
 315     const VerificationType&, instanceKlassHandle, TRAPS) const;
 316 };
 317 
 318 #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP