< prev index next >

src/hotspot/share/gc/z/zNMethodTableEntry.hpp

Print this page




  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 #ifndef SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
  25 #define SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
  26 
  27 #include "gc/z/zBitField.hpp"
  28 #include "memory/allocation.hpp"
  29 
  30 //
  31 // NMethod table entry layout
  32 // --------------------------
  33 //
  34 //   6
  35 //   3                                                                  3 2 1 0
  36 //  +--------------------------------------------------------------------+-+-+-+
  37 //  |11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111|1|1|1|
  38 //  +--------------------------------------------------------------------+-+-+-+
  39 //  |                                                                    | | |
  40 //  |                               2-2 Non-immediate Oops Flag (1-bits) * | |
  41 //  |                                                                      | |
  42 //  |                        1-1 Immediate Oops/Unregistered Flag (1-bits) * |


  43 //  |                                                                        |
  44 //  |                                           0-0 Registered Flag (1-bits) *
  45 //  |
  46 //  * 63-3 NMethod Address (61-bits)
  47 //
  48 
  49 class nmethod;
  50 
  51 class ZNMethodTableEntry : public CHeapObj<mtGC> {
  52 private:
  53   typedef ZBitField<uint64_t, bool,     0,  1>    field_registered;
  54   typedef ZBitField<uint64_t, bool,     1,  1>    field_unregistered;
  55   typedef ZBitField<uint64_t, bool,     1,  1>    field_immediate_oops;
  56   typedef ZBitField<uint64_t, bool,     2,  1>    field_non_immediate_oops;
  57   typedef ZBitField<uint64_t, nmethod*, 3, 61, 3> field_method;
  58 
  59   uint64_t _entry;
  60 
  61 public:
  62   explicit ZNMethodTableEntry(bool unregistered = false) :
  63       _entry(field_unregistered::encode(unregistered) |
  64              field_registered::encode(false)) {}
  65 
  66   ZNMethodTableEntry(nmethod* method, bool non_immediate_oops, bool immediate_oops) :
  67       _entry(field_method::encode(method) |
  68              field_non_immediate_oops::encode(non_immediate_oops) |
  69              field_immediate_oops::encode(immediate_oops) |
  70              field_registered::encode(true)) {}
  71 
  72   bool registered() const {
  73     return field_registered::decode(_entry);
  74   }
  75 
  76   bool unregistered() const {
  77     return field_unregistered::decode(_entry);
  78   }
  79 
  80   bool immediate_oops() const {
  81     return field_immediate_oops::decode(_entry);
  82   }
  83 
  84   bool non_immediate_oops() const {
  85     return field_non_immediate_oops::decode(_entry);
  86   }
  87 
  88   nmethod* method() const {
  89     return field_method::decode(_entry);
  90   }
  91 };
  92 
  93 #endif // SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP


  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 #ifndef SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
  25 #define SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
  26 
  27 #include "gc/z/zBitField.hpp"
  28 #include "memory/allocation.hpp"
  29 
  30 //
  31 // NMethod table entry layout
  32 // --------------------------
  33 //
  34 //   6
  35 //   3                                                                   2 1 0
  36 //  +---------------------------------------------------------------------+-+-+
  37 //  |11111111 11111111 11111111 11111111 11111111 11111111 11111111 111111|1|1|
  38 //  +---------------------------------------------------------------------+-+-+


  39 //  |                                                                     | |
  40 //  |                                                                     | |
  41 //  |                                                                     | |
  42 //  |                                      1-1 Unregistered Flag (1-bits) * |
  43 //  |                                                                       |
  44 //  |                                          0-0 Registered Flag (1-bits) *
  45 //  |
  46 //  * 63-3 NMethod Address (61-bits)
  47 //
  48 
  49 class nmethod;
  50 
  51 class ZNMethodTableEntry : public CHeapObj<mtGC> {
  52 private:
  53   typedef ZBitField<uint64_t, bool,     0,  1>    field_registered;
  54   typedef ZBitField<uint64_t, bool,     1,  1>    field_unregistered;
  55   typedef ZBitField<uint64_t, nmethod*, 2, 62, 2> field_method;


  56 
  57   uint64_t _entry;
  58 
  59 public:
  60   explicit ZNMethodTableEntry(bool unregistered = false) :
  61       _entry(field_registered::encode(false) |
  62              field_unregistered::encode(unregistered) |
  63              field_method::encode(NULL)) {}
  64 
  65   explicit ZNMethodTableEntry(nmethod* method) :
  66       _entry(field_registered::encode(true) |
  67              field_unregistered::encode(false) |
  68              field_method::encode(method)) {}
  69 
  70   bool registered() const {
  71     return field_registered::decode(_entry);
  72   }
  73 
  74   bool unregistered() const {
  75     return field_unregistered::decode(_entry);








  76   }
  77 
  78   nmethod* method() const {
  79     return field_method::decode(_entry);
  80   }
  81 };
  82 
  83 #endif // SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
< prev index next >