src/share/vm/oops/constantPool.hpp

changeset 4490
5daaddd917a1
parent 4467
b5f6465019f6
child 4493
edd76a5856f7
child 4497
16fb9f942703
     1.1 --- a/src/share/vm/oops/constantPool.hpp	Tue Jan 22 11:54:16 2013 -0800
     1.2 +++ b/src/share/vm/oops/constantPool.hpp	Wed Jan 23 10:34:29 2013 -0500
     1.3 @@ -95,11 +95,16 @@
     1.4    jobject              _resolved_references;
     1.5    Array<u2>*           _reference_map;
     1.6  
     1.7 -  int                  _flags;         // a few header bits to describe contents for GC
     1.8 +  enum {
     1.9 +    _has_invokedynamic = 1,           // Flags
    1.10 +    _has_pseudo_string = 2,
    1.11 +    _has_preresolution = 4,
    1.12 +    _on_stack          = 8
    1.13 +  };
    1.14 +
    1.15 +  int                  _flags;  // old fashioned bit twiddling
    1.16    int                  _length; // number of elements in the array
    1.17  
    1.18 -  bool                 _on_stack;     // Redefined method still executing refers to this constant pool.
    1.19 -
    1.20    union {
    1.21      // set for CDS to restore resolved references
    1.22      int                _resolved_reference_length;
    1.23 @@ -115,17 +120,8 @@
    1.24  
    1.25    void set_operands(Array<u2>* operands)       { _operands = operands; }
    1.26  
    1.27 -  enum FlagBit {
    1.28 -    FB_has_invokedynamic = 1,
    1.29 -    FB_has_pseudo_string = 2,
    1.30 -    FB_has_preresolution = 3
    1.31 -  };
    1.32 -
    1.33 -  int flags() const                         { return _flags; }
    1.34 -  void set_flags(int f)                     { _flags = f; }
    1.35 -  bool flag_at(FlagBit fb) const            { return (_flags & (1 << (int)fb)) != 0; }
    1.36 -  void set_flag_at(FlagBit fb);
    1.37 -  // no clear_flag_at function; they only increase
    1.38 +  int flags() const                            { return _flags; }
    1.39 +  void set_flags(int f)                        { _flags = f; }
    1.40  
    1.41   private:
    1.42    intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(ConstantPool)); }
    1.43 @@ -178,18 +174,20 @@
    1.44    Array<u1>* tags() const                   { return _tags; }
    1.45    Array<u2>* operands() const               { return _operands; }
    1.46  
    1.47 -  bool has_pseudo_string() const            { return flag_at(FB_has_pseudo_string); }
    1.48 -  bool has_invokedynamic() const            { return flag_at(FB_has_invokedynamic); }
    1.49 -  bool has_preresolution() const            { return flag_at(FB_has_preresolution); }
    1.50 -  void set_pseudo_string()                  {    set_flag_at(FB_has_pseudo_string); }
    1.51 -  void set_invokedynamic()                  {    set_flag_at(FB_has_invokedynamic); }
    1.52 -  void set_preresolution()                  {    set_flag_at(FB_has_preresolution); }
    1.53 +  bool has_invokedynamic() const            { return (_flags & _has_invokedynamic) != 0; }
    1.54 +  void set_has_invokedynamic()              { _flags |= _has_invokedynamic; }
    1.55 +
    1.56 +  bool has_pseudo_string() const            { return (_flags & _has_pseudo_string) != 0; }
    1.57 +  void set_has_pseudo_string()              { _flags |= _has_pseudo_string; }
    1.58 +
    1.59 +  bool has_preresolution() const            { return (_flags & _has_preresolution) != 0; }
    1.60 +  void set_has_preresolution()              { _flags |= _has_preresolution; }
    1.61  
    1.62    // Redefine classes support.  If a method refering to this constant pool
    1.63    // is on the executing stack, or as a handle in vm code, this constant pool
    1.64    // can't be removed from the set of previous versions saved in the instance
    1.65    // class.
    1.66 -  bool on_stack() const                     { return _on_stack; }
    1.67 +  bool on_stack() const                      { return (_flags &_on_stack) != 0; }
    1.68    void set_on_stack(const bool value);
    1.69  
    1.70    // Klass holding pool
    1.71 @@ -457,7 +455,7 @@
    1.72  
    1.73    void pseudo_string_at_put(int which, int obj_index, oop x) {
    1.74      assert(EnableInvokeDynamic, "");
    1.75 -    set_pseudo_string();        // mark header
    1.76 +    set_has_pseudo_string();        // mark header
    1.77      assert(tag_at(which).is_string(), "Corrupted constant pool");
    1.78      string_at_put(which, obj_index, x);    // this works just fine
    1.79    }

mercurial