test/hotspot/gtest/memory/test_chunkManager.cpp
author jwilhelm
Thu, 01 Feb 2018 02:05:35 +0100
changeset 48829 93de07994202
parent 47216 71c04702a3d5
child 49798 4bb2a92c13ea
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42594
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     1
/*
46333
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
     2
 * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
42594
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     4
 *
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     8
 *
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    13
 * accompanied this code).
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    14
 *
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    18
 *
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    21
 * questions.
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    22
 */
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    23
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    24
#include "precompiled.hpp"
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    25
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    26
// The test function is only available in debug builds
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    27
#ifdef ASSERT
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    28
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    29
#include "unittest.hpp"
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    30
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    31
void ChunkManager_test_list_index();
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    32
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    33
TEST(ChunkManager, list_index) {
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    34
  // The ChunkManager is only available in metaspace.cpp,
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    35
  // so the test code is located in that file.
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    36
  ChunkManager_test_list_index();
46333
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    37
42594
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    38
}
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    39
46333
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    40
extern void* setup_chunkmanager_returntests();
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    41
extern void teardown_chunkmanager_returntests(void*);
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    42
extern void run_chunkmanager_returntests(void* p, float phase_length_factor);
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    43
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    44
class ChunkManagerReturnTest : public ::testing::Test {
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    45
protected:
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    46
  void* _test;
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    47
  virtual void SetUp() {
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    48
    _test = setup_chunkmanager_returntests();
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    49
  }
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    50
  virtual void TearDown() {
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    51
    teardown_chunkmanager_returntests(_test);
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    52
  }
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    53
};
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    54
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    55
TEST_VM_F(ChunkManagerReturnTest, test00) { run_chunkmanager_returntests(_test, 0.0f); }
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    56
TEST_VM_F(ChunkManagerReturnTest, test05) { run_chunkmanager_returntests(_test, 0.5f); }
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    57
TEST_VM_F(ChunkManagerReturnTest, test10) { run_chunkmanager_returntests(_test, 1.0f); }
cef2c78aaa56 8170933: Cleanup Metaspace Chunk manager: Unify treatment of humongous and non-humongous chunks
stuefe
parents: 42594
diff changeset
    58
42594
1b274c848385 8169931: 8k class metaspace chunks misallocated from 4k chunk freelist​
stefank
parents:
diff changeset
    59
#endif // ASSERT