< prev index next >

src/hotspot/share/gc/z/zPage.inline.hpp

Print this page




  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_ZPAGE_INLINE_HPP
  25 #define SHARE_GC_Z_ZPAGE_INLINE_HPP
  26 
  27 #include "gc/z/zAddress.inline.hpp"
  28 #include "gc/z/zGlobals.hpp"
  29 #include "gc/z/zLiveMap.inline.hpp"
  30 #include "gc/z/zMark.hpp"
  31 #include "gc/z/zNUMA.hpp"
  32 #include "gc/z/zPage.hpp"
  33 #include "gc/z/zPhysicalMemory.inline.hpp"
  34 #include "gc/z/zVirtualMemory.inline.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "runtime/atomic.hpp"
  37 #include "runtime/orderAccess.hpp"
  38 #include "utilities/align.hpp"
  39 #include "utilities/debug.hpp"
  40 













  41 inline const char* ZPage::type_to_string() const {
  42   switch (type()) {
  43   case ZPageTypeSmall:
  44     return "Small";
  45 
  46   case ZPageTypeMedium:
  47     return "Medium";
  48 
  49   default:
  50     assert(type() == ZPageTypeLarge, "Invalid page type");
  51     return "Large";
  52   }
  53 }
  54 
  55 inline uint32_t ZPage::object_max_count() const {
  56   switch (type()) {
  57   case ZPageTypeLarge:
  58     // A large page can only contain a single
  59     // object aligned to the start of the page.
  60     return 1;


  99 inline uintptr_t ZPage::start() const {
 100   return _virtual.start();
 101 }
 102 
 103 inline uintptr_t ZPage::end() const {
 104   return _virtual.end();
 105 }
 106 
 107 inline size_t ZPage::size() const {
 108   return _virtual.size();
 109 }
 110 
 111 inline uintptr_t ZPage::top() const {
 112   return _top;
 113 }
 114 
 115 inline size_t ZPage::remaining() const {
 116   return end() - top();
 117 }
 118 
 119 inline ZPhysicalMemory& ZPage::physical_memory() {
 120   return _physical;
 121 }
 122 
 123 inline const ZVirtualMemory& ZPage::virtual_memory() const {
 124   return _virtual;








 125 }
 126 
 127 inline uint8_t ZPage::numa_id() {
 128   if (_numa_id == (uint8_t)-1) {
 129     _numa_id = (uint8_t)ZNUMA::memory_id(ZAddress::good(start()));
 130   }
 131 
 132   return _numa_id;
 133 }
 134 
 135 inline bool ZPage::is_in(uintptr_t addr) const {
 136   const uintptr_t offset = ZAddress::offset(addr);
 137   return offset >= start() && offset < top();
 138 }
 139 
 140 inline uintptr_t ZPage::block_start(uintptr_t addr) const {
 141   if (block_is_obj(addr)) {
 142     return addr;
 143   } else {
 144     return ZAddress::good(top());




  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_ZPAGE_INLINE_HPP
  25 #define SHARE_GC_Z_ZPAGE_INLINE_HPP
  26 
  27 #include "gc/z/zAddress.inline.hpp"
  28 #include "gc/z/zGlobals.hpp"
  29 #include "gc/z/zLiveMap.inline.hpp"
  30 #include "gc/z/zMark.hpp"
  31 #include "gc/z/zNUMA.hpp"
  32 #include "gc/z/zPage.hpp"
  33 #include "gc/z/zPhysicalMemory.inline.hpp"
  34 #include "gc/z/zVirtualMemory.inline.hpp"
  35 #include "oops/oop.inline.hpp"
  36 #include "runtime/atomic.hpp"
  37 #include "runtime/os.hpp"
  38 #include "utilities/align.hpp"
  39 #include "utilities/debug.hpp"
  40 
  41 inline uint8_t ZPage::type_from_size(size_t size) const {
  42   switch (size) {
  43   case ZPageSizeSmall:
  44     return ZPageTypeSmall;
  45 
  46   case ZPageSizeMedium:
  47     return ZPageTypeMedium;
  48 
  49   default:
  50     return ZPageTypeLarge;
  51   }
  52 }
  53 
  54 inline const char* ZPage::type_to_string() const {
  55   switch (type()) {
  56   case ZPageTypeSmall:
  57     return "Small";
  58 
  59   case ZPageTypeMedium:
  60     return "Medium";
  61 
  62   default:
  63     assert(type() == ZPageTypeLarge, "Invalid page type");
  64     return "Large";
  65   }
  66 }
  67 
  68 inline uint32_t ZPage::object_max_count() const {
  69   switch (type()) {
  70   case ZPageTypeLarge:
  71     // A large page can only contain a single
  72     // object aligned to the start of the page.
  73     return 1;


 112 inline uintptr_t ZPage::start() const {
 113   return _virtual.start();
 114 }
 115 
 116 inline uintptr_t ZPage::end() const {
 117   return _virtual.end();
 118 }
 119 
 120 inline size_t ZPage::size() const {
 121   return _virtual.size();
 122 }
 123 
 124 inline uintptr_t ZPage::top() const {
 125   return _top;
 126 }
 127 
 128 inline size_t ZPage::remaining() const {
 129   return end() - top();
 130 }
 131 
 132 inline const ZPhysicalMemory& ZPage::physical_memory() const {
 133   return _physical;
 134 }
 135 
 136 inline const ZVirtualMemory& ZPage::virtual_memory() const {
 137   return _virtual;
 138 }
 139 
 140 inline uint64_t ZPage::last_used() const {
 141   return _last_used;
 142 }
 143 
 144 inline void ZPage::set_last_used() {
 145   _last_used = os::elapsedTime();
 146 }
 147 
 148 inline uint8_t ZPage::numa_id() {
 149   if (_numa_id == (uint8_t)-1) {
 150     _numa_id = (uint8_t)ZNUMA::memory_id(ZAddress::good(start()));
 151   }
 152 
 153   return _numa_id;
 154 }
 155 
 156 inline bool ZPage::is_in(uintptr_t addr) const {
 157   const uintptr_t offset = ZAddress::offset(addr);
 158   return offset >= start() && offset < top();
 159 }
 160 
 161 inline uintptr_t ZPage::block_start(uintptr_t addr) const {
 162   if (block_is_obj(addr)) {
 163     return addr;
 164   } else {
 165     return ZAddress::good(top());


< prev index next >