src/share/vm/classfile/verificationType.hpp

changeset 2497
3582bf76420e
parent 2314
f95d63e2154a
child 2585
c1a6154012c8
     1.1 --- a/src/share/vm/classfile/verificationType.hpp	Thu Jan 27 13:42:28 2011 -0800
     1.2 +++ b/src/share/vm/classfile/verificationType.hpp	Thu Jan 27 16:11:27 2011 -0800
     1.3 @@ -29,7 +29,7 @@
     1.4  #include "memory/allocation.hpp"
     1.5  #include "oops/instanceKlass.hpp"
     1.6  #include "oops/oop.inline.hpp"
     1.7 -#include "oops/symbolOop.hpp"
     1.8 +#include "oops/symbol.hpp"
     1.9  #include "runtime/handles.hpp"
    1.10  #include "runtime/signature.hpp"
    1.11  
    1.12 @@ -47,6 +47,8 @@
    1.13    ITEM_Bogus = (uint)-1
    1.14  };
    1.15  
    1.16 +class ClassVerifier;
    1.17 +
    1.18  class VerificationType VALUE_OBJ_CLASS_SPEC {
    1.19    private:
    1.20      // Least significant bits of _handle are always 0, so we use these as
    1.21 @@ -56,7 +58,7 @@
    1.22      // will catch this and we'll have to add a descriminator tag to this
    1.23      // structure.
    1.24      union {
    1.25 -      symbolOop* _handle;
    1.26 +      Symbol*   _sym;
    1.27        uintptr_t _data;
    1.28      } _u;
    1.29  
    1.30 @@ -73,7 +75,7 @@
    1.31        TypeMask           = 0x00000003,
    1.32  
    1.33        // Topmost types encoding
    1.34 -      Reference          = 0x0,        // _handle contains the name
    1.35 +      Reference          = 0x0,        // _sym contains the name
    1.36        Primitive          = 0x1,        // see below for primitive list
    1.37        Uninitialized      = 0x2,        // 0x00ffff00 contains bci
    1.38        TypeQuery          = 0x3,        // Meta-types used for category testing
    1.39 @@ -85,7 +87,7 @@
    1.40        Category2_2ndFlag  = 0x04,       // Second word of a two-word value
    1.41  
    1.42        // special reference values
    1.43 -      Null               = 0x00000000, // A reference with a 0 handle is null
    1.44 +      Null               = 0x00000000, // A reference with a 0 sym is null
    1.45  
    1.46        // Primitives categories (the second byte determines the category)
    1.47        Category1          = (Category1Flag     << 1 * BitsPerByte) | Primitive,
    1.48 @@ -152,17 +154,14 @@
    1.49    static VerificationType category2_2nd_check()
    1.50      { return VerificationType(Category2_2ndQuery); }
    1.51  
    1.52 -  // For reference types, store the actual oop* handle
    1.53 -  static VerificationType reference_type(symbolHandle sh) {
    1.54 -      assert(((uintptr_t)sh.raw_value() & 0x3) == 0, "Oops must be aligned");
    1.55 +  // For reference types, store the actual Symbol
    1.56 +  static VerificationType reference_type(Symbol* sh) {
    1.57 +      assert(((uintptr_t)sh & 0x3) == 0, "Oops must be aligned");
    1.58        // If the above assert fails in the future because oop* isn't aligned,
    1.59        // then this type encoding system will have to change to have a tag value
    1.60        // to descriminate between oops and primitives.
    1.61 -      return VerificationType((uintptr_t)((symbolOop*)sh.raw_value()));
    1.62 +      return VerificationType((uintptr_t)sh);
    1.63    }
    1.64 -  static VerificationType reference_type(symbolOop s, TRAPS)
    1.65 -    { return reference_type(symbolHandle(THREAD, s)); }
    1.66 -
    1.67    static VerificationType uninitialized_type(u2 bci)
    1.68      { return VerificationType(bci << 1 * BitsPerByte | Uninitialized); }
    1.69    static VerificationType uninitialized_this_type()
    1.70 @@ -242,13 +241,9 @@
    1.71      return ((_u._data & BciMask) >> 1 * BitsPerByte);
    1.72    }
    1.73  
    1.74 -  symbolHandle name_handle() const {
    1.75 +  Symbol* name() const {
    1.76      assert(is_reference() && !is_null(), "Must be a non-null reference");
    1.77 -    return symbolHandle(_u._handle, true);
    1.78 -  }
    1.79 -  symbolOop name() const {
    1.80 -    assert(is_reference() && !is_null(), "Must be a non-null reference");
    1.81 -    return *(_u._handle);
    1.82 +    return _u._sym;
    1.83    }
    1.84  
    1.85    bool equals(const VerificationType& t) const {
    1.86 @@ -269,7 +264,7 @@
    1.87    // is assignable to another.  Returns true if one can assign 'from' to
    1.88    // this.
    1.89    bool is_assignable_from(
    1.90 -      const VerificationType& from, instanceKlassHandle context, TRAPS) const {
    1.91 +      const VerificationType& from, ClassVerifier* context, TRAPS) const {
    1.92      if (equals(from) || is_bogus()) {
    1.93        return true;
    1.94      } else {
    1.95 @@ -298,7 +293,7 @@
    1.96      }
    1.97    }
    1.98  
    1.99 -  VerificationType get_component(TRAPS) const;
   1.100 +  VerificationType get_component(ClassVerifier* context, TRAPS) const;
   1.101  
   1.102    int dimensions() const {
   1.103      assert(is_array(), "Must be an array");
   1.104 @@ -312,7 +307,7 @@
   1.105   private:
   1.106  
   1.107    bool is_reference_assignable_from(
   1.108 -    const VerificationType&, instanceKlassHandle, TRAPS) const;
   1.109 +    const VerificationType&, ClassVerifier*, TRAPS) const;
   1.110  };
   1.111  
   1.112  #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP

mercurial