--- old/src/hotspot/share/gc/z/zPage.cpp 2020-05-18 23:08:32.366755796 +0200 +++ new/src/hotspot/share/gc/z/zPage.cpp 2020-05-18 23:08:32.107747394 +0200 @@ -1,5 +1,5 @@ /* - * 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 @@ -58,6 +58,7 @@ 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)), @@ -99,6 +100,25 @@ 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(),