< prev index next >

src/hotspot/share/gc/z/zPage.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -56,10 +56,11 @@
 ZPage::~ZPage() {}
 
 void ZPage::assert_initialized() const {
   assert(!_virtual.is_null(), "Should not be null");
   assert(!_physical.is_null(), "Should not be null");
+  assert(_virtual.size() == _physical.size(), "Virtual/Physical size mismatch");
   assert((_type == ZPageTypeSmall && size() == ZPageSizeSmall) ||
          (_type == ZPageTypeMedium && size() == ZPageSizeMedium) ||
          (_type == ZPageTypeLarge && is_aligned(size(), ZGranuleSize)),
          "Page type/size mismatch");
 }

@@ -97,10 +98,29 @@
   page->_seqnum = _seqnum;
   page->_last_used = _last_used;
   return page;
 }
 
+ZPage* ZPage::split_committed() {
+  const ZPhysicalMemory pmem = _physical.split_committed();
+  if (pmem.is_null()) {
+    // Nothing committed
+    return NULL;
+  }
+
+  assert(!_physical.is_null(), "Should not be null");
+
+  // Resize this page
+  const ZVirtualMemory vmem = _virtual.split(pmem.size());
+  _type = type_from_size(_virtual.size());
+  _top = start();
+  _livemap.resize(object_max_count());
+
+  // Create new page
+  return new ZPage(vmem, pmem);
+}
+
 void ZPage::print_on(outputStream* out) const {
   out->print_cr(" %-6s  " PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT " %s%s",
                 type_to_string(), start(), top(), end(),
                 is_allocating()  ? " Allocating"  : "",
                 is_relocatable() ? " Relocatable" : "");
< prev index next >