< prev index next >

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

Print this page




  29 #include "metaprogramming/primitiveConversions.hpp"
  30 
  31 //
  32 // Forwarding entry layout
  33 // -----------------------
  34 //
  35 //   6                  4 4
  36 //   3                  6 5                                                1 0
  37 //  +--------------------+--------------------------------------------------+-+
  38 //  |11111111 11111111 11|111111 11111111 11111111 11111111 11111111 1111111|1|
  39 //  +--------------------+--------------------------------------------------+-+
  40 //  |                    |                                                  |
  41 //  |                    |                      0-0 Populated Flag (1-bits) *
  42 //  |                    |
  43 //  |                    * 45-1 To Object Offset (45-bits)
  44 //  |
  45 //  * 63-46 From Object Index (18-bits)
  46 //
  47 
  48 class ZForwardingEntry {
  49   friend struct PrimitiveConversions;
  50 
  51 private:
  52   typedef ZBitField<uint64_t, bool,   0,   1> field_populated;
  53   typedef ZBitField<uint64_t, size_t, 1,  45> field_to_offset;
  54   typedef ZBitField<uint64_t, size_t, 46, 18> field_from_index;
  55 
  56   uint64_t _entry;
  57 
  58 public:
  59   ZForwardingEntry() :
  60       _entry(0) {}
  61 
  62   ZForwardingEntry(size_t from_index, size_t to_offset) :
  63       _entry(field_populated::encode(true) |
  64              field_to_offset::encode(to_offset) |
  65              field_from_index::encode(from_index)) {}
  66 
  67   bool populated() const {
  68     return field_populated::decode(_entry);
  69   }




  29 #include "metaprogramming/primitiveConversions.hpp"
  30 
  31 //
  32 // Forwarding entry layout
  33 // -----------------------
  34 //
  35 //   6                  4 4
  36 //   3                  6 5                                                1 0
  37 //  +--------------------+--------------------------------------------------+-+
  38 //  |11111111 11111111 11|111111 11111111 11111111 11111111 11111111 1111111|1|
  39 //  +--------------------+--------------------------------------------------+-+
  40 //  |                    |                                                  |
  41 //  |                    |                      0-0 Populated Flag (1-bits) *
  42 //  |                    |
  43 //  |                    * 45-1 To Object Offset (45-bits)
  44 //  |
  45 //  * 63-46 From Object Index (18-bits)
  46 //
  47 
  48 class ZForwardingEntry {
  49   friend class PrimitiveConversions;
  50 
  51 private:
  52   typedef ZBitField<uint64_t, bool,   0,   1> field_populated;
  53   typedef ZBitField<uint64_t, size_t, 1,  45> field_to_offset;
  54   typedef ZBitField<uint64_t, size_t, 46, 18> field_from_index;
  55 
  56   uint64_t _entry;
  57 
  58 public:
  59   ZForwardingEntry() :
  60       _entry(0) {}
  61 
  62   ZForwardingEntry(size_t from_index, size_t to_offset) :
  63       _entry(field_populated::encode(true) |
  64              field_to_offset::encode(to_offset) |
  65              field_from_index::encode(from_index)) {}
  66 
  67   bool populated() const {
  68     return field_populated::decode(_entry);
  69   }


< prev index next >