< prev index next >
test/hotspot/gtest/metaspace/test_metaspace_misc.cpp
Print this page
rev 60811 : imported patch jep387-all.patch
rev 60812 : [mq]: diff1
@@ -1,8 +1,8 @@
/*
- * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2018, 2020 SAP SE. All rights reserved.
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020 SAP SE. 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.
@@ -23,16 +23,22 @@
*
*/
#include "precompiled.hpp"
-// #define LOG_PLEASE
#include "classfile/classLoaderData.hpp"
-#include "metaspaceTestsCommon.hpp"
+#include "memory/metaspace/msChunklevel.hpp"
+#include "memory/metaspace/msSettings.hpp"
#include "utilities/powerOfTwo.hpp"
+// #define LOG_PLEASE
+#include "metaspaceGtestCommon.hpp"
+
+using metaspace::chunklevel_t;
+using namespace metaspace::chunklevel;
+using metaspace::Settings;
TEST_VM(metaspace, misc_sizes) {
// Test test common sizes (seems primitive but breaks surprisingly often during development
// because of word vs byte confusion)
@@ -47,11 +53,10 @@
ASSERT_EQ(Settings::virtual_space_node_reserve_alignment_words(),
Metaspace::reserve_alignment_words());
}
-
TEST_VM(metaspace, misc_max_alloc_size) {
// Make sure we can allocate what we promise to allocate
const size_t sz = Metaspace::max_allocation_word_size();
ClassLoaderData* cld = ClassLoaderData::the_null_class_loader_data();
@@ -61,10 +66,12 @@
}
TEST_VM(metaspace, chunklevel_utils) {
+ // These tests seem to be really basic, but it is amazing what one can
+ // break accidentally...
LOG(SIZE_FORMAT, MAX_CHUNK_BYTE_SIZE);
LOG(SIZE_FORMAT, MIN_CHUNK_BYTE_SIZE);
LOG(SIZE_FORMAT, MIN_CHUNK_WORD_SIZE);
LOG(SIZE_FORMAT, MAX_CHUNK_WORD_SIZE);
LOG(SIZE_FORMAT, MAX_CHUNK_BYTE_SIZE);
@@ -96,12 +103,11 @@
EXPECT_EQ(level_fitting_word_size(MAX_CHUNK_WORD_SIZE), ROOT_CHUNK_LEVEL);
EXPECT_EQ(level_fitting_word_size(MAX_CHUNK_WORD_SIZE - 1), ROOT_CHUNK_LEVEL);
EXPECT_EQ(level_fitting_word_size((MAX_CHUNK_WORD_SIZE / 2) + 1), ROOT_CHUNK_LEVEL);
EXPECT_EQ(level_fitting_word_size(MAX_CHUNK_WORD_SIZE / 2), ROOT_CHUNK_LEVEL + 1);
- EXPECT_EQ(level_fitting_word_size(8 * K), CHUNK_LEVEL_64K);
- EXPECT_EQ(level_fitting_word_size(8 * K + 13), CHUNK_LEVEL_64K - 1);
- EXPECT_EQ(level_fitting_word_size(8 * K - 13), CHUNK_LEVEL_64K);
-
+ EXPECT_EQ(level_fitting_word_size(8 * K), LP64_ONLY(CHUNK_LEVEL_64K) NOT_LP64(CHUNK_LEVEL_32K));
+ EXPECT_EQ(level_fitting_word_size(8 * K + 13), LP64_ONLY(CHUNK_LEVEL_64K) NOT_LP64(CHUNK_LEVEL_32K) - 1);
+ EXPECT_EQ(level_fitting_word_size(8 * K - 13), LP64_ONLY(CHUNK_LEVEL_64K) NOT_LP64(CHUNK_LEVEL_32K));
}
< prev index next >