< prev index next >

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

Print this page




  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_ZMARKSTACKENTRY_HPP
  25 #define SHARE_GC_Z_ZMARKSTACKENTRY_HPP
  26 
  27 #include "gc/z/zBitField.hpp"
  28 #include "memory/allocation.hpp"
  29 
  30 //
  31 // Mark stack entry layout
  32 // -----------------------
  33 //
  34 //  Object entry
  35 //  ------------
  36 //
  37 //   6
  38 //   3                                                                   2 1 0
  39 //  +---------------------------------------------------------------------+-+-+
  40 //  |11111111 11111111 11111111 11111111 11111111 11111111 11111111 111111|1|1|
  41 //  +---------------------------------------------------------------------+-+-+
  42 //  |                                                                     | |
  43 //  |                                      1-1 Partial Array Flag (1-bit) * |
  44 //  |                                                                       |
  45 //  |                                                0-0 Final Flag (1-bit) *


  46 //  |
  47 //  * 63-2 Object Address (62-bits)
  48 //
  49 //
  50 //  Partial array entry
  51 //  -------------------
  52 //
  53 //   6                                 3  3
  54 //   3                                 2  1                               2 1 0
  55 //  +------------------------------------+---------------------------------+-+-+
  56 //  |11111111 11111111 11111111 11111111 |11111111 11111111 11111111 111111|1|1|
  57 //  +------------------------------------+---------------------------------+-+-+
  58 //  |                                    |                                 | |
  59 //  |                                    |  1-1 Partial Array Flag (1-bit) * |
  60 //  |                                    |                                   |
  61 //  |                                    |            0-0 Final Flag (1-bit) *
  62 //  |                                    |
  63 //  |                                    * 31-2 Partial Array Length (30-bits)
  64 //  |
  65 //  * 63-32 Partial Array Address Offset (32-bits)
  66 //
  67 
  68 class ZMarkStackEntry  {
  69 private:
  70   typedef ZBitField<uint64_t, bool,      0,  1>  field_finalizable;
  71   typedef ZBitField<uint64_t, bool,      1,  1>  field_partial_array;
  72   typedef ZBitField<uint64_t, uintptr_t, 2,  62> field_object_address;

  73   typedef ZBitField<uint64_t, size_t,    2,  30> field_partial_array_length;
  74   typedef ZBitField<uint64_t, size_t,    32, 32> field_partial_array_offset;
  75 
  76   uint64_t _entry;
  77 
  78 public:
  79   ZMarkStackEntry() {
  80     // This constructor is intentionally left empty and does not initialize
  81     // _entry to allow it to be optimized out when instantiating ZMarkStack,
  82     // which has a long array of ZMarkStackEntry elements, but doesn't care
  83     // what _entry is initialized to.
  84   }
  85 
  86   ZMarkStackEntry(uintptr_t object_address, bool finalizable) :
  87       _entry(field_object_address::encode(object_address) |

  88              field_partial_array::encode(false) |
  89              field_finalizable::encode(finalizable)) {}
  90 
  91   ZMarkStackEntry(size_t partial_array_offset, size_t partial_array_length, bool finalizable) :
  92       _entry(field_partial_array_offset::encode(partial_array_offset) |
  93              field_partial_array_length::encode(partial_array_length) |
  94              field_partial_array::encode(true) |
  95              field_finalizable::encode(finalizable)) {}
  96 
  97   bool finalizable() const {
  98     return field_finalizable::decode(_entry);
  99   }
 100 
 101   bool partial_array() const {
 102     return field_partial_array::decode(_entry);
 103   }
 104 
 105   size_t partial_array_offset() const {
 106     return field_partial_array_offset::decode(_entry);
 107   }
 108 
 109   size_t partial_array_length() const {
 110     return field_partial_array_length::decode(_entry);




 111   }
 112 
 113   uintptr_t object_address() const {
 114     return field_object_address::decode(_entry);
 115   }
 116 };
 117 
 118 #endif // SHARE_GC_Z_ZMARKSTACKENTRY_HPP


  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_ZMARKSTACKENTRY_HPP
  25 #define SHARE_GC_Z_ZMARKSTACKENTRY_HPP
  26 
  27 #include "gc/z/zBitField.hpp"
  28 #include "memory/allocation.hpp"
  29 
  30 //
  31 // Mark stack entry layout
  32 // -----------------------
  33 //
  34 //  Object entry
  35 //  ------------
  36 //
  37 //   6
  38 //   3                                                                  3 2 1 0
  39 //  +--------------------------------------------------------------------+-+-+-+
  40 //  |11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111|1|1|1|
  41 //  +--------------------------------------------------------------------+-+-+-+
  42 //  |                                                                    | | |
  43 //  |                                            2-2 Follow Flag (1-bit) * | |
  44 //  |                                                                      | |
  45 //  |                                       1-1 Partial Array Flag (1-bit) * |
  46 //  |                                                                        |
  47 //  |                                                 0-0 Final Flag (1-bit) *
  48 //  |
  49 //  * 63-3 Object Address (62-bits)
  50 //
  51 //
  52 //  Partial array entry
  53 //  -------------------
  54 //
  55 //   6                                 3  3
  56 //   3                                 2  1                               2 1 0
  57 //  +------------------------------------+---------------------------------+-+-+
  58 //  |11111111 11111111 11111111 11111111 |11111111 11111111 11111111 111111|1|1|
  59 //  +------------------------------------+---------------------------------+-+-+
  60 //  |                                    |                                 | |
  61 //  |                                    |  1-1 Partial Array Flag (1-bit) * |
  62 //  |                                    |                                   |
  63 //  |                                    |            0-0 Final Flag (1-bit) *
  64 //  |                                    |
  65 //  |                                    * 31-2 Partial Array Length (30-bits)
  66 //  |
  67 //  * 63-32 Partial Array Address Offset (32-bits)
  68 //
  69 
  70 class ZMarkStackEntry  {
  71 private:
  72   typedef ZBitField<uint64_t, bool,      0,  1>  field_finalizable;
  73   typedef ZBitField<uint64_t, bool,      1,  1>  field_partial_array;
  74   typedef ZBitField<uint64_t, bool,      2,  1>  field_follow;
  75   typedef ZBitField<uint64_t, uintptr_t, 3,  61> field_object_address;
  76   typedef ZBitField<uint64_t, size_t,    2,  30> field_partial_array_length;
  77   typedef ZBitField<uint64_t, size_t,    32, 32> field_partial_array_offset;
  78 
  79   uint64_t _entry;
  80 
  81 public:
  82   ZMarkStackEntry() {
  83     // This constructor is intentionally left empty and does not initialize
  84     // _entry to allow it to be optimized out when instantiating ZMarkStack,
  85     // which has a long array of ZMarkStackEntry elements, but doesn't care
  86     // what _entry is initialized to.
  87   }
  88 
  89   ZMarkStackEntry(uintptr_t object_address, bool follow, bool finalizable) :
  90       _entry(field_object_address::encode(object_address) |
  91              field_follow::encode(follow) |
  92              field_partial_array::encode(false) |
  93              field_finalizable::encode(finalizable)) {}
  94 
  95   ZMarkStackEntry(size_t partial_array_offset, size_t partial_array_length, bool finalizable) :
  96       _entry(field_partial_array_offset::encode(partial_array_offset) |
  97              field_partial_array_length::encode(partial_array_length) |
  98              field_partial_array::encode(true) |
  99              field_finalizable::encode(finalizable)) {}
 100 
 101   bool finalizable() const {
 102     return field_finalizable::decode(_entry);
 103   }
 104 
 105   bool partial_array() const {
 106     return field_partial_array::decode(_entry);
 107   }
 108 
 109   size_t partial_array_offset() const {
 110     return field_partial_array_offset::decode(_entry);
 111   }
 112 
 113   size_t partial_array_length() const {
 114     return field_partial_array_length::decode(_entry);
 115   }
 116 
 117   bool follow() const {
 118     return field_follow::decode(_entry);
 119   }
 120 
 121   uintptr_t object_address() const {
 122     return field_object_address::decode(_entry);
 123   }
 124 };
 125 
 126 #endif // SHARE_GC_Z_ZMARKSTACKENTRY_HPP
< prev index next >