Mercurial > hg > graal-jvmci-8
changeset 23679:b5557b757040
fix HotSpotVMConfig startup performance (JDK-8159167)
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Wed Jun 15 00:00:41 2016 +0200 @@ -38,24 +38,23 @@ import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; import jdk.vm.ci.hotspot.HotSpotStackIntrospection; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.runtime.JVMCIBackend; public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { - protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") HotSpotVMConfig config) { + protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { // Configure the feature set using the HotSpot flag settings. EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class); return features; } - protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") HotSpotVMConfig config) { + protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class); return flags; } - protected TargetDescription createTarget(HotSpotVMConfig config) { + protected TargetDescription createTarget(AArch64HotSpotVMConfig config) { final int stackFrameAlignment = 16; final int implicitNullCheckLimit = 4096; final boolean inlineObjects = true; @@ -67,8 +66,8 @@ return new HotSpotConstantReflectionProvider(runtime); } - protected RegisterConfig createRegisterConfig(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target) { - return new AArch64HotSpotRegisterConfig(target, runtime.getConfig()); + protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) { + return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops); } protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { @@ -93,7 +92,8 @@ public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { assert host == null; - TargetDescription target = createTarget(runtime.getConfig()); + AArch64HotSpotVMConfig config = new AArch64HotSpotVMConfig(runtime.getConfigStore()); + TargetDescription target = createTarget(config); RegisterConfig regConfig; HotSpotCodeCacheProvider codeCache; @@ -105,7 +105,7 @@ metaAccess = createMetaAccess(runtime); } try (InitTimer rt = timer("create RegisterConfig")) { - regConfig = createRegisterConfig(runtime, target); + regConfig = createRegisterConfig(config, target); } try (InitTimer rt = timer("create CodeCache provider")) { codeCache = createCodeCache(runtime, target, regConfig);
--- a/jvmci/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotRegisterConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -67,7 +67,6 @@ import jdk.vm.ci.code.ValueKindFactory; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; @@ -154,8 +153,8 @@ return registers; } - public AArch64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) { - this(target, initAllocatable(target.arch, config.useCompressedOops)); + public AArch64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops) { + this(target, initAllocatable(target.arch, useCompressedOops)); assert callerSaved.length >= allocatable.length; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.aarch64; + +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; +import jdk.vm.ci.hotspot.HotSpotVMConfigStore; + +/** + * Used to access native configuration details. + * + * All non-static, public fields in this class are so that they can be compiled as constants. + */ +public class AArch64HotSpotVMConfig extends HotSpotVMConfigAccess { + + public AArch64HotSpotVMConfig(HotSpotVMConfigStore config) { + super(config); + } + + /** + * Maximum allowed size of allocated area for a frame. + */ + public final int maxFrameSize = 16 * 1024; + + public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux"); + + public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); +}
--- a/jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Wed Jun 15 00:00:41 2016 +0200 @@ -38,64 +38,72 @@ import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; import jdk.vm.ci.hotspot.HotSpotStackIntrospection; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.runtime.JVMCIBackend; public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { - protected EnumSet<AMD64.CPUFeature> computeFeatures(HotSpotVMConfig config) { + protected EnumSet<AMD64.CPUFeature> computeFeatures(AMD64HotSpotVMConfig config) { // Configure the feature set using the HotSpot flag settings. EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class); - if ((config.x86CPUFeatures & config.cpu3DNOWPREFETCH) != 0) { + if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) { features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH); } assert config.useSSE >= 2 : "minimum config for x64"; features.add(AMD64.CPUFeature.SSE); features.add(AMD64.CPUFeature.SSE2); - if ((config.x86CPUFeatures & config.cpuSSE3) != 0) { + if ((config.vmVersionFeatures & config.amd64SSE3) != 0) { features.add(AMD64.CPUFeature.SSE3); } - if ((config.x86CPUFeatures & config.cpuSSSE3) != 0) { + if ((config.vmVersionFeatures & config.amd64SSSE3) != 0) { features.add(AMD64.CPUFeature.SSSE3); } - if ((config.x86CPUFeatures & config.cpuSSE4A) != 0) { + if ((config.vmVersionFeatures & config.amd64SSE4A) != 0) { features.add(AMD64.CPUFeature.SSE4A); } - if ((config.x86CPUFeatures & config.cpuSSE41) != 0) { + if ((config.vmVersionFeatures & config.amd64SSE41) != 0) { features.add(AMD64.CPUFeature.SSE4_1); } - if ((config.x86CPUFeatures & config.cpuSSE42) != 0) { + if ((config.vmVersionFeatures & config.amd64SSE42) != 0) { features.add(AMD64.CPUFeature.SSE4_2); } - if ((config.x86CPUFeatures & config.cpuPOPCNT) != 0) { + if ((config.vmVersionFeatures & config.amd64POPCNT) != 0) { features.add(AMD64.CPUFeature.POPCNT); } - if ((config.x86CPUFeatures & config.cpuLZCNT) != 0) { + if ((config.vmVersionFeatures & config.amd64LZCNT) != 0) { features.add(AMD64.CPUFeature.LZCNT); } - if ((config.x86CPUFeatures & config.cpuERMS) != 0) { + if ((config.vmVersionFeatures & config.amd64ERMS) != 0) { features.add(AMD64.CPUFeature.ERMS); } - if ((config.x86CPUFeatures & config.cpuAVX) != 0) { + if ((config.vmVersionFeatures & config.amd64AVX) != 0) { features.add(AMD64.CPUFeature.AVX); } - if ((config.x86CPUFeatures & config.cpuAVX2) != 0) { + if ((config.vmVersionFeatures & config.amd64AVX2) != 0) { features.add(AMD64.CPUFeature.AVX2); } - if ((config.x86CPUFeatures & config.cpuAES) != 0) { + if ((config.vmVersionFeatures & config.amd64AES) != 0) { features.add(AMD64.CPUFeature.AES); } - if ((config.x86CPUFeatures & config.cpu3DNOWPREFETCH) != 0) { + if ((config.vmVersionFeatures & config.amd643DNOWPREFETCH) != 0) { features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH); } - if ((config.x86CPUFeatures & config.cpuBMI1) != 0) { + if ((config.vmVersionFeatures & config.amd64BMI1) != 0) { features.add(AMD64.CPUFeature.BMI1); } + if ((config.vmVersionFeatures & config.amd64BMI2) != 0) { + features.add(AMD64.CPUFeature.BMI2); + } + if ((config.vmVersionFeatures & config.amd64RTM) != 0) { + features.add(AMD64.CPUFeature.RTM); + } + if ((config.vmVersionFeatures & config.amd64ADX) != 0) { + features.add(AMD64.CPUFeature.ADX); + } return features; } - protected EnumSet<AMD64.Flag> computeFlags(HotSpotVMConfig config) { + protected EnumSet<AMD64.Flag> computeFlags(AMD64HotSpotVMConfig config) { EnumSet<AMD64.Flag> flags = EnumSet.noneOf(AMD64.Flag.class); if (config.useCountLeadingZerosInstruction) { flags.add(AMD64.Flag.UseCountLeadingZerosInstruction); @@ -106,7 +114,7 @@ return flags; } - protected TargetDescription createTarget(HotSpotVMConfig config) { + protected TargetDescription createTarget(AMD64HotSpotVMConfig config) { final int stackFrameAlignment = 16; final int implicitNullCheckLimit = 4096; final boolean inlineObjects = true; @@ -118,8 +126,8 @@ return new HotSpotConstantReflectionProvider(runtime); } - protected RegisterConfig createRegisterConfig(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target) { - return new AMD64HotSpotRegisterConfig(target, runtime.getConfig()); + protected RegisterConfig createRegisterConfig(AMD64HotSpotVMConfig config, TargetDescription target) { + return new AMD64HotSpotRegisterConfig(target, config.useCompressedOops, config.windowsOs); } protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) { @@ -142,9 +150,9 @@ @SuppressWarnings("try") public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { - assert host == null; - TargetDescription target = createTarget(runtime.getConfig()); + AMD64HotSpotVMConfig config = new AMD64HotSpotVMConfig(runtime.getConfigStore()); + TargetDescription target = createTarget(config); RegisterConfig regConfig; HotSpotCodeCacheProvider codeCache; @@ -156,7 +164,7 @@ metaAccess = createMetaAccess(runtime); } try (InitTimer rt = timer("create RegisterConfig")) { - regConfig = createRegisterConfig(runtime, target); + regConfig = createRegisterConfig(config, target); } try (InitTimer rt = timer("create CodeCache provider")) { codeCache = createCodeCache(runtime, target, regConfig);
--- a/jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -59,7 +59,6 @@ import jdk.vm.ci.code.ValueKindFactory; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; @@ -140,15 +139,15 @@ return registers; } - public AMD64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) { - this(target, config, initAllocatable(target.arch, config.useCompressedOops)); + public AMD64HotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops, boolean windowsOs) { + this(target, initAllocatable(target.arch, useCompressedOops), windowsOs); assert callerSaved.length >= allocatable.length; } - public AMD64HotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config, Register[] allocatable) { + public AMD64HotSpotRegisterConfig(TargetDescription target, Register[] allocatable, boolean windowsOs) { this.target = target; - if (config.windowsOs) { + if (windowsOs) { javaGeneralParameterRegisters = new Register[]{rdx, r8, r9, rdi, rsi, rcx}; nativeGeneralParameterRegisters = new Register[]{rcx, rdx, r8, r9}; this.needsNativeStackHomeSpace = true;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotVMConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.amd64; + +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; +import jdk.vm.ci.hotspot.HotSpotVMConfigStore; + +public class AMD64HotSpotVMConfig extends HotSpotVMConfigAccess { + + public AMD64HotSpotVMConfig(HotSpotVMConfigStore config) { + super(config); + } + + /** + * Maximum allowed size of allocated area for a frame. + */ + public final int maxFrameSize = 16 * 1024; + + public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows"); + + public final boolean useCountLeadingZerosInstruction = getFlag("UseCountLeadingZerosInstruction", Boolean.class); + public final boolean useCountTrailingZerosInstruction = getFlag("UseCountTrailingZerosInstruction", Boolean.class); + public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); + + // CPU capabilities + public final int useSSE = getFlag("UseSSE", Integer.class); + public final int useAVX = getFlag("UseAVX", Integer.class); + + public final long vmVersionFeatures = getFieldValue("VM_Version::_cpuFeatures", Long.class, "int"); + + // CPU feature flags + public final long amd64CX8 = getConstant("VM_Version::CPU_CX8", Long.class); + public final long amd64CMOV = getConstant("VM_Version::CPU_CMOV", Long.class); + public final long amd64FXSR = getConstant("VM_Version::CPU_FXSR", Long.class); + public final long amd64HT = getConstant("VM_Version::CPU_HT", Long.class); + public final long amd64MMX = getConstant("VM_Version::CPU_MMX", Long.class); + public final long amd643DNOWPREFETCH = getConstant("VM_Version::CPU_3DNOW_PREFETCH", Long.class); + public final long amd64SSE = getConstant("VM_Version::CPU_SSE", Long.class); + public final long amd64SSE2 = getConstant("VM_Version::CPU_SSE2", Long.class); + public final long amd64SSE3 = getConstant("VM_Version::CPU_SSE3", Long.class); + public final long amd64SSSE3 = getConstant("VM_Version::CPU_SSSE3", Long.class); + public final long amd64SSE4A = getConstant("VM_Version::CPU_SSE4A", Long.class); + public final long amd64SSE41 = getConstant("VM_Version::CPU_SSE4_1", Long.class); + public final long amd64SSE42 = getConstant("VM_Version::CPU_SSE4_2", Long.class); + public final long amd64POPCNT = getConstant("VM_Version::CPU_POPCNT", Long.class); + public final long amd64LZCNT = getConstant("VM_Version::CPU_LZCNT", Long.class); + public final long amd64TSC = getConstant("VM_Version::CPU_TSC", Long.class); + public final long amd64TSCINV = getConstant("VM_Version::CPU_TSCINV", Long.class); + public final long amd64AVX = getConstant("VM_Version::CPU_AVX", Long.class); + public final long amd64AVX2 = getConstant("VM_Version::CPU_AVX2", Long.class); + public final long amd64AES = getConstant("VM_Version::CPU_AES", Long.class); + public final long amd64ERMS = getConstant("VM_Version::CPU_ERMS", Long.class); + public final long amd64CLMUL = getConstant("VM_Version::CPU_CLMUL", Long.class); + public final long amd64BMI1 = getConstant("VM_Version::CPU_BMI1", Long.class); + public final long amd64BMI2 = getConstant("VM_Version::CPU_BMI2", Long.class); + public final long amd64RTM = getConstant("VM_Version::CPU_RTM", Long.class); + public final long amd64ADX = getConstant("VM_Version::CPU_ADX", Long.class); +}
--- a/jvmci/jdk.vm.ci.hotspot.jfr/src/jdk/vm/ci/hotspot/jfr/events/JFREventProvider.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.jfr/src/jdk/vm/ci/hotspot/jfr/events/JFREventProvider.java Wed Jun 15 00:00:41 2016 +0200 @@ -22,10 +22,10 @@ */ package jdk.vm.ci.hotspot.jfr.events; -import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; - import java.net.URISyntaxException; +import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; import jdk.vm.ci.hotspot.services.EventProvider; /** @@ -46,7 +46,8 @@ @SuppressWarnings("unused") private final com.oracle.jrockit.jfr.Producer producer; public JFREventProvider() { - enabled = config().flightRecorder; + HotSpotVMConfigAccess config = new HotSpotVMConfigAccess(HotSpotJVMCIRuntime.runtime().getConfigStore()); + enabled = config.getFlag("FightRecorder", Boolean.class, false); com.oracle.jrockit.jfr.Producer p = null; if (enabled) { try {
--- a/jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Wed Jun 15 00:00:41 2016 +0200 @@ -37,14 +37,13 @@ import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider; import jdk.vm.ci.hotspot.HotSpotStackIntrospection; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.runtime.JVMCIBackend; import jdk.vm.ci.sparc.SPARC; import jdk.vm.ci.sparc.SPARC.CPUFeature; public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory { - protected TargetDescription createTarget(HotSpotVMConfig config) { + protected TargetDescription createTarget(SPARCHotSpotVMConfig config) { final int stackFrameAlignment = 16; final int implicitNullCheckLimit = 4096; final boolean inlineObjects = false; @@ -56,75 +55,75 @@ return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig); } - protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) { + protected EnumSet<CPUFeature> computeFeatures(SPARCHotSpotVMConfig config) { EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class); - if ((config.sparcFeatures & config.vis1Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcVis1Instructions) != 0) { features.add(CPUFeature.VIS1); } - if ((config.sparcFeatures & config.vis2Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcVis2Instructions) != 0) { features.add(CPUFeature.VIS2); } - if ((config.sparcFeatures & config.vis3Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcVis3Instructions) != 0) { features.add(CPUFeature.VIS3); } - if ((config.sparcFeatures & config.cbcondInstructions) != 0) { + if ((config.vmVersionFeatures & config.sparcCbcondInstructions) != 0) { features.add(CPUFeature.CBCOND); } - if ((config.sparcFeatures & config.v8Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcV8Instructions) != 0) { features.add(CPUFeature.V8); } - if ((config.sparcFeatures & config.hardwareMul32) != 0) { + if ((config.vmVersionFeatures & config.sparcHardwareMul32) != 0) { features.add(CPUFeature.HARDWARE_MUL32); } - if ((config.sparcFeatures & config.hardwareDiv32) != 0) { + if ((config.vmVersionFeatures & config.sparcHardwareDiv32) != 0) { features.add(CPUFeature.HARDWARE_DIV32); } - if ((config.sparcFeatures & config.hardwareFsmuld) != 0) { + if ((config.vmVersionFeatures & config.sparcHardwareFsmuld) != 0) { features.add(CPUFeature.HARDWARE_FSMULD); } - if ((config.sparcFeatures & config.hardwarePopc) != 0) { + if ((config.vmVersionFeatures & config.sparcHardwarePopc) != 0) { features.add(CPUFeature.HARDWARE_POPC); } - if ((config.sparcFeatures & config.v9Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcV9Instructions) != 0) { features.add(CPUFeature.V9); } - if ((config.sparcFeatures & config.sun4v) != 0) { + if ((config.vmVersionFeatures & config.sparcSun4v) != 0) { features.add(CPUFeature.SUN4V); } - if ((config.sparcFeatures & config.blkInitInstructions) != 0) { + if ((config.vmVersionFeatures & config.sparcBlkInitInstructions) != 0) { features.add(CPUFeature.BLK_INIT_INSTRUCTIONS); } - if ((config.sparcFeatures & config.fmafInstructions) != 0) { + if ((config.vmVersionFeatures & config.sparcFmafInstructions) != 0) { features.add(CPUFeature.FMAF); } - if ((config.sparcFeatures & config.fmauInstructions) != 0) { + if ((config.vmVersionFeatures & config.sparcFmauInstructions) != 0) { features.add(CPUFeature.FMAU); } - if ((config.sparcFeatures & config.sparc64Family) != 0) { + if ((config.vmVersionFeatures & config.sparcSparc64Family) != 0) { features.add(CPUFeature.SPARC64_FAMILY); } - if ((config.sparcFeatures & config.mFamily) != 0) { + if ((config.vmVersionFeatures & config.sparcMFamily) != 0) { features.add(CPUFeature.M_FAMILY); } - if ((config.sparcFeatures & config.tFamily) != 0) { + if ((config.vmVersionFeatures & config.sparcTFamily) != 0) { features.add(CPUFeature.T_FAMILY); } - if ((config.sparcFeatures & config.t1Model) != 0) { + if ((config.vmVersionFeatures & config.sparcT1Model) != 0) { features.add(CPUFeature.T1_MODEL); } - if ((config.sparcFeatures & config.sparc5Instructions) != 0) { + if ((config.vmVersionFeatures & config.sparcSparc5Instructions) != 0) { features.add(CPUFeature.SPARC5); } - if ((config.sparcFeatures & config.aesInstructions) != 0) { + if ((config.vmVersionFeatures & config.sparcAesInstructions) != 0) { features.add(CPUFeature.SPARC64_FAMILY); } - if ((config.sparcFeatures & config.sha1Instruction) != 0) { + if ((config.vmVersionFeatures & config.sparcSha1Instruction) != 0) { features.add(CPUFeature.SHA1); } - if ((config.sparcFeatures & config.sha256Instruction) != 0) { + if ((config.vmVersionFeatures & config.sparcSha256Instruction) != 0) { features.add(CPUFeature.SHA256); } - if ((config.sparcFeatures & config.sha512Instruction) != 0) { + if ((config.vmVersionFeatures & config.sparcSha512Instruction) != 0) { features.add(CPUFeature.SHA512); } return features; @@ -143,10 +142,11 @@ @SuppressWarnings("try") public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) { assert host == null; - TargetDescription target = createTarget(runtime.getConfig()); + SPARCHotSpotVMConfig config = new SPARCHotSpotVMConfig(runtime.getConfigStore()); + TargetDescription target = createTarget(config); HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime); - RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig()); + RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, config.useCompressedOops, config.linuxOs); HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig); HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime); StackIntrospection stackIntrospection = new HotSpotStackIntrospection(runtime);
--- a/jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -81,7 +81,6 @@ import jdk.vm.ci.code.ValueKindFactory; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; @@ -134,7 +133,8 @@ private final Register[] callerSaveRegisters; /** - * This lists all L and I registers which are saved in the register window. + * Registers saved by the callee. This lists all L and I registers which are saved in the + * register window. */ private final Register[] windowSaveRegisters = { l0, l1, l2, l3, l4, l5, l6, l7, @@ -166,14 +166,14 @@ return registers; } - public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) { - this(target, initAllocatable(target.arch, config.useCompressedOops), config); + public SPARCHotSpotRegisterConfig(TargetDescription target, boolean useCompressedOops, boolean linuxOs) { + this(target, initAllocatable(target.arch, useCompressedOops), linuxOs); } - public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable, HotSpotVMConfig config) { + public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable, boolean linuxOs) { this.target = target; this.allocatable = allocatable.clone(); - this.addNativeRegisterArgumentSlots = config.linuxOs; + this.addNativeRegisterArgumentSlots = linuxOs; HashSet<Register> callerSaveSet = new HashSet<>(); Collections.addAll(callerSaveSet, target.arch.getAvailableValueRegisters()); for (Register cs : windowSaveRegisters) { @@ -188,9 +188,8 @@ return callerSaveRegisters; } - @Override public Register[] getCalleeSaveRegisters() { - return null; + return windowSaveRegisters; } @Override
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotVMConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot.sparc; + +import jdk.vm.ci.hotspot.HotSpotVMConfigAccess; +import jdk.vm.ci.hotspot.HotSpotVMConfigStore; + +/** + * Used to access native configuration details. + * + * All non-static, public fields in this class are so that they can be compiled as constants. + */ +public class SPARCHotSpotVMConfig extends HotSpotVMConfigAccess { + + public SPARCHotSpotVMConfig(HotSpotVMConfigStore config) { + super(config); + } + + public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux"); + + public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); + + // CPU capabilities + public final long vmVersionFeatures = getFieldValue("Abstract_VM_Version::_features", Long.class, "uint64_t"); + + // SPARC specific values + public final int sparcVis3Instructions = getConstant("VM_Version::vis3_instructions_m", Integer.class); + public final int sparcVis2Instructions = getConstant("VM_Version::vis2_instructions_m", Integer.class); + public final int sparcVis1Instructions = getConstant("VM_Version::vis1_instructions_m", Integer.class); + public final int sparcCbcondInstructions = getConstant("VM_Version::cbcond_instructions_m", Integer.class); + public final int sparcV8Instructions = getConstant("VM_Version::v8_instructions_m", Integer.class); + public final int sparcHardwareMul32 = getConstant("VM_Version::hardware_mul32_m", Integer.class); + public final int sparcHardwareDiv32 = getConstant("VM_Version::hardware_div32_m", Integer.class); + public final int sparcHardwareFsmuld = getConstant("VM_Version::hardware_fsmuld_m", Integer.class); + public final int sparcHardwarePopc = getConstant("VM_Version::hardware_popc_m", Integer.class); + public final int sparcV9Instructions = getConstant("VM_Version::v9_instructions_m", Integer.class); + public final int sparcSun4v = getConstant("VM_Version::sun4v_m", Integer.class); + public final int sparcBlkInitInstructions = getConstant("VM_Version::blk_init_instructions_m", Integer.class); + public final int sparcFmafInstructions = getConstant("VM_Version::fmaf_instructions_m", Integer.class); + public final int sparcFmauInstructions = getConstant("VM_Version::fmau_instructions_m", Integer.class); + public final int sparcSparc64Family = getConstant("VM_Version::sparc64_family_m", Integer.class); + public final int sparcMFamily = getConstant("VM_Version::M_family_m", Integer.class); + public final int sparcTFamily = getConstant("VM_Version::T_family_m", Integer.class); + public final int sparcT1Model = getConstant("VM_Version::T1_model_m", Integer.class); + public final int sparcSparc5Instructions = getConstant("VM_Version::sparc5_instructions_m", Integer.class); + public final int sparcAesInstructions = getConstant("VM_Version::aes_instructions_m", Integer.class); + public final int sparcSha1Instruction = getConstant("VM_Version::sha1_instruction_m", Integer.class); + public final int sparcSha256Instruction = getConstant("VM_Version::sha256_instruction_m", Integer.class); + public final int sparcSha512Instruction = getConstant("VM_Version::sha512_instruction_m", Integer.class); + + public final boolean useBlockZeroing = getFlag("UseBlockZeroing", Boolean.class); + public final int blockZeroingLowLimit = getFlag("BlockZeroingLowLimit", Integer.class); +}
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Wed Jun 15 00:00:41 2016 +0200 @@ -35,7 +35,6 @@ import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.common.InitTimer; import jdk.vm.ci.common.JVMCIError; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMField; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; @@ -321,9 +320,22 @@ native void resetCompilationStatistics(); /** - * Initializes the fields of {@code config}. + * Reads the database of VM info. The return value encodes the info in a nested object array + * that is described by the pseudo Java object {@code info} below: + * + * <pre> + * info = [ + * VMField[] vmFields, + * [String name, Long size, ...] vmTypeSizes, + * [String name, Long value, ...] vmConstants, + * [String name, Long value, ...] vmAddresses, + * VMFlag[] vmFlags + * ] + * </pre> + * + * @return VM info as encoded above */ - native void initializeConfiguration(HotSpotVMConfig config); + native Object[] readConfiguration(); /** * Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic @@ -421,10 +433,9 @@ native long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method); /** - * Reads an object pointer within a VM data structure. That is, any {@link HotSpotVMField} whose - * {@link HotSpotVMField#type() type} is {@code "oop"} (e.g., - * {@code ArrayKlass::_component_mirror}, {@code Klass::_java_mirror}, - * {@code JavaThread::_threadObj}). + * Reads an object pointer within a VM data structure. That is, any {@link VMField} whose + * {@link VMField#type type} is {@code "oop"} (e.g., {@code ArrayKlass::_component_mirror}, + * {@code Klass::_java_mirror}, {@code JavaThread::_threadObj}). * * Note that {@link Unsafe#getObject(Object, long)} cannot be used for this since it does a * {@code narrowOop} read if the VM is using compressed oops whereas oops within VM data
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Wed Jun 15 00:00:41 2016 +0200 @@ -42,7 +42,7 @@ public class HotSpotCodeCacheProvider implements CodeCacheProvider { protected final HotSpotJVMCIRuntimeProvider runtime; - public final HotSpotVMConfig config; + protected final HotSpotVMConfig config; protected final TargetDescription target; protected final RegisterConfig regConfig;
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Jun 15 00:00:41 2016 +0200 @@ -45,6 +45,7 @@ import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory; import jdk.vm.ci.hotspot.services.HotSpotVMEventListener; +import jdk.vm.ci.hotspot.services.HotSpotJVMCICompilerFactory.CompilationLevel; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaType; @@ -198,6 +199,7 @@ protected final CompilerToVM compilerToVm; + protected final HotSpotVMConfigStore configStore; protected final HotSpotVMConfig config; private final JVMCIBackend hostBackend; @@ -227,7 +229,8 @@ compilerToVm = new CompilerToVM(); try (InitTimer t = timer("HotSpotVMConfig<init>")) { - config = new HotSpotVMConfig(compilerToVm); + configStore = new HotSpotVMConfigStore(compilerToVm); + config = new HotSpotVMConfig(configStore); } String hostArchitecture = config.getHostArchitectureName(); @@ -261,11 +264,24 @@ if (compilerFactory instanceof HotSpotJVMCICompilerFactory) { hsCompilerFactory = (HotSpotJVMCICompilerFactory) compilerFactory; trivialPrefixes = hsCompilerFactory.getTrivialPrefixes(); - compilationLevelAdjustment = hsCompilerFactory.getCompilationLevelAdjustment(config); + switch (hsCompilerFactory.getCompilationLevelAdjustment()) { + case None: + compilationLevelAdjustment = config.compLevelAdjustmentNone; + break; + case ByHolder: + compilationLevelAdjustment = config.compLevelAdjustmentByHolder; + break; + case ByFullSignature: + compilationLevelAdjustment = config.compLevelAdjustmentByFullSignature; + break; + default: + compilationLevelAdjustment = config.compLevelAdjustmentNone; + break; + } } else { hsCompilerFactory = null; trivialPrefixes = null; - compilationLevelAdjustment = 0; + compilationLevelAdjustment = config.compLevelAdjustmentNone; } } @@ -280,6 +296,10 @@ return metaAccessContext.fromClass(javaClass); } + public HotSpotVMConfigStore getConfigStore() { + return configStore; + } + public HotSpotVMConfig getConfig() { return config; } @@ -336,7 +356,35 @@ */ @SuppressWarnings({"unused"}) private int adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, int level) { - return hsCompilerFactory.adjustCompilationLevel(config, declaringClass, name, signature, isOsr, level); + CompilationLevel curLevel; + if (level == config.compilationLevelNone) { + curLevel = CompilationLevel.None; + } else if (level == config.compilationLevelSimple) { + curLevel = CompilationLevel.Simple; + } else if (level == config.compilationLevelLimitedProfile) { + curLevel = CompilationLevel.LimitedProfile; + } else if (level == config.compilationLevelFullProfile) { + curLevel = CompilationLevel.FullProfile; + } else if (level == config.compilationLevelFullOptimization) { + curLevel = CompilationLevel.FullOptimization; + } else { + throw JVMCIError.shouldNotReachHere(); + } + + switch (hsCompilerFactory.adjustCompilationLevel(declaringClass, name, signature, isOsr, curLevel)) { + case None: + return config.compilationLevelNone; + case Simple: + return config.compilationLevelSimple; + case LimitedProfile: + return config.compilationLevelLimitedProfile; + case FullProfile: + return config.compilationLevelFullProfile; + case FullOptimization: + return config.compilationLevelFullOptimization; + default: + return level; + } } /**
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Wed Jun 15 00:00:41 2016 +0200 @@ -36,6 +36,8 @@ */ public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime { + HotSpotVMConfigStore getConfigStore(); + HotSpotVMConfig getConfig(); CompilerToVM getCompilerToVM();
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Wed Jun 15 00:00:41 2016 +0200 @@ -22,7 +22,6 @@ */ package jdk.vm.ci.hotspot; -import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.MemoryAccessProvider; @@ -32,11 +31,11 @@ */ public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider { - JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding); + JavaConstant readNarrowOopConstant(Constant base, long displacement); Constant readKlassPointerConstant(Constant base, long displacement); - Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding); + Constant readNarrowKlassPointerConstant(Constant base, long displacement); Constant readMethodPointerConstant(Constant base, long displacement); }
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Jun 15 00:00:41 2016 +0200 @@ -23,7 +23,6 @@ package jdk.vm.ci.hotspot; import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; -import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -215,8 +214,7 @@ } @Override - public JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding) { - assert encoding.equals(runtime.getConfig().getOopEncoding()) : "unexpected oop encoding: " + encoding + " != " + runtime.getConfig().getOopEncoding(); + public JavaConstant readNarrowOopConstant(Constant base, long displacement) { return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, true), true); } @@ -236,7 +234,7 @@ } @Override - public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) { + public Constant readNarrowKlassPointerConstant(Constant base, long displacement) { HotSpotResolvedObjectTypeImpl klass = readKlass(base, displacement, true); if (klass == null) { return HotSpotCompressedNullConstant.COMPRESSED_NULL;
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Jun 15 00:00:41 2016 +0200 @@ -617,7 +617,7 @@ } HotSpotVMConfig config = config(); final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved); - return config.instanceKlassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset; + return config.klassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset; } @Override
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Jun 15 00:00:41 2016 +0200 @@ -497,10 +497,10 @@ HotSpotVMConfig config = config(); if (isInterface() || isArray()) { /* Everything has the core vtable of java.lang.Object */ - return config.baseVtableLength; + return config.baseVtableLength(); } - int result = UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize); - assert result >= config.baseVtableLength : UNSAFE.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize; + int result = UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize); + assert result >= config.baseVtableLength() : UNSAFE.getInt(getMetaspaceKlass() + config.klassVtableLengthOffset) + " " + config.vtableEntrySize; return result; }
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Wed Jun 15 00:00:41 2016 +0200 @@ -23,46 +23,16 @@ package jdk.vm.ci.hotspot; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; -import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Iterator; - -import jdk.vm.ci.common.JVMCIError; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMConstant; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMField; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMType; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMValue; -import sun.misc.Unsafe; /** * Used to access native configuration details. * * All non-static, public fields in this class are so that they can be compiled as constants. */ -public class HotSpotVMConfig { - - /** - * Determines if the current architecture is included in a given architecture set specification. - * - * @param currentArch - * @param archsSpecification specifies a set of architectures. A zero length value implies all - * architectures. - */ - private static boolean isRequired(String currentArch, String[] archsSpecification) { - if (archsSpecification.length == 0) { - return true; - } - for (String arch : archsSpecification) { - if (arch.equals(currentArch)) { - return true; - } - } - return false; - } +class HotSpotVMConfig extends HotSpotVMConfigAccess { /** * Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}. @@ -71,219 +41,19 @@ return runtime().getConfig(); } - @Override - public String toString() { - return getClass().getSimpleName(); - } - - HotSpotVMConfig(CompilerToVM compilerToVm) { - compilerToVm.initializeConfiguration(this); - assert verifyInitialization(); - - oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment()); - klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment); - - codeCacheLowBound = UNSAFE.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset); - codeCacheHighBound = UNSAFE.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset); + private final String osArch = getHostArchitectureName(); - final long barrierSetAddress = UNSAFE.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset); - final int kind = UNSAFE.getInt(barrierSetAddress + barrierSetKindOffset); - if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) { - final long base = UNSAFE.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset); - assert base != 0 : "unexpected byte_map_base: " + base; - cardtableStartAddress = base; - cardtableShift = cardTableModRefBSCardShift; - } else if ((kind == barrierSetModRef) || (kind == barrierSetOther)) { - // No post barriers - cardtableStartAddress = 0; - cardtableShift = 0; - } else { - cardtableStartAddress = -1; - cardtableShift = -1; - } - - inlineCacheMissStub = inlineCacheMissBlob + UNSAFE.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset); + @SuppressWarnings("try") + HotSpotVMConfig(HotSpotVMConfigStore store) { + super(store); assert check(); assert HotSpotVMConfigVerifier.check(); } - /** - * Reads a {@code '\0'} terminated C string from native memory and converts it to a - * {@link String}. - * - * @return a Java string - */ - static String readCString(Unsafe unsafe, long address) { - if (address == 0) { - return null; - } - StringBuilder sb = new StringBuilder(); - for (int i = 0;; i++) { - char c = (char) unsafe.getByte(address + i); - if (c == 0) { - break; - } - sb.append(c); - } - return sb.toString(); - } - - /** - * Check that the initialization produces the same result as the values captured through - * vmStructs. - */ - private boolean verifyInitialization() { - /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */ - assert gHotSpotVMStructs != 0; - assert gHotSpotVMTypes != 0; - assert gHotSpotVMIntConstants != 0; - assert gHotSpotVMLongConstants != 0; - - // Fill the VM fields hash map. - HashMap<String, VMFields.Field> vmFields = new HashMap<>(); - for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) { - vmFields.put(e.getName(), e); - } - - // Fill the VM types hash map. - HashMap<String, VMTypes.Type> vmTypes = new HashMap<>(); - for (VMTypes.Type e : new VMTypes(gHotSpotVMTypes)) { - vmTypes.put(e.getTypeName(), e); - } - - // Fill the VM constants hash map. - HashMap<String, AbstractConstant> vmConstants = new HashMap<>(); - for (AbstractConstant e : new VMIntConstants(gHotSpotVMIntConstants)) { - vmConstants.put(e.getName(), e); - } - for (AbstractConstant e : new VMLongConstants(gHotSpotVMLongConstants)) { - vmConstants.put(e.getName(), e); - } - - // Fill the flags hash map. - HashMap<String, Flags.Flag> flags = new HashMap<>(); - for (Flags.Flag e : new Flags(vmFields, vmTypes)) { - flags.put(e.getName(), e); - } - - String currentArch = getHostArchitectureName(); - - for (Field f : HotSpotVMConfig.class.getDeclaredFields()) { - if (f.isAnnotationPresent(HotSpotVMField.class)) { - HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class); - String name = annotation.name(); - String type = annotation.type(); - VMFields.Field entry = vmFields.get(name); - if (entry == null) { - if (!isRequired(currentArch, annotation.archs())) { - continue; - } - throw new IllegalArgumentException("field not found: " + name); - } - - // Make sure the native type is still the type we expect. - if (!type.equals("")) { - if (!type.equals(entry.getTypeString())) { - throw new IllegalArgumentException("compiler expects type " + type + " but field " + name + " is of type " + entry.getTypeString()); - } - } - - switch (annotation.get()) { - case OFFSET: - checkField(f, entry.getOffset()); - break; - case ADDRESS: - checkField(f, entry.getAddress()); - break; - case VALUE: - checkField(f, entry.getValue()); - break; - default: - throw new JVMCIError("unknown kind %s", annotation.get()); - } - } else if (f.isAnnotationPresent(HotSpotVMType.class)) { - HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class); - String name = annotation.name(); - VMTypes.Type entry = vmTypes.get(name); - if (entry == null) { - throw new IllegalArgumentException("type not found: " + name); - } - switch (annotation.get()) { - case SIZE: - checkField(f, entry.getSize()); - break; - default: - throw new JVMCIError("unknown kind %s", annotation.get()); - } - } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) { - HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class); - String name = annotation.name(); - AbstractConstant entry = vmConstants.get(name); - if (entry == null) { - if (!isRequired(currentArch, annotation.archs())) { - continue; - } - throw new IllegalArgumentException("constant not found: " + name); - } - checkField(f, entry.getValue()); - } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) { - HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class); - String name = annotation.name(); - Flags.Flag entry = flags.get(name); - if (entry == null) { - if (annotation.optional() || !isRequired(currentArch, annotation.archs())) { - continue; - } - throw new IllegalArgumentException("flag not found: " + name); - - } - checkField(f, entry.getValue()); - } - } - return true; - } - - private final CompressEncoding oopEncoding; - private final CompressEncoding klassEncoding; - - public CompressEncoding getOopEncoding() { - return oopEncoding; - } - - public CompressEncoding getKlassEncoding() { - return klassEncoding; - } - - private void checkField(Field field, Object value) { - try { - Class<?> fieldType = field.getType(); - if (fieldType == boolean.class) { - if (value instanceof String) { - assert field.getBoolean(this) == Boolean.valueOf((String) value) : field + " " + value + " " + field.getBoolean(this); - } else if (value instanceof Boolean) { - assert field.getBoolean(this) == (boolean) value : field + " " + value + " " + field.getBoolean(this); - } else if (value instanceof Long) { - assert field.getBoolean(this) == (((long) value) != 0) : field + " " + value + " " + field.getBoolean(this); - } else { - throw new JVMCIError(value.getClass().getSimpleName()); - } - } else if (fieldType == int.class) { - if (value instanceof Integer) { - assert field.getInt(this) == (int) value : field + " " + value + " " + field.getInt(this); - } else if (value instanceof Long) { - assert field.getInt(this) == (int) (long) value : field + " " + value + " " + field.getInt(this); - } else { - throw new JVMCIError(value.getClass().getSimpleName()); - } - } else if (fieldType == long.class) { - assert field.getLong(this) == (long) value : field + " " + value + " " + field.getLong(this); - } else { - throw new JVMCIError(field.toString()); - } - } catch (IllegalAccessException e) { - throw new JVMCIError("%s: %s", field, e); - } + @Override + public String toString() { + return getClass().getSimpleName(); } /** @@ -303,594 +73,118 @@ return arch; } - /** - * VMStructEntry (see vmStructs.hpp). - */ - @HotSpotVMValue(expression = "gHotSpotVMStructs", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMStructs; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeNameOffset") @Stable private long gHotSpotVMStructEntryTypeNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryFieldNameOffset") @Stable private long gHotSpotVMStructEntryFieldNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeStringOffset") @Stable private long gHotSpotVMStructEntryTypeStringOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryIsStaticOffset") @Stable private long gHotSpotVMStructEntryIsStaticOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryOffsetOffset") @Stable private long gHotSpotVMStructEntryOffsetOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryAddressOffset") @Stable private long gHotSpotVMStructEntryAddressOffset; - @HotSpotVMValue(expression = "gHotSpotVMStructEntryArrayStride") @Stable private long gHotSpotVMStructEntryArrayStride; - - class VMFields implements Iterable<VMFields.Field> { - - private long address; - - VMFields(long address) { - this.address = address; - } - - public Iterator<VMFields.Field> iterator() { - return new Iterator<VMFields.Field>() { - - private int index = 0; - - private Field current() { - return new Field(address + gHotSpotVMStructEntryArrayStride * index); - } - - /** - * The last entry is identified by a NULL fieldName. - */ - public boolean hasNext() { - Field entry = current(); - return entry.getFieldName() != null; - } - - public Field next() { - Field entry = current(); - index++; - return entry; - } - }; - } - - class Field { - - private long entryAddress; - - Field(long address) { - this.entryAddress = address; - } - - public String getTypeName() { - long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset); - return readCString(UNSAFE, typeNameAddress); - } - - public String getFieldName() { - long fieldNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset); - return readCString(UNSAFE, fieldNameAddress); - } - - public String getTypeString() { - long typeStringAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset); - return readCString(UNSAFE, typeStringAddress); - } - - public boolean isStatic() { - return UNSAFE.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0; - } - - public long getOffset() { - return UNSAFE.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset); - } - - public long getAddress() { - return UNSAFE.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset); - } - - public String getName() { - String typeName = getTypeName(); - String fieldName = getFieldName(); - return typeName + "::" + fieldName; - } - - public long getValue() { - String type = getTypeString(); - switch (type) { - case "int": - return UNSAFE.getInt(getAddress()); - case "address": - case "intptr_t": - return UNSAFE.getAddress(getAddress()); - default: - // All foo* types are addresses. - if (type.endsWith("*")) { - return UNSAFE.getAddress(getAddress()); - } - throw new JVMCIError(type); - } - } - - @Override - public String toString() { - return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(), - getAddress()); - } - } - } - - /** - * VMTypeEntry (see vmStructs.hpp). - */ - @HotSpotVMValue(expression = "gHotSpotVMTypes", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMTypes; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntryTypeNameOffset") @Stable private long gHotSpotVMTypeEntryTypeNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySuperclassNameOffset") @Stable private long gHotSpotVMTypeEntrySuperclassNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsOopTypeOffset") @Stable private long gHotSpotVMTypeEntryIsOopTypeOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsIntegerTypeOffset") @Stable private long gHotSpotVMTypeEntryIsIntegerTypeOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsUnsignedOffset") @Stable private long gHotSpotVMTypeEntryIsUnsignedOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySizeOffset") @Stable private long gHotSpotVMTypeEntrySizeOffset; - @HotSpotVMValue(expression = "gHotSpotVMTypeEntryArrayStride") @Stable private long gHotSpotVMTypeEntryArrayStride; - - class VMTypes implements Iterable<VMTypes.Type> { - - private long address; - - VMTypes(long address) { - this.address = address; - } - - public Iterator<VMTypes.Type> iterator() { - return new Iterator<VMTypes.Type>() { - - private int index = 0; - - private Type current() { - return new Type(address + gHotSpotVMTypeEntryArrayStride * index); - } - - /** - * The last entry is identified by a NULL type name. - */ - public boolean hasNext() { - Type entry = current(); - return entry.getTypeName() != null; - } - - public Type next() { - Type entry = current(); - index++; - return entry; - } - }; - } - - class Type { - - private long entryAddress; - - Type(long address) { - this.entryAddress = address; - } - - public String getTypeName() { - long typeNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset); - return readCString(UNSAFE, typeNameAddress); - } - - public String getSuperclassName() { - long superclassNameAddress = UNSAFE.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset); - return readCString(UNSAFE, superclassNameAddress); - } - - public boolean isOopType() { - return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0; - } - - public boolean isIntegerType() { - return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0; - } - - public boolean isUnsigned() { - return UNSAFE.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0; - } - - public long getSize() { - return UNSAFE.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset); - } - - @Override - public String toString() { - return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(), - isUnsigned(), getSize()); - } - } - } - - public abstract class AbstractConstant { - - protected long address; - protected long nameOffset; - protected long valueOffset; - - AbstractConstant(long address, long nameOffset, long valueOffset) { - this.address = address; - this.nameOffset = nameOffset; - this.valueOffset = valueOffset; - } - - public String getName() { - long nameAddress = UNSAFE.getAddress(address + nameOffset); - return readCString(UNSAFE, nameAddress); - } - - public abstract long getValue(); - } - - /** - * VMIntConstantEntry (see vmStructs.hpp). - */ - @HotSpotVMValue(expression = "gHotSpotVMIntConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMIntConstants; - @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryNameOffset") @Stable private long gHotSpotVMIntConstantEntryNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryValueOffset") @Stable private long gHotSpotVMIntConstantEntryValueOffset; - @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryArrayStride") @Stable private long gHotSpotVMIntConstantEntryArrayStride; - - class VMIntConstants implements Iterable<VMIntConstants.Constant> { - - private long address; - - VMIntConstants(long address) { - this.address = address; - } - - public Iterator<VMIntConstants.Constant> iterator() { - return new Iterator<VMIntConstants.Constant>() { - - private int index = 0; - - private Constant current() { - return new Constant(address + gHotSpotVMIntConstantEntryArrayStride * index); - } - - /** - * The last entry is identified by a NULL name. - */ - public boolean hasNext() { - Constant entry = current(); - return entry.getName() != null; - } - - public Constant next() { - Constant entry = current(); - index++; - return entry; - } - }; - } - - class Constant extends AbstractConstant { - - Constant(long address) { - super(address, gHotSpotVMIntConstantEntryNameOffset, gHotSpotVMIntConstantEntryValueOffset); - } - - @Override - public long getValue() { - return UNSAFE.getInt(address + valueOffset); - } - - @Override - public String toString() { - return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue()); - } - } - } - - /** - * VMLongConstantEntry (see vmStructs.hpp). - */ - @HotSpotVMValue(expression = "gHotSpotVMLongConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMLongConstants; - @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryNameOffset") @Stable private long gHotSpotVMLongConstantEntryNameOffset; - @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryValueOffset") @Stable private long gHotSpotVMLongConstantEntryValueOffset; - @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryArrayStride") @Stable private long gHotSpotVMLongConstantEntryArrayStride; - - class VMLongConstants implements Iterable<VMLongConstants.Constant> { - - private long address; - - VMLongConstants(long address) { - this.address = address; - } - - public Iterator<VMLongConstants.Constant> iterator() { - return new Iterator<VMLongConstants.Constant>() { - - private int index = 0; - - private Constant currentEntry() { - return new Constant(address + gHotSpotVMLongConstantEntryArrayStride * index); - } - - /** - * The last entry is identified by a NULL name. - */ - public boolean hasNext() { - Constant entry = currentEntry(); - return entry.getName() != null; - } - - public Constant next() { - Constant entry = currentEntry(); - index++; - return entry; - } - }; - } - - class Constant extends AbstractConstant { - - Constant(long address) { - super(address, gHotSpotVMLongConstantEntryNameOffset, gHotSpotVMLongConstantEntryValueOffset); - } - - @Override - public long getValue() { - return UNSAFE.getLong(address + valueOffset); - } - - @Override - public String toString() { - return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue()); - } - } - } - - class Flags implements Iterable<Flags.Flag> { - - private long address; - private long entrySize; - private long typeOffset; - private long nameOffset; - private long addrOffset; - - Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) { - address = vmStructs.get("Flag::flags").getValue(); - entrySize = vmTypes.get("Flag").getSize(); - typeOffset = vmStructs.get("Flag::_type").getOffset(); - nameOffset = vmStructs.get("Flag::_name").getOffset(); - addrOffset = vmStructs.get("Flag::_addr").getOffset(); - - assert vmTypes.get("bool").getSize() == Byte.BYTES; - assert vmTypes.get("intx").getSize() == Long.BYTES; - assert vmTypes.get("uintx").getSize() == Long.BYTES; - } - - public Iterator<Flags.Flag> iterator() { - return new Iterator<Flags.Flag>() { - - private int index = 0; - - private Flag current() { - return new Flag(address + entrySize * index); - } - - /** - * The last entry is identified by a NULL name. - */ - public boolean hasNext() { - Flag entry = current(); - return entry.getName() != null; - } - - public Flag next() { - Flag entry = current(); - index++; - return entry; - } - }; - } - - class Flag { - - private long entryAddress; - - Flag(long address) { - this.entryAddress = address; - } - - public String getType() { - long typeAddress = UNSAFE.getAddress(entryAddress + typeOffset); - return readCString(UNSAFE, typeAddress); - } - - public String getName() { - long nameAddress = UNSAFE.getAddress(entryAddress + nameOffset); - return readCString(UNSAFE, nameAddress); - } - - public long getAddr() { - return UNSAFE.getAddress(entryAddress + addrOffset); - } - - public Object getValue() { - switch (getType()) { - case "bool": - return Boolean.valueOf(UNSAFE.getByte(getAddr()) != 0); - case "intx": - case "uintx": - case "uint64_t": - return Long.valueOf(UNSAFE.getLong(getAddr())); - case "double": - return Double.valueOf(UNSAFE.getDouble(getAddr())); - case "ccstr": - case "ccstrlist": - return readCString(UNSAFE, getAddr()); - default: - throw new JVMCIError(getType()); - } - } - - @Override - public String toString() { - return String.format("Flag[type=%s, name=%s, value=%s]", getType(), getName(), getValue()); - } - } - } + private final Integer amd64RequiredInt = osArch.equals("amd64") ? null : 0; +// private final Integer sparcRequiredInt = osArch.equals("sparc") ? null : 0; // os information, register layout, code generation, ... - @HotSpotVMValue(expression = "DEBUG_ONLY(1) NOT_DEBUG(0)") @Stable public boolean cAssertions; +// public final boolean cAssertions = getConstant("ASSERT", Boolean.class); public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows"); public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux"); - @HotSpotVMFlag(name = "CodeEntryAlignment") @Stable public int codeEntryAlignment; - @HotSpotVMFlag(name = "VerifyOops") @Stable public boolean verifyOops; - @HotSpotVMFlag(name = "CITime") @Stable public boolean ciTime; - @HotSpotVMFlag(name = "CITimeEach") @Stable public boolean ciTimeEach; - @HotSpotVMFlag(name = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt; - @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt; - @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods; - @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit; - @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining; - @HotSpotVMFlag(name = "Inline") @Stable public boolean inline; - @HotSpotVMFlag(name = "JVMCIUseFastLocking") @Stable public boolean useFastLocking; - @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable; - @HotSpotVMFlag(name = "FoldStableValues") @Stable public boolean foldStableValues; +// public final int codeEntryAlignment = getFlag("CodeEntryAlignment", Integer.class); +// public final boolean verifyOops = getFlag("VerifyOops", Boolean.class); +// public final boolean ciTime = getFlag("CITime", Boolean.class); +// public final boolean ciTimeEach = getFlag("CITimeEach", Boolean.class); +// public final int compileTheWorldStartAt = getFlag("CompileTheWorldStartAt", Integer.class, 1); +// public final int compileTheWorldStopAt = getFlag("CompileTheWorldStopAt", Integer.class, +// Integer.MAX_VALUE); +// public final boolean dontCompileHugeMethods = getFlag("DontCompileHugeMethods", Boolean.class); +// public final int hugeMethodLimit = getFlag("HugeMethodLimit", Integer.class); +// public final boolean printInlining = getFlag("PrintInlining", Boolean.class); +// public final boolean inline = getFlag("Inline", Boolean.class); +// public final boolean useFastLocking = getFlag("JVMCIUseFastLocking", Boolean.class); +// public final boolean forceUnreachable = getFlag("ForceUnreachable", Boolean.class); +// public final boolean foldStableValues = getFlag("FoldStableValues", Boolean.class); - @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB; - @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking; - @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction; - @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction; - @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction; - @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics; - @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics; - @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC; - @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC; +// public final boolean useTLAB = getFlag("UseTLAB", Boolean.class); +// public final boolean useBiasedLocking = getFlag("UseBiasedLocking", Boolean.class); +// public final boolean usePopCountInstruction = getFlag("UsePopCountInstruction", Boolean.class); +// public final boolean useAESIntrinsics = getFlag("UseAESIntrinsics", Boolean.class); +// public final boolean useCRC32Intrinsics = getFlag("UseCRC32Intrinsics", Boolean.class); +// public final boolean useG1GC = getFlag("UseG1GC", Boolean.class); +// public final boolean useCMSGC = getFlag("UseConcMarkSweepGC", Boolean.class); - @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle; - @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr; - @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines; - @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines; - @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize; - @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance; +// public final int allocatePrefetchStyle = getFlag("AllocatePrefetchStyle", Integer.class); +// public final int allocatePrefetchInstr = getFlag("AllocatePrefetchInstr", Integer.class); +// public final int allocatePrefetchLines = getFlag("AllocatePrefetchLines", Integer.class); +// public final int allocateInstancePrefetchLines = getFlag("AllocateInstancePrefetchLines", +// Integer.class); +// public final int allocatePrefetchStepSize = getFlag("AllocatePrefetchStepSize", Integer.class); +// public final int allocatePrefetchDistance = getFlag("AllocatePrefetchDistance", Integer.class); - @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder; +// public final boolean flightRecorder = getFlag("FightRecorder", Boolean.class, false); - @HotSpotVMField(name = "Universe::_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap; - @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset; - - public long gcTotalCollectionsAddress() { - return universeCollectedHeap + collectedHeapTotalCollectionsOffset; - } - - @HotSpotVMFlag(name = "ReduceInitialCardMarks") @Stable public boolean useDeferredInitBarriers; +// private final long universeCollectedHeap = getFieldValue("Universe::_collectedHeap", Long.class, +// "CollectedHeap*"); +// private final int collectedHeapTotalCollectionsOffset = +// getFieldOffset("CollectedHeap::_total_collections", Integer.class, "unsigned int"); +// +// public long gcTotalCollectionsAddress() { +// return universeCollectedHeap + collectedHeapTotalCollectionsOffset; +// } +// +// public final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class); // Compressed Oops related values. - @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops; - @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers; - - @HotSpotVMField(name = "Universe::_narrow_oop._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase; - @HotSpotVMField(name = "Universe::_narrow_oop._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift; - @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment; - - public int logMinObjAlignment() { - return (int) (Math.log(objectAlignment) / Math.log(2)); - } - - @HotSpotVMField(name = "Universe::_narrow_klass._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase; - @HotSpotVMField(name = "Universe::_narrow_klass._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift; - @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment; - - // CPU capabilities - @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE; - @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX; + public final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class); + public final boolean useCompressedClassPointers = getFlag("UseCompressedClassPointers", Boolean.class); - // X86 specific values - @HotSpotVMField(name = "VM_Version::_cpuFeatures", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"amd64"}) @Stable public int x86CPUFeatures; - @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public int cpuCX8; - @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public int cpuCMOV; - @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public int cpuFXSR; - @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public int cpuHT; - @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public int cpuMMX; - @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public int cpu3DNOWPREFETCH; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public int cpuSSE; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public int cpuSSE2; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public int cpuSSE3; - @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public int cpuSSSE3; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public int cpuSSE4A; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public int cpuSSE41; - @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public int cpuSSE42; - @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public int cpuPOPCNT; - @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public int cpuLZCNT; - @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public int cpuTSC; - @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public int cpuTSCINV; - @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public int cpuAVX; - @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public int cpuAVX2; - @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public int cpuAES; - @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public int cpuERMS; - @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public int cpuCLMUL; - @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public int cpuBMI1; +// public final long narrowOopBase = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_base", +// Long.class, "address"); +// public final int narrowOopShift = getFieldValue("CompilerToVM::Data::Universe_narrow_oop_shift", +// Integer.class, "int"); + public final int objectAlignment = getFlag("ObjectAlignmentInBytes", Integer.class); + +// public int logMinObjAlignment() { +// return (int) (Math.log(objectAlignment) / Math.log(2)); +// } - // SPARC specific values - @HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures; - @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int vis3Instructions; - @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int vis2Instructions; - @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int vis1Instructions; - @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int cbcondInstructions; - @HotSpotVMConstant(name = "VM_Version::v8_instructions_m", archs = {"sparc"}) @Stable public int v8Instructions; - @HotSpotVMConstant(name = "VM_Version::hardware_mul32_m", archs = {"sparc"}) @Stable public int hardwareMul32; - @HotSpotVMConstant(name = "VM_Version::hardware_div32_m", archs = {"sparc"}) @Stable public int hardwareDiv32; - @HotSpotVMConstant(name = "VM_Version::hardware_fsmuld_m", archs = {"sparc"}) @Stable public int hardwareFsmuld; - @HotSpotVMConstant(name = "VM_Version::hardware_popc_m", archs = {"sparc"}) @Stable public int hardwarePopc; - @HotSpotVMConstant(name = "VM_Version::v9_instructions_m", archs = {"sparc"}) @Stable public int v9Instructions; - @HotSpotVMConstant(name = "VM_Version::sun4v_m", archs = {"sparc"}) @Stable public int sun4v; - @HotSpotVMConstant(name = "VM_Version::blk_init_instructions_m", archs = {"sparc"}) @Stable public int blkInitInstructions; - @HotSpotVMConstant(name = "VM_Version::fmaf_instructions_m", archs = {"sparc"}) @Stable public int fmafInstructions; - @HotSpotVMConstant(name = "VM_Version::fmau_instructions_m", archs = {"sparc"}) @Stable public int fmauInstructions; - @HotSpotVMConstant(name = "VM_Version::sparc64_family_m", archs = {"sparc"}) @Stable public int sparc64Family; - @HotSpotVMConstant(name = "VM_Version::M_family_m", archs = {"sparc"}) @Stable public int mFamily; - @HotSpotVMConstant(name = "VM_Version::T_family_m", archs = {"sparc"}) @Stable public int tFamily; - @HotSpotVMConstant(name = "VM_Version::T1_model_m", archs = {"sparc"}) @Stable public int t1Model; - @HotSpotVMConstant(name = "VM_Version::sparc5_instructions_m", archs = {"sparc"}) @Stable public int sparc5Instructions; - @HotSpotVMConstant(name = "VM_Version::aes_instructions_m", archs = {"sparc"}) @Stable public int aesInstructions; - @HotSpotVMConstant(name = "VM_Version::sha1_instruction_m", archs = {"sparc"}) @Stable public int sha1Instruction; - @HotSpotVMConstant(name = "VM_Version::sha256_instruction_m", archs = {"sparc"}) @Stable public int sha256Instruction; - @HotSpotVMConstant(name = "VM_Version::sha512_instruction_m", archs = {"sparc"}) @Stable public int sha512Instruction; +// public final int narrowKlassSize = getTypeSize("narrowKlass"); +// public final long narrowKlassBase = +// getFieldValue("CompilerToVM::Data::Universe_narrow_klass_base", Long.class, "address"); +// public final int narrowKlassShift = +// getFieldValue("CompilerToVM::Data::Universe_narrow_klass_shift", Integer.class, "int"); +// public final int logKlassAlignment = getConstant("LogKlassAlignmentInBytes", Integer.class); - @HotSpotVMFlag(name = "UseBlockZeroing", archs = {"sparc"}) @Stable public boolean useBlockZeroing; - @HotSpotVMFlag(name = "BlockZeroingLowLimit", archs = {"sparc"}) @Stable public int blockZeroingLowLimit; - - @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages; - @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging; - @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias; - @HotSpotVMValue(expression = "os::vm_page_size()") @Stable public int vmPageSize; +// public final int stackShadowPages = getFlag("StackShadowPages", Integer.class); +// public final boolean useStackBanging = getFlag("UseStackBanging", Boolean.class); +// public final int stackBias = getConstant("STACK_BIAS", Integer.class); +// public final int vmPageSize = getFieldValue("CompilerToVM::Data::vm_page_size", Integer.class, +// "int"); - // offsets, ... - @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset; - @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset; +// public final int markOffset = getFieldOffset("oopDesc::_mark", Integer.class, "markOop"); +// public final int hubOffset = getFieldOffset("oopDesc::_metadata._klass", Integer.class, +// "Klass*"); - @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset; - @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset; - @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset; - @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset; - @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset; - @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset; + public final int prototypeMarkWordOffset = getFieldOffset("Klass::_prototype_header", Integer.class, "markOop"); + public final int subklassOffset = getFieldOffset("Klass::_subklass", Integer.class, "Klass*"); + public final int nextSiblingOffset = getFieldOffset("Klass::_next_sibling", Integer.class, "Klass*"); + public final int superCheckOffsetOffset = getFieldOffset("Klass::_super_check_offset", Integer.class, "juint"); + public final int secondarySuperCacheOffset = getFieldOffset("Klass::_secondary_super_cache", Integer.class, "Klass*"); + public final int secondarySupersOffset = getFieldOffset("Klass::_secondary_supers", Integer.class, "Array<Klass*>*"); /** * The offset of the _java_mirror field (of type {@link Class}) in a Klass. */ - @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset; + public final int classMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "oop"); - @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset; - @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset; - @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset; - @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset; - @HotSpotVMField(name = "Klass::_name", type = "Symbol*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassNameOffset; + public final int klassSuperKlassOffset = getFieldOffset("Klass::_super", Integer.class, "Klass*"); + public final int klassModifierFlagsOffset = getFieldOffset("Klass::_modifier_flags", Integer.class, "jint"); + public final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags"); + public final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint"); + public final int klassNameOffset = getFieldOffset("Klass::_name", Integer.class, "Symbol*"); - @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue; - @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit; - @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift; - @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask; - @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift; - @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask; - @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift; - @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask; - @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift; - @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue; - @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue; + public final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class); + public final int klassLayoutHelperInstanceSlowPathBit = getConstant("Klass::_lh_instance_slow_path_bit", Integer.class); + public final int layoutHelperLog2ElementSizeShift = getConstant("Klass::_lh_log2_element_size_shift", Integer.class); + public final int layoutHelperLog2ElementSizeMask = getConstant("Klass::_lh_log2_element_size_mask", Integer.class); + public final int layoutHelperElementTypeShift = getConstant("Klass::_lh_element_type_shift", Integer.class); + public final int layoutHelperElementTypeMask = getConstant("Klass::_lh_element_type_mask", Integer.class); + public final int layoutHelperHeaderSizeShift = getConstant("Klass::_lh_header_size_shift", Integer.class); + public final int layoutHelperHeaderSizeMask = getConstant("Klass::_lh_header_size_mask", Integer.class); + public final int layoutHelperArrayTagShift = getConstant("Klass::_lh_array_tag_shift", Integer.class); + public final int layoutHelperArrayTagTypeValue = getConstant("Klass::_lh_array_tag_type_value", Integer.class); + public final int layoutHelperArrayTagObjectValue = getConstant("Klass::_lh_array_tag_obj_value", Integer.class); /** * This filters out the bit that differentiates a type array from an object array. @@ -899,172 +193,164 @@ return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift; } - /** - * Bit pattern in the klass layout helper that can be used to identify arrays. - */ - public final int arrayKlassLayoutHelperIdentifier = 0x80000000; +// /** +// * Bit pattern in the klass layout helper that can be used to identify arrays. +// */ +// public final int arrayKlassLayoutHelperIdentifier = 0x80000000; - @HotSpotVMField(name = "ArrayKlass::_component_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable int arrayKlassComponentMirrorOffset; + final int arrayKlassComponentMirrorOffset = getFieldOffset("ArrayKlass::_component_mirror", Integer.class, "oop"); - @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize; - @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset; - @HotSpotVMValue(expression = "InstanceKlass::vtable_start_offset() * HeapWordSize") @Stable public int instanceKlassVtableStartOffset; - @HotSpotVMValue(expression = "InstanceKlass::vtable_length_offset() * HeapWordSize") @Stable public int instanceKlassVtableLengthOffset; - @HotSpotVMValue(expression = "Universe::base_vtable_size() / vtableEntry::size()") @Stable public int baseVtableLength; + final int vtableEntrySize = getTypeSize("vtableEntry"); + public final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*"); + +// public final int arrayOopDescSize = getTypeSize("arrayOopDesc"); - /** - * The offset of the array length word in an array object's header. - */ - @HotSpotVMValue(expression = "arrayOopDesc::length_offset_in_bytes()") @Stable private int arrayLengthOffset; +// /** +// * The offset of the array length word in an array object's header. +// * +// * See {@code arrayOopDesc::length_offset_in_bytes()}. +// */ +// public final int arrayOopDescLengthOffset() { +// return useCompressedClassPointers ? hubOffset + narrowKlassSize : arrayOopDescSize; +// } - /** - * The offset of the array length word in an array object's header. - * - * See {@code arrayOopDesc::length_offset_in_bytes()}. - */ - public final int arrayOopDescLengthOffset() { - return arrayLengthOffset; - } - - @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset; - @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset; - @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset; - @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset; - @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset; + public final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int"); + public final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class); + public final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class); + public final int metaspaceArrayLengthOffset = getFieldOffset("Array<Klass*>::_length", Integer.class, "int"); + public final int metaspaceArrayBaseOffset = getFieldOffset("Array<Klass*>::_data[0]", Integer.class, "Klass*"); - @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset; - @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset; - @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset; - @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset; - - @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked; - @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized; + public final int instanceKlassSourceFileNameIndexOffset = getFieldOffset("InstanceKlass::_source_file_name_index", Integer.class, "u2"); + public final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "u1"); + public final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*"); + public final int instanceKlassFieldsOffset = getFieldOffset("InstanceKlass::_fields", Integer.class, "Array<u2>*"); - @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset; + public final int instanceKlassStateLinked = getConstant("InstanceKlass::linked", Integer.class); + public final int instanceKlassStateFullyInitialized = getConstant("InstanceKlass::fully_initialized", Integer.class); - @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset; - @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset; - @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset; - @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset; - @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset; - @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset; - @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots; + public final int arrayClassElementOffset = getFieldOffset("ObjArrayKlass::_element_klass", Integer.class, "Klass*"); - @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize; - - @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal; - @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable; - @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature; - @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags; - @HotSpotVMConstant(name = "JVM_ACC_IS_CLONEABLE") @Stable public int jvmAccIsCloneable; + public final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class); + public final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class); + public final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class); + public final int fieldInfoInitvalIndexOffset = getConstant("FieldInfo::initval_index_offset", Integer.class); + public final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class); + public final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class); + public final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class); - @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset; + public final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class); - @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset; - @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset; - @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset; - @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset; - @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset; - @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "ObjPtrQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset; - @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset; - @HotSpotVMValue(expression = "in_bytes(JavaThread::jvmci_counters_offset())") @Stable public int jvmciCountersThreadOffset; + public final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class); + public final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class); + public final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class); + public final int jvmAccWrittenFlags = getConstant("JVM_ACC_WRITTEN_FLAGS", Integer.class); + public final int jvmAccIsCloneable = getConstant("JVM_ACC_IS_CLONEABLE", Integer.class); + +// public final int threadTlabOffset = getFieldOffset("Thread::_tlab", Integer.class, +// "ThreadLocalAllocBuffer"); - /** - * An invalid value for {@link #rtldDefault}. - */ - public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE; - - /** - * Address of the library lookup routine. The C signature of this routine is: - * - * <pre> - * void* (const char *filename, char *ebuf, int ebuflen) - * </pre> - */ - @HotSpotVMValue(expression = "os::dll_load", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLoad; - - /** - * Address of the library lookup routine. The C signature of this routine is: - * - * <pre> - * void* (void* handle, const char* name) - * </pre> - */ - @HotSpotVMValue(expression = "os::dll_lookup", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLookup; - - /** - * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will - * return the first occurrence of the desired symbol using the default library search order. If - * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on - * the current platform. - */ - @HotSpotVMValue(expression = "RTLD_DEFAULT", defines = {"TARGET_OS_FAMILY_bsd", - "TARGET_OS_FAMILY_linux"}, get = HotSpotVMValue.Type.ADDRESS) @Stable public long rtldDefault = INVALID_RTLD_DEFAULT_HANDLE; +// public final int javaThreadAnchorOffset = getFieldOffset("JavaThread::_anchor", Integer.class, +// "JavaFrameAnchor"); +// public final int threadObjectOffset = getFieldOffset("JavaThread::_threadObj", Integer.class, +// "oop"); +// public final int osThreadOffset = getFieldOffset("JavaThread::_osthread", Integer.class, +// "OSThread*"); +// public final int javaThreadDirtyCardQueueOffset = getFieldOffset("JavaThread::_dirty_card_queue", +// Integer.class, "DirtyCardQueue"); +// public final int threadIsMethodHandleReturnOffset = +// getFieldOffset("JavaThread::_is_method_handle_return", Integer.class, "int"); +// public final int javaThreadSatbMarkQueueOffset = getFieldOffset("JavaThread::_satb_mark_queue", +// Integer.class, "ObjPtrQueue"); +// public final int threadObjectResultOffset = getFieldOffset("JavaThread::_vm_result", +// Integer.class, "oop"); +// public final int jvmciCountersThreadOffset = getFieldOffset("JavaThread::_jvmci_counters", +// Integer.class, "jlong*"); - /** - * This field is used to pass exception objects into and out of the runtime system during - * exception handling for compiled code. - */ - @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset; - @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset; - @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset; - - @HotSpotVMField(name = "JavaThread::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset; - @HotSpotVMField(name = "JavaThread::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset; - @HotSpotVMField(name = "JavaThread::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset; - - @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset; - @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset; - @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset; - @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset; +// /** +// * This field is used to pass exception objects into and out of the runtime system during +// * exception handling for compiled code. +// */ +// public final int threadExceptionOopOffset = getFieldOffset("JavaThread::_exception_oop", +// Integer.class, "oop"); +// public final int threadExceptionPcOffset = getFieldOffset("JavaThread::_exception_pc", +// Integer.class, "address"); +// public final int pendingExceptionOffset = getFieldOffset("ThreadShadow::_pending_exception", +// Integer.class, "oop"); +// +// public final int pendingDeoptimizationOffset = +// getFieldOffset("JavaThread::_pending_deoptimization", Integer.class, "int"); +// public final int pendingFailedSpeculationOffset = +// getFieldOffset("JavaThread::_pending_failed_speculation", Integer.class, "oop"); +// public final int pendingTransferToInterpreterOffset = +// getFieldOffset("JavaThread::_pending_transfer_to_interpreter", Integer.class, "bool"); +// +// private final int javaFrameAnchorLastJavaSpOffset = +// getFieldOffset("JavaFrameAnchor::_last_Java_sp", Integer.class, "intptr_t*"); +// private final int javaFrameAnchorLastJavaPcOffset = +// getFieldOffset("JavaFrameAnchor::_last_Java_pc", Integer.class, "address"); +// private final int javaFrameAnchorLastJavaFpOffset = +// getFieldOffset("JavaFrameAnchor::_last_Java_fp", Integer.class, "intptr_t*", +// osArch.equals("aarch64") || osArch.equals("amd64") ? null : Integer.MAX_VALUE); +// private final int javaFrameAnchorFlagsOffset = getFieldOffset("JavaFrameAnchor::_flags", +// Integer.class, "int", sparcRequiredInt); - public int threadLastJavaSpOffset() { - return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset; - } - - public int threadLastJavaPcOffset() { - return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset; - } +// public int threadLastJavaSpOffset() { +// return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset; +// } +// +// public int threadLastJavaPcOffset() { +// return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset; +// } - /** - * This value is only valid on AMD64. - */ - public int threadLastJavaFpOffset() { - // TODO add an assert for AMD64 - return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset; - } - - /** - * This value is only valid on SPARC. - */ - public int threadJavaFrameAnchorFlagsOffset() { - // TODO add an assert for SPARC - return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset; - } +// /** +// * This value is only valid on AMD64. +// */ +// public int threadLastJavaFpOffset() { +// // TODO add an assert for AMD64 +// return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset; +// } +// +// /** +// * This value is only valid on SPARC. +// */ +// public int threadJavaFrameAnchorFlagsOffset() { +// // TODO add an assert for SPARC +// return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset; +// } // These are only valid on AMD64. - @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize; - @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset; - @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset; - - @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset; - @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset; - @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset; - - @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset; + public final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, amd64RequiredInt); +// public final int frameInterpreterFrameSenderSpOffset = +// getConstant("frame::interpreter_frame_sender_sp_offset", Integer.class, amd64RequiredInt); +// public final int frameInterpreterFrameLastSpOffset = +// getConstant("frame::interpreter_frame_last_sp_offset", Integer.class, amd64RequiredInt); +// +// public final int ptrQueueActiveOffset = getFieldOffset("PtrQueue::_active", Integer.class, +// "bool"); +// public final int ptrQueueBufferOffset = getFieldOffset("PtrQueue::_buf", Integer.class, +// "void**"); +// public final int ptrQueueIndexOffset = getFieldOffset("PtrQueue::_index", Integer.class, +// "size_t"); +// +// public final int osThreadInterruptedOffset = getFieldOffset("OSThread::_interrupted", +// Integer.class, "jint"); +// +// public final int unlockedMask = getConstant("markOopDesc::unlocked_value", Integer.class); +// public final int biasedLockMaskInPlace = getConstant("markOopDesc::biased_lock_mask_in_place", +// Integer.class); +// public final int ageMaskInPlace = getConstant("markOopDesc::age_mask_in_place", Integer.class); +// public final int epochMaskInPlace = getConstant("markOopDesc::epoch_mask_in_place", +// Integer.class); - @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask; - @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace; - @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace; - @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace; - - @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift; - @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask; - @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace; - - @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern; - @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace; - @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace; +// public final long markOopDescHashShift = getConstant("markOopDesc::hash_shift", Long.class); +// public final long markOopDescHashMask = getConstant("markOopDesc::hash_mask", Long.class); +// public final long markOopDescHashMaskInPlace = getConstant("markOopDesc::hash_mask_in_place", +// Long.class); +// +// public final int biasedLockPattern = getConstant("markOopDesc::biased_lock_pattern", +// Integer.class); + public final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class); + public final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class); /** * See markOopDesc::prototype(). @@ -1073,469 +359,455 @@ return markWordNoHashInPlace | markWordNoLockInPlace; } - /** - * See markOopDesc::copy_set_hash(). - */ - public long tlabIntArrayMarkWord() { - long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace); - tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift); - return tmp; - } +// /** +// * See markOopDesc::copy_set_hash(). +// */ +// public long tlabIntArrayMarkWord() { +// long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace); +// tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift); +// return tmp; +// } - /** - * Mark word right shift to get identity hash code. - */ - @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift; +// /** +// * Mark word right shift to get identity hash code. +// */ +// public final int identityHashCodeShift = getConstant("markOopDesc::hash_shift", Integer.class); - /** - * Identity hash code value when uninitialized. - */ - @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue; +// /** +// * Identity hash code value when uninitialized. +// */ +// public final int uninitializedIdentityHashCodeValue = getConstant("markOopDesc::no_hash", +// Integer.class); - @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset; - @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset; - @HotSpotVMField(name = "Method::_intrinsic_id", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset; - @HotSpotVMField(name = "Method::_flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset; - @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset; + public final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags"); + public final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*"); + public final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u1"); + public final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u1"); + public final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int"); - @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite; - @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive; - @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline; - @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline; - @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden; - @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex; - @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex; +// public final int methodFlagsJfrTowrite = getConstant("Method::_jfr_towrite", Integer.class); + public final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class); + public final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class); + public final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class); +// public final int methodFlagsHidden = getConstant("Method::_hidden", Integer.class); + public final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class); + public final int invalidVtableIndex = getConstant("Method::invalid_vtable_index", Integer.class); - @HotSpotVMConstant(name = "InvocationEntryBci") @Stable public int invocationEntryBci; + public final int invocationEntryBci = getConstant("InvocationEntryBci", Integer.class); - @HotSpotVMField(name = "JVMCIEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvTaskOffset; - @HotSpotVMField(name = "JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset; - @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset; +// public final int jvmciEnvTaskOffset = getFieldOffset("JVMCIEnv::_task", Integer.class, +// "CompileTask*"); +// public final int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset = +// getFieldOffset("JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", Integer.class, "bool"); +// public final int compileTaskNumInlinedBytecodesOffset = +// getFieldOffset("CompileTask::_num_inlined_bytecodes", Integer.class, "int"); /** * Value of Method::extra_stack_entries(). */ - @HotSpotVMValue(expression = "Method::extra_stack_entries()") @Stable public int extraStackEntries; + public final int extraStackEntries = getFieldValue("CompilerToVM::Data::Method_extra_stack_entries", Integer.class, "int"); - @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset; - @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset; - @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset; - @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset; - @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset; - @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset; - @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset; + public final int constMethodConstantsOffset = getFieldOffset("ConstMethod::_constants", Integer.class, "ConstantPool*"); + public final int constMethodFlagsOffset = getFieldOffset("ConstMethod::_flags", Integer.class, "u2"); + public final int constMethodCodeSizeOffset = getFieldOffset("ConstMethod::_code_size", Integer.class, "u2"); + public final int constMethodNameIndexOffset = getFieldOffset("ConstMethod::_name_index", Integer.class, "u2"); + public final int constMethodSignatureIndexOffset = getFieldOffset("ConstMethod::_signature_index", Integer.class, "u2"); + public final int constMethodMaxStackOffset = getFieldOffset("ConstMethod::_max_stack", Integer.class, "u2"); + public final int methodMaxLocalsOffset = getFieldOffset("ConstMethod::_max_locals", Integer.class, "u2"); - @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable; - @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable; - @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable; + public final int constMethodHasLineNumberTable = getConstant("ConstMethod::_has_linenumber_table", Integer.class); + public final int constMethodHasLocalVariableTable = getConstant("ConstMethod::_has_localvariable_table", Integer.class); + public final int constMethodHasExceptionTable = getConstant("ConstMethod::_has_exception_table", Integer.class); - @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize; - @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset; - @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset; - @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset; - @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset; + final int exceptionTableElementSize = getTypeSize("ExceptionTableElement"); + public final int exceptionTableElementStartPcOffset = getFieldOffset("ExceptionTableElement::start_pc", Integer.class, "u2"); + public final int exceptionTableElementEndPcOffset = getFieldOffset("ExceptionTableElement::end_pc", Integer.class, "u2"); + public final int exceptionTableElementHandlerPcOffset = getFieldOffset("ExceptionTableElement::handler_pc", Integer.class, "u2"); + public final int exceptionTableElementCatchTypeIndexOffset = getFieldOffset("ExceptionTableElement::catch_type_index", Integer.class, "u2"); - @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize; - @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset; - @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset; - @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset; - @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset; - @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset; - @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset; + final int localVariableTableElementSize = getTypeSize("LocalVariableTableElement"); + public final int localVariableTableElementStartBciOffset = getFieldOffset("LocalVariableTableElement::start_bci", Integer.class, "u2"); + public final int localVariableTableElementLengthOffset = getFieldOffset("LocalVariableTableElement::length", Integer.class, "u2"); + public final int localVariableTableElementNameCpIndexOffset = getFieldOffset("LocalVariableTableElement::name_cp_index", Integer.class, "u2"); + public final int localVariableTableElementDescriptorCpIndexOffset = getFieldOffset("LocalVariableTableElement::descriptor_cp_index", Integer.class, "u2"); + public final int localVariableTableElementSignatureCpIndexOffset = getFieldOffset("LocalVariableTableElement::signature_cp_index", Integer.class, "u2"); + public final int localVariableTableElementSlotOffset = getFieldOffset("LocalVariableTableElement::slot", Integer.class, "u2"); - @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize; - @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset; - @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset; - @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset; + final int constantPoolSize = getTypeSize("ConstantPool"); + public final int constantPoolTagsOffset = getFieldOffset("ConstantPool::_tags", Integer.class, "Array<u1>*"); + public final int constantPoolHolderOffset = getFieldOffset("ConstantPool::_pool_holder", Integer.class, "InstanceKlass*"); + public final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length", Integer.class, "int"); - @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag; + public final int constantPoolCpCacheIndexTag = getConstant("ConstantPool::CPCACHE_INDEX_TAG", Integer.class); - @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8; - @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger; - @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong; - @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat; - @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble; - @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass; - @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass; - @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError; - @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString; - @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref; - @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref; - @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref; - @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType; - @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle; - @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError; - @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType; - @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError; - @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic; + public final int jvmConstantUtf8 = getConstant("JVM_CONSTANT_Utf8", Integer.class); + public final int jvmConstantInteger = getConstant("JVM_CONSTANT_Integer", Integer.class); + public final int jvmConstantLong = getConstant("JVM_CONSTANT_Long", Integer.class); + public final int jvmConstantFloat = getConstant("JVM_CONSTANT_Float", Integer.class); + public final int jvmConstantDouble = getConstant("JVM_CONSTANT_Double", Integer.class); + public final int jvmConstantClass = getConstant("JVM_CONSTANT_Class", Integer.class); + public final int jvmConstantUnresolvedClass = getConstant("JVM_CONSTANT_UnresolvedClass", Integer.class); + public final int jvmConstantUnresolvedClassInError = getConstant("JVM_CONSTANT_UnresolvedClassInError", Integer.class); + public final int jvmConstantString = getConstant("JVM_CONSTANT_String", Integer.class); + public final int jvmConstantFieldref = getConstant("JVM_CONSTANT_Fieldref", Integer.class); + public final int jvmConstantMethodref = getConstant("JVM_CONSTANT_Methodref", Integer.class); + public final int jvmConstantInterfaceMethodref = getConstant("JVM_CONSTANT_InterfaceMethodref", Integer.class); + public final int jvmConstantNameAndType = getConstant("JVM_CONSTANT_NameAndType", Integer.class); + public final int jvmConstantMethodHandle = getConstant("JVM_CONSTANT_MethodHandle", Integer.class); + public final int jvmConstantMethodHandleInError = getConstant("JVM_CONSTANT_MethodHandleInError", Integer.class); + public final int jvmConstantMethodType = getConstant("JVM_CONSTANT_MethodType", Integer.class); + public final int jvmConstantMethodTypeInError = getConstant("JVM_CONSTANT_MethodTypeInError", Integer.class); + public final int jvmConstantInvokeDynamic = getConstant("JVM_CONSTANT_InvokeDynamic", Integer.class); - @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax; - @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin; - @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax; + public final int jvmConstantExternalMax = getConstant("JVM_CONSTANT_ExternalMax", Integer.class); + public final int jvmConstantInternalMin = getConstant("JVM_CONSTANT_InternalMin", Integer.class); + public final int jvmConstantInternalMax = getConstant("JVM_CONSTANT_InternalMax", Integer.class); - @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize; + public final int heapWordSize = getConstant("HeapWordSize", Integer.class); - @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize; - @HotSpotVMField(name = "Symbol::_length", type = "unsigned short", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolLengthOffset; - @HotSpotVMField(name = "Symbol::_body[0]", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolBodyOffset; + final int symbolPointerSize = getTypeSize("Symbol*"); + public final int symbolLengthOffset = getFieldOffset("Symbol::_length", Integer.class, "unsigned short"); + public final int symbolBodyOffset = getFieldOffset("Symbol::_body[0]", Integer.class, "jbyte"); - @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols; - @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID; - @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit; + public final long vmSymbolsSymbols = getFieldAddress("vmSymbols::_symbols[0]", "Symbol*"); + public final int vmSymbolsFirstSID = getConstant("vmSymbols::FIRST_SID", Integer.class); + public final int vmSymbolsSIDLimit = getConstant("vmSymbols::SID_LIMIT", Integer.class); - @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int klassHasFinalizerFlag; + public final int klassHasFinalizerFlag = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class); // Modifier.SYNTHETIC is not public so we get it via vmStructs. - @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int syntheticFlag; + public final int syntheticFlag = getConstant("JVM_ACC_SYNTHETIC", Integer.class); - /** - * @see HotSpotResolvedObjectTypeImpl#createField - */ - @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers; +// /** +// * @see HotSpotResolvedObjectTypeImpl#createField +// */ +// public final int recognizedFieldModifiers = getConstant("JVM_RECOGNIZED_FIELD_MODIFIERS", +// Integer.class); + +// /** +// * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value +// * are allowed to look like (respectively) the high or low bits of a real oop. +// */ +// public final long nonOopBits = getFieldValue("Universe::_non_oop_bits", Long.class, "intptr_t"); - /** - * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value - * are allowed to look like (respectively) the high or low bits of a real oop. - */ - @HotSpotVMField(name = "Universe::_non_oop_bits", type = "intptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits; +// public final long verifyOopCounterAddress = getFieldAddress("StubRoutines::_verify_oop_count", +// "jint"); +// public final long verifyOopMask = getFieldValue("CompilerToVM::Data::Universe_verify_oop_mask", +// Long.class, "uintptr_t"); +// public final long verifyOopBits = getFieldValue("CompilerToVM::Data::Universe_verify_oop_bits", +// Long.class, "uintptr_t"); + public final int klassVtableStartOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_start_offset", Integer.class, "int"); + public final int klassVtableLengthOffset = getFieldValue("CompilerToVM::Data::Klass_vtable_length_offset", Integer.class, "int"); + public final int universeBaseVtableSize = getFieldValue("CompilerToVM::Data::Universe_base_vtable_size", Integer.class, "int"); - @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress; - @HotSpotVMValue(expression = "Universe::verify_oop_mask()") @Stable public long verifyOopMask; - @HotSpotVMValue(expression = "Universe::verify_oop_bits()") @Stable public long verifyOopBits; - - @HotSpotVMField(name = "CollectedHeap::_barrier_set", type = "BarrierSet*", get = HotSpotVMField.Type.OFFSET) @Stable public int collectedHeapBarrierSetOffset; - - @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes; + public final int baseVtableLength() { + return universeBaseVtableSize / vtableEntrySize; + } +// +// public final int collectedHeapBarrierSetOffset = getFieldOffset("CollectedHeap::_barrier_set", +// Integer.class, "BarrierSet*"); +// +// public final int logOfHRGrainBytes = getFieldValue("HeapRegion::LogOfHRGrainBytes", +// Integer.class, "int"); - @HotSpotVMField(name = "BarrierSet::_kind", type = "BarrierSet::Name", get = HotSpotVMField.Type.OFFSET) @Stable private int barrierSetKindOffset; - @HotSpotVMConstant(name = "BarrierSet::CardTableModRef") @Stable public int barrierSetCardTableModRef; - @HotSpotVMConstant(name = "BarrierSet::CardTableExtension") @Stable public int barrierSetCardTableExtension; - @HotSpotVMConstant(name = "BarrierSet::G1SATBCT") @Stable public int barrierSetG1SATBCT; - @HotSpotVMConstant(name = "BarrierSet::G1SATBCTLogging") @Stable public int barrierSetG1SATBCTLogging; - @HotSpotVMConstant(name = "BarrierSet::ModRef") @Stable public int barrierSetModRef; - @HotSpotVMConstant(name = "BarrierSet::Other") @Stable public int barrierSetOther; - - @HotSpotVMField(name = "CardTableModRefBS::byte_map_base", type = "jbyte*", get = HotSpotVMField.Type.OFFSET) @Stable private int cardTableModRefBSByteMapBaseOffset; - @HotSpotVMConstant(name = "CardTableModRefBS::card_shift") @Stable public int cardTableModRefBSCardShift; - - @HotSpotVMValue(expression = "(jbyte)CardTableModRefBS::dirty_card_val()") @Stable public byte dirtyCardValue; - @HotSpotVMValue(expression = "(jbyte)G1SATBCardTableModRefBS::g1_young_card_val()") @Stable public byte g1YoungCardValue; +// public final int barrierSetCardTableModRef = getConstant("BarrierSet::CardTableModRef", +// Integer.class); +// public final int barrierSetCardTableExtension = getConstant("BarrierSet::CardTableExtension", +// Integer.class); +// public final int barrierSetG1SATBCT = getConstant("BarrierSet::G1SATBCT", Integer.class); +// public final int barrierSetG1SATBCTLogging = getConstant("BarrierSet::G1SATBCTLogging", +// Integer.class); +// public final int barrierSetModRef = getConstant("BarrierSet::ModRef", Integer.class); +// public final int barrierSetOther = getConstant("BarrierSet::Other", Integer.class); +// +// public final int cardTableModRefBSCardShift = getConstant("CardTableModRefBS::card_shift", +// Integer.class); +// +// public final byte dirtyCardValue = getFieldValue("CompilerToVM::Data::dirty_card", Byte.class, +// "int"); +// public final byte g1YoungCardValue = getFieldValue("CompilerToVM::Data::g1_young_card", +// Byte.class, "int"); +// +// private final long cardtableStartAddress = +// getFieldValue("CompilerToVM::Data::cardtable_start_address", Long.class, "jbyte*"); +// private final int cardtableShift = getFieldValue("CompilerToVM::Data::cardtable_shift", +// Integer.class, "int"); +// +// public long cardtableStartAddress() { +// return cardtableStartAddress; +// } +// +// public int cardtableShift() { +// return cardtableShift; +// } - private final long cardtableStartAddress; - private final int cardtableShift; - - public long cardtableStartAddress() { - if (cardtableStartAddress == -1) { - throw JVMCIError.shouldNotReachHere(); - } - return cardtableStartAddress; - } - - public int cardtableShift() { - if (cardtableShift == -1) { - throw JVMCIError.shouldNotReachHere(); - } - return cardtableShift; - } - - @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress; +// public final long safepointPollingAddress = getFieldValue("os::_polling_page", Long.class, +// "address"); // G1 Collector Related Values. - public int g1CardQueueIndexOffset() { - return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset; - } - - public int g1CardQueueBufferOffset() { - return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset; - } +// public int g1CardQueueIndexOffset() { +// return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset; +// } +// +// public int g1CardQueueBufferOffset() { +// return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset; +// } +// +// public int g1SATBQueueMarkingOffset() { +// return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset; +// } +// +// public int g1SATBQueueIndexOffset() { +// return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset; +// } +// +// public int g1SATBQueueBufferOffset() { +// return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset; +// } - public int g1SATBQueueMarkingOffset() { - return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset; - } - - public int g1SATBQueueIndexOffset() { - return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset; - } - - public int g1SATBQueueBufferOffset() { - return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset; - } - - @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset; - @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset; + public final int klassOffset = getFieldValue("java_lang_Class::_klass_offset", Integer.class, "int"); +// public final int arrayKlassOffset = getFieldValue("java_lang_Class::_array_klass_offset", +// Integer.class, "int"); - @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset; - @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset; - @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset; + public final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*"); +// public final int methodCompiledEntryOffset = getFieldOffset("Method::_from_compiled_entry", +// Integer.class, "address"); + public final int methodCodeOffset = getFieldOffset("Method::_code", Integer.class, "nmethod*"); - @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize; - @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize; - @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset; - @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset; - @HotSpotVMField(name = "MethodData::_jvmci_ir_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataIRSizeOffset; + public final int methodDataSize = getFieldOffset("MethodData::_size", Integer.class, "int"); + public final int methodDataDataSize = getFieldOffset("MethodData::_data_size", Integer.class, "int"); + public final int methodDataOopDataOffset = getFieldOffset("MethodData::_data[0]", Integer.class, "intptr_t"); + public final int methodDataOopTrapHistoryOffset = getFieldOffset("MethodData::_trap_hist._array[0]", Integer.class, "u1"); + public final int methodDataIRSizeOffset = getFieldOffset("MethodData::_jvmci_ir_size", Integer.class, "int"); - @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset; - @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset; +// public final int nmethodEntryOffset = getFieldOffset("nmethod::_verified_entry_point", +// Integer.class, "address"); + public final int nmethodCompLevelOffset = getFieldOffset("nmethod::_comp_level", Integer.class, "int"); - @HotSpotVMConstant(name = "CompLevel_none") @Stable public int compilationLevelNone; - @HotSpotVMConstant(name = "CompLevel_simple") @Stable public int compilationLevelSimple; - @HotSpotVMConstant(name = "CompLevel_limited_profile") @Stable public int compilationLevelLimitedProfile; - @HotSpotVMConstant(name = "CompLevel_full_profile") @Stable public int compilationLevelFullProfile; - @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization; + public final int compilationLevelNone = getConstant("CompLevel_none", Integer.class); + public final int compilationLevelSimple = getConstant("CompLevel_simple", Integer.class); + public final int compilationLevelLimitedProfile = getConstant("CompLevel_limited_profile", Integer.class); + public final int compilationLevelFullProfile = getConstant("CompLevel_full_profile", Integer.class); + public final int compilationLevelFullOptimization = getConstant("CompLevel_full_optimization", Integer.class); - @HotSpotVMConstant(name = "JVMCIRuntime::none") @Stable public int compLevelAdjustmentNone; - @HotSpotVMConstant(name = "JVMCIRuntime::by_holder") @Stable public int compLevelAdjustmentByHolder; - @HotSpotVMConstant(name = "JVMCIRuntime::by_full_signature") @Stable public int compLevelAdjustmentByFullSignature; + public final int compLevelAdjustmentNone = getConstant("JVMCIRuntime::none", Integer.class); + public final int compLevelAdjustmentByHolder = getConstant("JVMCIRuntime::by_holder", Integer.class); + public final int compLevelAdjustmentByFullSignature = getConstant("JVMCIRuntime::by_full_signature", Integer.class); /** * This is the largest stack offset encodeable in an OopMapValue. Offsets larger than this will * throw an exception during code installation. */ - @HotSpotVMValue(expression = "JVMCIRuntime::max_oop_map_stack_offset") @Stable public int maxOopMapStackOffset; - - @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize; - @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset; - - @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->end_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapEndAddress; - @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->top_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapTopAddress; - - @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset; - - @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement; - @HotSpotVMValue(expression = "ThreadLocalAllocBuffer::alignment_reserve()") @Stable public int tlabAlignmentReserve; - - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset; - @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset; - - public int tlabSlowAllocationsOffset() { - return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset; - } - - public int tlabFastRefillWasteOffset() { - return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset; - } + public final int maxOopMapStackOffset = getFieldValue("JVMCIRuntime::max_oop_map_stack_offset", Integer.class, "int"); - public int tlabNumberOfRefillsOffset() { - return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset; - } - - public int tlabRefillWasteLimitOffset() { - return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset; - } - - public int threadTlabSizeOffset() { - return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset; - } - - public int threadTlabStartOffset() { - return threadTlabOffset + threadLocalAllocBufferStartOffset; - } - - public int threadTlabEndOffset() { - return threadTlabOffset + threadLocalAllocBufferEndOffset; - } - - public int threadTlabTopOffset() { - return threadTlabOffset + threadLocalAllocBufferTopOffset; - } - - public int threadTlabPfTopOffset() { - return threadTlabOffset + threadLocalAllocBufferPfTopOffset; - } - - @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats; - @HotSpotVMValue(expression = " !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()") @Stable public boolean inlineContiguousAllocationSupported; - +// final int basicLockSize = getTypeSize("BasicLock"); +// public final int basicLockDisplacedHeaderOffset = getFieldOffset("BasicLock::_displaced_header", +// Integer.class, "markOop"); +// +// public final int threadAllocatedBytesOffset = getFieldOffset("Thread::_allocated_bytes", +// Integer.class, "jlong"); +// +// public final int tlabRefillWasteIncrement = getFlag("TLABWasteIncrement", Integer.class); +// +// private final int threadLocalAllocBufferStartOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_start", Integer.class, "HeapWord*"); +// private final int threadLocalAllocBufferEndOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_end", Integer.class, "HeapWord*"); +// private final int threadLocalAllocBufferTopOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_top", Integer.class, "HeapWord*"); +// private final int threadLocalAllocBufferPfTopOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_pf_top", Integer.class, "HeapWord*"); +// private final int threadLocalAllocBufferSlowAllocationsOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_slow_allocations", Integer.class, "unsigned"); +// private final int threadLocalAllocBufferFastRefillWasteOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_fast_refill_waste", Integer.class, "unsigned"); +// private final int threadLocalAllocBufferNumberOfRefillsOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_number_of_refills", Integer.class, "unsigned"); +// private final int threadLocalAllocBufferRefillWasteLimitOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_refill_waste_limit", Integer.class, "size_t"); +// private final int threadLocalAllocBufferDesiredSizeOffset = +// getFieldOffset("ThreadLocalAllocBuffer::_desired_size", Integer.class, "size_t"); +// +// public int tlabSlowAllocationsOffset() { +// return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset; +// } +// +// public int tlabFastRefillWasteOffset() { +// return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset; +// } +// +// public int tlabNumberOfRefillsOffset() { +// return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset; +// } +// +// public int tlabRefillWasteLimitOffset() { +// return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset; +// } +// +// public int threadTlabSizeOffset() { +// return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset; +// } +// +// public int threadTlabStartOffset() { +// return threadTlabOffset + threadLocalAllocBufferStartOffset; +// } +// +// public int threadTlabEndOffset() { +// return threadTlabOffset + threadLocalAllocBufferEndOffset; +// } +// +// public int threadTlabTopOffset() { +// return threadTlabOffset + threadLocalAllocBufferTopOffset; +// } +// +// public int threadTlabPfTopOffset() { +// return threadTlabOffset + threadLocalAllocBufferPfTopOffset; +// } +// +// public final int tlabAlignmentReserve = +// getFieldValue("CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve", Integer.class, +// "size_t"); +// +// public final boolean tlabStats = getFlag("TLABStats", Boolean.class); +// +// public final boolean inlineContiguousAllocationSupported = +// getFieldValue("CompilerToVM::Data::_supports_inline_contig_alloc", Boolean.class); +// public final long heapEndAddress = getFieldValue("CompilerToVM::Data::_heap_end_addr", +// Long.class, "HeapWord**"); +// public final long heapTopAddress = getFieldValue("CompilerToVM::Data::_heap_top_addr", +// Long.class, "HeapWord**"); +// /** * The DataLayout header size is the same as the cell size. */ - @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize; - @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset; - @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset; - @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset; - @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset; - @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize; + public final int dataLayoutHeaderSize = getConstant("DataLayout::cell_size", Integer.class); + public final int dataLayoutTagOffset = getFieldOffset("DataLayout::_header._struct._tag", Integer.class, "u1"); + public final int dataLayoutFlagsOffset = getFieldOffset("DataLayout::_header._struct._flags", Integer.class, "u1"); + public final int dataLayoutBCIOffset = getFieldOffset("DataLayout::_header._struct._bci", Integer.class, "u2"); + public final int dataLayoutCellsOffset = getFieldOffset("DataLayout::_cells[0]", Integer.class, "intptr_t"); + public final int dataLayoutCellSize = getConstant("DataLayout::cell_size", Integer.class); - @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag; - @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag; - @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag; - @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag; - @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag; - @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag; - @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag; - @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag; - @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag; - @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag; - @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag; - @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag; - @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag; - @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag; - - @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth; - @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth; - @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth; - - @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset; - @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob; - - @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->unpack()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long handleDeoptStub; - @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->uncommon_trap()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long uncommonTrapStub; - - public final long inlineCacheMissStub; - - @HotSpotVMField(name = "CodeCache::_heap", type = "CodeHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long codeCacheHeap; - @HotSpotVMField(name = "CodeHeap::_memory", type = "VirtualSpace", get = HotSpotVMField.Type.OFFSET) @Stable private int codeHeapMemoryOffset; - @HotSpotVMField(name = "VirtualSpace::_low_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceLowBoundaryOffset; - @HotSpotVMField(name = "VirtualSpace::_high_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceHighBoundaryOffset; + public final int dataLayoutNoTag = getConstant("DataLayout::no_tag", Integer.class); + public final int dataLayoutBitDataTag = getConstant("DataLayout::bit_data_tag", Integer.class); + public final int dataLayoutCounterDataTag = getConstant("DataLayout::counter_data_tag", Integer.class); + public final int dataLayoutJumpDataTag = getConstant("DataLayout::jump_data_tag", Integer.class); + public final int dataLayoutReceiverTypeDataTag = getConstant("DataLayout::receiver_type_data_tag", Integer.class); + public final int dataLayoutVirtualCallDataTag = getConstant("DataLayout::virtual_call_data_tag", Integer.class); + public final int dataLayoutRetDataTag = getConstant("DataLayout::ret_data_tag", Integer.class); + public final int dataLayoutBranchDataTag = getConstant("DataLayout::branch_data_tag", Integer.class); + public final int dataLayoutMultiBranchDataTag = getConstant("DataLayout::multi_branch_data_tag", Integer.class); + public final int dataLayoutArgInfoDataTag = getConstant("DataLayout::arg_info_data_tag", Integer.class); + public final int dataLayoutCallTypeDataTag = getConstant("DataLayout::call_type_data_tag", Integer.class); + public final int dataLayoutVirtualCallTypeDataTag = getConstant("DataLayout::virtual_call_type_data_tag", Integer.class); + public final int dataLayoutParametersTypeDataTag = getConstant("DataLayout::parameters_type_data_tag", Integer.class); + public final int dataLayoutSpeculativeTrapDataTag = getConstant("DataLayout::speculative_trap_data_tag", Integer.class); - public final long codeCacheLowBound; - public final long codeCacheHighBound; - - @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub; - @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub; - @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub; - @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub; - @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub; - @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress; + public final int bciProfileWidth = getFlag("BciProfileWidth", Integer.class); + public final int typeProfileWidth = getFlag("TypeProfileWidth", Integer.class); + public final int methodProfileWidth = getFlag("MethodProfileWidth", Integer.class); +// +// public final long handleDeoptStub = +// getFieldValue("CompilerToVM::Data::SharedRuntime_deopt_blob_unpack", Long.class, "address"); +// public final long uncommonTrapStub = +// getFieldValue("CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap", Long.class, +// "address"); +// +// public final long inlineCacheMissStub = +// getFieldValue("CompilerToVM::Data::SharedRuntime_ic_miss_stub", Long.class, "address"); - @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy; - @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy; - @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy; - @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy; - @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy; - @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit; - @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit; - @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit; - @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy; - @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit; - @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy; - @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit; - @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy; - @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy; +// public final long javaTimeMillisAddress = getAddress("os::javaTimeMillis"); +// public final long javaTimeNanosAddress = getAddress("os::javaTimeNanos"); +// public final long arithmeticSinAddress = getFieldValue("CompilerToVM::Data::dsin", Long.class, +// "address"); +// public final long arithmeticCosAddress = getFieldValue("CompilerToVM::Data::dcos", Long.class, +// "address"); +// public final long arithmeticTanAddress = getFieldValue("CompilerToVM::Data::dtan", Long.class, +// "address"); +// public final long arithmeticExpAddress = getFieldValue("CompilerToVM::Data::dexp", Long.class, +// "address"); +// public final long arithmeticLogAddress = getFieldValue("CompilerToVM::Data::dlog", Long.class, +// "address"); +// public final long arithmeticLog10Address = getFieldValue("CompilerToVM::Data::dlog10", +// Long.class, "address"); +// public final long arithmeticPowAddress = getFieldValue("CompilerToVM::Data::dpow", Long.class, +// "address"); + +// public final int jvmciCountersSize = getFlag("JVMCICounterSize", Integer.class); - @HotSpotVMValue(expression = "JVMCIRuntime::new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newInstanceAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newArrayAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::new_multi_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newMultiArrayAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewArrayAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewInstanceAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::thread_is_interrupted", get = HotSpotVMValue.Type.ADDRESS) @Stable public long threadIsInterruptedAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::vm_message", signature = "(unsigned char, long, long, long, long)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmMessageAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::identity_hash_code", get = HotSpotVMValue.Type.ADDRESS) @Stable public long identityHashCodeAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::exception_handler_for_pc", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForPcAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::monitorenter", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorenterAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::monitorexit", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorexitAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::throw_and_post_jvmti_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwAndPostJvmtiExceptionAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::throw_klass_external_name_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwKlassExternalNameExceptionAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::throw_class_cast_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long throwClassCastExceptionAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::log_primitive", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrimitiveAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::log_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logObjectAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::log_printf", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrintfAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::vm_error", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmErrorAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::load_and_clear_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long loadAndClearExceptionAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_pre", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPreAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_post", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPostAddress; - @HotSpotVMValue(expression = "JVMCIRuntime::validate_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long validateObject; +// public final long deoptimizationFetchUnrollInfo = +// getAddress("Deoptimization::fetch_unroll_info"); +// public final long deoptimizationUncommonTrap = getAddress("Deoptimization::uncommon_trap"); +// public final long deoptimizationUnpackFrames = getAddress("Deoptimization::unpack_frames"); +// + public final int deoptReasonNone = getConstant("Deoptimization::Reason_none", Integer.class); + public final int deoptReasonNullCheck = getConstant("Deoptimization::Reason_null_check", Integer.class); + public final int deoptReasonRangeCheck = getConstant("Deoptimization::Reason_range_check", Integer.class); + public final int deoptReasonClassCheck = getConstant("Deoptimization::Reason_class_check", Integer.class); + public final int deoptReasonArrayCheck = getConstant("Deoptimization::Reason_array_check", Integer.class); + public final int deoptReasonUnreached0 = getConstant("Deoptimization::Reason_unreached0", Integer.class); + public final int deoptReasonTypeCheckInlining = getConstant("Deoptimization::Reason_type_checked_inlining", Integer.class); + public final int deoptReasonOptimizedTypeCheck = getConstant("Deoptimization::Reason_optimized_type_check", Integer.class); + public final int deoptReasonNotCompiledExceptionHandler = getConstant("Deoptimization::Reason_not_compiled_exception_handler", Integer.class); + public final int deoptReasonUnresolved = getConstant("Deoptimization::Reason_unresolved", Integer.class); + public final int deoptReasonJsrMismatch = getConstant("Deoptimization::Reason_jsr_mismatch", Integer.class); + public final int deoptReasonDiv0Check = getConstant("Deoptimization::Reason_div0_check", Integer.class); + public final int deoptReasonConstraint = getConstant("Deoptimization::Reason_constraint", Integer.class); + public final int deoptReasonLoopLimitCheck = getConstant("Deoptimization::Reason_loop_limit_check", Integer.class); + public final int deoptReasonAliasing = getConstant("Deoptimization::Reason_aliasing", Integer.class); + public final int deoptReasonTransferToInterpreter = getConstant("Deoptimization::Reason_transfer_to_interpreter", Integer.class); + public final int deoptReasonOSROffset = getConstant("Deoptimization::Reason_LIMIT", Integer.class); - @HotSpotVMValue(expression = "JVMCIRuntime::test_deoptimize_call_int", get = HotSpotVMValue.Type.ADDRESS) @Stable public long testDeoptimizeCallInt; - - @HotSpotVMValue(expression = "SharedRuntime::register_finalizer", get = HotSpotVMValue.Type.ADDRESS) @Stable public long registerFinalizerAddress; - @HotSpotVMValue(expression = "SharedRuntime::exception_handler_for_return_address", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForReturnAddressAddress; - @HotSpotVMValue(expression = "SharedRuntime::OSR_migration_end", get = HotSpotVMValue.Type.ADDRESS) @Stable public long osrMigrationEndAddress; - - @HotSpotVMValue(expression = "os::javaTimeMillis", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeMillisAddress; - @HotSpotVMValue(expression = "os::javaTimeNanos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeNanosAddress; - @HotSpotVMValue(expression = "SharedRuntime::dsin", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticSinAddress; - @HotSpotVMValue(expression = "SharedRuntime::dcos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticCosAddress; - @HotSpotVMValue(expression = "SharedRuntime::dtan", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticTanAddress; - @HotSpotVMValue(expression = "SharedRuntime::dexp", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticExpAddress; - @HotSpotVMValue(expression = "SharedRuntime::dlog", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLogAddress; - @HotSpotVMValue(expression = "SharedRuntime::dlog10", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLog10Address; - @HotSpotVMValue(expression = "SharedRuntime::dpow", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticPowAddress; - - @HotSpotVMValue(expression = "(jint) JVMCICounterSize") @Stable public int jvmciCountersSize; - - @HotSpotVMValue(expression = "Deoptimization::fetch_unroll_info", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationFetchUnrollInfo; - @HotSpotVMValue(expression = "Deoptimization::uncommon_trap", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUncommonTrap; - @HotSpotVMValue(expression = "Deoptimization::unpack_frames", signature = "(JavaThread*, int)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUnpackFrames; + public final int deoptActionNone = getConstant("Deoptimization::Action_none", Integer.class); + public final int deoptActionMaybeRecompile = getConstant("Deoptimization::Action_maybe_recompile", Integer.class); + public final int deoptActionReinterpret = getConstant("Deoptimization::Action_reinterpret", Integer.class); + public final int deoptActionMakeNotEntrant = getConstant("Deoptimization::Action_make_not_entrant", Integer.class); + public final int deoptActionMakeNotCompilable = getConstant("Deoptimization::Action_make_not_compilable", Integer.class); - @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone; - @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_class_check") @Stable public int deoptReasonClassCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_array_check") @Stable public int deoptReasonArrayCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_unreached0") @Stable public int deoptReasonUnreached0; - @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining; - @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler; - @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved; - @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @Stable public int deoptReasonJsrMismatch; - @HotSpotVMConstant(name = "Deoptimization::Reason_div0_check") @Stable public int deoptReasonDiv0Check; - @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint; - @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck; - @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing; - @HotSpotVMConstant(name = "Deoptimization::Reason_transfer_to_interpreter") @Stable public int deoptReasonTransferToInterpreter; - @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset; - - @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone; - @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile; - @HotSpotVMConstant(name = "Deoptimization::Action_reinterpret") @Stable public int deoptActionReinterpret; - @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant; - @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable; + public final int deoptimizationActionBits = getConstant("Deoptimization::_action_bits", Integer.class); + public final int deoptimizationReasonBits = getConstant("Deoptimization::_reason_bits", Integer.class); + public final int deoptimizationDebugIdBits = getConstant("Deoptimization::_debug_id_bits", Integer.class); + public final int deoptimizationActionShift = getConstant("Deoptimization::_action_shift", Integer.class); + public final int deoptimizationReasonShift = getConstant("Deoptimization::_reason_shift", Integer.class); + public final int deoptimizationDebugIdShift = getConstant("Deoptimization::_debug_id_shift", Integer.class); +// +// public final int deoptimizationUnpackDeopt = getConstant("Deoptimization::Unpack_deopt", +// Integer.class); +// public final int deoptimizationUnpackException = getConstant("Deoptimization::Unpack_exception", +// Integer.class); +// public final int deoptimizationUnpackUncommonTrap = +// getConstant("Deoptimization::Unpack_uncommon_trap", Integer.class); +// public final int deoptimizationUnpackReexecute = getConstant("Deoptimization::Unpack_reexecute", +// Integer.class); +// +// public final int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_size_of_deoptimized_frame", Integer.class, "int"); +// public final int deoptimizationUnrollBlockCallerAdjustmentOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_caller_adjustment", Integer.class, "int"); +// public final int deoptimizationUnrollBlockNumberOfFramesOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_number_of_frames", Integer.class, "int"); +// public final int deoptimizationUnrollBlockTotalFrameSizesOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_total_frame_sizes", Integer.class, "int"); +// public final int deoptimizationUnrollBlockUnpackKindOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_unpack_kind", Integer.class, "int"); +// public final int deoptimizationUnrollBlockFrameSizesOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_frame_sizes", Integer.class, "intptr_t*"); +// public final int deoptimizationUnrollBlockFramePcsOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_frame_pcs", Integer.class, "address*"); +// public final int deoptimizationUnrollBlockInitialInfoOffset = +// getFieldOffset("Deoptimization::UnrollBlock::_initial_info", Integer.class, "intptr_t"); - @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits; - @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits; - @HotSpotVMConstant(name = "Deoptimization::_debug_id_bits") @Stable public int deoptimizationDebugIdBits; - @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift; - @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift; - @HotSpotVMConstant(name = "Deoptimization::_debug_id_shift") @Stable public int deoptimizationDebugIdShift; - - @HotSpotVMConstant(name = "Deoptimization::Unpack_deopt") @Stable public int deoptimizationUnpackDeopt; - @HotSpotVMConstant(name = "Deoptimization::Unpack_exception") @Stable public int deoptimizationUnpackException; - @HotSpotVMConstant(name = "Deoptimization::Unpack_uncommon_trap") @Stable public int deoptimizationUnpackUncommonTrap; - @HotSpotVMConstant(name = "Deoptimization::Unpack_reexecute") @Stable public int deoptimizationUnpackReexecute; + public final int vmIntrinsicInvokeBasic = getConstant("vmIntrinsics::_invokeBasic", Integer.class); + public final int vmIntrinsicLinkToVirtual = getConstant("vmIntrinsics::_linkToVirtual", Integer.class); + public final int vmIntrinsicLinkToStatic = getConstant("vmIntrinsics::_linkToStatic", Integer.class); + public final int vmIntrinsicLinkToSpecial = getConstant("vmIntrinsics::_linkToSpecial", Integer.class); + public final int vmIntrinsicLinkToInterface = getConstant("vmIntrinsics::_linkToInterface", Integer.class); - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_size_of_deoptimized_frame", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_caller_adjustment", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockCallerAdjustmentOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_number_of_frames", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockNumberOfFramesOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_total_frame_sizes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockTotalFrameSizesOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_unpack_kind", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockUnpackKindOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_sizes", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFrameSizesOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_pcs", type = "address*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFramePcsOffset; - @HotSpotVMField(name = "Deoptimization::UnrollBlock::_initial_info", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockInitialInfoOffset; - - @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic; - @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual; - @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic; - @HotSpotVMConstant(name = "vmIntrinsics::_linkToSpecial") @Stable public int vmIntrinsicLinkToSpecial; - @HotSpotVMConstant(name = "vmIntrinsics::_linkToInterface") @Stable public int vmIntrinsicLinkToInterface; - - @HotSpotVMConstant(name = "JVMCIEnv::ok") @Stable public int codeInstallResultOk; - @HotSpotVMConstant(name = "JVMCIEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed; - @HotSpotVMConstant(name = "JVMCIEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid; - @HotSpotVMConstant(name = "JVMCIEnv::cache_full") @Stable public int codeInstallResultCacheFull; - @HotSpotVMConstant(name = "JVMCIEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge; + public final int codeInstallResultOk = getConstant("JVMCIEnv::ok", Integer.class); + public final int codeInstallResultDependenciesFailed = getConstant("JVMCIEnv::dependencies_failed", Integer.class); + public final int codeInstallResultDependenciesInvalid = getConstant("JVMCIEnv::dependencies_invalid", Integer.class); + public final int codeInstallResultCacheFull = getConstant("JVMCIEnv::cache_full", Integer.class); + public final int codeInstallResultCodeTooLarge = getConstant("JVMCIEnv::code_too_large", Integer.class); public String getCodeInstallResultDescription(int codeInstallResult) { if (codeInstallResult == codeInstallResultOk) { @@ -1557,41 +829,54 @@ return "unknown"; } - @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag; - @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag; + public final int compilerToVMKlassTag = getConstant("CompilerToVM::KLASS_TAG", Integer.class); + public final int compilerToVMSymbolTag = getConstant("CompilerToVM::SYMBOL_TAG", Integer.class); // Checkstyle: stop - @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY; - @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY; - @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY; - @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY; - @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY; - @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE; - @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL; - @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC; - @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL; - @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE; - @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR; - @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR; - @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR; - @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR; - @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int MARKID_CARD_TABLE_SHIFT; - @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS; - @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID; +// public final int MARKID_VERIFIED_ENTRY = getConstant("CodeInstaller::VERIFIED_ENTRY", +// Integer.class); +// public final int MARKID_UNVERIFIED_ENTRY = getConstant("CodeInstaller::UNVERIFIED_ENTRY", +// Integer.class); +// public final int MARKID_OSR_ENTRY = getConstant("CodeInstaller::OSR_ENTRY", Integer.class); +// public final int MARKID_EXCEPTION_HANDLER_ENTRY = +// getConstant("CodeInstaller::EXCEPTION_HANDLER_ENTRY", Integer.class); +// public final int MARKID_DEOPT_HANDLER_ENTRY = getConstant("CodeInstaller::DEOPT_HANDLER_ENTRY", +// Integer.class); +// public final int MARKID_INVOKEINTERFACE = getConstant("CodeInstaller::INVOKEINTERFACE", +// Integer.class); +// public final int MARKID_INVOKEVIRTUAL = getConstant("CodeInstaller::INVOKEVIRTUAL", +// Integer.class); +// public final int MARKID_INVOKESTATIC = getConstant("CodeInstaller::INVOKESTATIC", Integer.class); +// public final int MARKID_INVOKESPECIAL = getConstant("CodeInstaller::INVOKESPECIAL", +// Integer.class); +// public final int MARKID_INLINE_INVOKE = getConstant("CodeInstaller::INLINE_INVOKE", +// Integer.class); +// public final int MARKID_POLL_NEAR = getConstant("CodeInstaller::POLL_NEAR", Integer.class); +// public final int MARKID_POLL_RETURN_NEAR = getConstant("CodeInstaller::POLL_RETURN_NEAR", +// Integer.class); +// public final int MARKID_POLL_FAR = getConstant("CodeInstaller::POLL_FAR", Integer.class); +// public final int MARKID_POLL_RETURN_FAR = getConstant("CodeInstaller::POLL_RETURN_FAR", +// Integer.class); +// public final int MARKID_CARD_TABLE_SHIFT = getConstant("CodeInstaller::CARD_TABLE_SHIFT", +// Integer.class); +// public final int MARKID_CARD_TABLE_ADDRESS = getConstant("CodeInstaller::CARD_TABLE_ADDRESS", +// Integer.class); +// public final int MARKID_INVOKE_INVALID = getConstant("CodeInstaller::INVOKE_INVALID", +// Integer.class); - @HotSpotVMConstant(name = "BitData::exception_seen_flag") @Stable public int bitDataExceptionSeenFlag; - @HotSpotVMConstant(name = "BitData::null_seen_flag") @Stable public int bitDataNullSeenFlag; - @HotSpotVMConstant(name = "CounterData::count_off") @Stable public int methodDataCountOffset; - @HotSpotVMConstant(name = "JumpData::taken_off_set") @Stable public int jumpDataTakenOffset; - @HotSpotVMConstant(name = "JumpData::displacement_off_set") @Stable public int jumpDataDisplacementOffset; - @HotSpotVMConstant(name = "ReceiverTypeData::nonprofiled_count_off_set") @Stable public int receiverTypeDataNonprofiledCountOffset; - @HotSpotVMConstant(name = "ReceiverTypeData::receiver_type_row_cell_count") @Stable public int receiverTypeDataReceiverTypeRowCellCount; - @HotSpotVMConstant(name = "ReceiverTypeData::receiver0_offset") @Stable public int receiverTypeDataReceiver0Offset; - @HotSpotVMConstant(name = "ReceiverTypeData::count0_offset") @Stable public int receiverTypeDataCount0Offset; - @HotSpotVMConstant(name = "BranchData::not_taken_off_set") @Stable public int branchDataNotTakenOffset; - @HotSpotVMConstant(name = "ArrayData::array_len_off_set") @Stable public int arrayDataArrayLenOffset; - @HotSpotVMConstant(name = "ArrayData::array_start_off_set") @Stable public int arrayDataArrayStartOffset; - @HotSpotVMConstant(name = "MultiBranchData::per_case_cell_count") @Stable public int multiBranchDataPerCaseCellCount; + public final int bitDataExceptionSeenFlag = getConstant("BitData::exception_seen_flag", Integer.class); + public final int bitDataNullSeenFlag = getConstant("BitData::null_seen_flag", Integer.class); + public final int methodDataCountOffset = getConstant("CounterData::count_off", Integer.class); + public final int jumpDataTakenOffset = getConstant("JumpData::taken_off_set", Integer.class); + public final int jumpDataDisplacementOffset = getConstant("JumpData::displacement_off_set", Integer.class); + public final int receiverTypeDataNonprofiledCountOffset = getConstant("ReceiverTypeData::nonprofiled_count_off_set", Integer.class); + public final int receiverTypeDataReceiverTypeRowCellCount = getConstant("ReceiverTypeData::receiver_type_row_cell_count", Integer.class); + public final int receiverTypeDataReceiver0Offset = getConstant("ReceiverTypeData::receiver0_offset", Integer.class); + public final int receiverTypeDataCount0Offset = getConstant("ReceiverTypeData::count0_offset", Integer.class); + public final int branchDataNotTakenOffset = getConstant("BranchData::not_taken_off_set", Integer.class); + public final int arrayDataArrayLenOffset = getConstant("ArrayData::array_len_off_set", Integer.class); + public final int arrayDataArrayStartOffset = getConstant("ArrayData::array_start_off_set", Integer.class); + public final int multiBranchDataPerCaseCellCount = getConstant("MultiBranchData::per_case_cell_count", Integer.class); // Checkstyle: resume @@ -1603,128 +888,9 @@ } } - assert codeEntryAlignment > 0 : codeEntryAlignment; assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set"; assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set"; return true; } - - /** - * A compact representation of the different encoding strategies for Objects and metadata. - */ - public static class CompressEncoding { - public final long base; - public final int shift; - public final int alignment; - - CompressEncoding(long base, int shift, int alignment) { - this.base = base; - this.shift = shift; - this.alignment = alignment; - } - - public int compress(long ptr) { - if (ptr == 0L) { - return 0; - } else { - return (int) ((ptr - base) >>> shift); - } - } - - public long uncompress(int ptr) { - if (ptr == 0) { - return 0L; - } else { - return ((ptr & 0xFFFFFFFFL) << shift) + base; - } - } - - @Override - public String toString() { - return "base: " + base + " shift: " + shift + " alignment: " + alignment; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + alignment; - result = prime * result + (int) (base ^ (base >>> 32)); - result = prime * result + shift; - return result; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof CompressEncoding) { - CompressEncoding other = (CompressEncoding) obj; - return alignment == other.alignment && base == other.base && shift == other.shift; - } else { - return false; - } - } - } - - /** - * Returns the name of the C/C++ symbol that is associated (via HotSpotVMValue annotation) with - * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds - * the provided address. - * - * @param value value of the field - * @return C/C++ symbol name or null - */ - public String getVMValueCSymbol(long value) { - for (Field f : HotSpotVMConfig.class.getDeclaredFields()) { - if (f.isAnnotationPresent(HotSpotVMValue.class)) { - HotSpotVMValue annotation = f.getAnnotation(HotSpotVMValue.class); - - if (annotation.get() == HotSpotVMValue.Type.ADDRESS) { - try { - if (value == f.getLong(this)) { - return (annotation.expression() + annotation.signature()); - } - } catch (IllegalArgumentException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - } - } - return null; - } - - /** - * Returns the name of the C/C++ symbol that is associated (via HotSpotVMField annotation) with - * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds - * the provided address. - * - * @param value value of the field - * @return C/C++ symbol name or null - */ - public String getVMFieldCSymbol(long value) { - for (Field f : HotSpotVMConfig.class.getDeclaredFields()) { - if (f.isAnnotationPresent(HotSpotVMField.class)) { - HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class); - - if (annotation.get() == HotSpotVMField.Type.VALUE) { - try { - if (value == f.getLong(this)) { - return (annotation.name()); - } - } catch (IllegalArgumentException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - } - } - return null; - } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot; + +import jdk.vm.ci.common.JVMCIError; + +/** + * Access to VM configuration data. + */ +public class HotSpotVMConfigAccess { + + /** + * Gets the address of a C++ symbol. + * + * @param name name of C++ symbol + * @param notPresent if non-null and the symbol is not present then this value is returned + * @return the address of the symbol + * @throws JVMCIError if the symbol is not present and {@code notPresent == null} + */ + public long getAddress(String name, Long notPresent) { + Long entry = store.vmAddresses.get(name); + if (entry == null) { + if (notPresent != null) { + return notPresent; + } + throw new JVMCIError("expected VM symbol not found: " + name); + } + return entry; + } + + /** + * Gets the address of a C++ symbol. + * + * @param name name of C++ symbol + * @return the address of the symbol + * @throws JVMCIError if the symbol is not present + */ + public long getAddress(String name) { + return getAddress(name, null); + } + + /** + * Gets the size of a C++ type. + * + * @param name name of the type + * @return the size in bytes of the requested field + * @throws JVMCIError if the field is not present and {@code notPresent} is null + */ + public int getTypeSize(String name) { + Long entry = store.vmTypeSizes.get(name); + if (entry == null) { + throw new JVMCIError("expected VM type not found: " + name); + } + return (int) (long) entry; + } + + /** + * Gets the value of a C++ constant. + * + * @param name name of the constant (e.g., {@code "frame::arg_reg_save_area_bytes"}) + * @param type the boxed type to which the constant value will be converted + * @param notPresent if non-null and the constant is not present then this value is returned + * @return the constant value converted to {@code type} + * @throws JVMCIError if the constant is not present and {@code notPresent == null} + */ + public <T> T getConstant(String name, Class<T> type, T notPresent) { + Long c = store.vmConstants.get(name); + if (c == null) { + if (notPresent != null) { + return notPresent; + } + throw new JVMCIError("expected VM constant not found: " + name); + } + return type.cast(convertValue(name, type, c, null)); + } + + /** + * Gets the value of a C++ constant. + * + * @param name name of the constant (e.g., {@code "frame::arg_reg_save_area_bytes"}) + * @param type the boxed type to which the constant value will be converted + * @return the constant value converted to {@code type} + * @throws JVMCIError if the constant is not present + */ + public <T> T getConstant(String name, Class<T> type) { + return getConstant(name, type, null); + } + + /** + * Gets the offset of a non-static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the offset value will be converted (must be + * {@link Integer} or {@link Long}) + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @param notPresent if non-null and the field is not present then this value is returned + * @return the offset in bytes of the requested field + * @throws JVMCIError if the field is static or not present and {@code notPresent} is null + */ + public <T> T getFieldOffset(String name, Class<T> type, String cppType, T notPresent) { + assert type == Integer.class || type == Long.class; + VMField entry = getField(name, cppType, notPresent == null); + if (entry == null) { + return notPresent; + } + if (entry.address != 0) { + throw new JVMCIError("cannot get offset of static field " + name); + } + return entry == null ? notPresent : type.cast(convertValue(name, type, entry.offset, cppType)); + } + + /** + * Gets the offset of a non-static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the offset value will be converted (must be + * {@link Integer} or {@link Long}) + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @return the offset in bytes of the requested field + * @throws JVMCIError if the field is static or not present + */ + public <T> T getFieldOffset(String name, Class<T> type, String cppType) { + return getFieldOffset(name, type, cppType, null); + } + + /** + * Gets the offset of a non-static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the offset value will be converted (must be + * {@link Integer} or {@link Long}) + * @return the offset in bytes of the requested field + * @throws JVMCIError if the field is static or not present + */ + public <T> T getFieldOffset(String name, Class<T> type) { + return getFieldOffset(name, type, null, null); + } + + /** + * Gets the address of a static C++ field. + * + * @param name fully qualified name of the field + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @param notPresent if non-null and the field is not present then this value is returned + * @return the address of the requested field + * @throws JVMCIError if the field is not static or not present and {@code notPresent} is null + */ + public long getFieldAddress(String name, String cppType, Long notPresent) { + VMField entry = getField(name, cppType, notPresent == null); + if (entry == null) { + return notPresent; + } + if (entry.address == 0) { + throw new JVMCIError(name + " is not a static field"); + } + return entry == null ? notPresent : entry.address; + } + + /** + * Gets the address of a static C++ field. + * + * @param name fully qualified name of the field + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @return the address of the requested field + * @throws JVMCIError if the field is not static or not present + */ + public long getFieldAddress(String name, String cppType) { + return getFieldAddress(name, cppType, null); + } + + /** + * Gets the value of a static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the constant value will be converted + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @param notPresent if non-null and the field is not present then this value is returned + * @return the value of the requested field + * @throws JVMCIError if the field is not static or not present and {@code notPresent} is null + */ + public <T> T getFieldValue(String name, Class<T> type, String cppType, T notPresent) { + VMField entry = getField(name, cppType, notPresent == null); + if (entry == null) { + return notPresent; + } + if (entry.value == null) { + throw new JVMCIError(name + " is not a static field"); + } + return type.cast(convertValue(name, type, entry.value, cppType)); + } + + /** + * Gets the value of a static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the constant value will be converted + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @return the value of the requested field + * @throws JVMCIError if the field is not static or not present + */ + public <T> T getFieldValue(String name, Class<T> type, String cppType) { + return getFieldValue(name, type, cppType, null); + } + + /** + * Gets the value of a static C++ field. + * + * @param name fully qualified name of the field + * @param type the boxed type to which the constant value will be converted + * @return the value of the requested field + * @throws JVMCIError if the field is not static or not present + */ + public <T> T getFieldValue(String name, Class<T> type) { + return getFieldValue(name, type, null, null); + } + + /** + * Gets a C++ field. + * + * @param name fully qualified name of the field + * @param cppType if non-null, the expected C++ type of the field (e.g., {@code "HeapWord*"}) + * @param required specifies if the field must be present + * @return the field + * @throws JVMCIError if the field is not present and {@code required == true} + */ + private VMField getField(String name, String cppType, boolean required) { + VMField entry = store.vmFields.get(name); + if (entry == null) { + if (!required) { + return null; + } + throw new JVMCIError("expected VM field not found: " + name); + } + + // Make sure the native type is still the type we expect. + if (cppType != null && !cppType.equals(entry.type)) { + throw new JVMCIError("expected type " + cppType + " but VM field " + name + " is of type " + entry.type); + } + return entry; + } + + /** + * Gets a VM flag value. + * + * @param name name of the flag (e.g., {@code "CompileTheWorldStartAt"}) + * @param type the boxed type to which the flag's value will be converted + * @return the flag's value converted to {@code type} or {@code notPresent} if the flag is not + * present + * @throws JVMCIError if the flag is not present + */ + public <T> T getFlag(String name, Class<T> type) { + return getFlag(name, type, null); + } + + /** + * Gets a VM flag value. + * + * @param name name of the flag (e.g., {@code "CompileTheWorldStartAt"}) + * @param type the boxed type to which the flag's value will be converted + * @param notPresent if non-null and the flag is not present then this value is returned + * @return the flag's value converted to {@code type} or {@code notPresent} if the flag is not + * present + * @throws JVMCIError if the flag is not present and {@code notPresent == null} + */ + public <T> T getFlag(String name, Class<T> type, T notPresent) { + VMFlag entry = store.vmFlags.get(name); + if (entry == null) { + if (notPresent != null) { + return notPresent; + } + throw new JVMCIError("expected VM flag not found: " + name); + } + return type.cast(convertValue(name, type, entry.value, entry.type)); + } + + private static <T> Object convertValue(String name, Class<T> toType, Object value, String cppType) throws JVMCIError { + if (toType == Boolean.class) { + if (value instanceof String) { + return Boolean.valueOf((String) value); + } else if (value instanceof Boolean) { + return value; + } else if (value instanceof Long) { + return ((long) value) != 0; + } + } else if (toType == Byte.class) { + if (value instanceof Long) { + return (byte) (long) value; + } + } else if (toType == Integer.class) { + if (value instanceof Integer) { + return value; + } else if (value instanceof Long) { + return (int) (long) value; + } + } else if (toType == Long.class) { + return (long) value; + } + + throw new JVMCIError("cannot convert " + name + " of type " + value.getClass().getSimpleName() + (cppType == null ? "" : " [" + cppType + "]") + " to " + toType.getSimpleName()); + } + + private final HotSpotVMConfigStore store; + + public HotSpotVMConfigAccess(HotSpotVMConfigStore store) { + this.store = store; + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigStore.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot; + +import static jdk.vm.ci.common.InitTimer.timer; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import jdk.vm.ci.common.InitTimer; + +/** + * Access to VM configuration data. + */ +public final class HotSpotVMConfigStore { + + /** + * Gets the C++ symbols whose addresses are exposed by this object. + * + * @return an unmodifiable map from the symbol names to their addresses + */ + public Map<String, Long> getAddresses() { + return Collections.unmodifiableMap(vmAddresses); + } + + /** + * Gets the C++ type sizes exposed by this object. + * + * @return an unmodifiable map from C++ type names to their sizes in bytes + */ + public Map<String, Long> getTypeSizes() { + return Collections.unmodifiableMap(vmTypeSizes); + } + + /** + * Gets the C++ constants exposed by this object. + * + * @return an unmodifiable map from the names of C++ constants to their values + */ + public Map<String, Long> getConstants() { + return Collections.unmodifiableMap(vmConstants); + } + + /** + * Gets the VM flags exposed by this object. + * + * @return an unmodifiable map from VM flag names to {@link VMFlag} objects + */ + public Map<String, VMFlag> getFlags() { + return Collections.unmodifiableMap(vmFlags); + } + + /** + * Gets the C++ fields exposed by this object. + * + * @return an unmodifiable map from VM field names to {@link VMField} objects + */ + public Map<String, VMField> getFields() { + return Collections.unmodifiableMap(vmFields); + } + + final HashMap<String, VMField> vmFields; + final HashMap<String, Long> vmTypeSizes; + final HashMap<String, Long> vmConstants; + final HashMap<String, Long> vmAddresses; + final HashMap<String, VMFlag> vmFlags; + + /** + * Reads the database of VM info. The return value encodes the info in a nested object array + * that is described by the pseudo Java object {@code info} below: + * + * <pre> + * info = [ + * VMField[] vmFields, + * [String name, Long size, ...] vmTypeSizes, + * [String name, Long value, ...] vmConstants, + * [String name, Long value, ...] vmAddresses, + * VMFlag[] vmFlags + * ] + * </pre> + */ + @SuppressWarnings("try") + HotSpotVMConfigStore(CompilerToVM compilerToVm) { + Object[] data; + try (InitTimer t = timer("CompilerToVm readConfiguration")) { + data = compilerToVm.readConfiguration(); + } + assert data.length == 5; + + // @formatter:off + VMField[] vmFieldsInfo = (VMField[]) data[0]; + Object[] vmTypesSizesInfo = (Object[]) data[1]; + Object[] vmConstantsInfo = (Object[]) data[2]; + Object[] vmAddressesInfo = (Object[]) data[3]; + VMFlag[] vmFlagsInfo = (VMFlag[]) data[4]; + + vmFields = new HashMap<>(vmFieldsInfo.length); + vmTypeSizes = new HashMap<>(vmTypesSizesInfo.length); + vmConstants = new HashMap<>(vmConstantsInfo.length); + vmAddresses = new HashMap<>(vmAddressesInfo.length); + vmFlags = new HashMap<>(vmFlagsInfo.length); + // @formatter:on + + try (InitTimer t = timer("HotSpotVMConfigAccess<init> fill maps")) { + for (VMField vmField : vmFieldsInfo) { + vmFields.put(vmField.name, vmField); + } + + for (int i = 0; i < vmTypesSizesInfo.length / 2; i++) { + String name = (String) vmTypesSizesInfo[i * 2]; + Long size = (Long) vmTypesSizesInfo[i * 2 + 1]; + vmTypeSizes.put(name, size); + } + + for (int i = 0; i < vmConstantsInfo.length / 2; i++) { + String name = (String) vmConstantsInfo[i * 2]; + Long value = (Long) vmConstantsInfo[i * 2 + 1]; + vmConstants.put(name, value); + } + + for (int i = 0; i < vmAddressesInfo.length / 2; i++) { + String name = (String) vmAddressesInfo[i * 2]; + Long value = (Long) vmAddressesInfo[i * 2 + 1]; + vmAddresses.put(name, value); + } + + for (VMFlag vmFlag : vmFlagsInfo) { + vmFlags.put(vmFlag.name, vmFlag); + } + } + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMField.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot; + +/** + * Describes a C++ field exposed via {@link HotSpotVMConfigAccess}. + */ +public final class VMField { + + /** + * Fully qualified name of the represented field (e.g., "Klass::_name"). + */ + public final String name; + + /** + * The represented field's type (e.g., "Symbol*"). This may be {@code null}. + */ + public final String type; + + /** + * If represented field is non-static, this is its offset within the containing structure. + */ + public final long offset; + + /** + * If represented field is static, this is its address. Otherwise, this field is 0. + */ + public final long address; + + /** + * Value of the field represented as a boxed long; only valid for non-oop static fields. This + * value is only captured once, during JVMCI initialization. If {@link #type} cannot be + * meaningfully (e.g., a struct) or safely (e.g., an oop) expressed as a boxed long, this is + * {@code null}. + */ + public final Long value; + + /** + * Determines if the represented field is static. + */ + public boolean isStatic() { + return address != 0; + } + + /** + * Creates a description of a non-static field. + */ + public VMField(String name, String type, long offset) { + this.name = name; + this.type = type; + this.offset = offset; + this.address = 0; + this.value = null; + } + + /** + * Creates a description of a static field. + */ + public VMField(String name, String type, long address, Long value) { + this.name = name; + this.type = type; + this.offset = 0; + this.address = address; + this.value = value; + } + + @Override + public String toString() { + String val = value == null ? "null" : String.format("0x%x", value); + return String.format("Field[name=%s, type=%s, offset=%d, address=0x%x, value=%s]", name, type, offset, address, val); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMFlag.java Wed Jun 15 00:00:41 2016 +0200 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.hotspot; + +/** + * Describes a VM flag exposed via {@link HotSpotVMConfigAccess}. + */ +public final class VMFlag { + + /** + * The name of the flag. + */ + public final String name; + + /** + * The C++ type of the flag. + */ + public final String type; + + /** + * The flag's value. + */ + public final Object value; + + VMFlag(String name, String type, Object value) { + this.name = name; + this.type = type; + this.value = value; + } + + @Override + public String toString() { + return String.format("Flag[type=%s, name=%s, value=%s]", type, name, value); + } +}
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java Fri Jun 10 14:04:40 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java Wed Jun 15 00:00:41 2016 +0200 @@ -22,7 +22,6 @@ */ package jdk.vm.ci.hotspot.services; -import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.runtime.services.JVMCICompilerFactory; /** @@ -42,35 +41,54 @@ return null; } + public enum CompilationLevelAdjustment { + /** + * No adjustment. + */ + None, + + /** + * Adjust based on declaring class of method. + */ + ByHolder, + + /** + * Adjust based on declaring class, name and signature of method. + */ + ByFullSignature + } + /** * Determines if this object may want to adjust the compilation level for a method that is being - * scheduled by the VM for compilation. The legal return values and their meanings are: - * <ul> - * <li>0 - no adjustment</li> - * <li>1 - adjust based on declaring class of method</li> - * <li>2 - adjust based on declaring class, name and signature of method</li> - * </ul> + * scheduled by the VM for compilation. */ - public int getCompilationLevelAdjustment(HotSpotVMConfig config) { - return config.compLevelAdjustmentNone; + public CompilationLevelAdjustment getCompilationLevelAdjustment() { + return CompilationLevelAdjustment.None; + } + + public enum CompilationLevel { + None, + Simple, + LimitedProfile, + FullProfile, + FullOptimization } /** * Potentially modifies the compilation level currently selected by the VM compilation policy * for a method. * - * @param config object for reading HotSpot {@code CompLevel} enum values * @param declaringClass the class in which the method is declared * @param name the name of the method or {@code null} depending on the value that was returned - * by {@link #getCompilationLevelAdjustment(HotSpotVMConfig)} + * by {@link #getCompilationLevelAdjustment()} * @param signature the signature of the method or {@code null} depending on the value that was - * returned by {@link #getCompilationLevelAdjustment(HotSpotVMConfig)} + * returned by {@link #getCompilationLevelAdjustment()} * @param isOsr specifies if the compilation being scheduled in an OSR compilation * @param level the compilation level currently selected by the VM compilation policy * @return the compilation level to use for the compilation being scheduled (must be a valid * {@code CompLevel} enum value) */ - public int adjustCompilationLevel(HotSpotVMConfig config, Class<?> declaringClass, String name, String signature, boolean isOsr, int level) { + public CompilationLevel adjustCompilationLevel(Class<?> declaringClass, String name, String signature, boolean isOsr, CompilationLevel level) { throw new InternalError("Should not reach here"); } }
--- a/jvmci/jdk.vm.ci.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -jdk.vm.ci.hotspotvmconfig.processor.HotSpotVMConfigProcessor
--- a/jvmci/jdk.vm.ci.hotspotvmconfig.processor/src/jdk/vm/ci/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,441 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig.processor; - -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.annotation.Annotation; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.BiFunction; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.ElementKind; -import javax.lang.model.element.TypeElement; -import javax.lang.model.element.VariableElement; -import javax.tools.Diagnostic.Kind; -import javax.tools.FileObject; -import javax.tools.StandardLocation; - -import jdk.vm.ci.common.JVMCIError; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMConstant; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMField; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMType; -import jdk.vm.ci.hotspotvmconfig.HotSpotVMValue; - -@SupportedAnnotationTypes({"jdk.vm.ci.hotspotvmconfig.HotSpotVMConstant", "jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag", "jdk.vm.ci.hotspotvmconfig.HotSpotVMField", - "jdk.vm.ci.hotspotvmconfig.HotSpotVMType", "jdk.vm.ci.hotspotvmconfig.HotSpotVMValue"}) -public class HotSpotVMConfigProcessor extends AbstractProcessor { - - public HotSpotVMConfigProcessor() { - } - - @Override - public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latest(); - } - - /** - * Set to true to enable logging to a local file during annotation processing. There's no normal - * channel for any debug messages and debugging annotation processors requires some special - * setup. - */ - private static final boolean DEBUG = false; - - private PrintWriter log; - - /** - * Logging facility for debugging the annotation processor. - */ - - private PrintWriter getLog() { - if (log == null) { - try { - // Create the log file within the generated source directory so it's easy to find. - // /tmp isn't platform independent and java.io.tmpdir can map anywhere, particularly - // on the mac. - FileObject file = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", getClass().getSimpleName() + "log"); - log = new PrintWriter(new FileWriter(file.toUri().getPath(), true)); - } catch (IOException e) { - // Do nothing - } - } - return log; - } - - private void logMessage(String format, Object... args) { - if (!DEBUG) { - return; - } - PrintWriter bw = getLog(); - if (bw != null) { - bw.printf(format, args); - bw.flush(); - } - } - - private void logException(Throwable t) { - if (!DEBUG) { - return; - } - PrintWriter bw = getLog(); - if (bw != null) { - t.printStackTrace(bw); - bw.flush(); - } - } - - /** - * Bugs in an annotation processor can cause silent failure so try to report any exception - * throws as errors. - */ - private void reportExceptionThrow(Element element, Throwable t) { - if (element != null) { - logMessage("throw for %s:\n", element); - } - logException(t); - errorMessage(element, "Exception throw during processing: %s %s", t, Arrays.toString(Arrays.copyOf(t.getStackTrace(), 4))); - } - - //@formatter:off - String[] prologue = new String[]{ - "// The normal wrappers CommandLineFlags::boolAt and CommandLineFlags::intxAt skip constant flags", - "static bool boolAt(char* name, bool* value) {", - " Flag* result = Flag::find_flag(name, strlen(name), true, true);", - " if (result == NULL) return false;", - " if (!result->is_bool()) return false;", - " *value = result->get_bool();", - " return true;", - "}", - "", - "static bool intxAt(char* name, intx* value) {", - " Flag* result = Flag::find_flag(name, strlen(name), true, true);", - " if (result == NULL) return false;", - " if (!result->is_intx()) return false;", - " *value = result->get_intx();", - " return true;", - "}", - "", - "#define set_boolean(name, value) vmconfig_oop->bool_field_put(fs.offset(), value)", - "#define set_byte(name, value) vmconfig_oop->byte_field_put(fs.offset(), (jbyte)(value))", - "#define set_short(name, value) vmconfig_oop->short_field_put(fs.offset(), (jshort)(value))", - "#define set_int(name, value) vmconfig_oop->int_field_put(fs.offset(), (int)(value))", - "#define set_long(name, value) vmconfig_oop->long_field_put(fs.offset(), value)", - "#define set_address(name, value) do { set_long(name, (jlong)(value)); } while (0)", - "", - "#define set_optional_boolean_flag(varName, flagName) do { bool flagValue; if (boolAt((char*) flagName, &flagValue)) { set_boolean(varName, flagValue); } } while (0)", - "#define set_optional_int_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_int(varName, flagValue); } } while (0)", - "#define set_optional_long_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_long(varName, flagValue); } } while (0)", - "", - "void VMStructs::initHotSpotVMConfig(oop vmconfig_oop) {", - " InstanceKlass* vmconfig_klass = InstanceKlass::cast(vmconfig_oop->klass());", - "", - }; - //@formatter:on - - String outputName = "HotSpotVMConfig.inline.hpp"; - String outputDirectory = "hotspot"; - - private void createFiles(Map<String, VMConfigField> annotations, Element element) { - - Filer filer = processingEnv.getFiler(); - try (PrintWriter out = createSourceFile(outputDirectory, outputName, filer, element)) { - - for (String line : prologue) { - out.println(line); - } - - Map<String, Integer> expectedValues = new HashMap<>(); - for (VMConfigField value : annotations.values()) { - if (!value.optional) { - String key = value.define != null ? value.define : ""; - if (expectedValues.get(key) == null) { - expectedValues.put(key, 1); - } else { - expectedValues.put(key, expectedValues.get(key) + 1); - } - } - } - - out.printf(" int expected = %s;%n", expectedValues.get("")); - for (Entry<String, Integer> entry : expectedValues.entrySet()) { - if (entry.getKey().equals("")) { - continue; - } - out.printf("#if %s%n", entry.getKey()); - out.printf(" expected += %s;%n", entry.getValue()); - out.printf("#endif%n"); - } - out.println(" int assigned = 0;"); - out.println(" for (JavaFieldStream fs(vmconfig_klass); !fs.done(); fs.next()) {"); - - Set<String> fieldTypes = new HashSet<>(); - for (VMConfigField key : annotations.values()) { - fieldTypes.add(key.getType()); - } - // For each type of field, generate a switch on the length of the symbol and then do a - // direct compare. In general this reduces each operation to 2 tests plus a string - // compare. Being more perfect than that is probably not worth it. - for (String type : fieldTypes) { - String sigtype = type.equals("boolean") ? "bool" : type; - out.println(" if (fs.signature() == vmSymbols::" + sigtype + "_signature()) {"); - Set<Integer> lengths = new HashSet<>(); - for (Entry<String, VMConfigField> entry : annotations.entrySet()) { - if (entry.getValue().getType().equals(type)) { - lengths.add(entry.getKey().length()); - } - } - out.println(" switch (fs.name()->utf8_length()) {"); - for (int len : lengths) { - out.println(" case " + len + ":"); - for (Entry<String, VMConfigField> entry : annotations.entrySet()) { - if (entry.getValue().getType().equals(type) && entry.getKey().length() == len) { - out.println(" if (fs.name()->equals(\"" + entry.getKey() + "\")) {"); - entry.getValue().emit(out); - out.println(" continue;"); - out.println(" }"); - } - } - out.println(" continue;"); - } - out.println(" } // switch"); - out.println(" continue;"); - out.println(" } // if"); - } - out.println(" } // for"); - out.println(" guarantee(assigned == expected, \"Didn't find all fields during init of HotSpotVMConfig. Maybe recompile?\");"); - out.println("}"); - } - } - - protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) { - try { - // Ensure Unix line endings to comply with code style guide checked by Checkstyle - FileObject sourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg, relativeName, originatingElements); - logMessage("%s\n", sourceFile); - return new PrintWriter(sourceFile.openWriter()) { - - @Override - public void println() { - print("\n"); - } - }; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - static class VMConfigField { - final String setter; - final String define; - private boolean optional; - final VariableElement field; - - VMConfigField(VariableElement field, HotSpotVMField value) { - this.field = field; - define = archDefines(value.archs()); - String type = field.asType().toString(); - String name = value.name(); - int i = name.lastIndexOf("::"); - switch (value.get()) { - case OFFSET: - setter = String.format("set_%s(\"%s\", offset_of(%s, %s));", type, field.getSimpleName(), name.substring(0, i), name.substring(i + 2)); - break; - case ADDRESS: - setter = String.format("set_address(\"%s\", &%s);", field.getSimpleName(), name); - break; - case VALUE: - setter = String.format("set_%s(\"%s\", (%s) (intptr_t) %s);", type, field.getSimpleName(), type, name); - break; - default: - throw new JVMCIError("unexpected type: " + value.get()); - } - } - - VMConfigField(VariableElement field, HotSpotVMType value) { - this.field = field; - define = null; // ((HotSpotVMType) annotation).archs(); - String type = field.asType().toString(); - setter = String.format("set_%s(\"%s\", sizeof(%s));", type, field.getSimpleName(), value.name()); - } - - VMConfigField(VariableElement field, HotSpotVMValue value) { - this.field = field; - String[] defines = value.defines(); - int length = defines.length; - if (length != 0) { - for (int i = 0; i < length; i++) { - defines[i] = "defined(" + defines[i] + ")"; - } - define = String.join(" || ", defines); - } else { - define = null; // ((HotSpotVMValue) annotation).archs(); - } - String type = field.asType().toString(); - if (value.get() == HotSpotVMValue.Type.ADDRESS) { - setter = String.format("set_address(\"%s\", %s);", field.getSimpleName(), value.expression()); - } else { - setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.expression()); - } - } - - VMConfigField(VariableElement field, HotSpotVMConstant value) { - this.field = field; - define = archDefines(value.archs()); - String type = field.asType().toString(); - setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name()); - } - - VMConfigField(VariableElement field, HotSpotVMFlag value) { - this.field = field; - define = archDefines(value.archs()); - optional = value.optional(); - String type = field.asType().toString(); - if (value.optional()) { - setter = String.format("set_optional_%s_flag(\"%s\", \"%s\");", type, field.getSimpleName(), value.name()); - } else { - setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name()); - } - } - - public String getType() { - return field.asType().toString(); - } - - private static String archDefine(String arch) { - switch (arch) { - case "amd64": - return "defined(AMD64)"; - case "sparcv9": - return "(defined(SPARC) && defined(_LP64))"; - case "sparc": - return "defined(SPARC)"; - default: - throw new JVMCIError("unexpected arch: " + arch); - } - } - - private static String archDefines(String[] archs) { - if (archs == null || archs.length == 0) { - return null; - } - if (archs.length == 1) { - return archDefine(archs[0]); - } - String[] defs = new String[archs.length]; - int i = 0; - for (String arch : archs) { - defs[i++] = archDefine(arch); - } - return String.join(" || ", defs); - } - - public void emit(PrintWriter out) { - if (define != null) { - out.printf("#if %s\n", define); - } - out.printf(" %s%n", setter); - if (!optional) { - out.printf(" assigned++;%n"); - } - if (define != null) { - out.printf("#endif\n"); - } - } - - } - - @SuppressWarnings("unchecked") - private <T extends Annotation> void collectAnnotations(RoundEnvironment roundEnv, Map<String, VMConfigField> annotationMap, Class<T> annotationClass, - BiFunction<VariableElement, T, VMConfigField> builder) { - for (Element element : roundEnv.getElementsAnnotatedWith(annotationClass)) { - Annotation constant = element.getAnnotation(annotationClass); - if (element.getKind() != ElementKind.FIELD) { - errorMessage(element, "%s annotations may only be on fields", annotationClass.getSimpleName()); - } - if (annotationClass == HotSpotVMValue.class) { - HotSpotVMValue value = (HotSpotVMValue) constant; - if (value.get() == HotSpotVMValue.Type.ADDRESS && !element.asType().toString().equals("long")) { - errorMessage(element, "HotSpotVMValue with get == ADDRESS must be of type long, but found %s", element.asType()); - } - } - if (currentTypeElement == null) { - currentTypeElement = element.getEnclosingElement(); - } else { - if (!currentTypeElement.equals(element.getEnclosingElement())) { - errorMessage(element, "Multiple types encountered. Only HotSpotVMConfig is supported"); - } - } - annotationMap.put(element.getSimpleName().toString(), builder.apply((VariableElement) element, (T) constant)); - } - } - - private void errorMessage(Element element, String format, Object... args) { - processingEnv.getMessager().printMessage(Kind.ERROR, String.format(format, args), element); - } - - Element currentTypeElement = null; - - @Override - public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { - if (roundEnv.processingOver()) { - return true; - } - logMessage("Starting round %s %s\n", roundEnv, annotations); - try { - - currentTypeElement = null; - - // First collect all the annotations. - Map<String, VMConfigField> annotationMap = new HashMap<>(); - collectAnnotations(roundEnv, annotationMap, HotSpotVMConstant.class, (e, v) -> new VMConfigField(e, v)); - collectAnnotations(roundEnv, annotationMap, HotSpotVMFlag.class, (e, v) -> new VMConfigField(e, v)); - collectAnnotations(roundEnv, annotationMap, HotSpotVMField.class, (e, v) -> new VMConfigField(e, v)); - collectAnnotations(roundEnv, annotationMap, HotSpotVMType.class, (e, v) -> new VMConfigField(e, v)); - collectAnnotations(roundEnv, annotationMap, HotSpotVMValue.class, (e, v) -> new VMConfigField(e, v)); - - if (annotationMap.isEmpty()) { - return true; - } - - logMessage("type element %s\n", currentTypeElement); - createFiles(annotationMap, currentTypeElement); - - } catch (Throwable t) { - reportExceptionThrow(null, t); - } - - return true; - } -}
--- a/jvmci/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMConstant.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Refers to a C++ constant in the VM. - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface HotSpotVMConstant { - - /** - * Returns the name of the constant. - * - * @return name of constant - */ - String name(); - - /** - * List of architectures where this constant is required. Names are derived from - * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is - * required on all architectures. - */ - @SuppressWarnings("javadoc") - String[] archs() default {}; -}
--- a/jvmci/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMField.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Refers to a C++ field in the VM. - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface HotSpotVMField { - - /** - * Types of information this annotation can return. - */ - enum Type { - /** - * Returns the offset of this field within the type. Only valid for instance fields. - */ - OFFSET, - - /** - * Returns the absolute address of this field. Only valid for static fields. - */ - ADDRESS, - - /** - * Returns the value of this field. Only valid for static fields. - */ - VALUE; - } - - /** - * Specifies what type of information to return. - * - * @see Type - */ - Type get(); - - /** - * Returns the type name containing this field. - * - * @return name of containing type - */ - String type(); - - /** - * Returns the name of this field. - * - * @return name of field - */ - String name(); - - /** - * List of architectures where this constant is required. Names are derived from - * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is - * required on all architectures. - */ - @SuppressWarnings("javadoc") - String[] archs() default {}; -}
--- a/jvmci/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMFlag.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Refers to a C++ flag in the VM. - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface HotSpotVMFlag { - - /** - * Returns the name of this flag. - * - * @return name of flag. - */ - String name(); - - /** - * List of architectures where this constant is required. Names are derived from - * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is - * required on all architectures. - */ - @SuppressWarnings("javadoc") - String[] archs() default {}; - - boolean optional() default false; -}
--- a/jvmci/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMType.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Refers to a C++ type in the VM. - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface HotSpotVMType { - - /** - * Types of information this annotation can return. - */ - enum Type { - /** - * Returns the size of the type (C++ {@code sizeof()}). - */ - SIZE; - } - - /** - * Specifies what type of information to return. - * - * @see Type - */ - Type get(); - - /** - * Returns the name of the type. - * - * @return name of type - */ - String name(); -}
--- a/jvmci/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMValue.java Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. 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. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.vm.ci.hotspotvmconfig; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface HotSpotVMValue { - - /** - * A C++ expression to be evaluated and assigned to the field. - */ - String expression(); - - enum Type { - /** - * A C++ address which might require extra casts to be safely assigned to a Java field. - */ - ADDRESS, - - /** - * A simple value which can be assigned to a regular Java field. - */ - VALUE - } - - /** - * If {@link #expression} is a C++ function name, {@link #signature} represents the signature of - * the function. - * - */ - String signature() default ""; - - Type get() default Type.VALUE; - - /** - * List of preprocessor symbols that should guard initialization of this value. - */ - String[] defines() default {}; - -}
--- a/make/jvmci.make Fri Jun 10 14:04:40 2016 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -# This Makefile is generated automatically, do not edit - -TARGET=. -# Bootstrap JDK to be used (for javac and jar) -ABS_BOOTDIR= - -JAVAC=$(ABS_BOOTDIR)/bin/javac -g -target 1.8 -JAR=$(ABS_BOOTDIR)/bin/jar - -HS_COMMON_SRC=. - -# Directories, where the generated property-files reside within the JAR files -SERVICES_INF=/META-INF/jvmci.services - -JARS = $(foreach dist,$(DISTRIBUTIONS),$($(dist)_JAR)) - -ifeq ($(ABS_BOOTDIR),) - $(error Variable ABS_BOOTDIR must be set to a JDK installation.) -endif -ifeq ($(MAKE_VERBOSE),) - QUIETLY=@ -endif - -# Required to construct a whitespace for use with subst -space := -space += - -# Extracts META-INF/jvmci.services from a JAR file into a given directory -# Arguments: -# 1: JAR file to extract -# 2: target directory (which already exists) -define extract - $(eval TMP := $(shell mktemp -d $(TARGET)/tmp_XXXXX)) - $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \ - (test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))); - $(QUIETLY) rm -r $(TMP); - $(QUIETLY) cp $(1) $(2) -endef - -# Calls $(JAVAC) with the boot class path $(JDK_BOOTCLASSPATH) and sources taken from the automatic variable $^ -# Arguments: -# 1: processorpath -# 2: classpath -# 3: resources to copy -# 4: target JAR file -define build_and_jar - $(info Building $(4)) - $(eval TMP := $(shell mkdir -p $(TARGET) && mktemp -d $(TARGET)/tmp_XXXXX)) - $(QUIETLY) $(JAVAC) -d $(TMP) -processorpath :$(1) -bootclasspath $(JDK_BOOTCLASSPATH) -cp :$(2) $(filter %.java,$^) - $(QUIETLY) test "$(3)" = "" || cp -r $(3) $(TMP) - - @# Since all projects are built together with one javac call we cannot determine - @# which project contains HotSpotVMConfig.inline.hpp so we hardcode it. - $(eval vmconfig := $(TMP)/hotspot/HotSpotVMConfig.inline.hpp) - $(eval vmconfigDest := $(HS_COMMON_SRC)/../mxbuild/jvmci/jdk.vm.ci.hotspot/src_gen/hotspot) - $(QUIETLY) test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest)) - - $(QUIETLY) mkdir -p $(shell dirname $(4)) - $(QUIETLY) $(JAR) -0cf $(4) -C $(TMP) . - $(QUIETLY) rm -r $(TMP) -endef - -# Verifies that make/defs.make contains an appropriate line for each JVMCI service -# and that only existing JVMCI services are exported. -# Arguments: -# 1: list of service files -# 2: variable name for directory of service files -define verify_defs_make - $(eval defs := make/defs.make) - $(eval uncondPattern := EXPORT_LIST += $$$$($(2))/) - $(eval condPattern := CONDITIONAL_EXPORT_LIST += $$$$($(2))/) - $(eval unconditionalExports := $(shell grep '^EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g')) - $(eval conditionalExports := $(shell grep '^CONDITIONAL_EXPORT_LIST += $$($2)' make/defs.make | sed 's:.*($(2))/::g')) - $(eval allExports := $(unconditionalExports) $(conditionalExports)) - $(foreach file,$(1),$(if $(findstring $(file),$(allExports)), ,$(error "Line matching '$(uncondPattern)$(file)' or '$(condPattern)$(file)' not found in $(defs)"))) - $(foreach export,$(unconditionalExports),$(if $(findstring $(export),$(1)), ,$(error "The line '$(uncondPattern)$(export)' should not be in $(defs)"))) -endef - -all: default - $(info Put $(EXPORTED_FILES) into SHARED_DIR $(SHARED_DIR)) - $(shell mkdir -p $(SHARED_DIR)) - $(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR))) - -export: all - $(call verify_defs_make,$(notdir $(wildcard $(SHARED_DIR)/jvmci.services/*)),EXPORT_JRE_LIB_JVMCI_SERVICES_DIR) -.PHONY: export - -clean: - $(QUIETLY) rm $(JARS) 2> /dev/null || true - $(QUIETLY) rmdir -p $(dir $(JARS)) 2> /dev/null || true -.PHONY: export clean - - - -JDK_BOOTCLASSPATH = $(ABS_BOOTDIR)/jre/lib/resources.jar:$(ABS_BOOTDIR)/jre/lib/rt.jar:$(ABS_BOOTDIR)/jre/lib/sunrsasign.jar:$(ABS_BOOTDIR)/jre/lib/jsse.jar:$(ABS_BOOTDIR)/jre/lib/jce.jar:$(ABS_BOOTDIR)/jre/lib/charsets.jar:$(ABS_BOOTDIR)/jre/lib/jfr.jar:$(ABS_BOOTDIR)/jre/classes - -JVMCI_SERVICES_SRC += $(shell find jvmci/jdk.vm.ci.services/src -type f 2> /dev/null) - -JVMCI_SERVICES_JAR = $(TARGET)/jvmci-services.jar - -EXPORTED_FILES += $(JVMCI_SERVICES_JAR) - -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.meta/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.code/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.runtime/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.common/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.aarch64/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.amd64/src -type f 2> /dev/null) -JVMCI_API_SRC += $(shell find jvmci/jdk.vm.ci.sparc/src -type f 2> /dev/null) - -JVMCI_API_JAR = $(TARGET)/jvmci-api.jar - -JVMCI_API_DEP_JARS = $(TARGET)/jvmci-services.jar - -EXPORTED_FILES += $(JVMCI_API_JAR) - -JVMCI_HOTSPOTVMCONFIG_SRC += $(shell find jvmci/jdk.vm.ci.hotspotvmconfig/src -type f 2> /dev/null) - -JVMCI_HOTSPOTVMCONFIG_JAR = $(TARGET)/jvmci-hotspotvmconfig.jar - -EXPORTED_FILES += $(JVMCI_HOTSPOTVMCONFIG_JAR) - -JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/jdk.vm.ci.hotspotvmconfig.processor/src -type f 2> /dev/null) - -JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jvmci-hotspotvmconfig-processor.jar - -JVMCI_HOTSPOTVMCONFIG_PROCESSOR_DEP_JARS = $(TARGET)/jvmci-services.jar $(TARGET)/jvmci-api.jar $(TARGET)/jvmci-hotspotvmconfig.jar - -JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.vm.ci.hotspot/src -type f 2> /dev/null) -JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.vm.ci.hotspot.aarch64/src -type f 2> /dev/null) -JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.vm.ci.hotspot.amd64/src -type f 2> /dev/null) -JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.vm.ci.hotspot.sparc/src -type f 2> /dev/null) -ifeq ($(shell find $(ABS_BOOTDIR)/ -name 'jfr.jar'; echo $$?),'0') -JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.vm.ci.hotspot.jfr/src -type f 2> /dev/null) -endif - -JVMCI_HOTSPOT_JAR = $(TARGET)/jvmci-hotspot.jar - -JVMCI_HOTSPOT_DEP_JARS = $(TARGET)/jvmci-hotspotvmconfig.jar $(TARGET)/jvmci-services.jar $(TARGET)/jvmci-api.jar - -EXPORTED_FILES += $(JVMCI_HOTSPOT_JAR) - -DISTRIBUTIONS = JVMCI_SERVICES JVMCI_API JVMCI_HOTSPOTVMCONFIG JVMCI_HOTSPOTVMCONFIG_PROCESSOR JVMCI_HOTSPOT - -$(JVMCI_SERVICES_JAR): $(JVMCI_SERVICES_SRC) - $(call build_and_jar,,$(subst $(space),:,),,$(JVMCI_SERVICES_JAR)) - - -$(JVMCI_API_JAR): $(JVMCI_API_SRC) $(JVMCI_API_DEP_JARS) - $(call build_and_jar,,$(subst $(space),:,$(JVMCI_API_DEP_JARS)),,$(JVMCI_API_JAR)) - - -$(JVMCI_HOTSPOTVMCONFIG_JAR): $(JVMCI_HOTSPOTVMCONFIG_SRC) - $(call build_and_jar,,$(subst $(space),:,),,$(JVMCI_HOTSPOTVMCONFIG_JAR)) - - -$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC) $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_DEP_JARS) - $(call build_and_jar,,$(subst $(space),:,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_DEP_JARS)),jvmci/jdk.vm.ci.hotspotvmconfig.processor/src/META-INF,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR)) - - -$(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS) - $(call build_and_jar,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(subst $(space),:,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_DEP_JARS)),$(subst $(space),:,$(JVMCI_HOTSPOT_DEP_JARS)),jvmci/jdk.vm.ci.hotspot.aarch64/src/META-INF jvmci/jdk.vm.ci.hotspot.amd64/src/META-INF jvmci/jdk.vm.ci.hotspot.sparc/src/META-INF jvmci/jdk.vm.ci.hotspot.jfr/src/META-INF,$(JVMCI_HOTSPOT_JAR)) - - -default: $(JVMCI_SERVICES_JAR) $(JVMCI_API_JAR) $(JVMCI_HOTSPOT_JAR) $(JVMCI_HOTSPOTVMCONFIG_JAR) -.PHONY: default
--- a/mx.jvmci/mx_jvmci.py Fri Jun 10 14:04:40 2016 +0200 +++ b/mx.jvmci/mx_jvmci.py Wed Jun 15 00:00:41 2016 +0200 @@ -213,7 +213,6 @@ LibJDKDeployedDist('JVMCI_SERVICES'), JvmciJDKDeployedDist('JVMCI_API'), JvmciJDKDeployedDist('JVMCI_HOTSPOT'), - JvmciJDKDeployedDist('JVMCI_HOTSPOTVMCONFIG'), HotSpotVMJDKDeployedDist('JVM_<vmbuild>_<vm>'), ]
--- a/mx.jvmci/suite.py Fri Jun 10 14:04:40 2016 +0200 +++ b/mx.jvmci/suite.py Wed Jun 15 00:00:41 2016 +0200 @@ -153,35 +153,14 @@ "subDir" : "jvmci", "sourceDirs" : ["src"], "dependencies" : [ - "jdk.vm.ci.hotspotvmconfig", "jdk.vm.ci.common", "jdk.vm.ci.runtime", ], - "annotationProcessors" : [ - "JVMCI_HOTSPOTVMCONFIG_PROCESSOR", - ], "checkstyle" : "jdk.vm.ci.services", "javaCompliance" : "1.8", "workingSets" : "JVMCI", }, - "jdk.vm.ci.hotspotvmconfig" : { - "subDir" : "jvmci", - "sourceDirs" : ["src"], - "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "1.8", - "workingSets" : "JVMCI,HotSpot", - }, - - "jdk.vm.ci.hotspotvmconfig.processor" : { - "subDir" : "jvmci", - "sourceDirs" : ["src"], - "dependencies" : ["jdk.vm.ci.hotspotvmconfig", "jdk.vm.ci.common"], - "checkstyle" : "jdk.vm.ci.services", - "javaCompliance" : "1.8", - "workingSets" : "JVMCI,HotSpot,Codegen", - }, - "jdk.vm.ci.hotspot.aarch64" : { "subDir" : "jvmci", "sourceDirs" : ["src"], @@ -322,13 +301,6 @@ ], }, - "JVMCI_HOTSPOTVMCONFIG" : { - "subDir" : "jvmci", - "dependencies" : [ - "jdk.vm.ci.hotspotvmconfig", - ], - }, - "JVMCI_HOTSPOT" : { "subDir" : "jvmci", "dependencies" : [ @@ -338,7 +310,6 @@ "jdk.vm.ci.hotspot.jfr", ], "distDependencies" : [ - "JVMCI_HOTSPOTVMCONFIG", "JVMCI_SERVICES", "JVMCI_API", ], @@ -354,14 +325,5 @@ ], "exclude" : ["mx:JUNIT"], }, - - "JVMCI_HOTSPOTVMCONFIG_PROCESSOR" : { - "subDir" : "jvmci", - "dependencies" : ["jdk.vm.ci.hotspotvmconfig.processor"], - "distDependencies" : [ - "JVMCI_API", - "JVMCI_HOTSPOTVMCONFIG", - ], - }, }, }
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Jun 15 00:00:41 2016 +0200 @@ -42,6 +42,7 @@ #include "jvmci/jvmciJavaClasses.hpp" #include "jvmci/jvmciCodeInstaller.hpp" #include "gc_implementation/g1/heapRegion.hpp" +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" #include "runtime/javaCalls.hpp" #include "runtime/deoptimization.hpp" #include "runtime/vframe.hpp" @@ -82,8 +83,255 @@ return NULL; } -C2V_VMENTRY(void, initializeConfiguration, (JNIEnv *, jobject, jobject config)) - VMStructs::initHotSpotVMConfig(JNIHandles::resolve(config)); +int CompilerToVM::Data::Klass_vtable_start_offset; +int CompilerToVM::Data::Klass_vtable_length_offset; + +int CompilerToVM::Data::Method_extra_stack_entries; + +address CompilerToVM::Data::SharedRuntime_ic_miss_stub; +address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub; +address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack; +address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap; + +size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve; + +CollectedHeap* CompilerToVM::Data::Universe_collectedHeap; +int CompilerToVM::Data::Universe_base_vtable_size; +address CompilerToVM::Data::Universe_narrow_oop_base; +int CompilerToVM::Data::Universe_narrow_oop_shift; +address CompilerToVM::Data::Universe_narrow_klass_base; +int CompilerToVM::Data::Universe_narrow_klass_shift; +void* CompilerToVM::Data::Universe_non_oop_bits; +uintptr_t CompilerToVM::Data::Universe_verify_oop_mask; +uintptr_t CompilerToVM::Data::Universe_verify_oop_bits; + +bool CompilerToVM::Data::_supports_inline_contig_alloc; +HeapWord** CompilerToVM::Data::_heap_end_addr; +HeapWord** CompilerToVM::Data::_heap_top_addr; + +jbyte* CompilerToVM::Data::cardtable_start_address; +int CompilerToVM::Data::cardtable_shift; +int CompilerToVM::Data::g1_young_card; +int CompilerToVM::Data::dirty_card; + +int CompilerToVM::Data::vm_page_size; + +address CompilerToVM::Data::CodeCache_low_bound; +address CompilerToVM::Data::CodeCache_high_bound; + +address CompilerToVM::Data::dsin; +address CompilerToVM::Data::dcos; +address CompilerToVM::Data::dtan; +address CompilerToVM::Data::dexp; +address CompilerToVM::Data::dlog; +address CompilerToVM::Data::dlog10; +address CompilerToVM::Data::dpow; + +void CompilerToVM::Data::initialize(TRAPS) { + Klass_vtable_start_offset = InstanceKlass::vtable_start_offset() * HeapWordSize; + Klass_vtable_length_offset = InstanceKlass::vtable_length_offset() * HeapWordSize; + + Method_extra_stack_entries = Method::extra_stack_entries(); + + SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub(); + SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub(); + SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack(); + SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap(); + + ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve(); + + Universe_collectedHeap = Universe::heap(); + Universe_base_vtable_size = Universe::base_vtable_size(); + Universe_narrow_oop_base = Universe::narrow_oop_base(); + Universe_narrow_oop_shift = Universe::narrow_oop_shift(); + Universe_narrow_klass_base = Universe::narrow_klass_base(); + Universe_narrow_klass_shift = Universe::narrow_klass_shift(); + Universe_non_oop_bits = Universe::non_oop_word(); + Universe_verify_oop_mask = Universe::verify_oop_mask(); + Universe_verify_oop_bits = Universe::verify_oop_bits(); + + _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc(); + _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1; + _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1; + + g1_young_card = G1SATBCardTableModRefBS::g1_young_card_val(); + dirty_card = CardTableModRefBS::dirty_card_val(); + + CodeCache_low_bound = CodeCache::low_bound(); + CodeCache_high_bound = CodeCache::high_bound(); + + BarrierSet* bs = Universe::heap()->barrier_set(); + switch (bs->kind()) { + case BarrierSet::CardTableModRef: + case BarrierSet::CardTableExtension: + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: { + jbyte* base = ((CardTableModRefBS*) bs)->byte_map_base; + assert(base != 0, "unexpected byte_map_base"); + cardtable_start_address = base; + cardtable_shift = CardTableModRefBS::card_shift; + break; + } + case BarrierSet::ModRef: + cardtable_start_address = 0; + cardtable_shift = 0; + // No post barriers + break; + default: + JVMCI_ERROR("Unsupported BarrierSet kind %d", bs->kind()); + break; + } + + vm_page_size = os::vm_page_size(); + +#define SET_TRIGFUNC(name) \ + name = CAST_FROM_FN_PTR(address, SharedRuntime::name); \ + + SET_TRIGFUNC(dsin); + SET_TRIGFUNC(dcos); + SET_TRIGFUNC(dtan); + SET_TRIGFUNC(dexp); + SET_TRIGFUNC(dlog10); + SET_TRIGFUNC(dlog); + SET_TRIGFUNC(dpow); + +#undef SET_TRIGFUNC +} + +C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env)) +#define BOXED_LONG(name, value) oop name; do { jvalue p; p.j = (jlong) (value); name = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL);} while(0) +#define BOXED_DOUBLE(name, value) oop name; do { jvalue p; p.d = (jdouble) (value); name = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL);} while(0) + ResourceMark rm; + HandleMark hm; + + CompilerToVM::Data::initialize(CHECK_NULL); + + VMField::klass()->initialize(thread); + VMFlag::klass()->initialize(thread); + + int len = VMStructs::localHotSpotVMStructs_count(); + objArrayHandle vmFields = oopFactory::new_objArray(VMField::klass(), len, CHECK_NULL); + for (int i = 0; i < len ; i++) { + VMStructEntry vmField = VMStructs::localHotSpotVMStructs[i]; + instanceHandle vmFieldObj = InstanceKlass::cast(VMField::klass())->allocate_instance_handle(CHECK_NULL); + int name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */; + char* name_buf = NEW_RESOURCE_ARRAY(char, name_buf_len + 1); + sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName); + Handle name = java_lang_String::create_from_str(name_buf, CHECK_NULL); + Handle type = java_lang_String::create_from_str(vmField.typeString, CHECK_NULL); + VMField::set_name(vmFieldObj, name()); + VMField::set_type(vmFieldObj, type()); + VMField::set_offset(vmFieldObj, vmField.offset); + VMField::set_address(vmFieldObj, (jlong) vmField.address); + if (vmField.isStatic && vmField.typeString != NULL) { + if (strcmp(vmField.typeString, "bool") == 0) { + BOXED_LONG(value, *(jbyte*) vmField.address); + VMField::set_value(vmFieldObj, value); + } else if (strcmp(vmField.typeString, "int") == 0 || + strcmp(vmField.typeString, "jint") == 0) { + BOXED_LONG(value, *(jint*) vmField.address); + VMField::set_value(vmFieldObj, value); + } else if (strcmp(vmField.typeString, "uint64_t") == 0) { + BOXED_LONG(value, *(uint64_t*) vmField.address); + VMField::set_value(vmFieldObj, value); + } else if (strcmp(vmField.typeString, "address") == 0 || + strcmp(vmField.typeString, "intptr_t") == 0 || + strcmp(vmField.typeString, "uintptr_t") == 0 || + strcmp(vmField.typeString, "size_t") == 0 || + // All foo* types are addresses. + vmField.typeString[strlen(vmField.typeString) - 1] == '*') { + BOXED_LONG(value, *((address*) vmField.address)); + VMField::set_value(vmFieldObj, value); + } + } + vmFields->obj_at_put(i, vmFieldObj()); + } + + len = VMStructs::localHotSpotVMTypes_count(); + objArrayHandle vmTypes = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL); + for (int i = 0; i < len ; i++) { + VMTypeEntry vmType = VMStructs::localHotSpotVMTypes[i]; + Handle name = java_lang_String::create_from_str(vmType.typeName, CHECK_NULL); + BOXED_LONG(size, vmType.size); + vmTypes->obj_at_put(i * 2, name()); + vmTypes->obj_at_put(i * 2 + 1, size); + } + + int ints_len = VMStructs::localHotSpotVMIntConstants_count(); + int longs_len = VMStructs::localHotSpotVMLongConstants_count(); + len = ints_len + longs_len; + objArrayHandle vmConstants = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL); + int insert = 0; + for (int i = 0; i < ints_len ; i++) { + VMIntConstantEntry c = VMStructs::localHotSpotVMIntConstants[i]; + Handle name = java_lang_String::create_from_str(c.name, CHECK_NULL); + BOXED_LONG(value, c.value); + vmConstants->obj_at_put(insert++, name()); + vmConstants->obj_at_put(insert++, value); + } + for (int i = 0; i < longs_len ; i++) { + VMLongConstantEntry c = VMStructs::localHotSpotVMLongConstants[i]; + Handle name = java_lang_String::create_from_str(c.name, CHECK_NULL); + BOXED_LONG(value, c.value); + vmConstants->obj_at_put(insert++, name()); + vmConstants->obj_at_put(insert++, value); + } + assert(insert == len * 2, "must be"); + + len = VMStructs::localHotSpotVMAddresses_count(); + objArrayHandle vmAddresses = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL); + for (int i = 0; i < len ; i++) { + VMAddressEntry a = VMStructs::localHotSpotVMAddresses[i]; + Handle name = java_lang_String::create_from_str(a.name, CHECK_NULL); + BOXED_LONG(value, a.value); + vmAddresses->obj_at_put(i * 2, name()); + vmAddresses->obj_at_put(i * 2 + 1, value); + } + + // The last entry is the null entry. + len = Flag::numFlags - 1; + objArrayHandle vmFlags = oopFactory::new_objArray(VMFlag::klass(), len, CHECK_NULL); + for (int i = 0; i < len; i++) { + Flag* flag = &Flag::flags[i]; + instanceHandle vmFlagObj = InstanceKlass::cast(VMFlag::klass())->allocate_instance_handle(CHECK_NULL); + Handle name = java_lang_String::create_from_str(flag->_name, CHECK_NULL); + Handle type = java_lang_String::create_from_str(flag->_type, CHECK_NULL); + VMFlag::set_name(vmFlagObj, name()); + VMFlag::set_type(vmFlagObj, type()); + if (flag->is_bool()) { + BOXED_LONG(value, flag->get_bool()); + VMFlag::set_value(vmFlagObj, value); + } else if (flag->is_ccstr()) { + Handle value = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_NULL); + VMFlag::set_value(vmFlagObj, value()); + } else if (flag->is_intx()) { + BOXED_LONG(value, flag->get_intx()); + VMFlag::set_value(vmFlagObj, value); + } else if (flag->is_uint64_t()) { + BOXED_LONG(value, flag->get_uint64_t()); + VMFlag::set_value(vmFlagObj, value); + } else if (flag->is_uintx()) { + BOXED_LONG(value, flag->get_uintx()); + VMFlag::set_value(vmFlagObj, value); + } else if (flag->is_double()) { + BOXED_DOUBLE(value, flag->get_double()); + VMFlag::set_value(vmFlagObj, value); + } else { + JVMCI_ERROR_NULL("VM flag %s has unsupported type %s", flag->_name, flag->_type); + } + vmFlags->obj_at_put(i, vmFlagObj()); + } + + objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 5, CHECK_NULL); + data->obj_at_put(0, vmFields()); + data->obj_at_put(1, vmTypes()); + data->obj_at_put(2, vmConstants()); + data->obj_at_put(3, vmAddresses()); + data->obj_at_put(4, vmFlags()); + + return (jobjectArray) JNIHandles::make_local(THREAD, data); +#undef BOXED_LONG +#undef BOXED_DOUBLE C2V_END C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method)) @@ -1178,7 +1426,6 @@ #define HS_RESOLVED_KLASS "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;" #define HS_CONSTANT_POOL "Ljdk/vm/ci/hotspot/HotSpotConstantPool;" #define HS_COMPILED_CODE "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;" -#define HS_CONFIG "Ljdk/vm/ci/hotspot/HotSpotVMConfig;" #define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;" #define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;" #define METASPACE_METHOD_DATA "J" @@ -1218,7 +1465,7 @@ {CC"getResolvedJavaMethod", CC"(Ljava/lang/Object;J)"HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethod)}, {CC"getConstantPool", CC"(Ljava/lang/Object;J)"HS_CONSTANT_POOL, FN_PTR(getConstantPool)}, {CC"getResolvedJavaType", CC"(Ljava/lang/Object;JZ)"HS_RESOLVED_KLASS, FN_PTR(getResolvedJavaType)}, - {CC"initializeConfiguration", CC"("HS_CONFIG")V", FN_PTR(initializeConfiguration)}, + {CC"readConfiguration", CC"()[Ljava/lang/Object;", FN_PTR(readConfiguration)}, {CC"installCode", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG")I", FN_PTR(installCode)}, {CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)}, {CC"disassembleCodeBlob", CC"("INSTALLED_CODE")"STRING, FN_PTR(disassembleCodeBlob)},
--- a/src/share/vm/jvmci/jvmciCompilerToVM.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/jvmciCompilerToVM.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -29,7 +29,59 @@ #include "jvmci/jvmciJavaClasses.hpp" class CompilerToVM { -public: + public: + class Data { + friend class VMStructs; + + private: + static int Klass_vtable_start_offset; + static int Klass_vtable_length_offset; + + static int Method_extra_stack_entries; + + static address SharedRuntime_ic_miss_stub; + static address SharedRuntime_handle_wrong_method_stub; + static address SharedRuntime_deopt_blob_unpack; + static address SharedRuntime_deopt_blob_uncommon_trap; + + static size_t ThreadLocalAllocBuffer_alignment_reserve; + + static CollectedHeap* Universe_collectedHeap; + static int Universe_base_vtable_size; + static address Universe_narrow_oop_base; + static int Universe_narrow_oop_shift; + static address Universe_narrow_klass_base; + static int Universe_narrow_klass_shift; + static uintptr_t Universe_verify_oop_mask; + static uintptr_t Universe_verify_oop_bits; + static void* Universe_non_oop_bits; + + static bool _supports_inline_contig_alloc; + static HeapWord** _heap_end_addr; + static HeapWord** _heap_top_addr; + + static jbyte* cardtable_start_address; + static int cardtable_shift; + static int g1_young_card; + static int dirty_card; + + static int vm_page_size; + + static address CodeCache_low_bound; + static address CodeCache_high_bound; + + static address dsin; + static address dcos; + static address dtan; + static address dexp; + static address dlog; + static address dlog10; + static address dpow; + + public: + static void initialize(TRAPS); + }; + /** * Tag bits used by lookupKlassInPool to distinguish the types in Java. */
--- a/src/share/vm/jvmci/jvmciJavaClasses.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/jvmciJavaClasses.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -110,6 +110,18 @@ start_class(HotSpotForeignCallTarget) \ long_field(HotSpotForeignCallTarget, address) \ end_class \ + start_class(VMField) \ + oop_field(VMField, name, "Ljava/lang/String;") \ + oop_field(VMField, type, "Ljava/lang/String;") \ + long_field(VMField, offset) \ + long_field(VMField, address) \ + oop_field(VMField, value, "Ljava/lang/Long;") \ + end_class \ + start_class(VMFlag) \ + oop_field(VMFlag, name, "Ljava/lang/String;") \ + oop_field(VMFlag, type, "Ljava/lang/String;") \ + oop_field(VMFlag, value, "Ljava/lang/Object;") \ + end_class \ start_class(Assumptions_NoFinalizableSubclass) \ oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/vm/ci/meta/ResolvedJavaType;") \ end_class \
--- a/src/share/vm/jvmci/systemDictionary_jvmci.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/systemDictionary_jvmci.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -47,6 +47,8 @@ do_klass(HotSpotJVMCIRuntime_klass, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, Jvmci) \ do_klass(HotSpotSpeculationLog_klass, jdk_vm_ci_hotspot_HotSpotSpeculationLog, Jvmci) \ do_klass(HotSpotCompilationRequestResult_klass, jdk_vm_ci_hotspot_HotSpotCompilationRequestResult, Jvmci) \ + do_klass(VMField_klass, jdk_vm_ci_hotspot_VMField, Jvmci) \ + do_klass(VMFlag_klass, jdk_vm_ci_hotspot_VMFlag, Jvmci) \ do_klass(Assumptions_ConcreteMethod_klass, jdk_vm_ci_meta_Assumptions_ConcreteMethod, Jvmci) \ do_klass(Assumptions_NoFinalizableSubclass_klass, jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass, Jvmci) \ do_klass(Assumptions_ConcreteSubtype_klass, jdk_vm_ci_meta_Assumptions_ConcreteSubtype, Jvmci) \
--- a/src/share/vm/jvmci/vmStructs_jvmci.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/vmStructs_jvmci.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -31,14 +31,61 @@ #include "jvmci/jvmciEnv.hpp" #define VM_STRUCTS_JVMCI(nonstatic_field, static_field) \ - nonstatic_field(JavaThread, _pending_deoptimization, int) \ - nonstatic_field(JavaThread, _pending_failed_speculation, oop) \ - nonstatic_field(JavaThread, _pending_transfer_to_interpreter, bool) \ - nonstatic_field(MethodData, _jvmci_ir_size, int) \ - nonstatic_field(JVMCIEnv, _task, CompileTask*) \ - nonstatic_field(JVMCIEnv, _jvmti_can_hotswap_or_post_breakpoint, bool) \ + static_field(CompilerToVM::Data, Klass_vtable_start_offset, int) \ + static_field(CompilerToVM::Data, Klass_vtable_length_offset, int) \ + \ + static_field(CompilerToVM::Data, Method_extra_stack_entries, int) \ + \ + static_field(CompilerToVM::Data, SharedRuntime_ic_miss_stub, address) \ + static_field(CompilerToVM::Data, SharedRuntime_handle_wrong_method_stub, address) \ + static_field(CompilerToVM::Data, SharedRuntime_deopt_blob_unpack, address) \ + static_field(CompilerToVM::Data, SharedRuntime_deopt_blob_uncommon_trap, address) \ + \ + static_field(CompilerToVM::Data, ThreadLocalAllocBuffer_alignment_reserve, size_t) \ + \ + static_field(CompilerToVM::Data, Universe_collectedHeap, CollectedHeap*) \ + static_field(CompilerToVM::Data, Universe_base_vtable_size, int) \ + static_field(CompilerToVM::Data, Universe_narrow_oop_base, address) \ + static_field(CompilerToVM::Data, Universe_narrow_oop_shift, int) \ + static_field(CompilerToVM::Data, Universe_narrow_klass_base, address) \ + static_field(CompilerToVM::Data, Universe_narrow_klass_shift, int) \ + static_field(CompilerToVM::Data, Universe_non_oop_bits, void*) \ + static_field(CompilerToVM::Data, Universe_verify_oop_mask, uintptr_t) \ + static_field(CompilerToVM::Data, Universe_verify_oop_bits, uintptr_t) \ + \ + static_field(CompilerToVM::Data, _supports_inline_contig_alloc, bool) \ + static_field(CompilerToVM::Data, _heap_end_addr, HeapWord**) \ + static_field(CompilerToVM::Data, _heap_top_addr, HeapWord**) \ + \ + static_field(CompilerToVM::Data, cardtable_start_address, jbyte*) \ + static_field(CompilerToVM::Data, cardtable_shift, int) \ + static_field(CompilerToVM::Data, g1_young_card, int) \ + static_field(CompilerToVM::Data, dirty_card, int) \ + \ + static_field(CompilerToVM::Data, vm_page_size, int) \ + \ + static_field(CompilerToVM::Data, CodeCache_low_bound, address) \ + static_field(CompilerToVM::Data, CodeCache_high_bound, address) \ + \ + static_field(CompilerToVM::Data, dsin, address) \ + static_field(CompilerToVM::Data, dcos, address) \ + static_field(CompilerToVM::Data, dtan, address) \ + static_field(CompilerToVM::Data, dexp, address) \ + static_field(CompilerToVM::Data, dlog, address) \ + static_field(CompilerToVM::Data, dlog10, address) \ + static_field(CompilerToVM::Data, dpow, address) \ + \ + nonstatic_field(JavaThread, _pending_deoptimization, int) \ + nonstatic_field(JavaThread, _pending_failed_speculation, oop) \ + nonstatic_field(JavaThread, _pending_transfer_to_interpreter, bool) \ + nonstatic_field(JavaThread, _jvmci_counters, jlong*) \ + nonstatic_field(MethodData, _jvmci_ir_size, int) \ + nonstatic_field(JVMCIEnv, _task, CompileTask*) \ + nonstatic_field(JVMCIEnv, _jvmti_can_hotswap_or_post_breakpoint, bool) \ + static_field(JVMCIRuntime, max_oop_map_stack_offset, int) \ #define VM_TYPES_JVMCI(declare_type, declare_toplevel_type) \ + declare_toplevel_type(narrowKlass) \ declare_toplevel_type(JVMCIEnv) \ #define VM_INT_CONSTANTS_JVMCI(declare_constant, declare_preprocessor_constant) \ @@ -99,4 +146,63 @@ \ declare_constant(Method::invalid_vtable_index) \ +#define VM_ADDRESSES_JVMCI(declare_address, declare_preprocessor_address, declare_function) \ + declare_function(SharedRuntime::register_finalizer) \ + declare_function(SharedRuntime::exception_handler_for_return_address) \ + declare_function(SharedRuntime::OSR_migration_end) \ + \ + declare_function(os::dll_load) \ + declare_function(os::dll_lookup) \ + declare_function(os::javaTimeMillis) \ + declare_function(os::javaTimeNanos) \ + \ + declare_function(Deoptimization::fetch_unroll_info) \ + COMPILER2_PRESENT(declare_function(Deoptimization::uncommon_trap)) \ + declare_function(Deoptimization::unpack_frames) \ + \ + declare_function(JVMCIRuntime::new_instance) \ + declare_function(JVMCIRuntime::new_array) \ + declare_function(JVMCIRuntime::new_multi_array) \ + declare_function(JVMCIRuntime::dynamic_new_array) \ + declare_function(JVMCIRuntime::dynamic_new_instance) \ + \ + declare_function(JVMCIRuntime::thread_is_interrupted) \ + declare_function(JVMCIRuntime::vm_message) \ + declare_function(JVMCIRuntime::identity_hash_code) \ + declare_function(JVMCIRuntime::exception_handler_for_pc) \ + declare_function(JVMCIRuntime::monitorenter) \ + declare_function(JVMCIRuntime::monitorexit) \ + declare_function(JVMCIRuntime::throw_and_post_jvmti_exception) \ + declare_function(JVMCIRuntime::throw_klass_external_name_exception) \ + declare_function(JVMCIRuntime::throw_class_cast_exception) \ + declare_function(JVMCIRuntime::log_primitive) \ + declare_function(JVMCIRuntime::log_object) \ + declare_function(JVMCIRuntime::log_printf) \ + declare_function(JVMCIRuntime::vm_error) \ + declare_function(JVMCIRuntime::load_and_clear_exception) \ + declare_function(JVMCIRuntime::write_barrier_pre) \ + declare_function(JVMCIRuntime::write_barrier_post) \ + declare_function(JVMCIRuntime::validate_object) \ + \ + declare_function(JVMCIRuntime::test_deoptimize_call_int) + +#ifdef TARGET_OS_FAMILY_linux + +#define VM_ADDRESSES_JVMCI_OS(declare_address, declare_preprocessor_address, declare_function) \ + declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT) + +#endif // TARGET_OS_FAMILY_linux + + +#ifdef TARGET_OS_FAMILY_bsd + +#define VM_ADDRESSES_JVMCI_OS(declare_address, declare_preprocessor_address, declare_function) \ + declare_preprocessor_address("RTLD_DEFAULT", RTLD_DEFAULT) + +#endif // TARGET_OS_FAMILY_bsd + +#ifndef VM_ADDRESSES_JVMCI_OS +#define VM_ADDRESSES_JVMCI_OS(declare_address, declare_preprocessor_address, declare_function) +#endif + #endif // SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
--- a/src/share/vm/jvmci/vmSymbols_jvmci.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/jvmci/vmSymbols_jvmci.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -48,6 +48,8 @@ template(jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, "jdk/vm/ci/hotspot/HotSpotJVMCIRuntime") \ template(jdk_vm_ci_hotspot_HotSpotSpeculationLog, "jdk/vm/ci/hotspot/HotSpotSpeculationLog") \ template(jdk_vm_ci_hotspot_HotSpotCompilationRequestResult, "jdk/vm/ci/hotspot/HotSpotCompilationRequestResult") \ + template(jdk_vm_ci_hotspot_VMField, "jdk/vm/ci/hotspot/VMField") \ + template(jdk_vm_ci_hotspot_VMFlag, "jdk/vm/ci/hotspot/VMFlag") \ template(jdk_vm_ci_meta_JavaConstant, "jdk/vm/ci/meta/JavaConstant") \ template(jdk_vm_ci_meta_PrimitiveConstant, "jdk/vm/ci/meta/PrimitiveConstant") \ template(jdk_vm_ci_meta_RawConstant, "jdk/vm/ci/meta/RawConstant") \
--- a/src/share/vm/runtime/vmStructs.cpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/runtime/vmStructs.cpp Wed Jun 15 00:00:41 2016 +0200 @@ -3003,6 +3003,23 @@ # define GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value) #endif /* COMPILER1 */ +//-------------------------------------------------------------------------------- +// VMAddressEntry macros +// + +#define GENERATE_VM_ADDRESS_ENTRY(name) \ + { QUOTE(name), (void*) (name) }, + +#define GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY(name, value) \ + { name, (void*) (value) }, + +#define GENERATE_VM_FUNCTION_ENTRY(name) \ + { QUOTE(name), CAST_FROM_FN_PTR(void*, &(name)) }, + +// This macro generates the sentinel value indicating the end of the list +#define GENERATE_VM_ADDRESS_LAST_ENTRY() \ + { NULL, NULL } + // // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries // @@ -3181,6 +3198,20 @@ GENERATE_VM_LONG_CONSTANT_LAST_ENTRY() }; +VMAddressEntry VMStructs::localHotSpotVMAddresses[] = { +#if INCLUDE_JVMCI + VM_ADDRESSES_JVMCI(GENERATE_VM_ADDRESS_ENTRY, + GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY, + GENERATE_VM_FUNCTION_ENTRY) + + VM_ADDRESSES_JVMCI_OS(GENERATE_VM_ADDRESS_ENTRY, + GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY, + GENERATE_VM_FUNCTION_ENTRY) +#endif + + GENERATE_VM_ADDRESS_LAST_ENTRY() +}; + // This is used both to check the types of referenced fields and, in // debug builds, to ensure that all of the field types are present. void @@ -3500,10 +3531,25 @@ } #endif - #if INCLUDE_JVMCI -// Emit initialization code for HotSpotVMConfig. It's placed here so -// it can take advantage of the relaxed access checking enjoyed by -// VMStructs. -#include "HotSpotVMConfig.inline.hpp" +int VMStructs::localHotSpotVMStructs_count() { + // Ignore sentinel entry at the end + return (sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry)) - 1; +} +int VMStructs::localHotSpotVMTypes_count() { + // Ignore sentinel entry at the end + return (sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry)) - 1; +} +int VMStructs::localHotSpotVMIntConstants_count() { + // Ignore sentinel entry at the end + return (sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry)) - 1; +} +int VMStructs::localHotSpotVMLongConstants_count() { + // Ignore sentinel entry at the end + return (sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry)) - 1; +} +int VMStructs::localHotSpotVMAddresses_count() { + // Ignore sentinel entry at the end + return (sizeof(localHotSpotVMAddresses) / sizeof(VMAddressEntry)) - 1; +} #endif
--- a/src/share/vm/runtime/vmStructs.hpp Fri Jun 10 14:04:40 2016 +0200 +++ b/src/share/vm/runtime/vmStructs.hpp Wed Jun 15 00:00:41 2016 +0200 @@ -95,6 +95,11 @@ uint64_t value; // Value of constant } VMLongConstantEntry; +typedef struct { + const char* name; // Name of address (example: "SharedRuntime::register_finalizer") + void* value; // Value of address +} VMAddressEntry; + // This class is a friend of most classes, to be able to access // private fields class VMStructs { @@ -117,6 +122,11 @@ // the fact that it has a NULL typeName static VMLongConstantEntry localHotSpotVMLongConstants[]; + /** + * Table of addresses. + */ + static VMAddressEntry localHotSpotVMAddresses[]; + // This is used to run any checking code necessary for validation of // the data structure (debug build only) static void init(); @@ -127,9 +137,11 @@ #endif #if INCLUDE_JVMCI - // The definition of this method is generated by - // jdk.vm.ci.hotspotvmconfig.HotSpotVMConfigProcessor. -static void initHotSpotVMConfig(oop config); + static int localHotSpotVMStructs_count(); + static int localHotSpotVMTypes_count(); + static int localHotSpotVMIntConstants_count(); + static int localHotSpotVMLongConstants_count(); + static int localHotSpotVMAddresses_count(); #endif private: