test/hotspot/gtest/gc/z/test_zVirtualMemory.cpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 54834 39ba09047e19
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     1
/*
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
50975
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     4
 *
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     7
 * published by the Free Software Foundation.
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     8
 *
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    13
 * accompanied this code).
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    14
 *
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    18
 *
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b833992fa8fa 8206322: ZGC: Incorrect license header in gtests
pliden
parents: 50525
diff changeset
    21
 * questions.
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    22
 */
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    23
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    24
#include "precompiled.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    25
#include "gc/z/zVirtualMemory.inline.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    26
#include "unittest.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    27
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    28
TEST(ZVirtualMemory, split) {
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    29
  ZVirtualMemory vmem(0, 10);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    30
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    31
  ZVirtualMemory vmem0 = vmem.split(0);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    32
  EXPECT_EQ(vmem0.size(), 0u);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    33
  EXPECT_EQ(vmem.size(), 10u);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    34
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    35
  ZVirtualMemory vmem1 = vmem.split(5);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    36
  EXPECT_EQ(vmem1.size(), 5u);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    37
  EXPECT_EQ(vmem.size(), 5u);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    38
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    39
  ZVirtualMemory vmem2 = vmem.split(5);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    40
  EXPECT_EQ(vmem2.size(), 5u);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    41
  EXPECT_EQ(vmem.size(), 0u);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    42
54834
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    43
  ZVirtualMemory vmem3 = vmem.split(0);
39ba09047e19 8222480: Implementation: JEP 351: ZGC: Uncommit Unused Memory
pliden
parents: 50975
diff changeset
    44
  EXPECT_EQ(vmem3.size(), 0u);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    45
}