src/share/vm/code/pcDesc.hpp

changeset 3108
7588156f5cf9
parent 2314
f95d63e2154a
child 6876
710a3c8b516e
     1.1 --- a/src/share/vm/code/pcDesc.hpp	Sat Sep 03 14:03:54 2011 -0700
     1.2 +++ b/src/share/vm/code/pcDesc.hpp	Mon Sep 05 17:09:05 2011 -0700
     1.3 @@ -39,15 +39,17 @@
     1.4    int _scope_decode_offset; // offset for scope in nmethod
     1.5    int _obj_decode_offset;
     1.6  
     1.7 -  union PcDescFlags {
     1.8 -    int word;
     1.9 -    struct {
    1.10 -      unsigned int reexecute: 1;
    1.11 -      unsigned int is_method_handle_invoke: 1;
    1.12 -      unsigned int return_oop: 1;
    1.13 -    } bits;
    1.14 -    bool operator ==(const PcDescFlags& other) { return word == other.word; }
    1.15 -  } _flags;
    1.16 +  enum {
    1.17 +    PCDESC_reexecute               = 1 << 0,
    1.18 +    PCDESC_is_method_handle_invoke = 1 << 1,
    1.19 +    PCDESC_return_oop              = 1 << 2
    1.20 +  };
    1.21 +
    1.22 +  int _flags;
    1.23 +
    1.24 +  void set_flag(int mask, bool z) {
    1.25 +    _flags = z ? (_flags | mask) : (_flags & ~mask);
    1.26 +  }
    1.27  
    1.28   public:
    1.29    int pc_offset() const           { return _pc_offset;   }
    1.30 @@ -69,8 +71,8 @@
    1.31    };
    1.32  
    1.33    // Flags
    1.34 -  bool     should_reexecute()              const { return _flags.bits.reexecute; }
    1.35 -  void set_should_reexecute(bool z)              { _flags.bits.reexecute = z;    }
    1.36 +  bool     should_reexecute()              const { return (_flags & PCDESC_reexecute) != 0; }
    1.37 +  void set_should_reexecute(bool z)              { set_flag(PCDESC_reexecute, z); }
    1.38  
    1.39    // Does pd refer to the same information as pd?
    1.40    bool is_same_info(const PcDesc* pd) {
    1.41 @@ -79,11 +81,11 @@
    1.42        _flags == pd->_flags;
    1.43    }
    1.44  
    1.45 -  bool     is_method_handle_invoke()       const { return _flags.bits.is_method_handle_invoke;     }
    1.46 -  void set_is_method_handle_invoke(bool z)       {        _flags.bits.is_method_handle_invoke = z; }
    1.47 +  bool     is_method_handle_invoke()       const { return (_flags & PCDESC_is_method_handle_invoke) != 0;     }
    1.48 +  void set_is_method_handle_invoke(bool z)       { set_flag(PCDESC_is_method_handle_invoke, z); }
    1.49  
    1.50 -  bool     return_oop()                    const { return _flags.bits.return_oop;     }
    1.51 -  void set_return_oop(bool z)                    {        _flags.bits.return_oop = z; }
    1.52 +  bool     return_oop()                    const { return (_flags & PCDESC_return_oop) != 0;     }
    1.53 +  void set_return_oop(bool z)                    { set_flag(PCDESC_return_oop, z); }
    1.54  
    1.55    // Returns the real pc
    1.56    address real_pc(const nmethod* code) const;

mercurial