29 import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
30 import org.graalvm.compiler.core.common.CompressEncoding;
31 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
32
33 import jdk.vm.ci.common.JVMCIError;
34 import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
35 import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
36
37 /**
38 * Used to access native configuration details.
39 */
40 public class GraalHotSpotVMConfig extends HotSpotVMConfigAccess {
41
42 /**
43 * Sentinel value to use for an {@linkplain InjectedParameter injected}
44 * {@link GraalHotSpotVMConfig} parameter to a {@linkplain Fold foldable} method.
45 */
46 public static final GraalHotSpotVMConfig INJECTED_VMCONFIG = null;
47
48 private final boolean isJDK8 = System.getProperty("java.specification.version").compareTo("1.9") < 0;
49 public final String osName = getHostOSName();
50 public final String osArch = getHostArchitectureName();
51 public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
52 public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux");
53
54 GraalHotSpotVMConfig(HotSpotVMConfigStore store) {
55 super(store);
56
57 assert narrowKlassShift <= logKlassAlignment;
58 assert narrowOopShift <= logMinObjAlignment();
59 oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift);
60 klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift);
61
62 assert check();
63 }
64
65 /**
66 * Gets the value of a static C++ field under two possible names. {@code name} is the preferred
67 * name and will be checked first.
68 *
530 Integer.class);
531
532 public final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int");
533 public final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length",
534 Integer.class, "int");
535
536 public final int heapWordSize = getConstant("HeapWordSize", Integer.class);
537
538 /**
539 * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
540 * are allowed to look like (respectively) the high or low bits of a real oop.
541 */
542 public final long nonOopBits = getFieldValue("CompilerToVM::Data::Universe_non_oop_bits", Long.class, "void*");
543
544 public final long verifyOopCounterAddress = getFieldAddress("StubRoutines::_verify_oop_count", "jint");
545 public final long verifyOopMask = getFieldValue("CompilerToVM::Data::Universe_verify_oop_mask", Long.class, "uintptr_t");
546 public final long verifyOopBits = getFieldValue("CompilerToVM::Data::Universe_verify_oop_bits", Long.class, "uintptr_t");
547
548 public final int logOfHRGrainBytes = getFieldValue("HeapRegion::LogOfHRGrainBytes", Integer.class, "int");
549
550 public final byte dirtyCardValue = isJDK8 ? getFieldValue("CompilerToVM::Data::dirty_card", Byte.class, "int") : getConstant("CardTableModRefBS::dirty_card", Byte.class);
551 public final byte g1YoungCardValue = isJDK8 ? getFieldValue("CompilerToVM::Data::g1_young_card", Byte.class, "int") : getConstant("G1SATBCardTableModRefBS::g1_young_gen", Byte.class);
552
553 public final long cardtableStartAddress = getFieldValue("CompilerToVM::Data::cardtable_start_address", Long.class, "jbyte*");
554 public final int cardtableShift = getFieldValue("CompilerToVM::Data::cardtable_shift", Integer.class, "int");
555
556 /**
557 * This is the largest stack offset encodeable in an OopMapValue. Offsets larger than this will
558 * throw an exception during code installation.
559 */
560 public final int maxOopMapStackOffset = getFieldValueWithAlternate("CompilerToVM::Data::_max_oop_map_stack_offset", "JVMCIRuntime::max_oop_map_stack_offset", Integer.class, "int");
561
562 public final long safepointPollingAddress = getFieldValue("os::_polling_page", Long.class, "address");
563
564 // G1 Collector Related Values.
565
566 public int g1CardQueueIndexOffset() {
567 return javaThreadDirtyCardQueueOffset + dirtyCardQueueIndexOffset;
568 }
569
570 public int g1CardQueueBufferOffset() {
571 return javaThreadDirtyCardQueueOffset + dirtyCardQueueBufferOffset;
|
29 import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
30 import org.graalvm.compiler.core.common.CompressEncoding;
31 import org.graalvm.compiler.hotspot.nodes.GraalHotSpotVMConfigNode;
32
33 import jdk.vm.ci.common.JVMCIError;
34 import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
35 import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
36
37 /**
38 * Used to access native configuration details.
39 */
40 public class GraalHotSpotVMConfig extends HotSpotVMConfigAccess {
41
42 /**
43 * Sentinel value to use for an {@linkplain InjectedParameter injected}
44 * {@link GraalHotSpotVMConfig} parameter to a {@linkplain Fold foldable} method.
45 */
46 public static final GraalHotSpotVMConfig INJECTED_VMCONFIG = null;
47
48 private final boolean isJDK8 = System.getProperty("java.specification.version").compareTo("1.9") < 0;
49 private final boolean isJDK9 = !isJDK8;
50 private final boolean isJDK10 = isJDK9;
51 public final String osName = getHostOSName();
52 public final String osArch = getHostArchitectureName();
53 public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
54 public final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux");
55
56 GraalHotSpotVMConfig(HotSpotVMConfigStore store) {
57 super(store);
58
59 assert narrowKlassShift <= logKlassAlignment;
60 assert narrowOopShift <= logMinObjAlignment();
61 oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift);
62 klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift);
63
64 assert check();
65 }
66
67 /**
68 * Gets the value of a static C++ field under two possible names. {@code name} is the preferred
69 * name and will be checked first.
70 *
532 Integer.class);
533
534 public final int constantPoolSize = getFieldValue("CompilerToVM::Data::sizeof_ConstantPool", Integer.class, "int");
535 public final int constantPoolLengthOffset = getFieldOffset("ConstantPool::_length",
536 Integer.class, "int");
537
538 public final int heapWordSize = getConstant("HeapWordSize", Integer.class);
539
540 /**
541 * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
542 * are allowed to look like (respectively) the high or low bits of a real oop.
543 */
544 public final long nonOopBits = getFieldValue("CompilerToVM::Data::Universe_non_oop_bits", Long.class, "void*");
545
546 public final long verifyOopCounterAddress = getFieldAddress("StubRoutines::_verify_oop_count", "jint");
547 public final long verifyOopMask = getFieldValue("CompilerToVM::Data::Universe_verify_oop_mask", Long.class, "uintptr_t");
548 public final long verifyOopBits = getFieldValue("CompilerToVM::Data::Universe_verify_oop_bits", Long.class, "uintptr_t");
549
550 public final int logOfHRGrainBytes = getFieldValue("HeapRegion::LogOfHRGrainBytes", Integer.class, "int");
551
552 public final byte dirtyCardValue = isJDK10 ? getConstant("CardTable::dirty_card", Byte.class) :
553 (isJDK9 ? getConstant("CardTableModRefBS::dirty_card", Byte.class) :
554 getFieldValue("CompilerToVM::Data::dirty_card", Byte.class, "int"));
555 public final byte g1YoungCardValue = isJDK10 ? getConstant("G1CardTable::g1_young_gen", Byte.class) :
556 (isJDK9 ? getConstant("G1SATBCardTableModRefBS::g1_young_gen", Byte.class) :
557 getFieldValue("CompilerToVM::Data::g1_young_card", Byte.class, "int"));
558
559 public final long cardtableStartAddress = getFieldValue("CompilerToVM::Data::cardtable_start_address", Long.class, "jbyte*");
560 public final int cardtableShift = getFieldValue("CompilerToVM::Data::cardtable_shift", Integer.class, "int");
561
562 /**
563 * This is the largest stack offset encodeable in an OopMapValue. Offsets larger than this will
564 * throw an exception during code installation.
565 */
566 public final int maxOopMapStackOffset = getFieldValueWithAlternate("CompilerToVM::Data::_max_oop_map_stack_offset", "JVMCIRuntime::max_oop_map_stack_offset", Integer.class, "int");
567
568 public final long safepointPollingAddress = getFieldValue("os::_polling_page", Long.class, "address");
569
570 // G1 Collector Related Values.
571
572 public int g1CardQueueIndexOffset() {
573 return javaThreadDirtyCardQueueOffset + dirtyCardQueueIndexOffset;
574 }
575
576 public int g1CardQueueBufferOffset() {
577 return javaThreadDirtyCardQueueOffset + dirtyCardQueueBufferOffset;
|