< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  26 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
  27 
  28 import jdk.internal.misc.Unsafe;

  29 
  30 /**
  31  * Used to access native configuration details.
  32  *
  33  * All non-static, public fields in this class are so that they can be compiled as constants.
  34  */
  35 class HotSpotVMConfig extends HotSpotVMConfigAccess {
  36 
  37     /**
  38      * Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}.
  39      */
  40     static HotSpotVMConfig config() {
  41         return runtime().getConfig();
  42     }
  43 
  44     private final String osArch = getHostArchitectureName();
  45 
  46     HotSpotVMConfig(HotSpotVMConfigStore store) {
  47         super(store);





  48     }
  49 
  50     /**
  51      * Gets the host architecture name for the purpose of finding the corresponding
  52      * {@linkplain HotSpotJVMCIBackendFactory backend}.
  53      */
  54     String getHostArchitectureName() {
  55         String arch = System.getProperty("os.arch");
  56         switch (arch) {
  57             case "x86_64":
  58                 return "amd64";
  59 
  60             case "sparcv9":
  61                 return "sparc";
  62             default:
  63                 return arch;
  64         }
  65     }
  66 
  67     final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class);


 100 
 101     final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
 102     final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
 103     final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
 104 
 105     final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class);
 106     final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class);
 107     final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class);
 108     final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class);
 109     final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class);
 110     final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class);
 111 
 112     final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class);
 113 
 114     final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
 115     final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class);
 116     final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class);
 117     final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
 118     final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
 119 
 120     // Modifier.SYNTHETIC is not public so we get it via vmStructs.
 121     final int jvmAccSynthetic = getConstant("JVM_ACC_SYNTHETIC", Integer.class);
 122 
 123     // This is only valid on AMD64.
 124     final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
 125 
 126     private final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class);
 127     private final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class);
 128 
 129     /**
 130      * See {@code markOopDesc::prototype()}.
 131      */
 132     long arrayPrototypeMarkWord() {
 133         return markWordNoHashInPlace | markWordNoLockInPlace;
 134     }
 135 
 136     final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
 137     final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
 138     final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
 139     final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
 140     final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int");
 141 
 142     final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*");




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
  26 import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
  27 
  28 import jdk.internal.misc.Unsafe;
  29 import jdk.vm.ci.meta.ModifiersProvider;
  30 
  31 /**
  32  * Used to access native configuration details.
  33  *
  34  * All non-static, public fields in this class are so that they can be compiled as constants.
  35  */
  36 class HotSpotVMConfig extends HotSpotVMConfigAccess {
  37 
  38     /**
  39      * Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}.
  40      */
  41     static HotSpotVMConfig config() {
  42         return runtime().getConfig();
  43     }
  44 
  45     private final String osArch = getHostArchitectureName();
  46 
  47     HotSpotVMConfig(HotSpotVMConfigStore store) {
  48         super(store);
  49         assert ModifiersProvider.SYNTHETIC == getConstant("JVM_ACC_SYNTHETIC", Integer.class);
  50         assert ModifiersProvider.ANNOTATION == getConstant("JVM_ACC_ANNOTATION", Integer.class);
  51         assert ModifiersProvider.BRIDGE == getConstant("JVM_ACC_BRIDGE", Integer.class);
  52         assert ModifiersProvider.VARARGS == getConstant("JVM_ACC_VARARGS", Integer.class);
  53         assert ModifiersProvider.ENUM == getConstant("JVM_ACC_ENUM", Integer.class);
  54     }
  55 
  56     /**
  57      * Gets the host architecture name for the purpose of finding the corresponding
  58      * {@linkplain HotSpotJVMCIBackendFactory backend}.
  59      */
  60     String getHostArchitectureName() {
  61         String arch = System.getProperty("os.arch");
  62         switch (arch) {
  63             case "x86_64":
  64                 return "amd64";
  65 
  66             case "sparcv9":
  67                 return "sparc";
  68             default:
  69                 return arch;
  70         }
  71     }
  72 
  73     final boolean useDeferredInitBarriers = getFlag("ReduceInitialCardMarks", Boolean.class);


 106 
 107     final int arrayU1LengthOffset = getFieldOffset("Array<int>::_length", Integer.class, "int");
 108     final int arrayU1DataOffset = getFieldOffset("Array<u1>::_data", Integer.class);
 109     final int arrayU2DataOffset = getFieldOffset("Array<u2>::_data", Integer.class);
 110 
 111     final int fieldInfoAccessFlagsOffset = getConstant("FieldInfo::access_flags_offset", Integer.class);
 112     final int fieldInfoNameIndexOffset = getConstant("FieldInfo::name_index_offset", Integer.class);
 113     final int fieldInfoSignatureIndexOffset = getConstant("FieldInfo::signature_index_offset", Integer.class);
 114     final int fieldInfoLowPackedOffset = getConstant("FieldInfo::low_packed_offset", Integer.class);
 115     final int fieldInfoHighPackedOffset = getConstant("FieldInfo::high_packed_offset", Integer.class);
 116     final int fieldInfoFieldSlots = getConstant("FieldInfo::field_slots", Integer.class);
 117 
 118     final int fieldInfoTagSize = getConstant("FIELDINFO_TAG_SIZE", Integer.class);
 119 
 120     final int jvmAccHasFinalizer = getConstant("JVM_ACC_HAS_FINALIZER", Integer.class);
 121     final int jvmAccFieldInternal = getConstant("JVM_ACC_FIELD_INTERNAL", Integer.class);
 122     final int jvmAccFieldStable = getConstant("JVM_ACC_FIELD_STABLE", Integer.class);
 123     final int jvmAccFieldHasGenericSignature = getConstant("JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE", Integer.class);
 124     final int jvmAccIsCloneableFast = getConstant("JVM_ACC_IS_CLONEABLE_FAST", Integer.class);
 125 



 126     // This is only valid on AMD64.
 127     final int runtimeCallStackSize = getConstant("frame::arg_reg_save_area_bytes", Integer.class, osArch.equals("amd64") ? null : 0);
 128 
 129     private final int markWordNoHashInPlace = getConstant("markOopDesc::no_hash_in_place", Integer.class);
 130     private final int markWordNoLockInPlace = getConstant("markOopDesc::no_lock_in_place", Integer.class);
 131 
 132     /**
 133      * See {@code markOopDesc::prototype()}.
 134      */
 135     long arrayPrototypeMarkWord() {
 136         return markWordNoHashInPlace | markWordNoLockInPlace;
 137     }
 138 
 139     final int methodAccessFlagsOffset = getFieldOffset("Method::_access_flags", Integer.class, "AccessFlags");
 140     final int methodConstMethodOffset = getFieldOffset("Method::_constMethod", Integer.class, "ConstMethod*");
 141     final int methodIntrinsicIdOffset = getFieldOffset("Method::_intrinsic_id", Integer.class, "u2");
 142     final int methodFlagsOffset = getFieldOffset("Method::_flags", Integer.class, "u2");
 143     final int methodVtableIndexOffset = getFieldOffset("Method::_vtable_index", Integer.class, "int");
 144 
 145     final int methodDataOffset = getFieldOffset("Method::_method_data", Integer.class, "MethodData*");


< prev index next >