annotate test/hotspot/gtest/gc/z/test_zVirtualMemory.cpp @ 50525:767cdb97f103

8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental) Reviewed-by: pliden, stefank, eosterlund, ehelin, sjohanss, rbackman, coleenp, ihse, jgeorge, lmesnik, rkennke Contributed-by: per.liden@oracle.com, stefan.karlsson@oracle.com, erik.osterlund@oracle.com, mikael.gerdin@oracle.com, kim.barrett@oracle.com, nils.eliasson@oracle.com, rickard.backman@oracle.com, rwestrel@redhat.com, coleen.phillimore@oracle.com, robbin.ehn@oracle.com, gerard.ziemski@oracle.com, hugh.wilkinson@intel.com, sandhya.viswanathan@intel.com, bill.npo.wheeler@intel.com, vinay.k.awasthi@intel.com, yasuenag@gmail.com
author pliden
date Tue, 12 Jun 2018 17:40:28 +0200
parents
children b833992fa8fa
rev   line source
pliden@50525 1 /*
pliden@50525 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
pliden@50525 3 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
pliden@50525 4 */
pliden@50525 5
pliden@50525 6 #include "precompiled.hpp"
pliden@50525 7 #include "gc/z/zVirtualMemory.inline.hpp"
pliden@50525 8 #include "utilities/debug.hpp"
pliden@50525 9 #include "unittest.hpp"
pliden@50525 10
pliden@50525 11 TEST(ZVirtualMemory, split) {
pliden@50525 12 const size_t PageSize = 2 * M;
pliden@50525 13
pliden@50525 14 ZVirtualMemory mem(0, 10 * PageSize);
pliden@50525 15
pliden@50525 16 ZVirtualMemory mem_split0 = mem.split(0 * PageSize);
pliden@50525 17 EXPECT_EQ(mem_split0.size(), 0 * PageSize);
pliden@50525 18 EXPECT_EQ( mem.size(), 10 * PageSize);
pliden@50525 19
pliden@50525 20 ZVirtualMemory mem_split1 = mem.split(5u * PageSize);
pliden@50525 21 EXPECT_EQ(mem_split1.size(), 5 * PageSize);
pliden@50525 22 EXPECT_EQ( mem.size(), 5 * PageSize);
pliden@50525 23
pliden@50525 24 ZVirtualMemory mem_split2 = mem.split(5u * PageSize);
pliden@50525 25 EXPECT_EQ(mem_split2.size(), 5 * PageSize);
pliden@50525 26 EXPECT_EQ( mem.size(), 0 * PageSize);
pliden@50525 27
pliden@50525 28 ZVirtualMemory mem_split3 = mem.split(0 * PageSize);
pliden@50525 29 EXPECT_EQ(mem_split3.size(), 0 * PageSize);
pliden@50525 30 }