Path: blob/master/test/hotspot/jtreg/compiler/jvmci/compilerToVM/ReadConfigurationTest.java
41153 views
/*1* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 813642126* @requires vm.jvmci27* @library / /test/lib28* @library ../common/patches29* @modules java.base/jdk.internal.misc30* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot31* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper32* @build compiler.jvmci.compilerToVM.ReadConfigurationTest33* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI34* -XX:-UseJVMCICompiler35* compiler.jvmci.compilerToVM.ReadConfigurationTest36*/3738package compiler.jvmci.compilerToVM;3940import jdk.test.lib.Asserts;41import jdk.vm.ci.hotspot.VMField;42import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;43import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;44import jdk.vm.ci.hotspot.HotSpotVMConfigStore;45import jdk.vm.ci.hotspot.VMIntrinsicMethod;4647public class ReadConfigurationTest {48public static void main(String args[]) {49new ReadConfigurationTest().runTest();50}5152private void runTest() {53HotSpotVMConfigStore store = HotSpotJVMCIRuntime.runtime().getConfigStore();54TestHotSpotVMConfig config = new TestHotSpotVMConfig(store);55Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address");56Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address");5758for (VMField field : store.getFields().values()) {59Object value = field.value;60if (value != null) {61Asserts.assertTrue(value instanceof Long || value instanceof Boolean,62"Got unexpected value type for VM field " + field.name + ": " + value.getClass());63}64}6566for (VMIntrinsicMethod m : config.getStore().getIntrinsics()) {67Asserts.assertNotNull(m);68Asserts.assertNotNull(m.declaringClass);69Asserts.assertFalse(m.declaringClass.contains("."),70"declaringClass should be in class file format: " + m.declaringClass);71Asserts.assertNotNull(m.name);72Asserts.assertNotNull(m.descriptor);73Asserts.assertTrue(m.id > 0);74}75}7677private static class TestHotSpotVMConfig extends HotSpotVMConfigAccess {7879private TestHotSpotVMConfig(HotSpotVMConfigStore store) {80super(store);81}8283final long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class);84final long stubRoutineJintArrayCopy = getFieldValue("StubRoutines::_jint_arraycopy", Long.class);85}86}878889