--- a/hotspot/.hgignore Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/.hgignore Wed Nov 04 07:23:23 2015 -1000
@@ -11,3 +11,12 @@
^.hgtip
.DS_Store
\.class$
+^\.?mx.jvmci/
+^src/jdk.vm.ci/share/classes/\w[\w\.]*/.*\.xml
+^src/jdk.vm.ci/share/classes/\w[\w\.]*/.*\.iml
+^src/jdk.vm.ci/share/classes/\w[\w\.]*/nbproject
+^src/jdk.vm.ci/share/classes/\w[\w\.]*/\..*
+^test/compiler/jvmci/\w[\w\.]*/.*\.xml
+^test/compiler/jvmci/\w[\w\.]*/.*\.iml
+^test/compiler/jvmci/\w[\w\.]*/nbproject
+^test/compiler/jvmci/\w[\w\.]*/\..*
--- a/hotspot/make/gensrc/Gensrc-jdk.vm.ci.gmk Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/make/gensrc/Gensrc-jdk.vm.ci.gmk Wed Nov 04 07:23:23 2015 -1000
@@ -56,10 +56,10 @@
################################################################################
PROC_SRC_SUBDIRS := \
- jdk.vm.ci.compiler \
jdk.vm.ci.hotspot \
jdk.vm.ci.hotspot.amd64 \
jdk.vm.ci.hotspot.sparc \
+ jdk.vm.ci.runtime \
#
PROC_SRC_DIRS := $(patsubst %, $(SRC_DIR)/%/src, $(PROC_SRC_SUBDIRS))
@@ -94,11 +94,7 @@
$(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors: \
$(GENSRC_DIR)/_gensrc_proc_done
$(MKDIR) -p $(@D)
- ($(CD) $(GENSRC_DIR)/META-INF/jvmci.options && \
- $(RM) -f $@; \
- for i in $$(ls); do \
- echo $${i}_OptionDescriptors >> $@; \
- done)
+ $(FIND) $(GENSRC_DIR) -name '*_OptionDescriptors.java' | $(SED) 's:.*/jdk\.vm\.ci/\(.*\)\.java:\1:' | $(TR) '/' '.' > $@
TARGETS += $(GENSRC_DIR)/META-INF/services/jdk.vm.ci.options.OptionDescriptors
--- a/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/aarch64/vm/jvmciCodeInstaller_aarch64.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -38,11 +38,11 @@
Unimplemented();
}
-void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
+void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle& constant) {
Unimplemented();
}
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
+void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
Unimplemented();
}
--- a/hotspot/src/cpu/ppc/vm/jvmciCodeInstaller_ppc.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/ppc/vm/jvmciCodeInstaller_ppc.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -38,11 +38,11 @@
Unimplemented();
}
-void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
+void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle& constant) {
Unimplemented();
}
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
+void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
Unimplemented();
}
--- a/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -66,6 +66,25 @@
}
}
+void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle& constant) {
+ address pc = _instructions->start() + pc_offset;
+ if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
+#ifdef _LP64
+ NativeMovConstReg32* move = nativeMovConstReg32_at(pc);
+ narrowKlass narrowOop = record_narrow_metadata_reference(constant);
+ move->set_data((intptr_t)narrowOop);
+ TRACE_jvmci_3("relocating (narrow metaspace constant) at %p/%p", pc, narrowOop);
+#else
+ fatal("compressed Klass* on 32bit");
+#endif
+ } else {
+ NativeMovConstReg* move = nativeMovConstReg_at(pc);
+ Metadata* reference = record_metadata_reference(constant);
+ move->set_data((intptr_t)reference);
+ TRACE_jvmci_3("relocating (metaspace constant) at %p/%p", pc, reference);
+ }
+}
+
void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
address pc = _instructions->start() + pc_offset;
NativeInstruction* inst = nativeInstruction_at(pc);
@@ -87,10 +106,6 @@
}
}
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
- fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp");
-}
-
void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
address pc = (address) inst;
if (inst->is_call()) {
@@ -168,16 +183,25 @@
// convert JVMCI register indices (as used in oop maps) to HotSpot registers
VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg) {
- if (jvmci_reg < RegisterImpl::number_of_registers) {
+ // JVMCI Registers are numbered as follows:
+ // 0..31: Thirty-two General Purpose registers (CPU Registers)
+ // 32..63: Thirty-two single precision float registers
+ // 64..95: Thirty-two double precision float registers
+ // 96..111: Sixteen quad precision float registers
+ if (jvmci_reg < 32) {
return as_Register(jvmci_reg)->as_VMReg();
} else {
- jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers;
- floatRegisterNumber += MAX2(0, floatRegisterNumber-32); // Beginning with f32, only every second register is going to be addressed
- if (floatRegisterNumber < FloatRegisterImpl::number_of_registers) {
- return as_FloatRegister(floatRegisterNumber)->as_VMReg();
+ jint floatRegisterNumber;
+ if(jvmci_reg < 64) { // Single precision
+ floatRegisterNumber = jvmci_reg - 32;
+ } else if(jvmci_reg < 96) {
+ floatRegisterNumber = 2 * (jvmci_reg - 64);
+ } else if(jvmci_reg < 112) {
+ floatRegisterNumber = 4 * (jvmci_reg - 96);
+ } else {
+ fatal("Unknown jvmci register");
}
- ShouldNotReachHere();
- return NULL;
+ return as_FloatRegister(floatRegisterNumber)->as_VMReg();
}
}
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -417,6 +417,67 @@
//-------------------------------------------------------------------
+void NativeMovConstReg32::verify() {
+ NativeInstruction::verify();
+ // make sure code pattern is actually a "set_metadata" synthetic instruction
+ // see MacroAssembler::set_oop()
+ int i0 = long_at(sethi_offset);
+ int i1 = long_at(add_offset);
+
+ // verify the pattern "sethi %hi22(imm), reg ; add reg, %lo10(imm), reg"
+ Register rd = inv_rd(i0);
+ if (!is_op2(i0, Assembler::sethi_op2) && rd != G0 ) {
+ fatal("not a set_metadata");
+ }
+}
+
+
+void NativeMovConstReg32::print() {
+ tty->print_cr(INTPTR_FORMAT ": mov reg, " INTPTR_FORMAT, instruction_address(), data());
+}
+
+
+intptr_t NativeMovConstReg32::data() const {
+ return data32(long_at(sethi_offset), long_at(add_offset));
+}
+
+
+void NativeMovConstReg32::set_data(intptr_t x) {
+ set_long_at(sethi_offset, set_data32_sethi( long_at(sethi_offset), x));
+ set_long_at(add_offset, set_data32_simm13( long_at(add_offset), x));
+
+ // also store the value into an oop_Relocation cell, if any
+ CodeBlob* cb = CodeCache::find_blob(instruction_address());
+ nmethod* nm = cb ? cb->as_nmethod_or_null() : NULL;
+ if (nm != NULL) {
+ RelocIterator iter(nm, instruction_address(), next_instruction_address());
+ oop* oop_addr = NULL;
+ Metadata** metadata_addr = NULL;
+ while (iter.next()) {
+ if (iter.type() == relocInfo::oop_type) {
+ oop_Relocation *r = iter.oop_reloc();
+ if (oop_addr == NULL) {
+ oop_addr = r->oop_addr();
+ *oop_addr = cast_to_oop(x);
+ } else {
+ assert(oop_addr == r->oop_addr(), "must be only one set-oop here");
+ }
+ }
+ if (iter.type() == relocInfo::metadata_type) {
+ metadata_Relocation *r = iter.metadata_reloc();
+ if (metadata_addr == NULL) {
+ metadata_addr = r->metadata_addr();
+ *metadata_addr = (Metadata*)x;
+ } else {
+ assert(metadata_addr == r->metadata_addr(), "must be only one set-metadata here");
+ }
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------------
+
void NativeMovConstRegPatching::verify() {
NativeInstruction::verify();
// Make sure code pattern is sethi/nop/add.
--- a/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/sparc/vm/nativeInst_sparc.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -518,6 +518,46 @@
#endif // _LP64
+// An interface for accessing/manipulating 32 bit native set_metadata imm, reg instructions
+// (used to manipulate inlined data references, etc.)
+// set_metadata imm, reg
+// == sethi %hi22(imm), reg ; add reg, %lo10(imm), reg
+class NativeMovConstReg32;
+inline NativeMovConstReg32* nativeMovConstReg32_at(address address);
+class NativeMovConstReg32: public NativeInstruction {
+ public:
+ enum Sparc_specific_constants {
+ sethi_offset = 0,
+ add_offset = 4,
+ instruction_size = 8
+ };
+
+ address instruction_address() const { return addr_at(0); }
+ address next_instruction_address() const { return addr_at(instruction_size); }
+
+ // (The [set_]data accessor respects oop_type relocs also.)
+ intptr_t data() const;
+ void set_data(intptr_t x);
+
+ // report the destination register
+ Register destination() { return inv_rd(long_at(sethi_offset)); }
+
+ void verify();
+ void print();
+
+ // unit test stuff
+ static void test();
+
+ // Creation
+ friend inline NativeMovConstReg32* nativeMovConstReg32_at(address address) {
+ NativeMovConstReg32* test = (NativeMovConstReg32*)address;
+ #ifdef ASSERT
+ test->verify();
+ #endif
+ return test;
+ }
+};
+
// An interface for accessing/manipulating native set_metadata imm, reg instructions.
// (used to manipulate inlined data references, etc.)
// set_metadata imm, reg
--- a/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/sparc/vm/vmStructs_sparc.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -83,7 +83,26 @@
declare_constant(VM_Version::vis1_instructions_m) \
declare_constant(VM_Version::vis2_instructions_m) \
declare_constant(VM_Version::vis3_instructions_m) \
- declare_constant(VM_Version::cbcond_instructions_m)
+ declare_constant(VM_Version::cbcond_instructions_m) \
+ declare_constant(VM_Version::v8_instructions_m) \
+ declare_constant(VM_Version::hardware_mul32_m) \
+ declare_constant(VM_Version::hardware_div32_m) \
+ declare_constant(VM_Version::hardware_fsmuld_m) \
+ declare_constant(VM_Version::hardware_popc_m) \
+ declare_constant(VM_Version::v9_instructions_m) \
+ declare_constant(VM_Version::sun4v_m) \
+ declare_constant(VM_Version::blk_init_instructions_m) \
+ declare_constant(VM_Version::fmaf_instructions_m) \
+ declare_constant(VM_Version::fmau_instructions_m) \
+ declare_constant(VM_Version::sparc64_family_m) \
+ declare_constant(VM_Version::M_family_m) \
+ declare_constant(VM_Version::T_family_m) \
+ declare_constant(VM_Version::T1_model_m) \
+ declare_constant(VM_Version::sparc5_instructions_m) \
+ declare_constant(VM_Version::aes_instructions_m) \
+ declare_constant(VM_Version::sha1_instruction_m) \
+ declare_constant(VM_Version::sha256_instruction_m) \
+ declare_constant(VM_Version::sha512_instruction_m)
#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
--- a/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -85,6 +85,23 @@
}
}
+void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle& constant) {
+ address pc = _instructions->start() + pc_offset;
+ if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
+#ifdef _LP64
+ address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
+ *((narrowKlass*) operand) = record_narrow_metadata_reference(constant);
+ TRACE_jvmci_3("relocating (narrow metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
+#else
+ fatal("compressed Klass* on 32bit");
+#endif
+ } else {
+ address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
+ *((Metadata**) operand) = record_metadata_reference(constant);
+ TRACE_jvmci_3("relocating (metaspace constant) at " PTR_FORMAT "/" PTR_FORMAT, p2i(pc), p2i(operand));
+ }
+}
+
void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
address pc = _instructions->start() + pc_offset;
@@ -100,16 +117,6 @@
TRACE_jvmci_3("relocating at " PTR_FORMAT "/" PTR_FORMAT " with destination at " PTR_FORMAT " (%d)", p2i(pc), p2i(operand), p2i(dest), data_offset);
}
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
- if (cb->is_nmethod()) {
- nmethod* nm = (nmethod*) cb;
- nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point());
- } else {
- nativeJump_at((address)inst)->set_jump_destination(cb->code_begin());
- }
- _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
-}
-
void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
address pc = (address) inst;
if (inst->is_call()) {
--- a/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/cpu/x86/vm/vmStructs_x86.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -82,6 +82,7 @@
declare_constant(VM_Version::CPU_AVX512CD) \
declare_constant(VM_Version::CPU_AVX512BW)
-#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
+ declare_preprocessor_constant("VM_Version::CPU_AVX512VL", CPU_AVX512VL)
#endif // CPU_X86_VM_VMSTRUCTS_X86_HPP
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,15 +22,18 @@
*/
package jdk.vm.ci.amd64;
-import static jdk.vm.ci.code.MemoryBarriers.*;
-import static jdk.vm.ci.code.Register.*;
+import static jdk.vm.ci.code.MemoryBarriers.LOAD_STORE;
+import static jdk.vm.ci.code.MemoryBarriers.STORE_STORE;
+import static jdk.vm.ci.code.Register.SPECIAL;
-import java.nio.*;
-import java.util.*;
+import java.nio.ByteOrder;
+import java.util.EnumSet;
-import jdk.vm.ci.code.*;
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.Register.RegisterCategory;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.PlatformKind;
/**
* Represents the AMD64 architecture.
@@ -65,9 +68,7 @@
r8, r9, r10, r11, r12, r13, r14, r15
};
- private static final int XMM_REFERENCE_MAP_SHIFT = 2;
-
- public static final RegisterCategory XMM = new RegisterCategory("XMM", cpuRegisters.length, XMM_REFERENCE_MAP_SHIFT);
+ public static final RegisterCategory XMM = new RegisterCategory("XMM");
// XMM registers
public static final Register xmm0 = new Register(16, 0, "xmm0", XMM);
@@ -79,8 +80,8 @@
public static final Register xmm6 = new Register(22, 6, "xmm6", XMM);
public static final Register xmm7 = new Register(23, 7, "xmm7", XMM);
- public static final Register xmm8 = new Register(24, 8, "xmm8", XMM);
- public static final Register xmm9 = new Register(25, 9, "xmm9", XMM);
+ public static final Register xmm8 = new Register(24, 8, "xmm8", XMM);
+ public static final Register xmm9 = new Register(25, 9, "xmm9", XMM);
public static final Register xmm10 = new Register(26, 10, "xmm10", XMM);
public static final Register xmm11 = new Register(27, 11, "xmm11", XMM);
public static final Register xmm12 = new Register(28, 12, "xmm12", XMM);
@@ -88,28 +89,77 @@
public static final Register xmm14 = new Register(30, 14, "xmm14", XMM);
public static final Register xmm15 = new Register(31, 15, "xmm15", XMM);
- public static final Register[] xmmRegisters = {
+ public static final Register xmm16 = new Register(32, 16, "xmm16", XMM);
+ public static final Register xmm17 = new Register(33, 17, "xmm17", XMM);
+ public static final Register xmm18 = new Register(34, 18, "xmm18", XMM);
+ public static final Register xmm19 = new Register(35, 19, "xmm19", XMM);
+ public static final Register xmm20 = new Register(36, 20, "xmm20", XMM);
+ public static final Register xmm21 = new Register(37, 21, "xmm21", XMM);
+ public static final Register xmm22 = new Register(38, 22, "xmm22", XMM);
+ public static final Register xmm23 = new Register(39, 23, "xmm23", XMM);
+
+ public static final Register xmm24 = new Register(40, 24, "xmm24", XMM);
+ public static final Register xmm25 = new Register(41, 25, "xmm25", XMM);
+ public static final Register xmm26 = new Register(42, 26, "xmm26", XMM);
+ public static final Register xmm27 = new Register(43, 27, "xmm27", XMM);
+ public static final Register xmm28 = new Register(44, 28, "xmm28", XMM);
+ public static final Register xmm29 = new Register(45, 29, "xmm29", XMM);
+ public static final Register xmm30 = new Register(46, 30, "xmm30", XMM);
+ public static final Register xmm31 = new Register(47, 31, "xmm31", XMM);
+
+ public static final Register[] xmmRegistersSSE = {
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
};
- public static final Register[] cpuxmmRegisters = {
+ public static final Register[] xmmRegistersAVX512 = {
+ xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
+ xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
+ xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23,
+ xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31
+ };
+
+ public static final RegisterCategory MASK = new RegisterCategory("MASK", false);
+
+ public static final Register k0 = new Register(48, 0, "k0", MASK);
+ public static final Register k1 = new Register(49, 1, "k1", MASK);
+ public static final Register k2 = new Register(50, 2, "k2", MASK);
+ public static final Register k3 = new Register(51, 3, "k3", MASK);
+ public static final Register k4 = new Register(52, 4, "k4", MASK);
+ public static final Register k5 = new Register(53, 5, "k5", MASK);
+ public static final Register k6 = new Register(54, 6, "k6", MASK);
+ public static final Register k7 = new Register(55, 7, "k7", MASK);
+
+ public static final Register[] valueRegistersSSE = {
rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
r8, r9, r10, r11, r12, r13, r14, r15,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
};
+ public static final Register[] valueRegistersAVX512 = {
+ rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
+ r8, r9, r10, r11, r12, r13, r14, r15,
+ xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
+ xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
+ xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23,
+ xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31,
+ k0, k1, k2, k3, k4, k5, k6, k7
+ };
+
/**
* Register used to construct an instruction-relative address.
*/
- public static final Register rip = new Register(32, -1, "rip", SPECIAL);
+ public static final Register rip = new Register(56, -1, "rip", SPECIAL);
public static final Register[] allRegisters = {
rax, rcx, rdx, rbx, rsp, rbp, rsi, rdi,
r8, r9, r10, r11, r12, r13, r14, r15,
xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15,
+ xmm16, xmm17, xmm18, xmm19, xmm20, xmm21, xmm22, xmm23,
+ xmm24, xmm25, xmm26, xmm27, xmm28, xmm29, xmm30, xmm31,
+ k0, k1, k2, k3, k4, k5, k6, k7,
rip
};
@@ -151,7 +201,8 @@
AVX512PF,
AVX512ER,
AVX512CD,
- AVX512BW
+ AVX512BW,
+ AVX512VL
}
private final EnumSet<CPUFeature> features;
@@ -166,11 +217,21 @@
private final EnumSet<Flag> flags;
+ private final AMD64Kind largestKind;
+
public AMD64(EnumSet<CPUFeature> features, EnumSet<Flag> flags) {
- super("AMD64", JavaKind.Long, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, cpuRegisters.length + (xmmRegisters.length << XMM_REFERENCE_MAP_SHIFT), 8);
+ super("AMD64", AMD64Kind.QWORD, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, 8);
this.features = features;
this.flags = flags;
assert features.contains(CPUFeature.SSE2) : "minimum config for x64";
+
+ if (features.contains(CPUFeature.AVX512F)) {
+ largestKind = AMD64Kind.V512_QWORD;
+ } else if (features.contains(CPUFeature.AVX)) {
+ largestKind = AMD64Kind.V256_QWORD;
+ } else {
+ largestKind = AMD64Kind.V128_QWORD;
+ }
}
public EnumSet<CPUFeature> getFeatures() {
@@ -182,50 +243,60 @@
}
@Override
+ public Register[] getAvailableValueRegisters() {
+ if (features.contains(CPUFeature.AVX512F)) {
+ return valueRegistersAVX512;
+ } else {
+ return valueRegistersSSE;
+ }
+ }
+
+ @Override
public PlatformKind getPlatformKind(JavaKind javaKind) {
- if (javaKind.isObject()) {
- return getWordKind();
- } else {
- return javaKind;
+ switch (javaKind) {
+ case Boolean:
+ case Byte:
+ return AMD64Kind.BYTE;
+ case Short:
+ case Char:
+ return AMD64Kind.WORD;
+ case Int:
+ return AMD64Kind.DWORD;
+ case Long:
+ case Object:
+ return AMD64Kind.QWORD;
+ case Float:
+ return AMD64Kind.SINGLE;
+ case Double:
+ return AMD64Kind.DOUBLE;
+ default:
+ return null;
}
}
@Override
public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) {
- if (!(platformKind instanceof JavaKind)) {
- return false;
+ AMD64Kind kind = (AMD64Kind) platformKind;
+ if (kind.isInteger()) {
+ return category.equals(CPU);
+ } else if (kind.isXMM()) {
+ return category.equals(XMM);
+ } else {
+ assert kind.isMask();
+ return category.equals(MASK);
}
-
- JavaKind kind = (JavaKind) platformKind;
- if (category.equals(CPU)) {
- switch (kind) {
- case Boolean:
- case Byte:
- case Char:
- case Short:
- case Int:
- case Long:
- return true;
- }
- } else if (category.equals(XMM)) {
- switch (kind) {
- case Float:
- case Double:
- return true;
- }
- }
-
- return false;
}
@Override
- public PlatformKind getLargestStorableKind(RegisterCategory category) {
+ public AMD64Kind getLargestStorableKind(RegisterCategory category) {
if (category.equals(CPU)) {
- return JavaKind.Long;
+ return AMD64Kind.QWORD;
} else if (category.equals(XMM)) {
- return JavaKind.Double;
+ return largestKind;
+ } else if (category.equals(MASK)) {
+ return AMD64Kind.MASK64;
} else {
- return JavaKind.Illegal;
+ return null;
}
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64Kind.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2015, 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.amd64;
+
+import jdk.vm.ci.meta.PlatformKind;
+
+public enum AMD64Kind implements PlatformKind {
+
+ // scalar
+ BYTE(1),
+ WORD(2),
+ DWORD(4),
+ QWORD(8),
+ SINGLE(4),
+ DOUBLE(8),
+
+ // SSE2
+ V32_BYTE(4, BYTE),
+ V32_WORD(4, WORD),
+ V64_BYTE(8, BYTE),
+ V64_WORD(8, WORD),
+ V64_DWORD(8, DWORD),
+ V128_BYTE(16, BYTE),
+ V128_WORD(16, WORD),
+ V128_DWORD(16, DWORD),
+ V128_QWORD(16, QWORD),
+ V128_SINGLE(16, SINGLE),
+ V128_DOUBLE(16, DOUBLE),
+
+ // AVX
+ V256_BYTE(32, BYTE),
+ V256_WORD(32, WORD),
+ V256_DWORD(32, DWORD),
+ V256_QWORD(32, QWORD),
+ V256_SINGLE(32, SINGLE),
+ V256_DOUBLE(32, DOUBLE),
+
+ // AVX512
+ V512_BYTE(64, BYTE),
+ V512_WORD(64, WORD),
+ V512_DWORD(64, DWORD),
+ V512_QWORD(64, QWORD),
+ V512_SINGLE(64, SINGLE),
+ V512_DOUBLE(64, DOUBLE),
+
+ MASK8(1),
+ MASK16(2),
+ MASK32(4),
+ MASK64(8);
+
+ private final int size;
+ private final int vectorLength;
+
+ private final AMD64Kind scalar;
+ private final EnumKey<AMD64Kind> key = new EnumKey<>(this);
+
+ private AMD64Kind(int size) {
+ this.size = size;
+ this.scalar = this;
+ this.vectorLength = 1;
+ }
+
+ private AMD64Kind(int size, AMD64Kind scalar) {
+ this.size = size;
+ this.scalar = scalar;
+
+ assert size % scalar.size == 0;
+ this.vectorLength = size / scalar.size;
+ }
+
+ public AMD64Kind getScalar() {
+ return scalar;
+ }
+
+ public int getSizeInBytes() {
+ return size;
+ }
+
+ public int getVectorLength() {
+ return vectorLength;
+ }
+
+ public Key getKey() {
+ return key;
+ }
+
+ public boolean isInteger() {
+ switch (this) {
+ case BYTE:
+ case WORD:
+ case DWORD:
+ case QWORD:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isXMM() {
+ switch (this) {
+ case SINGLE:
+ case DOUBLE:
+ case V32_BYTE:
+ case V32_WORD:
+ case V64_BYTE:
+ case V64_WORD:
+ case V64_DWORD:
+ case V128_BYTE:
+ case V128_WORD:
+ case V128_DWORD:
+ case V128_QWORD:
+ case V128_SINGLE:
+ case V128_DOUBLE:
+ case V256_BYTE:
+ case V256_WORD:
+ case V256_DWORD:
+ case V256_QWORD:
+ case V256_SINGLE:
+ case V256_DOUBLE:
+ case V512_BYTE:
+ case V512_WORD:
+ case V512_DWORD:
+ case V512_QWORD:
+ case V512_SINGLE:
+ case V512_DOUBLE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isMask() {
+ switch (this) {
+ case MASK8:
+ case MASK16:
+ case MASK32:
+ case MASK64:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public char getTypeChar() {
+ switch (this) {
+ case BYTE:
+ return 'b';
+ case WORD:
+ return 'w';
+ case DWORD:
+ return 'd';
+ case QWORD:
+ return 'q';
+ case SINGLE:
+ return 'S';
+ case DOUBLE:
+ return 'D';
+ case V32_BYTE:
+ case V32_WORD:
+ case V64_BYTE:
+ case V64_WORD:
+ case V64_DWORD:
+ return 'v';
+ case V128_BYTE:
+ case V128_WORD:
+ case V128_DWORD:
+ case V128_QWORD:
+ case V128_SINGLE:
+ case V128_DOUBLE:
+ return 'x';
+ case V256_BYTE:
+ case V256_WORD:
+ case V256_DWORD:
+ case V256_QWORD:
+ case V256_SINGLE:
+ case V256_DOUBLE:
+ return 'y';
+ case V512_BYTE:
+ case V512_WORD:
+ case V512_DWORD:
+ case V512_QWORD:
+ case V512_SINGLE:
+ case V512_DOUBLE:
+ return 'z';
+ case MASK8:
+ case MASK16:
+ case MASK32:
+ case MASK64:
+ return 'k';
+ default:
+ return '-';
+ }
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/AbstractAddress.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013, 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.code;
-
-/**
- * Abstract base class that represents a platform specific address.
- */
-public abstract class AbstractAddress {
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Architecture.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,11 +22,12 @@
*/
package jdk.vm.ci.code;
-import java.nio.*;
-import java.util.*;
+import java.nio.ByteOrder;
+import java.util.Arrays;
import jdk.vm.ci.code.Register.RegisterCategory;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.PlatformKind;
/**
* Represents a CPU architecture, including information such as its endianness, CPU registers, word
@@ -35,13 +36,6 @@
public abstract class Architecture {
/**
- * The number of entries required in a {@link ReferenceMap} covering all the registers that may
- * store references. The index of a register in the reference map is given by
- * {@link Register#getReferenceMapIndex()}.
- */
- private final int registerReferenceMapSize;
-
- /**
* The architecture specific type of a native word.
*/
private final PlatformKind wordKind;
@@ -85,7 +79,7 @@
private final int returnAddressSize;
protected Architecture(String name, PlatformKind wordKind, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
- int registerReferenceMapSize, int returnAddressSize) {
+ int returnAddressSize) {
this.name = name;
this.registers = registers;
this.wordKind = wordKind;
@@ -93,7 +87,6 @@
this.unalignedMemoryAccess = unalignedMemoryAccess;
this.implicitMemoryBarriers = implicitMemoryBarriers;
this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
- this.registerReferenceMapSize = registerReferenceMapSize;
this.returnAddressSize = returnAddressSize;
}
@@ -107,10 +100,6 @@
return getName().toLowerCase();
}
- public int getRegisterReferenceMapSize() {
- return registerReferenceMapSize;
- }
-
/**
* Gets the natural size of words (typically registers and pointers) of this architecture, in
* bytes.
@@ -131,13 +120,23 @@
}
/**
- * Gets an array of all available registers on this architecture. The index of each register in
- * this array is equal to its {@linkplain Register#number number}.
+ * Gets an array of all registers that exist on this architecture. This contains all registers
+ * that exist in the specification of this architecture. Not all of them may be available on
+ * this particular architecture instance. The index of each register in this array is equal to
+ * its {@linkplain Register#number number}.
*/
public Register[] getRegisters() {
return registers.clone();
}
+ /**
+ * Gets an array of all registers available for storing values on this architecture. This may be
+ * a subset of {@link #getRegisters()}, depending on the capabilities of this particular CPU.
+ */
+ public Register[] getAvailableValueRegisters() {
+ return getRegisters();
+ }
+
public ByteOrder getByteOrder() {
return byteOrder;
}
@@ -207,7 +206,6 @@
assert this.byteOrder.equals(that.byteOrder);
assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
- assert this.registerReferenceMapSize == that.registerReferenceMapSize;
assert Arrays.equals(this.registers, that.registers);
assert this.returnAddressSize == that.returnAddressSize;
assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BailoutException.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BailoutException.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Locale;
/**
* Exception thrown when the compiler refuses to compile a method because of problems with the
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodeFrame.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,12 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Arrays;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaValue;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.Value;
/**
* Represents the Java bytecode frame state(s) at a given position including {@link Value locations}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,9 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Objects;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
/**
* Represents a code position, that is, a chain of inlined methods with bytecode locations, that is
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CallingConvention.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,10 @@
*/
package jdk.vm.ci.code;
-import static jdk.vm.ci.code.ValueUtil.*;
-
-import jdk.vm.ci.meta.*;
+import static jdk.vm.ci.code.ValueUtil.isAllocatableValue;
+import static jdk.vm.ci.code.ValueUtil.isStackSlot;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.Value;
/**
* A calling convention describes the locations in which the arguments for a call are placed and the
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,14 @@
*/
package jdk.vm.ci.code;
-import jdk.vm.ci.code.CompilationResult.*;
-import jdk.vm.ci.code.DataSection.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CompilationResult.Call;
+import jdk.vm.ci.code.CompilationResult.DataPatch;
+import jdk.vm.ci.code.CompilationResult.Mark;
+import jdk.vm.ci.code.DataSection.Data;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.SpeculationLog;
/**
* Access to code cache related details and requirements.
@@ -32,26 +37,62 @@
public interface CodeCacheProvider {
/**
- * Adds the given compilation result as an implementation of the given method without making it
- * the default implementation.
+ * Installs code for a given method based on a given compilation result without making it the
+ * default implementation of the method.
*
- * @param method a method to which the executable code is begin added
+ * @param method a method implemented by the installed code
* @param compResult the compilation result to be added
- * @param speculationLog the speculation log to be used
- * @return a reference to the compiled and ready-to-run code or throws a
- * {@link BailoutException} if the code installation failed
+ * @param log the speculation log to be used
+ * @param installedCode a predefined {@link InstalledCode} object to use as a reference to the
+ * installed code. If {@code null}, a new {@link InstalledCode} object will be
+ * created.
+ * @return a reference to the ready-to-run code
+ * @throws BailoutException if the code installation failed
*/
- InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog speculationLog, InstalledCode predefinedInstalledCode);
+ default InstalledCode addCode(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog log, InstalledCode installedCode) {
+ return installCode(new CompilationRequest(method), compResult, installedCode, log, false);
+ }
/**
- * Sets the given compilation result as the default implementation of the given method.
+ * Installs code for a given method based on a given compilation result and makes it the default
+ * implementation of the method.
*
- * @param method a method to which the executable code is begin added
+ * @param method a method implemented by the installed code and for which the installed code
+ * becomes the default implementation
+ * @param compResult the compilation result to be added
+ * @return a reference to the ready-to-run code
+ * @throws BailoutException if the code installation failed
+ */
+ default InstalledCode setDefaultCode(ResolvedJavaMethod method, CompilationResult compResult) {
+ return installCode(new CompilationRequest(method), compResult, null, null, true);
+ }
+
+ /**
+ * Installs code based on a given compilation result.
+ *
+ * @param compRequest details of the method compiled to produce {@code compResult} or
+ * {@code null} if the input to {@code compResult} was not a
+ * {@link ResolvedJavaMethod}
* @param compResult the compilation result to be added
- * @return a reference to the compiled and ready-to-run code or null if the code installation
- * failed
+ * @param installedCode a pre-allocated {@link InstalledCode} object to use as a reference to
+ * the installed code. If {@code null}, a new {@link InstalledCode} object will be
+ * created.
+ * @param log the speculation log to be used
+ * @param isDefault specifies if the installed code should be made the default implementation of
+ * {@code compRequest.getMethod()}. The default implementation for a method is the
+ * code executed for standard calls to the method. This argument is ignored if
+ * {@code compRequest == null}.
+ * @return a reference to the compiled and ready-to-run installed code
+ * @throws BailoutException if the code installation failed
*/
- InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult);
+ InstalledCode installCode(CompilationRequest compRequest, CompilationResult compResult, InstalledCode installedCode, SpeculationLog log, boolean isDefault);
+
+ /**
+ * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be
+ * raised the next time {@code installedCode} is
+ * {@linkplain InstalledCode#executeVarargs(Object...) executed}.
+ */
+ void invalidateInstalledCode(InstalledCode installedCode);
/**
* Gets a name for a {@link Mark} mark.
@@ -102,4 +143,16 @@
* Create a new speculation log for the target runtime.
*/
SpeculationLog createSpeculationLog();
+
+ /**
+ * Returns the maximum absolute offset of a PC relative call to a given address from any
+ * position in the code cache or -1 when not applicable. Intended for determining the required
+ * size of address/offset fields.
+ */
+ long getMaxCallTargetOffset(long address);
+
+ /**
+ * Determines if debug info should also be emitted at non-safepoint locations.
+ */
+ boolean shouldDebugNonSafepoints();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeUtil.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeUtil.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,15 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.MetaUtil;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.Signature;
/**
* Miscellaneous collection of utility methods used by {@code jdk.vm.ci.code} and its clients.
@@ -323,49 +329,12 @@
public interface RefMapFormatter {
String formatStackSlot(int frameRefMapIndex);
-
- String formatRegister(int regRefMapIndex);
}
/**
- * Formats a location in a register reference map.
+ * Formats a location present in a reference map.
*/
- public static class DefaultRegFormatter implements RefMapFormatter {
-
- private final Register[] registers;
-
- public DefaultRegFormatter(Architecture arch) {
- registers = new Register[arch.getRegisterReferenceMapSize()];
- for (Register r : arch.getRegisters()) {
- if (r.getReferenceMapIndex() >= 0) {
- registers[r.getReferenceMapIndex()] = r;
- }
- }
- }
-
- public String formatStackSlot(int frameRefMapIndex) {
- return null;
- }
-
- public String formatRegister(int regRefMapIndex) {
- int i = regRefMapIndex;
- int idx = 0;
- while (registers[i] == null) {
- i--;
- idx++;
- }
- if (idx == 0) {
- return registers[i].toString();
- } else {
- return String.format("%s+%d", registers[i].toString(), idx);
- }
- }
- }
-
- /**
- * Formats a location present in a register or frame reference map.
- */
- public static class DefaultRefMapFormatter extends DefaultRegFormatter {
+ public static class DefaultRefMapFormatter implements RefMapFormatter {
/**
* The size of a stack slot.
@@ -383,8 +352,7 @@
*/
public final int refMapToFPOffset;
- public DefaultRefMapFormatter(Architecture arch, int slotSize, Register fp, int refMapToFPOffset) {
- super(arch);
+ public DefaultRefMapFormatter(int slotSize, Register fp, int refMapToFPOffset) {
this.slotSize = slotSize;
this.fp = fp;
this.refMapToFPOffset = refMapToFPOffset;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationRequest.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, 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.code;
+
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+/**
+ * Represents a request to compile a method.
+ */
+public class CompilationRequest {
+
+ private final ResolvedJavaMethod method;
+
+ private final int entryBCI;
+
+ /**
+ * Creates a request to compile a method starting at its entry point.
+ *
+ * @param method the method to be compiled
+ */
+ public CompilationRequest(ResolvedJavaMethod method) {
+ this(method, -1);
+ }
+
+ /**
+ * Creates a request to compile a method starting at a given BCI.
+ *
+ * @param method the method to be compiled
+ * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the
+ * method's entry point
+ */
+ public CompilationRequest(ResolvedJavaMethod method, int entryBCI) {
+ assert method != null;
+ this.method = method;
+ this.entryBCI = entryBCI;
+ }
+
+ /**
+ * Gets the method to be compiled.
+ */
+ public ResolvedJavaMethod getMethod() {
+ return method;
+ }
+
+ /**
+ * Gets the bytecode index (BCI) at which to start compiling where -1 denotes a non-OSR
+ * compilation request and all other values denote an on stack replacement (OSR) compilation
+ * request.
+ */
+ public int getEntryBCI() {
+ return entryBCI;
+ }
+
+ @Override
+ public String toString() {
+ return method.format("%H.%n(%p)@" + entryBCI);
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,13 +22,24 @@
*/
package jdk.vm.ci.code;
-import static java.util.Collections.*;
-import static jdk.vm.ci.meta.MetaUtil.*;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.unmodifiableList;
+import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.meta.Assumptions.*;
+import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.InvokeTarget;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MetaUtil;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.VMConstant;
/**
* Represents the output from compiling a method, including the compiled machine code, associated
@@ -115,8 +126,8 @@
public enum MetaSpaceAccessType {
Move,
- Store, // store only works for compressed oops (memory <- 32bit value). Compressed oops is
- // not supported using AOT. TODO: Look at HotSpotStoreConstantOp
+ Store, // store only works for compressed oops (memory <- 32bit value). Compressed oops is
+ // not supported using AOT. TODO: Look at HotSpotStoreConstantOp
Compare; // HotSpotCompareMemoryConstantOp, HotSpotCompareConstantOp
private MetaSpaceAccessType() {
@@ -128,13 +139,11 @@
*/
public static final class MetaSpaceAccess extends Infopoint {
- private static final long serialVersionUID = 1701958512608684706L;
-
/**
* Metaspace reference.
*/
public final Object reference; // Object here is a HotSpotResolvedObjectType or a
- // HotSpotMetaSpaceConstant
+ // HotSpotMetaSpaceConstant
public final MetaSpaceAccessType type;
@@ -296,6 +305,15 @@
}
return false;
}
+
+ @Override
+ public String toString() {
+ if (initialized) {
+ return String.format("DataSection[0x%x]", offset);
+ } else {
+ return "DataSection[?]";
+ }
+ }
}
/**
@@ -528,8 +546,6 @@
}
}
- private int id = -1;
-
/**
* Specifies whether this compilation is a {@code +ImmutableCode} {@code +GeneratePIC}
* compilation.
@@ -612,7 +628,6 @@
CompilationResult that = (CompilationResult) obj;
// @formatter:off
if (this.entryBCI == that.entryBCI &&
- this.id == that.id &&
this.customStackAreaOffset == that.customStackAreaOffset &&
this.totalFrameSize == that.totalFrameSize &&
this.targetCodeSize == that.targetCodeSize &&
@@ -633,20 +648,6 @@
}
/**
- * @return the compile id
- */
- public int getId() {
- return id;
- }
-
- /**
- * @param id the compile id to set
- */
- public void setId(int id) {
- this.id = id;
- }
-
- /**
* @return true is this is a {@code +ImmutableCode} {@code +GeneratePIC} compilation, false
* otherwise.
*/
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DataSection.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DataSection.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,15 +22,18 @@
*/
package jdk.vm.ci.code;
-import static jdk.vm.ci.meta.MetaUtil.*;
+import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString;
-import java.nio.*;
-import java.util.*;
-import java.util.function.*;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Objects;
+import java.util.function.Consumer;
-import jdk.vm.ci.code.CompilationResult.*;
-import jdk.vm.ci.code.DataSection.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CompilationResult.DataPatch;
+import jdk.vm.ci.code.CompilationResult.DataSectionReference;
+import jdk.vm.ci.code.DataSection.Data;
+import jdk.vm.ci.meta.SerializableConstant;
public final class DataSection implements Iterable<Data> {
@@ -176,11 +179,27 @@
*/
public DataSectionReference insertData(Data data) {
assert !finalLayout;
- if (data.ref == null) {
- data.ref = new DataSectionReference();
+ synchronized (data) {
+ if (data.ref == null) {
+ data.ref = new DataSectionReference();
+ dataItems.add(data);
+ }
+ return data.ref;
+ }
+ }
+
+ /**
+ * Transfers all {@link Data} from the provided other {@link DataSection} to this
+ * {@link DataSection}, and empties the other section.
+ */
+ public void addAll(DataSection other) {
+ assert !finalLayout && !other.finalLayout;
+
+ for (Data data : other.dataItems) {
+ assert data.ref != null;
dataItems.add(data);
}
- return data.ref;
+ other.dataItems.clear();
}
/**
@@ -195,14 +214,16 @@
dataItems.sort((a, b) -> a.alignment - b.alignment);
int position = 0;
+ int alignment = 1;
for (Data d : dataItems) {
- sectionAlignment = lcm(sectionAlignment, d.alignment);
+ alignment = lcm(alignment, d.alignment);
position = align(position, d.alignment);
d.ref.setOffset(position);
position += d.size;
}
+ sectionAlignment = alignment;
sectionSize = position;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/DebugInfo.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Objects;
/**
* Represents the debugging information for a particular point of execution. This information
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/InstalledCode.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,14 +29,19 @@
public class InstalledCode {
/**
- * Raw address of this code blob.
+ * Raw address address of entity representing this installed code.
*/
- private long address;
+ protected long address;
+
+ /**
+ * Raw address of entryPoint of this installed code.
+ */
+ protected long entryPoint;
/**
* Counts how often the address field was reassigned.
*/
- private long version;
+ protected long version;
protected final String name;
@@ -44,27 +49,29 @@
this.name = name;
}
- public final void setAddress(long address) {
- this.address = address;
- version++;
- }
-
/**
- * @return the address of this code blob
+ * @return the address of entity representing this installed code.
*/
public final long getAddress() {
return address;
}
/**
- * @return the address of this code blob
+ * @return the address of the normal entry point of the installed code.
+ */
+ public final long getEntryPoint() {
+ return entryPoint;
+ }
+
+ /**
+ * @return the version number of this installed code
*/
public final long getVersion() {
return version;
}
/**
- * Returns the name of this code blob.
+ * Returns the name of this installed code.
*/
public String getName() {
return name;
@@ -79,10 +86,19 @@
}
/**
- * Returns the number of instruction bytes for this code.
+ * @return true if the code represented by this object is still valid for invocation, false
+ * otherwise (may happen due to deopt, etc.)
*/
- public long getCodeSize() {
- return 0;
+ public boolean isValid() {
+ return entryPoint != 0;
+ }
+
+ /**
+ * @return true if the code represented by this object still exists and might have live
+ * activations, false otherwise (may happen due to deopt, etc.)
+ */
+ public boolean isAlive() {
+ return address != 0;
}
/**
@@ -93,17 +109,9 @@
}
/**
- * @return true if the code represented by this object is still valid, false otherwise (may
- * happen due to deopt, etc.)
- */
- public boolean isValid() {
- return address != 0;
- }
-
- /**
* Invalidates this installed code such that any subsequent
* {@linkplain #executeVarargs(Object...) invocation} will throw an
- * {@link InvalidInstalledCodeException}.
+ * {@link InvalidInstalledCodeException} and all existing invocations will be deoptimized.
*/
public void invalidate() {
throw new UnsupportedOperationException();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Location.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Location.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Register.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/Register.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,8 @@
*/
package jdk.vm.ci.code;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.LIRKind;
/**
* Represents a target machine register.
@@ -80,22 +81,15 @@
public static class RegisterCategory {
private final String name;
-
- private final int referenceMapOffset;
- private final int referenceMapShift;
+ private final boolean mayContainReference;
public RegisterCategory(String name) {
- this(name, 0, 0);
+ this(name, true);
}
- public RegisterCategory(String name, int referenceMapOffset) {
- this(name, referenceMapOffset, 0);
- }
-
- public RegisterCategory(String name, int referenceMapOffset, int referenceMapShift) {
+ public RegisterCategory(String name, boolean mayContainReference) {
this.name = name;
- this.referenceMapOffset = referenceMapOffset;
- this.referenceMapShift = referenceMapShift;
+ this.mayContainReference = mayContainReference;
}
@Override
@@ -112,7 +106,7 @@
public boolean equals(Object obj) {
if (obj instanceof RegisterCategory) {
RegisterCategory that = (RegisterCategory) obj;
- return this.referenceMapOffset == that.referenceMapOffset && this.referenceMapShift == that.referenceMapShift && this.name.equals(that.name);
+ return this.name.equals(that.name);
}
return false;
}
@@ -138,10 +132,10 @@
}
/**
- * Get the start index of this register in the {@link ReferenceMap}.
+ * Determine whether this register needs to be part of the reference map.
*/
- public int getReferenceMapIndex() {
- return (encoding << registerCategory.referenceMapShift) + registerCategory.referenceMapOffset;
+ public boolean mayContainReference() {
+ return registerCategory.mayContainReference;
}
/**
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterAttributes.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Arrays;
/**
* A collection of register attributes. The specific attribute values for a register may be local to
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterConfig.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,10 @@
*/
package jdk.vm.ci.code;
-import jdk.vm.ci.code.CallingConvention.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CallingConvention.Type;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.PlatformKind;
/**
* A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterSaveLayout.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,11 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
/**
* A map from registers to frame slots. This can be used to describe where callee saved registers
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/RegisterValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,9 @@
*/
package jdk.vm.ci.code;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.LIRKind;
/**
* Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SourceStackTrace.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SourceStackTrace.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackLockValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackLockValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,9 @@
*/
package jdk.vm.ci.code;
-import static jdk.vm.ci.code.ValueUtil.*;
-
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.JavaValue;
+import jdk.vm.ci.meta.Value;
/**
* Represents lock information in the debug information.
@@ -32,10 +32,10 @@
public final class StackLockValue implements JavaValue {
private JavaValue owner;
- private StackSlotValue slot;
+ private AllocatableValue slot;
private final boolean eliminated;
- public StackLockValue(JavaValue object, StackSlotValue slot, boolean eliminated) {
+ public StackLockValue(JavaValue object, AllocatableValue slot, boolean eliminated) {
this.owner = object;
this.slot = slot;
this.eliminated = eliminated;
@@ -81,8 +81,7 @@
return false;
}
- public void setSlot(StackSlotValue stackSlot) {
- assert slot == null || (isVirtualStackSlot(slot) && (slot.equals(stackSlot) || isStackSlot(stackSlot))) : String.format("Can not set slot for %s to %s", this, stackSlot);
+ public void setSlot(AllocatableValue stackSlot) {
slot = stackSlot;
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackSlot.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackSlot.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -22,13 +22,14 @@
*/
package jdk.vm.ci.code;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.LIRKind;
/**
* Represents a compiler spill slot or an outgoing stack-based argument in a method's frame or an
* incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}.
*/
-public final class StackSlot extends StackSlotValue {
+public final class StackSlot extends AllocatableValue {
private final int offset;
private final boolean addFrameSize;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/StackSlotValue.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014, 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.code;
-
-import jdk.vm.ci.meta.*;
-
-/**
- * Common base class for {@linkplain StackSlot real} and {@linkplain VirtualStackSlot virtual} stack
- * slots.
- */
-public abstract class StackSlotValue extends AllocatableValue {
-
- public StackSlotValue(LIRKind lirKind) {
- super(lirKind);
- }
-
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/TargetDescription.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/TargetDescription.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,10 @@
*/
package jdk.vm.ci.code;
-import static jdk.vm.ci.meta.MetaUtil.*;
-
-import jdk.vm.ci.meta.*;
+import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.LIRKind;
+import jdk.vm.ci.meta.PlatformKind;
/**
* Represents the target machine for a compiler, including the CPU architecture, the size of
@@ -50,9 +51,9 @@
public final int wordSize;
/**
- * The kind to be used for representing raw pointers and CPU registers.
+ * The {@link JavaKind} to be used for representing raw pointers and CPU registers in Java code.
*/
- public final JavaKind wordKind;
+ public final JavaKind wordJavaKind;
/**
* The stack alignment requirement of the platform. For example, from Appendix D of <a
@@ -78,10 +79,12 @@
this.arch = arch;
this.isMP = isMP;
this.wordSize = arch.getWordSize();
- this.wordKind = JavaKind.fromWordSize(wordSize);
+ this.wordJavaKind = JavaKind.fromWordSize(wordSize);
this.stackAlignment = stackAlignment;
this.implicitNullCheckLimit = implicitNullCheckLimit;
this.inlineObjects = inlineObjects;
+
+ assert arch.getPlatformKind(wordJavaKind).equals(arch.getWordKind());
}
@Override
@@ -101,7 +104,7 @@
this.inlineObjects == that.inlineObjects &&
this.isMP == that.isMP &&
this.stackAlignment == that.stackAlignment &&
- this.wordKind.equals(that.wordKind) &&
+ this.wordJavaKind.equals(that.wordJavaKind) &&
this.wordSize == that.wordSize &&
this.arch.equals(that.arch)) {
return true;
@@ -116,10 +119,6 @@
return identityHashCodeString(this);
}
- public int getSizeInBytes(PlatformKind kind) {
- return kind.getSizeInBytes();
- }
-
public LIRKind getLIRKind(JavaKind javaKind) {
PlatformKind platformKind = arch.getPlatformKind(javaKind);
if (javaKind.isObject()) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/UnsignedMath.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2011, 2011, 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.code;
-
-import java.math.*;
-
-//JaCoCo Exclude
-
-/**
- * Utilities for unsigned comparisons. All methods have correct, but slow, standard Java
- * implementations so that they can be used with compilers not supporting the intrinsics.
- */
-public class UnsignedMath {
-
- private static final long MASK = 0xffffffffL;
-
- /**
- * Unsigned comparison aboveThan for two numbers.
- */
- public static boolean aboveThan(int a, int b) {
- return (a & MASK) > (b & MASK);
- }
-
- /**
- * Unsigned comparison aboveOrEqual for two numbers.
- */
- public static boolean aboveOrEqual(int a, int b) {
- return (a & MASK) >= (b & MASK);
- }
-
- /**
- * Unsigned comparison belowThan for two numbers.
- */
- public static boolean belowThan(int a, int b) {
- return (a & MASK) < (b & MASK);
- }
-
- /**
- * Unsigned comparison belowOrEqual for two numbers.
- */
- public static boolean belowOrEqual(int a, int b) {
- return (a & MASK) <= (b & MASK);
- }
-
- /**
- * Unsigned comparison aboveThan for two numbers.
- */
- public static boolean aboveThan(long a, long b) {
- return (a > b) ^ ((a < 0) != (b < 0));
- }
-
- /**
- * Unsigned comparison aboveOrEqual for two numbers.
- */
- public static boolean aboveOrEqual(long a, long b) {
- return (a >= b) ^ ((a < 0) != (b < 0));
- }
-
- /**
- * Unsigned comparison belowThan for two numbers.
- */
- public static boolean belowThan(long a, long b) {
- return (a < b) ^ ((a < 0) != (b < 0));
- }
-
- /**
- * Unsigned comparison belowOrEqual for two numbers.
- */
- public static boolean belowOrEqual(long a, long b) {
- return (a <= b) ^ ((a < 0) != (b < 0));
- }
-
- /**
- * Unsigned division for two numbers.
- */
- public static int divide(int a, int b) {
- return (int) ((a & MASK) / (b & MASK));
- }
-
- /**
- * Unsigned remainder for two numbers.
- */
- public static int remainder(int a, int b) {
- return (int) ((a & MASK) % (b & MASK));
- }
-
- /**
- * Unsigned division for two numbers.
- */
- public static long divide(long a, long b) {
- return bi(a).divide(bi(b)).longValue();
- }
-
- /**
- * Unsigned remainder for two numbers.
- */
- public static long remainder(long a, long b) {
- return bi(a).remainder(bi(b)).longValue();
- }
-
- private static BigInteger bi(long unsigned) {
- return unsigned >= 0 ? BigInteger.valueOf(unsigned) : BigInteger.valueOf(unsigned & 0x7fffffffffffffffL).setBit(63);
- }
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueUtil.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/ValueUtil.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,14 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaValue;
+import jdk.vm.ci.meta.PlatformKind;
+import jdk.vm.ci.meta.Value;
/**
* Utility class for working with the {@link Value} class and its subclasses.
@@ -60,6 +65,11 @@
return value instanceof JavaConstant;
}
+ public static JavaConstant asConstantJavaValue(JavaValue value) {
+ assert value != null;
+ return (JavaConstant) value;
+ }
+
public static boolean isAllocatableValue(Value value) {
assert value != null;
return value instanceof AllocatableValue;
@@ -80,26 +90,6 @@
return (StackSlot) value;
}
- public static boolean isStackSlotValue(Value value) {
- assert value != null;
- return value instanceof StackSlotValue;
- }
-
- public static StackSlotValue asStackSlotValue(Value value) {
- assert value != null;
- return (StackSlotValue) value;
- }
-
- public static boolean isVirtualStackSlot(Value value) {
- assert value != null;
- return value instanceof VirtualStackSlot;
- }
-
- public static VirtualStackSlot asVirtualStackSlot(Value value) {
- assert value != null;
- return (VirtualStackSlot) value;
- }
-
public static boolean isRegister(Value value) {
assert value != null;
return value instanceof RegisterValue;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualObject.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,15 @@
*/
package jdk.vm.ci.code;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.Set;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaValue;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* An instance of this class represents an object whose allocation was removed by escape analysis.
@@ -134,45 +140,6 @@
return id;
}
- private boolean checkValues() {
- assert (values == null) == (slotKinds == null);
- if (values != null) {
- assert values.length == slotKinds.length;
- if (!type.isArray()) {
- ResolvedJavaField[] fields = type.getInstanceFields(true);
- int fieldIndex = 0;
- for (int i = 0; i < values.length; i++) {
- ResolvedJavaField field = fields[fieldIndex++];
- JavaKind valKind = slotKinds[i].getStackKind();
- if (field.getJavaKind() == JavaKind.Object) {
- assert valKind.isObject() : field + ": " + valKind + " != " + field.getJavaKind();
- } else {
- if ((valKind == JavaKind.Double || valKind == JavaKind.Long) && field.getJavaKind() == JavaKind.Int) {
- assert fields[fieldIndex].getJavaKind() == JavaKind.Int;
- fieldIndex++;
- } else {
- assert valKind == field.getJavaKind().getStackKind() : field + ": " + valKind + " != " + field.getJavaKind();
- }
- }
- }
- assert fields.length == fieldIndex : type + ": fields=" + Arrays.toString(fields) + ", field values=" + Arrays.toString(values);
- } else {
- JavaKind componentKind = type.getComponentType().getJavaKind().getStackKind();
- if (componentKind == JavaKind.Object) {
- for (int i = 0; i < values.length; i++) {
- assert slotKinds[i].isObject() : slotKinds[i] + " != " + componentKind;
- }
- } else {
- for (int i = 0; i < values.length; i++) {
- assert slotKinds[i] == componentKind || componentKind.getBitCount() >= slotKinds[i].getBitCount() ||
- (componentKind == JavaKind.Int && slotKinds[i].getBitCount() >= JavaKind.Int.getBitCount()) : slotKinds[i] + " != " + componentKind;
- }
- }
- }
- }
- return true;
- }
-
/**
* Overwrites the current set of values with a new one.
*
@@ -183,7 +150,6 @@
public void setValues(JavaValue[] values, JavaKind[] slotKinds) {
this.values = values;
this.slotKinds = slotKinds;
- assert checkValues();
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/VirtualStackSlot.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2014, 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.code;
-
-import jdk.vm.ci.meta.*;
-
-/**
- * {@link VirtualStackSlot}s are stack slots that are not yet fixed to specific frame offset. They
- * are replaced by real {@link StackSlot}s with a fixed position in the frame before code emission.
- */
-public abstract class VirtualStackSlot extends StackSlotValue {
-
- private final int id;
-
- public VirtualStackSlot(int id, LIRKind lirKind) {
- super(lirKind);
- this.id = id;
- }
-
- public int getId() {
- return id;
- }
-
- @Override
- public String toString() {
- return "vstack:" + id + getKindSuffix();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + id;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- VirtualStackSlot other = (VirtualStackSlot) obj;
- if (id != other.id) {
- return false;
- }
- return true;
- }
-
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java Wed Nov 04 07:23:23 2015 -1000
@@ -18,10 +18,10 @@
* if you need additional information or have any questions.
*/
/**
- * Package that defines the interface between a Java application that wants to install code and the
- * runtime. The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider}
- * interface. The method
- * {@link jdk.vm.ci.code.CodeCacheProvider#addMethod(jdk.vm.ci.meta.ResolvedJavaMethod, CompilationResult, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
- * can be used to install code for a given method.
+ * Package that defines the interface between a Java application that wants to install code and the runtime.
+ * The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider} interface.
+ * The method {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompilationResult, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
+ * can be used to install code.
*/
package jdk.vm.ci.code;
+
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrame.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/InspectedFrame.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.code.stack;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
public interface InspectedFrame {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/StackIntrospection.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/stack/StackIntrospection.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.code.stack;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
public interface StackIntrospection {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,8 @@
*/
package jdk.vm.ci.common;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Locale;
/**
* Indicates a condition in JVMCI related code that should never occur during normal operation.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/Compiler.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2015, 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.compiler;
-
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.options.*;
-
-public interface Compiler {
- int INVOCATION_ENTRY_BCI = -1;
-
- @Option(help = "", type = OptionType.Debug) OptionValue<String> PrintFilter = new OptionValue<>(null);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintCompilation = new OptionValue<>(false);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintAfterCompilation = new OptionValue<>(false);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintBailout = new OptionValue<>(false);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnBailout = new OptionValue<>(false);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> ExitVMOnException = new OptionValue<>(true);
- @Option(help = "", type = OptionType.Debug) OptionValue<Boolean> PrintStackTraceOnException = new OptionValue<>(false);
-
- /**
- * Request the compilation of a method by this JVMCI compiler. The compiler should compile the
- * method to machine code and install it in the code cache if the compilation is successful.
- *
- * @param method the method that should be compiled
- * @param entryBCI the BCI at which to start compiling where -1 denotes a non-OSR compilation
- * request and all other values denote an OSR compilation request
- * @param jvmciEnv pointer to native {@code JVMCIEnv} object
- * @param id a unique identifier for this compilation
- */
- void compileMethod(ResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id);
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/CompilerFactory.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, 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.compiler;
-
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.runtime.*;
-
-/**
- * Factory for a JVMCI compiler.
- */
-public interface CompilerFactory {
-
- /**
- * Get the name of this compiler. The compiler will be selected when the jvmci.compiler system
- * property is equal to this name.
- */
- String getCompilerName();
-
- /**
- * Initialize an {@link Architecture}. The compiler has the opportunity to extend the
- * {@link Architecture} description with a custom subclass.
- */
- Architecture initializeArchitecture(Architecture arch);
-
- /**
- * Create a new instance of the {@link Compiler}.
- */
- Compiler createCompiler(JVMCIRuntime runtime);
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.compiler/src/jdk/vm/ci/compiler/StartupEventListener.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, 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.compiler;
-
-public interface StartupEventListener {
-
- /**
- * This method is called before any of the {@link CompilerFactory} methods.
- */
- void beforeJVMCIStartup();
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotJVMCIBackendFactory.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,18 +22,26 @@
*/
package jdk.vm.ci.hotspot.amd64;
-import static jdk.vm.ci.inittimer.InitTimer.*;
+import static jdk.vm.ci.inittimer.InitTimer.timer;
-import java.util.*;
+import java.util.EnumSet;
-import jdk.vm.ci.amd64.*;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.compiler.*;
-import jdk.vm.ci.hotspot.*;
-import jdk.vm.ci.inittimer.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
-import jdk.vm.ci.service.*;
+import jdk.vm.ci.amd64.AMD64;
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.RegisterConfig;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.code.stack.StackIntrospection;
+import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
+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.inittimer.InitTimer;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.runtime.JVMCIBackend;
+import jdk.vm.ci.service.ServiceProvider;
@ServiceProvider(HotSpotJVMCIBackendFactory.class)
public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
@@ -68,6 +76,9 @@
if ((config.x86CPUFeatures & config.cpuLZCNT) != 0) {
features.add(AMD64.CPUFeature.LZCNT);
}
+ if ((config.x86CPUFeatures & config.cpuERMS) != 0) {
+ features.add(AMD64.CPUFeature.ERMS);
+ }
if ((config.x86CPUFeatures & config.cpuAVX) != 0) {
features.add(AMD64.CPUFeature.AVX);
}
@@ -77,12 +88,42 @@
if ((config.x86CPUFeatures & config.cpuAES) != 0) {
features.add(AMD64.CPUFeature.AES);
}
- if ((config.x86CPUFeatures & config.cpuERMS) != 0) {
- features.add(AMD64.CPUFeature.ERMS);
+ if ((config.x86CPUFeatures & config.cpu3DNOWPREFETCH) != 0) {
+ features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH);
}
if ((config.x86CPUFeatures & config.cpuBMI1) != 0) {
features.add(AMD64.CPUFeature.BMI1);
}
+ if ((config.x86CPUFeatures & config.cpuBMI2) != 0) {
+ features.add(AMD64.CPUFeature.BMI2);
+ }
+ if ((config.x86CPUFeatures & config.cpuRTM) != 0) {
+ features.add(AMD64.CPUFeature.RTM);
+ }
+ if ((config.x86CPUFeatures & config.cpuADX) != 0) {
+ features.add(AMD64.CPUFeature.ADX);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512F) != 0) {
+ features.add(AMD64.CPUFeature.AVX512F);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512DQ) != 0) {
+ features.add(AMD64.CPUFeature.AVX512DQ);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512PF) != 0) {
+ features.add(AMD64.CPUFeature.AVX512PF);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512ER) != 0) {
+ features.add(AMD64.CPUFeature.AVX512ER);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512CD) != 0) {
+ features.add(AMD64.CPUFeature.AVX512CD);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512BW) != 0) {
+ features.add(AMD64.CPUFeature.AVX512BW);
+ }
+ if ((config.x86CPUFeatures & config.cpuAVX512VL) != 0) {
+ features.add(AMD64.CPUFeature.AVX512VL);
+ }
return features;
}
@@ -97,12 +138,12 @@
return flags;
}
- protected TargetDescription createTarget(HotSpotVMConfig config, CompilerFactory compilerFactory) {
+ protected TargetDescription createTarget(HotSpotVMConfig config) {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = true;
Architecture arch = new AMD64(computeFeatures(config), computeFlags(config));
- return new TargetDescription(compilerFactory.initializeArchitecture(arch), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
+ return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) {
@@ -132,15 +173,16 @@
}
@SuppressWarnings("try")
- public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, CompilerFactory compilerFactory, JVMCIBackend host) {
+ public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
assert host == null;
- TargetDescription target = createTarget(runtime.getConfig(), compilerFactory);
+ TargetDescription target = createTarget(runtime.getConfig());
RegisterConfig regConfig;
HotSpotCodeCacheProvider codeCache;
ConstantReflectionProvider constantReflection;
HotSpotMetaAccessProvider metaAccess;
+ StackIntrospection stackIntrospection;
try (InitTimer t = timer("create providers")) {
try (InitTimer rt = timer("create MetaAccess provider")) {
metaAccess = createMetaAccess(runtime);
@@ -154,13 +196,16 @@
try (InitTimer rt = timer("create ConstantReflection provider")) {
constantReflection = createConstantReflection(runtime);
}
+ try (InitTimer rt = timer("create StackIntrospection provider")) {
+ stackIntrospection = new HotSpotStackIntrospection(runtime);
+ }
}
try (InitTimer rt = timer("instantiate backend")) {
- return createBackend(metaAccess, codeCache, constantReflection);
+ return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}
- protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection) {
- return new JVMCIBackend(metaAccess, codeCache, constantReflection);
+ protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, StackIntrospection stackIntrospection) {
+ return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.amd64/src/jdk/vm/ci/hotspot/amd64/AMD64HotSpotRegisterConfig.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,16 +22,47 @@
*/
package jdk.vm.ci.hotspot.amd64;
-import static jdk.vm.ci.amd64.AMD64.*;
-
-import java.util.*;
+import static jdk.vm.ci.amd64.AMD64.r12;
+import static jdk.vm.ci.amd64.AMD64.r15;
+import static jdk.vm.ci.amd64.AMD64.r8;
+import static jdk.vm.ci.amd64.AMD64.r9;
+import static jdk.vm.ci.amd64.AMD64.rax;
+import static jdk.vm.ci.amd64.AMD64.rcx;
+import static jdk.vm.ci.amd64.AMD64.rdi;
+import static jdk.vm.ci.amd64.AMD64.rdx;
+import static jdk.vm.ci.amd64.AMD64.rsi;
+import static jdk.vm.ci.amd64.AMD64.rsp;
+import static jdk.vm.ci.amd64.AMD64.xmm0;
+import static jdk.vm.ci.amd64.AMD64.xmm1;
+import static jdk.vm.ci.amd64.AMD64.xmm2;
+import static jdk.vm.ci.amd64.AMD64.xmm3;
+import static jdk.vm.ci.amd64.AMD64.xmm4;
+import static jdk.vm.ci.amd64.AMD64.xmm5;
+import static jdk.vm.ci.amd64.AMD64.xmm6;
+import static jdk.vm.ci.amd64.AMD64.xmm7;
-import jdk.vm.ci.amd64.*;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.code.CallingConvention.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.hotspot.*;
-import jdk.vm.ci.meta.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.CallingConvention;
+import jdk.vm.ci.code.CallingConvention.Type;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterAttributes;
+import jdk.vm.ci.code.RegisterConfig;
+import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.LIRKind;
+import jdk.vm.ci.meta.PlatformKind;
+import jdk.vm.ci.meta.Value;
public class AMD64HotSpotRegisterConfig implements RegisterConfig {
@@ -86,28 +117,30 @@
*/
private final boolean needsNativeStackHomeSpace;
- private static Register[] initAllocatable(boolean reserveForHeapBase) {
- Register[] registers = null;
- // @formatter:off
- if (reserveForHeapBase) {
- registers = new Register[] {
- rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, /*r12,*/ r13, r14, /*r15, */
- xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
- xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
- };
- } else {
- registers = new Register[] {
- rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, /*r15, */
- xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7,
- xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
- };
+ private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) {
+ Register[] allRegisters = arch.getAvailableValueRegisters();
+ Register[] registers = new Register[allRegisters.length - (reserveForHeapBase ? 3 : 2)];
+
+ int idx = 0;
+ for (Register reg : allRegisters) {
+ if (reg.equals(rsp) || reg.equals(r15)) {
+ // skip stack pointer and thread register
+ continue;
+ }
+ if (reserveForHeapBase && reg.equals(r12)) {
+ // skip heap base register
+ continue;
+ }
+
+ registers[idx++] = reg;
}
- // @formatter:on
+
+ assert idx == registers.length;
return registers;
}
public AMD64HotSpotRegisterConfig(Architecture architecture, HotSpotVMConfig config) {
- this(architecture, config, initAllocatable(config.useCompressedOops));
+ this(architecture, config, initAllocatable(architecture, config.useCompressedOops));
assert callerSaved.length >= allocatable.length;
}
@@ -125,7 +158,7 @@
this.needsNativeStackHomeSpace = false;
}
- this.allocatable = allocatable.clone();
+ this.allocatable = allocatable;
Set<Register> callerSaveSet = new HashSet<>();
Collections.addAll(callerSaveSet, allocatable);
Collections.addAll(callerSaveSet, xmmParameterRegisters);
@@ -134,7 +167,7 @@
callerSaved = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
allAllocatableAreCallerSaved = true;
- attributesMap = RegisterAttributes.createMap(this, AMD64.allRegisters);
+ attributesMap = RegisterAttributes.createMap(this, architecture.getRegisters());
}
@Override
@@ -221,7 +254,7 @@
if (locations[i] == null) {
LIRKind lirKind = target.getLIRKind(kind);
locations[i] = StackSlot.get(lirKind, currentStackOffset, !type.out);
- currentStackOffset += Math.max(target.getSizeInBytes(lirKind.getPlatformKind()), target.wordSize);
+ currentStackOffset += Math.max(lirKind.getPlatformKind().getSizeInBytes(), target.wordSize);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotJVMCIBackendFactory.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,28 +22,36 @@
*/
package jdk.vm.ci.hotspot.sparc;
-import static jdk.vm.ci.inittimer.InitTimer.*;
+import static jdk.vm.ci.inittimer.InitTimer.timer;
-import java.util.*;
+import java.util.EnumSet;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.compiler.*;
-import jdk.vm.ci.hotspot.*;
-import jdk.vm.ci.inittimer.*;
-import jdk.vm.ci.runtime.*;
-import jdk.vm.ci.service.*;
-import jdk.vm.ci.sparc.*;
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.RegisterConfig;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.code.stack.StackIntrospection;
+import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
+import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
+import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
+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.inittimer.InitTimer;
+import jdk.vm.ci.runtime.JVMCIBackend;
+import jdk.vm.ci.service.ServiceProvider;
+import jdk.vm.ci.sparc.SPARC;
import jdk.vm.ci.sparc.SPARC.CPUFeature;
@ServiceProvider(HotSpotJVMCIBackendFactory.class)
public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
- protected TargetDescription createTarget(HotSpotVMConfig config, CompilerFactory compilerFactory) {
+ protected TargetDescription createTarget(HotSpotVMConfig config) {
final int stackFrameAlignment = 16;
final int implicitNullCheckLimit = 4096;
final boolean inlineObjects = false;
Architecture arch = new SPARC(computeFeatures(config));
- return new TargetDescription(compilerFactory.initializeArchitecture(arch), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
+ return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
}
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
@@ -64,8 +72,62 @@
if ((config.sparcFeatures & config.cbcondInstructions) != 0) {
features.add(CPUFeature.CBCOND);
}
- if (config.useBlockZeroing) {
- features.add(CPUFeature.BLOCK_ZEROING);
+ if ((config.sparcFeatures & config.v8Instructions) != 0) {
+ features.add(CPUFeature.V8);
+ }
+ if ((config.sparcFeatures & config.hardwareMul32) != 0) {
+ features.add(CPUFeature.HARDWARE_MUL32);
+ }
+ if ((config.sparcFeatures & config.hardwareDiv32) != 0) {
+ features.add(CPUFeature.HARDWARE_DIV32);
+ }
+ if ((config.sparcFeatures & config.hardwareFsmuld) != 0) {
+ features.add(CPUFeature.HARDWARE_FSMULD);
+ }
+ if ((config.sparcFeatures & config.hardwarePopc) != 0) {
+ features.add(CPUFeature.HARDWARE_POPC);
+ }
+ if ((config.sparcFeatures & config.v9Instructions) != 0) {
+ features.add(CPUFeature.V9);
+ }
+ if ((config.sparcFeatures & config.sun4v) != 0) {
+ features.add(CPUFeature.SUN4V);
+ }
+ if ((config.sparcFeatures & config.blkInitInstructions) != 0) {
+ features.add(CPUFeature.BLK_INIT_INSTRUCTIONS);
+ }
+ if ((config.sparcFeatures & config.fmafInstructions) != 0) {
+ features.add(CPUFeature.FMAF);
+ }
+ if ((config.sparcFeatures & config.fmauInstructions) != 0) {
+ features.add(CPUFeature.FMAU);
+ }
+ if ((config.sparcFeatures & config.sparc64Family) != 0) {
+ features.add(CPUFeature.SPARC64_FAMILY);
+ }
+ if ((config.sparcFeatures & config.mFamily) != 0) {
+ features.add(CPUFeature.M_FAMILY);
+ }
+ if ((config.sparcFeatures & config.tFamily) != 0) {
+ features.add(CPUFeature.T_FAMILY);
+ }
+ if ((config.sparcFeatures & config.t1Model) != 0) {
+ features.add(CPUFeature.T1_MODEL);
+ }
+ if ((config.sparcFeatures & config.sparc5Instructions) != 0) {
+ features.add(CPUFeature.SPARC5);
+ }
+ if ((config.sparcFeatures & config.aesInstructions) != 0) {
+ features.add(CPUFeature.SPARC64_FAMILY);
+ }
+ if ((config.sparcFeatures & config.sha1Instruction) != 0) {
+ features.add(CPUFeature.SHA1);
+ }
+ if ((config.sparcFeatures & config.sha256Instruction) != 0) {
+ features.add(CPUFeature.SHA256);
+ }
+ if ((config.sparcFeatures & config.sha512Instruction) != 0) {
+ features.add(CPUFeature.SHA512);
}
return features;
}
@@ -81,20 +143,22 @@
}
@SuppressWarnings("try")
- public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, CompilerFactory compilerFactory, JVMCIBackend host) {
+ public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
assert host == null;
- TargetDescription target = createTarget(runtime.getConfig(), compilerFactory);
+ TargetDescription target = createTarget(runtime.getConfig());
HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime);
- RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig());
+ RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target.arch, runtime.getConfig());
HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig);
HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime);
+ StackIntrospection stackIntrospection = new HotSpotStackIntrospection(runtime);
try (InitTimer rt = timer("instantiate backend")) {
- return createBackend(metaAccess, codeCache, constantReflection);
+ return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}
- protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, HotSpotConstantReflectionProvider constantReflection) {
- return new JVMCIBackend(metaAccess, codeCache, constantReflection);
+ protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, HotSpotConstantReflectionProvider constantReflection,
+ StackIntrospection stackIntrospection) {
+ return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot.sparc/src/jdk/vm/ci/hotspot/sparc/SPARCHotSpotRegisterConfig.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,16 +22,72 @@
*/
package jdk.vm.ci.hotspot.sparc;
-import static jdk.vm.ci.sparc.SPARC.*;
-
-import java.util.*;
+import static jdk.vm.ci.code.CallingConvention.Type.JavaCall;
+import static jdk.vm.ci.code.CallingConvention.Type.JavaCallee;
+import static jdk.vm.ci.code.CallingConvention.Type.NativeCall;
+import static jdk.vm.ci.meta.JavaKind.Void;
+import static jdk.vm.ci.meta.Value.ILLEGAL;
+import static jdk.vm.ci.sparc.SPARC.REGISTER_SAFE_AREA_SIZE;
+import static jdk.vm.ci.sparc.SPARC.d0;
+import static jdk.vm.ci.sparc.SPARC.d2;
+import static jdk.vm.ci.sparc.SPARC.d4;
+import static jdk.vm.ci.sparc.SPARC.d6;
+import static jdk.vm.ci.sparc.SPARC.f0;
+import static jdk.vm.ci.sparc.SPARC.f1;
+import static jdk.vm.ci.sparc.SPARC.f2;
+import static jdk.vm.ci.sparc.SPARC.f3;
+import static jdk.vm.ci.sparc.SPARC.f4;
+import static jdk.vm.ci.sparc.SPARC.f5;
+import static jdk.vm.ci.sparc.SPARC.f6;
+import static jdk.vm.ci.sparc.SPARC.f7;
+import static jdk.vm.ci.sparc.SPARC.g0;
+import static jdk.vm.ci.sparc.SPARC.g2;
+import static jdk.vm.ci.sparc.SPARC.g6;
+import static jdk.vm.ci.sparc.SPARC.i0;
+import static jdk.vm.ci.sparc.SPARC.i1;
+import static jdk.vm.ci.sparc.SPARC.i2;
+import static jdk.vm.ci.sparc.SPARC.i3;
+import static jdk.vm.ci.sparc.SPARC.i4;
+import static jdk.vm.ci.sparc.SPARC.i5;
+import static jdk.vm.ci.sparc.SPARC.i6;
+import static jdk.vm.ci.sparc.SPARC.i7;
+import static jdk.vm.ci.sparc.SPARC.l0;
+import static jdk.vm.ci.sparc.SPARC.l1;
+import static jdk.vm.ci.sparc.SPARC.l2;
+import static jdk.vm.ci.sparc.SPARC.l3;
+import static jdk.vm.ci.sparc.SPARC.l4;
+import static jdk.vm.ci.sparc.SPARC.l5;
+import static jdk.vm.ci.sparc.SPARC.l6;
+import static jdk.vm.ci.sparc.SPARC.l7;
+import static jdk.vm.ci.sparc.SPARC.o0;
+import static jdk.vm.ci.sparc.SPARC.o1;
+import static jdk.vm.ci.sparc.SPARC.o2;
+import static jdk.vm.ci.sparc.SPARC.o3;
+import static jdk.vm.ci.sparc.SPARC.o4;
+import static jdk.vm.ci.sparc.SPARC.o5;
+import static jdk.vm.ci.sparc.SPARC.sp;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.code.CallingConvention.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.hotspot.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.sparc.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.CallingConvention;
+import jdk.vm.ci.code.CallingConvention.Type;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterAttributes;
+import jdk.vm.ci.code.RegisterConfig;
+import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
+import jdk.vm.ci.meta.AllocatableValue;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.LIRKind;
+import jdk.vm.ci.meta.PlatformKind;
+import jdk.vm.ci.sparc.SPARC;
public class SPARCHotSpotRegisterConfig implements RegisterConfig {
@@ -41,6 +97,11 @@
private final RegisterAttributes[] attributesMap;
+ /**
+ * Does native code (C++ code) spill arguments in registers to the parent frame?
+ */
+ private final boolean addNativeRegisterArgumentSlots;
+
@Override
public Register[] getAllocatableRegisters() {
return allocatable.clone();
@@ -50,22 +111,9 @@
ArrayList<Register> list = new ArrayList<>();
for (Register reg : registers) {
if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
- // Special treatment for double precision
- // TODO: This is wasteful it uses only half of the registers as float.
- if (kind == JavaKind.Double) {
- if (reg.getRegisterCategory().equals(FPUd)) {
- list.add(reg);
- }
- } else if (kind == JavaKind.Float) {
- if (reg.getRegisterCategory().equals(FPUs)) {
- list.add(reg);
- }
- } else {
- list.add(reg);
- }
+ list.add(reg);
}
}
-
Register[] ret = list.toArray(new Register[list.size()]);
return ret;
}
@@ -78,76 +126,57 @@
private final Register[] cpuCallerParameterRegisters = {o0, o1, o2, o3, o4, o5};
private final Register[] cpuCalleeParameterRegisters = {i0, i1, i2, i3, i4, i5};
- private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
+ private final Register[] fpuFloatParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
private final Register[] fpuDoubleParameterRegisters = {d0, null, d2, null, d4, null, d6, null};
+
// @formatter:off
- private final Register[] callerSaveRegisters =
- {g1, g2, g3, g4, g5, g6, g7,
- o0, o1, o2, o3, o4, o5, o7,
- f0, f1, f2, f3, f4, f5, f6, f7,
- f8, f9, f10, f11, f12, f13, f14, f15,
- f16, f17, f18, f19, f20, f21, f22, f23,
- f24, f25, f26, f27, f28, f29, f30, f31,
- d32, d34, d36, d38, d40, d42, d44, d46,
- d48, d50, d52, d54, d56, d58, d60, d62};
- // @formatter:on
+ private final Register[] callerSaveRegisters;
/**
* Registers saved by the callee. This lists all L and I registers which are saved in the
* register window.
*/
- private final Register[] calleeSaveRegisters = {l0, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7};
+ private final Register[] calleeSaveRegisters = {
+ l0, l1, l2, l3, l4, l5, l6, l7,
+ i0, i1, i2, i3, i4, i5, i6, i7};
+ // @formatter:on
+
+ private static Register[] initAllocatable(Architecture arch, boolean reserveForHeapBase) {
+ Register[] allRegisters = arch.getAvailableValueRegisters();
+ Register[] registers = new Register[allRegisters.length - (reserveForHeapBase ? 4 : 3)];
- private static Register[] initAllocatable(boolean reserveForHeapBase) {
- Register[] registers = null;
- if (reserveForHeapBase) {
- // @formatter:off
- registers = new Register[]{
- // TODO this is not complete
- // o7 cannot be used as register because it is always overwritten on call
- // and the current register handler would ignore this fact if the called
- // method still does not modify registers, in fact o7 is modified by the Call instruction
- // There would be some extra handlin necessary to be able to handle the o7 properly for local usage
- g1, g4, g5,
- o0, o1, o2, o3, o4, o5, /*o6,o7,*/
- l0, l1, l2, l3, l4, l5, l6, l7,
- i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
- //f0, f1, f2, f3, f4, f5, f6, f7,
- f8, f9, f10, f11, f12, f13, f14, f15,
- f16, f17, f18, f19, f20, f21, f22, f23,
- f24, f25, f26, f27, f28, f29, f30, f31,
- d32, d34, d36, d38, d40, d42, d44, d46,
- d48, d50, d52, d54, d56, d58, d60, d62
- };
- // @formatter:on
- } else {
- // @formatter:off
- registers = new Register[]{
- // TODO this is not complete
- g1, g4, g5,
- o0, o1, o2, o3, o4, o5, /*o6, o7,*/
- l0, l1, l2, l3, l4, l5, l6, l7,
- i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
-// f0, f1, f2, f3, f4, f5, f6, f7
- f8, f9, f10, f11, f12, f13, f14, f15,
- f16, f17, f18, f19, f20, f21, f22, f23,
- f24, f25, f26, f27, f28, f29, f30, f31,
- d32, d34, d36, d38, d40, d42, d44, d46,
- d48, d50, d52, d54, d56, d58, d60, d62
- };
- // @formatter:on
+ int idx = 0;
+ for (Register reg : allRegisters) {
+ if (reg.equals(sp) || reg.equals(g2) || reg.equals(g0)) {
+ // skip g0, stack pointer and thread register
+ continue;
+ }
+ if (reserveForHeapBase && reg.equals(g6)) {
+ // skip heap base register
+ continue;
+ }
+
+ registers[idx++] = reg;
}
+ assert idx == registers.length;
return registers;
}
- public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
- this(target, initAllocatable(config.useCompressedOops));
+ public SPARCHotSpotRegisterConfig(Architecture arch, HotSpotVMConfig config) {
+ this(arch, initAllocatable(arch, config.useCompressedOops), config);
}
- public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable) {
- this.architecture = target.arch;
+ public SPARCHotSpotRegisterConfig(Architecture arch, Register[] allocatable, HotSpotVMConfig config) {
+ this.architecture = arch;
this.allocatable = allocatable.clone();
+ this.addNativeRegisterArgumentSlots = config.linuxOs;
+ HashSet<Register> callerSaveSet = new HashSet<>();
+ Collections.addAll(callerSaveSet, arch.getAvailableValueRegisters());
+ for (Register cs : calleeSaveRegisters) {
+ callerSaveSet.remove(cs);
+ }
+ this.callerSaveRegisters = callerSaveSet.toArray(new Register[callerSaveSet.size()]);
attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters);
}
@@ -172,21 +201,31 @@
@Override
public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
- if (type == Type.JavaCall || type == Type.NativeCall) {
+ if (type == JavaCall || type == NativeCall) {
return callingConvention(cpuCallerParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
}
- if (type == Type.JavaCallee) {
+ if (type == JavaCallee) {
return callingConvention(cpuCalleeParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
}
throw JVMCIError.shouldNotReachHere();
}
public Register[] getCallingConventionRegisters(Type type, JavaKind kind) {
- if (architecture.canStoreValue(FPUs, kind) || architecture.canStoreValue(FPUd, kind)) {
- return fpuParameterRegisters;
+ switch (kind) {
+ case Boolean:
+ case Byte:
+ case Short:
+ case Char:
+ case Int:
+ case Long:
+ case Object:
+ return type == Type.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
+ case Double:
+ case Float:
+ return fpuFloatParameterRegisters;
+ default:
+ throw JVMCIError.shouldNotReachHere("Unknown JavaKind " + kind);
}
- assert architecture.canStoreValue(CPU, kind);
- return type == Type.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
}
private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
@@ -213,7 +252,7 @@
}
break;
case Double:
- if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
+ if (!stackOnly && currentFloating < fpuFloatParameterRegisters.length) {
if (currentFloating % 2 != 0) {
// Make register number even to be a double reg
currentFloating++;
@@ -224,8 +263,8 @@
}
break;
case Float:
- if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
- Register register = fpuParameterRegisters[currentFloating++];
+ if (!stackOnly && currentFloating < fpuFloatParameterRegisters.length) {
+ Register register = fpuFloatParameterRegisters[currentFloating++];
locations[i] = register.asValue(target.getLIRKind(kind));
}
break;
@@ -234,20 +273,27 @@
}
if (locations[i] == null) {
+ LIRKind lirKind = target.getLIRKind(kind);
// Stack slot is always aligned to its size in bytes but minimum wordsize
- int typeSize = SPARC.spillSlotSize(target, kind);
+ int typeSize = lirKind.getPlatformKind().getSizeInBytes();
currentStackOffset = roundUp(currentStackOffset, typeSize);
- int slotOffset = currentStackOffset + SPARC.REGISTER_SAFE_AREA_SIZE;
- locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), slotOffset, !type.out);
+ int slotOffset = currentStackOffset + REGISTER_SAFE_AREA_SIZE;
+ locations[i] = StackSlot.get(lirKind, slotOffset, !type.out);
currentStackOffset += typeSize;
}
}
- JavaKind returnKind = returnType == null ? JavaKind.Void : returnType.getJavaKind();
- AllocatableValue returnLocation = returnKind == JavaKind.Void ? Value.ILLEGAL : getReturnRegister(returnKind, type).asValue(target.getLIRKind(returnKind.getStackKind()));
- // Space where callee may spill outgoing parameters o0...o5
- int lowerOutgoingSpace = Math.min(locations.length, 6) * target.wordSize;
- return new CallingConvention(currentStackOffset + lowerOutgoingSpace, returnLocation, locations);
+ JavaKind returnKind = returnType == null ? Void : returnType.getJavaKind();
+ AllocatableValue returnLocation = returnKind == Void ? ILLEGAL : getReturnRegister(returnKind, type).asValue(target.getLIRKind(returnKind.getStackKind()));
+
+ int outArgSpillArea;
+ if (type == NativeCall && addNativeRegisterArgumentSlots) {
+ // Space for native callee which may spill our outgoing arguments
+ outArgSpillArea = Math.min(locations.length, generalParameterRegisters.length) * target.wordSize;
+ } else {
+ outArgSpillArea = 0;
+ }
+ return new CallingConvention(currentStackOffset + outArgSpillArea, returnLocation, locations);
}
private static int roundUp(int number, int mod) {
@@ -256,7 +302,7 @@
@Override
public Register getReturnRegister(JavaKind kind) {
- return getReturnRegister(kind, Type.JavaCallee);
+ return getReturnRegister(kind, JavaCallee);
}
private static Register getReturnRegister(JavaKind kind, Type type) {
@@ -268,7 +314,7 @@
case Int:
case Long:
case Object:
- return type == Type.JavaCallee ? i0 : o0;
+ return type == JavaCallee ? i0 : o0;
case Float:
return f0;
case Double:
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -23,6 +23,7 @@
package jdk.vm.ci.hotspot;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import static jdk.vm.ci.inittimer.InitTimer.timer;
import java.lang.reflect.Constructor;
@@ -36,7 +37,6 @@
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.SpeculationLog;
import sun.misc.Unsafe;
/**
@@ -44,7 +44,7 @@
* pointer as an argument (e.g., {@link #getSymbol(long)}) is undefined if the argument does not
* denote a valid native object.
*/
-public final class CompilerToVM {
+final class CompilerToVM {
/**
* Initializes the native part of the JVMCI runtime.
*/
@@ -62,6 +62,14 @@
}
/**
+ * Gets the {@link CompilerToVM} instance associated with the singleton
+ * {@link HotSpotJVMCIRuntime} instance.
+ */
+ public static CompilerToVM compilerToVM() {
+ return runtime().getCompilerToVM();
+ }
+
+ /**
* Copies the original bytecode of {@code method} into a new byte array and returns it.
*
* @return a new byte array containing the original bytecode of {@code method}
@@ -301,7 +309,7 @@
* {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
* {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
*/
- public native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+ native int installCode(TargetDescription target, HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog);
public native int getMetadata(TargetDescription target, HotSpotCompiledCode compiledCode, HotSpotMetaData metaData);
@@ -317,18 +325,18 @@
* @param timeUnitsPerSecond the granularity of the units for the {@code time} value
* @param installedCode the nmethod installed as a result of the compilation
*/
- public synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethodImpl method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
+ synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethodImpl method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
InstalledCode installedCode);
/**
* Resets all compilation statistics.
*/
- public native void resetCompilationStatistics();
+ native void resetCompilationStatistics();
/**
* Initializes the fields of {@code config}.
*/
- native long initializeConfiguration();
+ native long initializeConfiguration(HotSpotVMConfig config);
/**
* Resolves the implementation of {@code method} for virtual dispatches on objects of dynamic
@@ -367,7 +375,7 @@
* @param address an address that may be called from any code in the code cache
* @return -1 if {@code address == 0}
*/
- public native long getMaxCallTargetOffset(long address);
+ native long getMaxCallTargetOffset(long address);
/**
* Gets a textual disassembly of {@code codeBlob}.
@@ -376,7 +384,7 @@
* {@code codeBlob} could not be disassembled for some reason
*/
// The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage
- public synchronized native String disassembleCodeBlob(long codeBlob);
+ synchronized native String disassembleCodeBlob(InstalledCode installedCode);
/**
* Gets a stack trace element for {@code method} at bytecode index {@code bci}.
@@ -454,12 +462,12 @@
* Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be
* raised the next time {@code installedCode} is executed.
*/
- public native void invalidateInstalledCode(InstalledCode installedCode);
+ native void invalidateInstalledCode(InstalledCode installedCode);
/**
* Collects the current values of all JVMCI benchmark counters, summed up over all threads.
*/
- public native long[] collectCounters();
+ native long[] collectCounters();
/**
* Determines if {@code metaspaceMethodData} is mature.
@@ -489,7 +497,7 @@
* @param methods the methods to look for, where {@code null} means that any frame is returned
* @return the frame, or {@code null} if the end of the stack was reached during the search
*/
- public native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, HotSpotResolvedJavaMethodImpl[] methods, int initialSkip);
+ native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, ResolvedJavaMethod[] methods, int initialSkip);
/**
* Materializes all virtual objects within {@code stackFrame} updates its locals.
@@ -512,30 +520,34 @@
/**
* Determines if debug info should also be emitted at non-safepoint locations.
*/
- public native boolean shouldDebugNonSafepoints();
+
+ native boolean shouldDebugNonSafepoints();
/**
* Writes {@code length} bytes from {@code bytes} starting at offset {@code offset} to the
* HotSpot's log stream.
*
- * @exception NullPointerException if <code>bytes</code> is <code>null</code>.
+ * @exception NullPointerException if {@code bytes == null}
* @exception IndexOutOfBoundsException if copying would cause access of data outside array
- * bounds.
+ * bounds
*/
- public native void writeDebugOutput(byte[] bytes, int offset, int length);
+ native void writeDebugOutput(byte[] bytes, int offset, int length);
/**
* Flush HotSpot's log stream.
*/
- public native void flushDebugOutput();
+ native void flushDebugOutput();
/**
- * Read a value representing a metaspace Method* and return the
- * {@link HotSpotResolvedJavaMethodImpl} wrapping it. This method does no checking that the
- * location actually contains a valid Method*. If the {@code base} object is a
+ * Read a HotSpot Method* value from the memory location described by {@code base} plus
+ * {@code displacement} and return the {@link HotSpotResolvedJavaMethodImpl} wrapping it. This
+ * method does no checking that the memory location actually contains a valid pointer and may
+ * crash the VM if an invalid location is provided. If the {@code base} is null then
+ * {@code displacement} is used by itself. If {@code base} is a
* {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or
* {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object
- * and used as the base. Otherwise the object itself is used as the base.
+ * and added to {@code displacement}. Any other non-null object type causes an
+ * {@link IllegalArgumentException} to be thrown.
*
* @param base an object to read from or null
* @param displacement
@@ -544,12 +556,14 @@
native HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(Object base, long displacement);
/**
- * Read a value representing a metaspace ConstantPool* and return the
- * {@link HotSpotConstantPool} wrapping it. This method does no checking that the location
- * actually contains a valid ConstantPool*. If the {@code base} object is a
- * {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or
- * {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object
- * and used as the base. Otherwise the object itself is used as the base.
+ * Read a HotSpot ConstantPool* value from the memory location described by {@code base} plus
+ * {@code displacement} and return the {@link HotSpotConstantPool} wrapping it. This method does
+ * no checking that the memory location actually contains a valid pointer and may crash the VM
+ * if an invalid location is provided. If the {@code base} is null then {@code displacement} is
+ * used by itself. If {@code base} is a {@link HotSpotResolvedJavaMethodImpl},
+ * {@link HotSpotConstantPool} or {@link HotSpotResolvedObjectTypeImpl} then the metaspace
+ * pointer is fetched from that object and added to {@code displacement}. Any other non-null
+ * object type causes an {@link IllegalArgumentException} to be thrown.
*
* @param base an object to read from or null
* @param displacement
@@ -558,12 +572,15 @@
native HotSpotConstantPool getConstantPool(Object base, long displacement);
/**
- * Read a value representing a metaspace Klass* and return the
- * {@link HotSpotResolvedObjectTypeImpl} wrapping it. The method does no checking that the
- * location actually contains a valid Klass*. If the {@code base} object is a
+ * Read a HotSpot Klass* value from the memory location described by {@code base} plus
+ * {@code displacement} and return the {@link HotSpotResolvedObjectTypeImpl} wrapping it. This
+ * method does no checking that the memory location actually contains a valid pointer and may
+ * crash the VM if an invalid location is provided. If the {@code base} is null then
+ * {@code displacement} is used by itself. If {@code base} is a
* {@link HotSpotResolvedJavaMethodImpl}, {@link HotSpotConstantPool} or
* {@link HotSpotResolvedObjectTypeImpl} then the metaspace pointer is fetched from that object
- * and used as the base. Otherwise the object itself is used as the base.
+ * and added to {@code displacement}. Any other non-null object type causes an
+ * {@link IllegalArgumentException} to be thrown.
*
* @param base an object to read from or null
* @param displacement
@@ -571,4 +588,17 @@
* @return null or the resolved method for this location
*/
native HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base, long displacement, boolean compressed);
+
+ /**
+ * Return the size of the HotSpot ProfileData* pointed at by {@code position}. If
+ * {@code position} is outside the space of the MethodData then an
+ * {@link IllegalArgumentException} is thrown. A {@code position} inside the MethodData but that
+ * isn't pointing at a valid ProfileData will crash the VM.
+ *
+ * @param metaspaceMethodData
+ * @param position
+ * @return the size of the ProfileData item pointed at by {@code position}
+ * @throws IllegalArgumentException if an out of range position is given
+ */
+ native int methodDataProfileDataSize(long metaspaceMethodData, int position);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,15 +22,30 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotCompressedNullConstant.*;
+import static jdk.vm.ci.hotspot.HotSpotCompressedNullConstant.COMPRESSED_NULL;
-import java.lang.reflect.*;
+import java.lang.reflect.Field;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.code.CompilationResult.*;
-import jdk.vm.ci.code.DataSection.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.BailoutException;
+import jdk.vm.ci.code.CodeCacheProvider;
+import jdk.vm.ci.code.CompilationRequest;
+import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.CompilationResult.Call;
+import jdk.vm.ci.code.CompilationResult.ConstantReference;
+import jdk.vm.ci.code.CompilationResult.DataPatch;
+import jdk.vm.ci.code.CompilationResult.Mark;
+import jdk.vm.ci.code.DataSection;
+import jdk.vm.ci.code.DataSection.Data;
+import jdk.vm.ci.code.DataSection.DataBuilder;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.code.RegisterConfig;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.SerializableConstant;
+import jdk.vm.ci.meta.SpeculationLog;
+import jdk.vm.ci.meta.VMConstant;
/**
* HotSpot implementation of {@link CodeCacheProvider}.
@@ -98,72 +113,64 @@
return runtime.getConfig().runtimeCallStackSize;
}
- public InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) {
- HotSpotJVMCIRuntime.runtime().notifyInstall(this, installedCode, compResult);
+ private InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) {
+ ((HotSpotJVMCIRuntime) runtime).notifyInstall(this, installedCode, compResult);
return installedCode;
}
- private InstalledCode installCode(CompilationResult compResult, HotSpotCompiledNmethod compiledCode, InstalledCode installedCode, SpeculationLog log) {
- int result = runtime.getCompilerToVM().installCode(target, compiledCode, installedCode, log);
- if (result != config.codeInstallResultOk) {
- String msg = compiledCode.getInstallationFailureMessage();
- String resultDesc = config.getCodeInstallResultDescription(result);
- if (msg != null) {
- msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
+ public InstalledCode installCode(CompilationRequest compRequest, CompilationResult compResult, InstalledCode installedCode, SpeculationLog log, boolean isDefault) {
+ HotSpotResolvedJavaMethod method = compRequest != null ? (HotSpotResolvedJavaMethod) compRequest.getMethod() : null;
+ InstalledCode resultInstalledCode;
+ if (installedCode == null) {
+ if (method == null) {
+ // Must be a stub
+ resultInstalledCode = new HotSpotRuntimeStub(compResult.getName());
} else {
- msg = String.format("Code installation failed: %s", resultDesc);
+ resultInstalledCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
}
- if (result == config.codeInstallResultDependenciesInvalid) {
- throw new AssertionError(resultDesc + " " + msg);
+ } else {
+ resultInstalledCode = installedCode;
+ }
+ HotSpotCompiledCode compiledCode;
+ if (method != null) {
+ final int id;
+ final long jvmciEnv;
+ if (compRequest instanceof HotSpotCompilationRequest) {
+ HotSpotCompilationRequest hsCompRequest = (HotSpotCompilationRequest) compRequest;
+ id = hsCompRequest.getId();
+ jvmciEnv = hsCompRequest.getJvmciEnv();
+ } else {
+ id = method.allocateCompileId(compRequest.getEntryBCI());
+ jvmciEnv = 0L;
}
- throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
+ compiledCode = new HotSpotCompiledNmethod(method, compResult, id, jvmciEnv);
+ } else {
+ compiledCode = new HotSpotCompiledCode(compResult);
}
- return logOrDump(installedCode, compResult);
- }
-
- public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long jvmciEnv, boolean isDefault) {
- if (compResult.getId() == -1) {
- compResult.setId(method.allocateCompileId(compResult.getEntryBCI()));
+ int result = runtime.getCompilerToVM().installCode(target, compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log);
+ if (result != config.codeInstallResultOk) {
+ String resultDesc = config.getCodeInstallResultDescription(result);
+ if (compiledCode instanceof HotSpotCompiledNmethod) {
+ HotSpotCompiledNmethod compiledNmethod = (HotSpotCompiledNmethod) compiledCode;
+ String msg = compiledNmethod.getInstallationFailureMessage();
+ if (msg != null) {
+ msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
+ } else {
+ msg = String.format("Code installation failed: %s", resultDesc);
+ }
+ if (result == config.codeInstallResultDependenciesInvalid) {
+ throw new AssertionError(resultDesc + " " + msg);
+ }
+ throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
+ } else {
+ throw new BailoutException("Error installing %s: %s", compResult.getName(), resultDesc);
+ }
}
- HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
- HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(method, compResult, jvmciEnv);
- return installCode(compResult, compiledCode, installedCode, method.getSpeculationLog());
+ return logOrDump(resultInstalledCode, compResult);
}
- @Override
- public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog log, InstalledCode predefinedInstalledCode) {
- HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
- if (compResult.getId() == -1) {
- compResult.setId(hotspotMethod.allocateCompileId(compResult.getEntryBCI()));
- }
- InstalledCode installedCode = predefinedInstalledCode;
- if (installedCode == null) {
- HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, compResult.getName(), false);
- installedCode = code;
- }
- HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(hotspotMethod, compResult);
- return installCode(compResult, compiledCode, installedCode, log);
- }
-
- @Override
- public InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) {
- HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
- return installMethod(hotspotMethod, compResult, 0L, true);
- }
-
- public HotSpotNmethod addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) {
- HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method;
- if (compResult.getId() == -1) {
- compResult.setId(javaMethod.allocateCompileId(compResult.getEntryBCI()));
- }
- HotSpotNmethod code = new HotSpotNmethod(javaMethod, compResult.getName(), false, true);
- HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, compResult);
- CompilerToVM vm = runtime.getCompilerToVM();
- int result = vm.installCode(target, compiled, code, null);
- if (result != runtime.getConfig().codeInstallResultOk) {
- return null;
- }
- return code;
+ public void invalidateInstalledCode(InstalledCode installedCode) {
+ runtime.getCompilerToVM().invalidateInstalledCode(installedCode);
}
public boolean needsDataPatch(JavaConstant constant) {
@@ -176,35 +183,29 @@
if (constant instanceof VMConstant) {
VMConstant vmConstant = (VMConstant) constant;
boolean compressed;
- long raw;
- if (constant instanceof HotSpotObjectConstant) {
- HotSpotObjectConstant c = (HotSpotObjectConstant) vmConstant;
+ if (constant instanceof HotSpotConstant) {
+ HotSpotConstant c = (HotSpotConstant) vmConstant;
compressed = c.isCompressed();
- raw = 0xDEADDEADDEADDEADL;
- } else if (constant instanceof HotSpotMetaspaceConstant) {
- HotSpotMetaspaceConstant meta = (HotSpotMetaspaceConstant) constant;
- compressed = meta.isCompressed();
- raw = meta.rawValue();
} else {
throw new JVMCIError(String.valueOf(constant));
}
- size = target.getSizeInBytes(compressed ? JavaKind.Int : target.wordKind);
+ size = compressed ? 4 : target.wordSize;
if (size == 4) {
builder = (buffer, patch) -> {
patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
- buffer.putInt((int) raw);
+ buffer.putInt(0xDEADDEAD);
};
} else {
assert size == 8;
builder = (buffer, patch) -> {
patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
- buffer.putLong(raw);
+ buffer.putLong(0xDEADDEADDEADDEADL);
};
}
} else if (JavaConstant.isNull(constant)) {
boolean compressed = COMPRESSED_NULL.equals(constant);
- size = target.getSizeInBytes(compressed ? JavaKind.Int : target.wordKind);
+ size = compressed ? 4 : target.wordSize;
builder = DataBuilder.zero(size);
} else if (constant instanceof SerializableConstant) {
SerializableConstant s = (SerializableConstant) constant;
@@ -250,8 +251,7 @@
public String disassemble(InstalledCode code) {
if (code.isValid()) {
- long codeBlob = code.getAddress();
- return runtime.getCompilerToVM().disassembleCodeBlob(codeBlob);
+ return runtime.getCompilerToVM().disassembleCodeBlob(code);
}
return null;
}
@@ -259,4 +259,35 @@
public SpeculationLog createSpeculationLog() {
return new HotSpotSpeculationLog();
}
+
+ public long getMaxCallTargetOffset(long address) {
+ return runtime.getCompilerToVM().getMaxCallTargetOffset(address);
+ }
+
+ public boolean shouldDebugNonSafepoints() {
+ return runtime.getCompilerToVM().shouldDebugNonSafepoints();
+ }
+
+ /**
+ * Notifies the VM of statistics for a completed compilation.
+ *
+ * @param id the identifier of the compilation
+ * @param method the method compiled
+ * @param osr specifies if the compilation was for on-stack-replacement
+ * @param processedBytecodes the number of bytecodes processed during the compilation, including
+ * the bytecodes of all inlined methods
+ * @param time the amount time spent compiling {@code method}
+ * @param timeUnitsPerSecond the granularity of the units for the {@code time} value
+ * @param installedCode the nmethod installed as a result of the compilation
+ */
+ public void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode) {
+ runtime.getCompilerToVM().notifyCompilationStatistics(id, (HotSpotResolvedJavaMethodImpl) method, osr, processedBytecodes, time, timeUnitsPerSecond, installedCode);
+ }
+
+ /**
+ * Resets all compilation statistics.
+ */
+ public void resetCompilationStatistics() {
+ runtime.getCompilerToVM().resetCompilationStatistics();
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompilationRequest.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2015, 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.code.CompilationRequest;
+
+/**
+ * A compilation request with extra HotSpot specific context such as a compilation identifier and
+ * the address of a {@code JVMCIEnv} object that provides native context for a compilation.
+ */
+public class HotSpotCompilationRequest extends CompilationRequest {
+ private final long jvmciEnv;
+ private final int id;
+
+ /**
+ * Creates a request to compile a method starting at a given BCI and allocates an identifier to
+ * the request.
+ *
+ * @param method the method to be compiled
+ * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the
+ * method's entry point
+ * @param jvmciEnv address of a native {@code JVMCIEnv} object or 0L
+ */
+ public HotSpotCompilationRequest(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv) {
+ this(method, entryBCI, jvmciEnv, method.allocateCompileId(entryBCI));
+ }
+
+ /**
+ * Creates a request to compile a method starting at a given BCI.
+ *
+ * @param method the method to be compiled
+ * @param entryBCI the bytecode index (BCI) at which to start compiling where -1 denotes the
+ * method's entry point
+ * @param jvmciEnv address of a native {@code JVMCIEnv} object or 0L
+ * @param id an identifier for the request
+ */
+ public HotSpotCompilationRequest(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
+ super(method, entryBCI);
+ this.jvmciEnv = jvmciEnv;
+ this.id = id;
+ }
+
+ @Override
+ public HotSpotResolvedJavaMethod getMethod() {
+ return (HotSpotResolvedJavaMethod) super.getMethod();
+ }
+
+ /**
+ * Gets the address of the native {@code JVMCIEnv} object or 0L if no such object exists.
+ */
+ public long getJvmciEnv() {
+ return jvmciEnv;
+ }
+
+ /**
+ * Gets the VM allocated identifier for this compilation.
+ */
+ public int getId() {
+ return id;
+ }
+
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,12 +22,16 @@
*/
package jdk.vm.ci.hotspot;
-import java.nio.*;
-import java.util.*;
-import java.util.stream.*;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Stream;
import java.util.stream.Stream.Builder;
-import jdk.vm.ci.code.*;
+import jdk.vm.ci.code.BytecodeFrame;
+import jdk.vm.ci.code.CompilationResult;
import jdk.vm.ci.code.CompilationResult.CodeAnnotation;
import jdk.vm.ci.code.CompilationResult.CodeComment;
import jdk.vm.ci.code.CompilationResult.DataPatch;
@@ -36,14 +40,15 @@
import jdk.vm.ci.code.CompilationResult.JumpTable;
import jdk.vm.ci.code.CompilationResult.Mark;
import jdk.vm.ci.code.CompilationResult.Site;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.DataSection;
import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
/**
* A {@link CompilationResult} with additional HotSpot-specific information required for installing
* the code in HotSpot's code cache.
*/
-public abstract class HotSpotCompiledCode {
+public class HotSpotCompiledCode {
public final String name;
public final Site[] sites;
@@ -113,9 +118,7 @@
targetCodeSize = compResult.getTargetCodeSize();
DataSection data = compResult.getDataSection();
- if (!data.isFinalized()) {
- data.finalizeLayout();
- }
+ data.finalizeLayout();
dataSection = new byte[data.getSectionSize()];
ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
@@ -176,4 +179,9 @@
Arrays.sort(result, new SiteComparator());
return result;
}
+
+ @Override
+ public String toString() {
+ return name;
+ }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,8 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.inittimer.*;
+import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.inittimer.SuppressFBWarnings;
/**
* {@link HotSpotCompiledCode} destined for installation as an nmethod.
@@ -32,8 +32,17 @@
public final HotSpotResolvedJavaMethod method;
public final int entryBCI;
+
+ /**
+ * Compilation identifier.
+ */
public final int id;
+
+ /**
+ * Address of a native {@code JVMCIEnv} object or 0L if no such object exists.
+ */
public final long jvmciEnv;
+
public final boolean hasUnsafeAccess;
/**
@@ -42,15 +51,11 @@
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage;
- public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult) {
- this(method, compResult, 0L);
- }
-
- public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long jvmciEnv) {
+ public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, int id, long jvmciEnv) {
super(compResult);
this.method = method;
this.entryBCI = compResult.getEntryBCI();
- this.id = compResult.getId();
+ this.id = id;
this.jvmciEnv = jvmciEnv;
this.hasUnsafeAccess = compResult.hasUnsafeAccess();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompressedNullConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,9 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
/**
* The compressed representation of the {@link JavaConstant#NULL_POINTER null constant}.
@@ -48,6 +50,14 @@
return true;
}
+ public Constant compress() {
+ throw new IllegalArgumentException();
+ }
+
+ public Constant uncompress() {
+ return NULL_POINTER;
+ }
+
@Override
public boolean isDefaultForKind() {
return true;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.Constant;
/**
* Marker interface for hotspot specific constants.
@@ -30,4 +30,8 @@
public interface HotSpotConstant extends Constant {
boolean isCompressed();
+
+ Constant compress();
+
+ Constant uncompress();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,18 +22,27 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.invoke.*;
+import java.lang.invoke.MethodHandle;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaField;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
/**
* Implementation of {@link ConstantPool} for HotSpot.
*/
-public final class HotSpotConstantPool implements ConstantPool, HotSpotProxified, MetaspaceWrapperObject {
+final class HotSpotConstantPool implements ConstantPool, HotSpotProxified, MetaspaceWrapperObject {
/**
* Subset of JVM bytecode opcodes used by {@link HotSpotConstantPool}.
@@ -121,10 +130,6 @@
this.tag = tag;
}
- private static HotSpotVMConfig config() {
- return runtime().getConfig();
- }
-
/**
* Maps JVM_CONSTANT tags to {@link JVM_CONSTANT} values. Using a separate class for lazy
* initialization.
@@ -204,7 +209,7 @@
* @return holder for this constant pool
*/
private HotSpotResolvedObjectType getHolder() {
- return runtime().getCompilerToVM().getResolvedJavaType(this, runtime().getConfig().constantPoolHolderOffset, false);
+ return compilerToVM().getResolvedJavaType(this, config().constantPoolHolderOffset, false);
}
/**
@@ -224,7 +229,7 @@
} else {
assert opcode == Bytecodes.GETFIELD || opcode == Bytecodes.PUTFIELD || opcode == Bytecodes.GETSTATIC || opcode == Bytecodes.PUTSTATIC || opcode == Bytecodes.INVOKEINTERFACE ||
opcode == Bytecodes.INVOKEVIRTUAL || opcode == Bytecodes.INVOKESPECIAL || opcode == Bytecodes.INVOKESTATIC : "unexpected invoke opcode " + opcode;
- index = rawIndex + runtime().getConfig().constantPoolCpCacheIndexTag;
+ index = rawIndex + config().constantPoolCpCacheIndexTag;
}
return index;
}
@@ -241,7 +246,7 @@
if (isInvokedynamicIndex(index)) {
return decodeInvokedynamicIndex(index);
} else {
- return index - runtime().getConfig().constantPoolCpCacheIndexTag;
+ return index - config().constantPoolCpCacheIndexTag;
}
}
@@ -260,7 +265,7 @@
return ~i;
}
- public long getMetaspaceConstantPool() {
+ long getMetaspaceConstantPool() {
return metaspaceConstantPool;
}
@@ -276,7 +281,7 @@
*/
private JVM_CONSTANT getTagAt(int index) {
assertBounds(index);
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final long metaspaceConstantPoolTags = UNSAFE.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset);
final int tag = UNSAFE.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index);
if (tag == 0) {
@@ -293,7 +298,7 @@
*/
private long getEntryAt(int index) {
assertBounds(index);
- return UNSAFE.getAddress(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getAddress(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -304,7 +309,7 @@
*/
private int getIntAt(int index) {
assertTag(index, JVM_CONSTANT.Integer);
- return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -315,7 +320,7 @@
*/
private long getLongAt(int index) {
assertTag(index, JVM_CONSTANT.Long);
- return UNSAFE.getLong(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getLong(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -326,7 +331,7 @@
*/
private float getFloatAt(int index) {
assertTag(index, JVM_CONSTANT.Float);
- return UNSAFE.getFloat(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getFloat(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -337,7 +342,7 @@
*/
private double getDoubleAt(int index) {
assertTag(index, JVM_CONSTANT.Double);
- return UNSAFE.getDouble(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getDouble(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -348,7 +353,7 @@
*/
private int getNameAndTypeAt(int index) {
assertTag(index, JVM_CONSTANT.NameAndType);
- return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
}
/**
@@ -359,7 +364,7 @@
* @return {@code JVM_CONSTANT_NameAndType} reference constant pool entry
*/
private int getNameAndTypeRefIndexAt(int index) {
- return runtime().getCompilerToVM().lookupNameAndTypeRefIndexInPool(this, index);
+ return compilerToVM().lookupNameAndTypeRefIndexInPool(this, index);
}
/**
@@ -370,7 +375,7 @@
* @return name as {@link String}
*/
private String getNameOf(int which) {
- return runtime().getCompilerToVM().lookupNameInPool(this, which);
+ return compilerToVM().lookupNameInPool(this, which);
}
/**
@@ -394,7 +399,7 @@
* @return signature as {@link String}
*/
private String getSignatureOf(int which) {
- return runtime().getCompilerToVM().lookupSignatureInPool(this, which);
+ return compilerToVM().lookupSignatureInPool(this, which);
}
/**
@@ -417,7 +422,7 @@
* @return klass reference index
*/
private int getKlassRefIndexAt(int index) {
- return runtime().getCompilerToVM().lookupKlassRefIndexInPool(this, index);
+ return compilerToVM().lookupKlassRefIndexInPool(this, index);
}
/**
@@ -427,22 +432,11 @@
* @param index constant pool index
* @return klass reference index
*/
- private int getUncachedKlassRefIndexAt(int index, JVM_CONSTANT tag) {
- int resultIndex;
- if (tag == JVM_CONSTANT.MethodRef || tag == JVM_CONSTANT.Fieldref || tag == JVM_CONSTANT.InterfaceMethodref) {
- assertTagIsFieldOrMethod(index);
- final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
- // klass ref index is in the low 16-bits.
- resultIndex = refIndex & 0xFFFF;
- } else {
- resultIndex = index;
- }
-
- // Read the tag only once because it could change between multiple reads.
- final JVM_CONSTANT klassTag = getTagAt(resultIndex);
- assert klassTag == JVM_CONSTANT.Class || klassTag == JVM_CONSTANT.UnresolvedClass || klassTag == JVM_CONSTANT.UnresolvedClassInError : klassTag;
-
- return resultIndex;
+ private int getUncachedKlassRefIndexAt(int index) {
+ assertTagIsFieldOrMethod(index);
+ final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+ // klass ref index is in the low 16-bits.
+ return refIndex & 0xFFFF;
}
/**
@@ -478,7 +472,7 @@
@Override
public int length() {
- return UNSAFE.getInt(getMetaspaceConstantPool() + runtime().getConfig().constantPoolLengthOffset);
+ return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolLengthOffset);
}
@Override
@@ -505,13 +499,13 @@
* "pseudo strings" (arbitrary live objects) patched into a String entry. Such
* entries do not have a symbol in the constant pool slot.
*/
- Object string = runtime().getCompilerToVM().resolvePossiblyCachedConstantInPool(this, cpi);
+ Object string = compilerToVM().resolvePossiblyCachedConstantInPool(this, cpi);
return HotSpotObjectConstantImpl.forObject(string);
case MethodHandle:
case MethodHandleInError:
case MethodType:
case MethodTypeInError:
- Object obj = runtime().getCompilerToVM().resolveConstantInPool(this, cpi);
+ Object obj = compilerToVM().resolveConstantInPool(this, cpi);
return HotSpotObjectConstantImpl.forObject(obj);
default:
throw new JVMCIError("Unknown constant pool tag %s", tag);
@@ -521,7 +515,7 @@
@Override
public String lookupUtf8(int cpi) {
assertTag(cpi, JVM_CONSTANT.Utf8);
- return runtime().getCompilerToVM().getSymbol(getEntryAt(cpi));
+ return compilerToVM().getSymbol(getEntryAt(cpi));
}
@Override
@@ -533,7 +527,7 @@
public JavaConstant lookupAppendix(int cpi, int opcode) {
assert Bytecodes.isInvoke(opcode);
final int index = rawIndexToConstantPoolIndex(cpi, opcode);
- Object appendix = runtime().getCompilerToVM().lookupAppendixInPool(this, index);
+ Object appendix = compilerToVM().lookupAppendixInPool(this, index);
if (appendix == null) {
return null;
} else {
@@ -558,7 +552,7 @@
@Override
public JavaMethod lookupMethod(int cpi, int opcode) {
final int index = rawIndexToConstantPoolIndex(cpi, opcode);
- final HotSpotResolvedJavaMethod method = runtime().getCompilerToVM().lookupMethodInPool(this, index, (byte) opcode);
+ final HotSpotResolvedJavaMethod method = compilerToVM().lookupMethodInPool(this, index, (byte) opcode);
if (method != null) {
return method;
} else {
@@ -570,7 +564,7 @@
return new HotSpotMethodUnresolved(name, signature, holder);
} else {
final int klassIndex = getKlassRefIndexAt(index);
- final Object type = runtime().getCompilerToVM().lookupKlassInPool(this, klassIndex);
+ final Object type = compilerToVM().lookupKlassInPool(this, klassIndex);
JavaType holder = getJavaType(type);
return new HotSpotMethodUnresolved(name, signature, holder);
}
@@ -583,7 +577,7 @@
if (elem != null && elem.lastCpi == cpi) {
return elem.javaType;
} else {
- final Object type = runtime().getCompilerToVM().lookupKlassInPool(this, cpi);
+ final Object type = compilerToVM().lookupKlassInPool(this, cpi);
JavaType result = getJavaType(type);
if (result instanceof ResolvedJavaType) {
this.lastLookupType = new LookupTypeCacheElement(cpi, result);
@@ -609,7 +603,7 @@
long[] info = new long[2];
HotSpotResolvedObjectTypeImpl resolvedHolder;
try {
- resolvedHolder = runtime().getCompilerToVM().resolveFieldInPool(this, index, (byte) opcode, info);
+ resolvedHolder = compilerToVM().resolveFieldInPool(this, index, (byte) opcode, info);
} catch (Throwable t) {
/*
* If there was an exception resolving the field we give up and return an unresolved
@@ -643,8 +637,8 @@
break;
case Bytecodes.INVOKEDYNAMIC: {
// invokedynamic instructions point to a constant pool cache entry.
- index = decodeConstantPoolCacheIndex(cpi) + runtime().getConfig().constantPoolCpCacheIndexTag;
- index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(this, index);
+ index = decodeConstantPoolCacheIndex(cpi) + config().constantPoolCpCacheIndexTag;
+ index = compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index);
break;
}
case Bytecodes.GETSTATIC:
@@ -657,7 +651,7 @@
case Bytecodes.INVOKEINTERFACE: {
// invoke and field instructions point to a constant pool cache entry.
index = rawIndexToConstantPoolIndex(cpi, opcode);
- index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(this, index);
+ index = compilerToVM().constantPoolRemapInstructionOperandFromCache(this, index);
break;
}
default:
@@ -673,11 +667,15 @@
case MethodRef:
case Fieldref:
case InterfaceMethodref:
+ index = getUncachedKlassRefIndexAt(index);
+ // Read the tag only once because it could change between multiple reads.
+ final JVM_CONSTANT klassTag = getTagAt(index);
+ assert klassTag == JVM_CONSTANT.Class || klassTag == JVM_CONSTANT.UnresolvedClass || klassTag == JVM_CONSTANT.UnresolvedClassInError : klassTag;
+ // fall through
case Class:
case UnresolvedClass:
case UnresolvedClassInError:
- index = getUncachedKlassRefIndexAt(index, tag);
- final HotSpotResolvedObjectTypeImpl type = runtime().getCompilerToVM().resolveTypeInPool(this, index);
+ final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index);
Class<?> klass = type.mirror();
if (!klass.isPrimitive() && !klass.isArray()) {
UNSAFE.ensureClassInitialized(klass);
@@ -687,14 +685,14 @@
if (Bytecodes.isInvokeHandleAlias(opcode)) {
final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode);
if (isInvokeHandle(methodRefCacheIndex, type)) {
- runtime().getCompilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
+ compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
}
}
}
break;
case InvokeDynamic:
if (isInvokedynamicIndex(cpi)) {
- runtime().getCompilerToVM().resolveInvokeDynamicInPool(this, cpi);
+ compilerToVM().resolveInvokeDynamicInPool(this, cpi);
}
break;
default:
@@ -704,7 +702,7 @@
}
private boolean isInvokeHandle(int methodRefCacheIndex, HotSpotResolvedObjectTypeImpl klass) {
- assertTag(runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef);
+ assertTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef);
return ResolvedJavaMethod.isSignaturePolymorphic(klass, getNameOf(methodRefCacheIndex), runtime().getHostJVMCIBackend().getMetaAccess());
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,12 +22,24 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider.Options.*;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
+
+import java.lang.reflect.Array;
-import java.lang.reflect.*;
-
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.options.*;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaField;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.MemoryAccessProvider;
+import jdk.vm.ci.meta.MethodHandleAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.options.Option;
+import jdk.vm.ci.options.OptionType;
+import jdk.vm.ci.options.OptionValue;
+import jdk.vm.ci.options.StableOptionValue;
/**
* HotSpot implementation of {@link ConstantReflectionProvider}.
@@ -61,11 +73,6 @@
}
@Override
- public boolean isEmbeddable(Constant constant) {
- return true;
- }
-
- @Override
public Boolean constantEquals(Constant x, Constant y) {
if (x == y) {
return true;
@@ -110,8 +117,8 @@
}
Class<?> componentType = ((HotSpotObjectConstantImpl) array).object().getClass().getComponentType();
JavaKind kind = runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(componentType).getJavaKind();
- int arraybase = runtime.getArrayBaseOffset(kind);
- int scale = runtime.getArrayIndexScale(kind);
+ int arraybase = getArrayBaseOffset(kind);
+ int scale = getArrayIndexScale(kind);
if (offset < arraybase) {
return -1;
}
@@ -207,6 +214,10 @@
return HotSpotObjectConstantImpl.forObject(value);
}
+ public JavaConstant forObject(Object value) {
+ return HotSpotObjectConstantImpl.forObject(value);
+ }
+
@Override
public ResolvedJavaType asJavaType(Constant constant) {
if (constant instanceof HotSpotObjectConstant) {
@@ -216,7 +227,7 @@
}
}
if (constant instanceof HotSpotMetaspaceConstant) {
- Object obj = HotSpotMetaspaceConstantImpl.getMetaspaceObject(constant);
+ MetaspaceWrapperObject obj = HotSpotMetaspaceConstantImpl.getMetaspaceObject(constant);
if (obj instanceof HotSpotResolvedObjectTypeImpl) {
return (ResolvedJavaType) obj;
}
@@ -251,7 +262,7 @@
* {@code value} was read
*/
protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) {
- return !value.isDefaultForKind() || TrustFinalDefaultFields.getValue();
+ return !value.isDefaultForKind() || Options.TrustFinalDefaultFields.getValue();
}
/**
@@ -327,7 +338,7 @@
if (!hotspotField.isStable()) {
return readNonStableFieldValue(field, receiver);
} else {
- return readStableFieldValue(field, receiver, false);
+ return readStableFieldValue(field, receiver, hotspotField.isDefaultStable());
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java Wed Nov 04 07:23:23 2015 -1000
@@ -23,7 +23,6 @@
package jdk.vm.ci.hotspot;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.inittimer.SuppressFBWarnings;
import sun.misc.Unsafe;
@@ -59,18 +58,6 @@
return size;
}
- /**
- * @return a copy of this code blob if it is {@linkplain #isValid() valid}, null otherwise.
- */
- public byte[] getBlob() {
- if (!isValid()) {
- return null;
- }
- byte[] blob = new byte[size];
- UNSAFE.copyMemory(null, getAddress(), blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size);
- return blob;
- }
-
@Override
public abstract String toString();
@@ -79,7 +66,6 @@
return codeStart;
}
- @Override
public long getCodeSize() {
return codeSize;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIBackendFactory.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIBackendFactory.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,12 +22,11 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.compiler.*;
-import jdk.vm.ci.runtime.*;
+import jdk.vm.ci.runtime.JVMCIBackend;
public interface HotSpotJVMCIBackendFactory {
- JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, CompilerFactory compilerFactory, JVMCIBackend host);
+ JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host);
/**
* Gets the CPU architecture of this backend.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -22,19 +22,18 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.compiler.*;
-import jdk.vm.ci.compiler.Compiler;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
-import jdk.vm.ci.service.*;
+import jdk.vm.ci.code.CompilationRequest;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
+import jdk.vm.ci.runtime.JVMCIRuntime;
+import jdk.vm.ci.service.Services;
final class HotSpotJVMCICompilerConfig {
- private static class DummyCompilerFactory implements CompilerFactory, Compiler {
+ private static class DummyCompilerFactory implements JVMCICompilerFactory, JVMCICompiler {
- public void compileMethod(ResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
+ public void compileMethod(CompilationRequest request) {
throw new JVMCIError("no JVMCI compiler selected");
}
@@ -42,16 +41,12 @@
return "<none>";
}
- public Architecture initializeArchitecture(Architecture arch) {
- return arch;
- }
-
- public Compiler createCompiler(JVMCIRuntime runtime) {
+ public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
return this;
}
}
- private static CompilerFactory compilerFactory;
+ private static JVMCICompilerFactory compilerFactory;
/**
* Selects the system compiler.
@@ -61,7 +56,7 @@
*/
static Boolean selectCompiler(String compilerName) {
assert compilerFactory == null;
- for (CompilerFactory factory : Services.load(CompilerFactory.class)) {
+ for (JVMCICompilerFactory factory : Services.load(JVMCICompilerFactory.class)) {
if (factory.getCompilerName().equals(compilerName)) {
compilerFactory = factory;
return Boolean.TRUE;
@@ -71,7 +66,7 @@
throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
}
- static CompilerFactory getCompilerFactory() {
+ static JVMCICompilerFactory getCompilerFactory() {
if (compilerFactory == null) {
compilerFactory = new DummyCompilerFactory();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,17 @@
*/
package jdk.vm.ci.hotspot;
-import java.lang.ref.*;
-import java.util.*;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.WeakHashMap;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JVMCIMetaAccessContext;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* This class manages the set of metadata roots that must be scanned during garbage collection.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,54 +22,55 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.inittimer.InitTimer.*;
+import static jdk.vm.ci.inittimer.InitTimer.timer;
-import java.util.*;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TreeMap;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.compiler.*;
-import jdk.vm.ci.compiler.Compiler;
-import jdk.vm.ci.inittimer.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
-import jdk.vm.ci.service.*;
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.inittimer.InitTimer;
+import jdk.vm.ci.meta.JVMCIMetaAccessContext;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCI;
+import jdk.vm.ci.runtime.JVMCIBackend;
+import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.service.Services;
//JaCoCo Exclude
+/**
+ * HotSpot implementation of a JVMCI runtime.
+ *
+ * The initialization of this class is very fragile since it's initialized both through
+ * {@link JVMCI#initialize()} or through calling {@link HotSpotJVMCIRuntime#runtime()} and
+ * {@link HotSpotJVMCIRuntime#runtime()} is also called by {@link JVMCI#initialize()}. So this class
+ * can't have a static initializer and any required initialization must be done as part of
+ * {@link #runtime()}. This allows the initialization to funnel back through
+ * {@link JVMCI#initialize()} without deadlocking.
+ */
public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, HotSpotProxified {
- /**
- * The proper initialization of this class is complex because it's tangled up with the
- * initialization of the JVMCI and really should only ever be triggered through
- * {@link JVMCI#getRuntime}. However since {@link #runtime} can also be called directly it
- * should also trigger proper initialization. To ensure proper ordering, the static initializer
- * of this class initializes {@link JVMCI} and then access to {@link DelayedInit#instance}
- * triggers the final initialization of the {@link HotSpotJVMCIRuntime}.
- */
- static {
- JVMCI.initialize();
- }
-
@SuppressWarnings("try")
static class DelayedInit {
private static final HotSpotJVMCIRuntime instance;
static {
- try (InitTimer t0 = timer("HotSpotJVMCIRuntime.<clinit>")) {
- try (InitTimer t = timer("StartupEventListener.beforeJVMCIStartup")) {
- for (StartupEventListener l : Services.load(StartupEventListener.class)) {
- l.beforeJVMCIStartup();
- }
- }
-
- try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) {
- instance = new HotSpotJVMCIRuntime();
- }
-
- try (InitTimer t = timer("HotSpotJVMCIRuntime.completeInitialization")) {
- instance.completeInitialization();
- }
+ try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) {
+ instance = new HotSpotJVMCIRuntime();
}
}
}
@@ -78,20 +79,10 @@
* Gets the singleton {@link HotSpotJVMCIRuntime} object.
*/
public static HotSpotJVMCIRuntime runtime() {
- assert DelayedInit.instance != null;
+ JVMCI.initialize();
return DelayedInit.instance;
}
- /**
- * Do deferred initialization.
- */
- public void completeInitialization() {
- compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this);
- for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
- vmEventListener.completeInitialization(this);
- }
- }
-
public static HotSpotJVMCIBackendFactory findFactory(String architecture) {
for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) {
if (factory.getArchitecture().equalsIgnoreCase(architecture)) {
@@ -106,7 +97,7 @@
* Gets the kind of a word value on the {@linkplain #getHostJVMCIBackend() host} backend.
*/
public static JavaKind getHostWordKind() {
- return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordKind;
+ return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordJavaKind;
}
protected final CompilerToVM compilerToVm;
@@ -114,16 +105,19 @@
protected final HotSpotVMConfig config;
private final JVMCIBackend hostBackend;
- private Compiler compiler;
+ private volatile JVMCICompiler compiler;
protected final JVMCIMetaAccessContext metaAccessContext;
private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
private final Iterable<HotSpotVMEventListener> vmEventListeners;
+ @SuppressWarnings("unused") private final String[] trivialPrefixes;
+
@SuppressWarnings("try")
private HotSpotJVMCIRuntime() {
compilerToVm = new CompilerToVM();
+
try (InitTimer t = timer("HotSpotVMConfig<init>")) {
config = new HotSpotVMConfig(compilerToVm);
}
@@ -135,10 +129,8 @@
factory = findFactory(hostArchitecture);
}
- CompilerFactory compilerFactory = HotSpotJVMCICompilerConfig.getCompilerFactory();
-
try (InitTimer t = timer("create JVMCI backend:", hostArchitecture)) {
- hostBackend = registerBackend(factory.createJVMCIBackend(this, compilerFactory, null));
+ hostBackend = registerBackend(factory.createJVMCIBackend(this, null));
}
vmEventListeners = Services.load(HotSpotVMEventListener.class);
@@ -154,6 +146,12 @@
context = new HotSpotJVMCIMetaAccessContext();
}
metaAccessContext = context;
+
+ if (Boolean.valueOf(System.getProperty("jvmci.printconfig"))) {
+ printConfig(config, compilerToVm);
+ }
+
+ trivialPrefixes = HotSpotJVMCICompilerConfig.getCompilerFactory().getTrivialPrefixes();
}
private JVMCIBackend registerBackend(JVMCIBackend backend) {
@@ -179,7 +177,14 @@
return metaAccessContext;
}
- public Compiler getCompiler() {
+ public JVMCICompiler getCompiler() {
+ if (compiler == null) {
+ synchronized (this) {
+ if (compiler == null) {
+ compiler = HotSpotJVMCICompilerConfig.getCompilerFactory().createCompiler(this);
+ }
+ }
+ }
return compiler;
}
@@ -211,7 +216,7 @@
return backends.get(arch);
}
- public Map<Class<? extends Architecture>, JVMCIBackend> getBackends() {
+ public Map<Class<? extends Architecture>, JVMCIBackend> getJVMCIBackends() {
return Collections.unmodifiableMap(backends);
}
@@ -220,7 +225,7 @@
*/
@SuppressWarnings({"unused"})
private void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
- compiler.compileMethod(method, entryBCI, jvmciEnv, id);
+ getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id));
}
/**
@@ -247,4 +252,105 @@
vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compResult);
}
}
+
+ private static void printConfig(HotSpotVMConfig config, CompilerToVM vm) {
+ Field[] fields = config.getClass().getDeclaredFields();
+ Map<String, Field> sortedFields = new TreeMap<>();
+ for (Field f : fields) {
+ if (!f.isSynthetic() && !Modifier.isStatic(f.getModifiers())) {
+ f.setAccessible(true);
+ sortedFields.put(f.getName(), f);
+ }
+ }
+ for (Field f : sortedFields.values()) {
+ try {
+ String line = String.format("%9s %-40s = %s%n", f.getType().getSimpleName(), f.getName(), pretty(f.get(config)));
+ byte[] lineBytes = line.getBytes();
+ vm.writeDebugOutput(lineBytes, 0, lineBytes.length);
+ vm.flushDebugOutput();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ private static String pretty(Object value) {
+ if (value == null) {
+ return "null";
+ }
+
+ Class<?> klass = value.getClass();
+ if (value instanceof String) {
+ return "\"" + value + "\"";
+ } else if (value instanceof Method) {
+ return "method \"" + ((Method) value).getName() + "\"";
+ } else if (value instanceof Class<?>) {
+ return "class \"" + ((Class<?>) value).getSimpleName() + "\"";
+ } else if (value instanceof Integer) {
+ if ((Integer) value < 10) {
+ return value.toString();
+ }
+ return value + " (0x" + Integer.toHexString((Integer) value) + ")";
+ } else if (value instanceof Long) {
+ if ((Long) value < 10 && (Long) value > -10) {
+ return value + "l";
+ }
+ return value + "l (0x" + Long.toHexString((Long) value) + "l)";
+ } else if (klass.isArray()) {
+ StringBuilder str = new StringBuilder();
+ int dimensions = 0;
+ while (klass.isArray()) {
+ dimensions++;
+ klass = klass.getComponentType();
+ }
+ int length = Array.getLength(value);
+ str.append(klass.getSimpleName()).append('[').append(length).append(']');
+ for (int i = 1; i < dimensions; i++) {
+ str.append("[]");
+ }
+ str.append(" {");
+ for (int i = 0; i < length; i++) {
+ str.append(pretty(Array.get(value, i)));
+ if (i < length - 1) {
+ str.append(", ");
+ }
+ }
+ str.append('}');
+ return str.toString();
+ }
+ return value.toString();
+ }
+
+ public OutputStream getLogStream() {
+ return new OutputStream() {
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ if (b == null) {
+ throw new NullPointerException();
+ } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) {
+ throw new IndexOutOfBoundsException();
+ } else if (len == 0) {
+ return;
+ }
+ compilerToVm.writeDebugOutput(b, off, len);
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ write(new byte[]{(byte) b}, 0, 1);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ compilerToVm.flushDebugOutput();
+ }
+ };
+ }
+
+ /**
+ * Collects the current values of all JVMCI benchmark counters, summed up over all threads.
+ */
+ public long[] collectCounters() {
+ return compilerToVm.collectCounters();
+ }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,11 +22,15 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.compiler.Compiler;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
-import sun.misc.*;
+import java.io.OutputStream;
+
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.JVMCIMetaAccessContext;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCIRuntime;
+import sun.misc.Unsafe;
//JaCoCo Exclude
@@ -39,7 +43,10 @@
CompilerToVM getCompilerToVM();
- Compiler getCompiler();
+ /**
+ * Gets an output stream that writes to the HotSpot's {@code tty} stream.
+ */
+ OutputStream getLogStream();
/**
* Converts a name to a Java type. This method attempts to resolve {@code name} to a
@@ -70,7 +77,7 @@
*
* @return the offset in bytes
*/
- default int getArrayBaseOffset(JavaKind kind) {
+ static int getArrayBaseOffset(JavaKind kind) {
switch (kind) {
case Boolean:
return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
@@ -100,7 +107,7 @@
*
* @return the scale in order to convert the index into a byte offset
*/
- default int getArrayIndexScale(JavaKind kind) {
+ static int getArrayIndexScale(JavaKind kind) {
switch (kind) {
case Boolean:
return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaType;
/**
* Common base class for all HotSpot {@link JavaType} implementations.
@@ -39,5 +39,4 @@
public final String getName() {
return name;
}
-
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,10 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.hotspot.HotSpotVMConfig.*;
-import jdk.vm.ci.meta.*;
+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;
/**
* HotSpot specific extension of {@link MemoryAccessProvider}.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -23,8 +23,6 @@
package jdk.vm.ci.hotspot;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-
-import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.hotspot.HotSpotVMConfig.CompressEncoding;
import jdk.vm.ci.meta.Constant;
@@ -36,7 +34,7 @@
/**
* HotSpot implementation of {@link MemoryAccessProvider}.
*/
-public class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified {
+class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified {
protected final HotSpotJVMCIRuntimeProvider runtime;
@@ -54,7 +52,7 @@
private boolean isValidObjectFieldDisplacement(Constant base, long displacement) {
if (base instanceof HotSpotMetaspaceConstant) {
- Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
+ MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
if (displacement == runtime.getConfig().classMirrorOffset) {
// Klass::_java_mirror is valid for all Klass* values
@@ -68,8 +66,9 @@
}
private static long asRawPointer(Constant base) {
- if (base instanceof HotSpotMetaspaceConstant) {
- return ((HotSpotMetaspaceConstant) base).rawValue();
+ if (base instanceof HotSpotMetaspaceConstantImpl) {
+ MetaspaceWrapperObject meta = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
+ return meta.getMetaspacePointer();
} else if (base instanceof PrimitiveConstant) {
PrimitiveConstant prim = (PrimitiveConstant) base;
if (prim.getJavaKind().isNumericInteger()) {
@@ -119,7 +118,7 @@
}
}
if (base instanceof HotSpotMetaspaceConstant) {
- Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
+ MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
if (displacement == runtime.getConfig().classMirrorOffset) {
assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror();
@@ -211,8 +210,7 @@
if (klass == null) {
return JavaConstant.NULL_POINTER;
}
- TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget();
- return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, klass.getMetaspaceKlass(), klass, false);
+ return HotSpotMetaspaceConstantImpl.forMetaspaceObject(klass, false);
}
@Override
@@ -221,15 +219,14 @@
if (klass == null) {
return HotSpotCompressedNullConstant.COMPRESSED_NULL;
}
- return HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Int, encoding.compress(klass.getMetaspaceKlass()), klass, true);
+ return HotSpotMetaspaceConstantImpl.forMetaspaceObject(klass, true);
}
@Override
public Constant readMethodPointerConstant(Constant base, long displacement) {
- TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget();
assert (base instanceof HotSpotObjectConstantImpl);
Object baseObject = ((HotSpotObjectConstantImpl) base).object();
HotSpotResolvedJavaMethodImpl method = runtime.getCompilerToVM().getResolvedJavaMethod(baseObject, displacement);
- return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, method.getMetaspaceMethod(), method, false);
+ return HotSpotMetaspaceConstantImpl.forMetaspaceObject(method, false);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,14 +22,31 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
+import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.reflect.*;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CodeUtil;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.DeoptimizationAction;
+import jdk.vm.ci.meta.DeoptimizationReason;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
// JaCoCo Exclude
@@ -292,9 +309,9 @@
int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object());
ResolvedJavaType elementType = lookupJavaType.getComponentType();
JavaKind elementKind = elementType.getJavaKind();
- final int headerSize = runtime.getArrayBaseOffset(elementKind);
+ final int headerSize = getArrayBaseOffset(elementKind);
TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
- int sizeOfElement = target.getSizeInBytes(elementKind);
+ int sizeOfElement = getArrayIndexScale(elementKind);
int alignment = target.wordSize;
int log2ElementSize = CodeUtil.log2(sizeOfElement);
return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaData.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaData.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,6 +22,8 @@
*/
package jdk.vm.ci.hotspot;
+import jdk.vm.ci.inittimer.SuppressFBWarnings;
+
public class HotSpotMetaData {
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private byte[] pcDescBytes;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private byte[] scopesDescBytes;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaspaceConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaspaceConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,18 +22,11 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.hotspot.HotSpotVMConfig.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.VMConstant;
public interface HotSpotMetaspaceConstant extends HotSpotConstant, VMConstant {
- Constant compress(CompressEncoding encoding);
-
- Constant uncompress(CompressEncoding encoding);
-
HotSpotResolvedObjectType asResolvedJavaType();
HotSpotResolvedJavaMethod asResolvedJavaMethod();
-
- long rawValue();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMetaspaceConstantImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,59 +22,75 @@
*/
package jdk.vm.ci.hotspot;
-import java.util.*;
+import java.util.Objects;
-import jdk.vm.ci.hotspot.HotSpotVMConfig.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.VMConstant;
-public final class HotSpotMetaspaceConstantImpl extends PrimitiveConstant implements HotSpotMetaspaceConstant, VMConstant, HotSpotProxified {
+final class HotSpotMetaspaceConstantImpl implements HotSpotMetaspaceConstant, VMConstant, HotSpotProxified {
- static HotSpotMetaspaceConstantImpl forMetaspaceObject(JavaKind kind, long primitive, Object metaspaceObject, boolean compressed) {
- return new HotSpotMetaspaceConstantImpl(kind, primitive, metaspaceObject, compressed);
+ static HotSpotMetaspaceConstantImpl forMetaspaceObject(MetaspaceWrapperObject metaspaceObject, boolean compressed) {
+ return new HotSpotMetaspaceConstantImpl(metaspaceObject, compressed);
}
- static Object getMetaspaceObject(Constant constant) {
+ static MetaspaceWrapperObject getMetaspaceObject(Constant constant) {
return ((HotSpotMetaspaceConstantImpl) constant).metaspaceObject;
}
- private final Object metaspaceObject;
+ private final MetaspaceWrapperObject metaspaceObject;
private final boolean compressed;
- private HotSpotMetaspaceConstantImpl(JavaKind kind, long primitive, Object metaspaceObject, boolean compressed) {
- super(kind, primitive);
+ private HotSpotMetaspaceConstantImpl(MetaspaceWrapperObject metaspaceObject, boolean compressed) {
this.metaspaceObject = metaspaceObject;
this.compressed = compressed;
}
@Override
public int hashCode() {
- return super.hashCode() ^ System.identityHashCode(metaspaceObject);
+ return System.identityHashCode(metaspaceObject) ^ (compressed ? 1 : 2);
}
@Override
public boolean equals(Object o) {
- return o == this || (o instanceof HotSpotMetaspaceConstantImpl && super.equals(o) && Objects.equals(metaspaceObject, ((HotSpotMetaspaceConstantImpl) o).metaspaceObject));
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof HotSpotMetaspaceConstantImpl)) {
+ return false;
+ }
+
+ HotSpotMetaspaceConstantImpl other = (HotSpotMetaspaceConstantImpl) o;
+ return Objects.equals(this.metaspaceObject, other.metaspaceObject) && this.compressed == other.compressed;
+ }
+
+ @Override
+ public String toValueString() {
+ return String.format("meta{%s%s}", metaspaceObject, compressed ? ";compressed" : "");
}
@Override
public String toString() {
- return super.toString() + "{" + metaspaceObject + (compressed ? ";compressed}" : "}");
+ return toValueString();
+ }
+
+ public boolean isDefaultForKind() {
+ return false;
}
public boolean isCompressed() {
return compressed;
}
- public JavaConstant compress(CompressEncoding encoding) {
+ public Constant compress() {
assert !isCompressed();
- HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Int, encoding.compress(asLong()), metaspaceObject, true);
+ HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(metaspaceObject, true);
assert res.isCompressed();
return res;
}
- public JavaConstant uncompress(CompressEncoding encoding) {
+ public Constant uncompress() {
assert isCompressed();
- HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Long, encoding.uncompress(asInt()), metaspaceObject, false);
+ HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(metaspaceObject, false);
assert !res.isCompressed();
return res;
}
@@ -92,8 +108,4 @@
}
return null;
}
-
- public long rawValue() {
- return asLong();
- }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -22,12 +22,17 @@
*/
package jdk.vm.ci.hotspot;
-import static java.util.FormattableFlags.*;
-import java.util.*;
+import static java.util.FormattableFlags.ALTERNATE;
+import static java.util.FormattableFlags.LEFT_JUSTIFY;
+import static java.util.FormattableFlags.UPPERCASE;
-import jdk.vm.ci.meta.*;
+import java.util.Formattable;
+import java.util.Formatter;
-public abstract class HotSpotMethod implements JavaMethod, Formattable /* , JavaMethodContex */{
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+abstract class HotSpotMethod implements JavaMethod, Formattable /* , JavaMethodContex */{
public static String applyFormattingFlagsAndWidth(String s, int flags, int width) {
if (flags == 0 && width < 0) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,24 +22,31 @@
*/
package jdk.vm.ci.hotspot;
-import static java.lang.String.*;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
+import static java.lang.String.format;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.util.*;
+import java.util.Arrays;
-import jdk.vm.ci.hotspot.HotSpotMethodDataAccessor.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.meta.JavaMethodProfile.*;
-import jdk.vm.ci.meta.JavaTypeProfile.*;
-import sun.misc.*;
+import jdk.vm.ci.hotspot.HotSpotMethodDataAccessor.Tag;
+import jdk.vm.ci.meta.DeoptimizationReason;
+import jdk.vm.ci.meta.JavaMethodProfile;
+import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod;
+import jdk.vm.ci.meta.JavaTypeProfile;
+import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.TriState;
+import sun.misc.Unsafe;
/**
* Access to a HotSpot MethodData structure (defined in methodData.hpp).
*/
public final class HotSpotMethodData {
- private static final HotSpotVMConfig config = runtime().getConfig();
+ private static final HotSpotVMConfig config = config();
private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE);
private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN);
@@ -50,16 +57,16 @@
new BitData(),
new CounterData(),
new JumpData(),
- new TypeCheckData(),
+ new ReceiverTypeData(),
new VirtualCallData(),
new RetData(),
new BranchData(),
new MultiBranchData(),
new ArgInfoData(),
- null, // call_type_data_tag
- null, // virtual_call_type_data_tag
- null, // parameters_type_data_tag
- null, // speculative_trap_data_tag
+ new UnknownProfileData(Tag.CallTypeData),
+ new VirtualCallTypeData(),
+ new UnknownProfileData(Tag.ParametersTypeData),
+ new UnknownProfileData(Tag.SpeculativeTrapData),
};
// @formatter:on
@@ -127,7 +134,8 @@
}
HotSpotMethodDataAccessor result = getData(position);
- assert result != null : "NO_DATA tag is not allowed";
+ final Tag tag = AbstractMethodData.readTag(this, position);
+ assert result != null : "NO_DATA tag is not allowed " + tag;
return result;
}
@@ -193,12 +201,12 @@
private HotSpotResolvedJavaMethod readMethod(int position, int offsetInBytes) {
long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
- return runtime().compilerToVm.getResolvedJavaMethod(null, metaspaceMethodData + fullOffsetInBytes);
+ return compilerToVM().getResolvedJavaMethod(null, metaspaceMethodData + fullOffsetInBytes);
}
private HotSpotResolvedObjectTypeImpl readKlass(int position, int offsetInBytes) {
long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
- return runtime().compilerToVm.getResolvedJavaType(null, metaspaceMethodData + fullOffsetInBytes, false);
+ return compilerToVM().getResolvedJavaType(null, metaspaceMethodData + fullOffsetInBytes, false);
}
private static int truncateLongToInt(long value) {
@@ -266,10 +274,10 @@
/**
* Corresponds to {@code exception_seen_flag}.
*/
- private static final int EXCEPTIONS_MASK = 0x2;
+ private static final int EXCEPTIONS_MASK = 1 << config.bitDataExceptionSeenFlag;
private final Tag tag;
- private final int staticSize;
+ protected final int staticSize;
protected AbstractMethodData(Tag tag, int staticSize) {
this.tag = tag;
@@ -291,8 +299,12 @@
}
@Override
- public int getSize(HotSpotMethodData data, int position) {
- return staticSize + getDynamicSize(data, position);
+ public final int getSize(HotSpotMethodData data, int position) {
+ int size = staticSize + getDynamicSize(data, position);
+ // Sanity check against VM
+ int vmSize = HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
+ assert size == vmSize : size + " != " + vmSize;
+ return size;
}
@Override
@@ -375,7 +387,7 @@
private static class BitData extends AbstractMethodData {
private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
- private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01;
+ private static final int BIT_DATA_NULL_SEEN_FLAG = 1 << config.bitDataNullSeenFlag;
private BitData() {
super(Tag.BitData, BIT_DATA_SIZE);
@@ -399,7 +411,7 @@
private static class CounterData extends BitData {
private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
- private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0);
+ private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset);
public CounterData() {
super(Tag.CounterData, COUNTER_DATA_SIZE);
@@ -427,8 +439,8 @@
private static class JumpData extends AbstractMethodData {
private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
- protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0);
- protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1);
+ protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset);
+ protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset);
public JumpData() {
super(Tag.JumpData, JUMP_DATA_SIZE);
@@ -474,11 +486,11 @@
private abstract static class AbstractTypeData extends CounterData {
- protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(2);
+ protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(config.receiverTypeDataReceiverTypeRowCellCount);
- protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(1);
- protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(2);
- protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(3);
+ protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataNonprofiledCountOffset);
+ protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(config.receiverTypeDataReceiver0Offset);
+ protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(config.receiverTypeDataCount0Offset);
protected AbstractTypeData(Tag tag, int staticSize) {
super(tag, staticSize);
@@ -571,14 +583,18 @@
}
}
- private static class TypeCheckData extends AbstractTypeData {
+ private static class ReceiverTypeData extends AbstractTypeData {
private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
- public TypeCheckData() {
+ public ReceiverTypeData() {
super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
}
+ protected ReceiverTypeData(Tag tag, int staticSize) {
+ super(tag, staticSize);
+ }
+
@Override
public int getExecutionCount(HotSpotMethodData data, int position) {
return -1;
@@ -590,7 +606,7 @@
}
}
- private static class VirtualCallData extends AbstractTypeData {
+ private static class VirtualCallData extends ReceiverTypeData {
private static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
@@ -600,6 +616,10 @@
super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
}
+ protected VirtualCallData(Tag tag, int staticSize) {
+ super(tag, staticSize);
+ }
+
@Override
public int getExecutionCount(HotSpotMethodData data, int position) {
final int typeProfileWidth = config.typeProfileWidth;
@@ -692,6 +712,19 @@
}
}
+ private static class VirtualCallTypeData extends VirtualCallData {
+
+ public VirtualCallTypeData() {
+ super(Tag.VirtualCallTypeData, 0);
+ }
+
+ @Override
+ protected int getDynamicSize(HotSpotMethodData data, int position) {
+ assert staticSize == 0;
+ return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
+ }
+ }
+
private static class RetData extends CounterData {
private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
@@ -705,7 +738,7 @@
private static class BranchData extends JumpData {
private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
- private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2);
+ private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset);
public BranchData() {
super(Tag.BranchData, BRANCH_DATA_SIZE);
@@ -737,8 +770,8 @@
private static class ArrayData extends AbstractMethodData {
- private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0);
- protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1);
+ private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset);
+ protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset);
public ArrayData(Tag tag, int staticSize) {
super(tag, staticSize);
@@ -762,7 +795,7 @@
private static class MultiBranchData extends ArrayData {
private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
- private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2;
+ private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = config.multiBranchDataPerCaseCellCount;
private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
@@ -854,6 +887,24 @@
}
}
+ private static class UnknownProfileData extends AbstractMethodData {
+ public UnknownProfileData(Tag tag) {
+ super(tag, 0);
+ }
+
+ @Override
+ protected int getDynamicSize(HotSpotMethodData data, int position) {
+ assert staticSize == 0;
+ return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
+ }
+
+ @Override
+ public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
public void setCompiledIRSize(int size) {
UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,11 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
-
-import jdk.vm.ci.meta.*;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
+import jdk.vm.ci.meta.JavaMethodProfile;
+import jdk.vm.ci.meta.JavaTypeProfile;
+import jdk.vm.ci.meta.ProfilingInfo;
+import jdk.vm.ci.meta.TriState;
/**
* Interface for accessor objects that encapsulate the logic for accessing the different kinds of
@@ -62,10 +64,6 @@
return value;
}
- private static HotSpotVMConfig config() {
- return runtime().getConfig();
- }
-
public static Tag getEnum(int value) {
Tag result = values()[value];
assert value == result.value;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,11 +22,16 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
-import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.*;
-
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.MethodHandleAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider, HotSpotProxified {
@@ -155,6 +160,6 @@
Object object = ((HotSpotObjectConstantImpl) memberName).object();
/* Read the ResolvedJavaMethod from the injected field MemberName.vmtarget */
- return runtime().compilerToVm.getResolvedJavaMethod(object, LazyInitialization.memberNameVmtargetField.offset());
+ return compilerToVM().getResolvedJavaMethod(object, LazyInitialization.memberNameVmtargetField.offset());
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodUnresolved.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodUnresolved.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,12 +22,14 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.Signature;
/**
* Implementation of {@link JavaMethod} for unresolved HotSpot methods.
*/
-public final class HotSpotMethodUnresolved extends HotSpotMethod {
+final class HotSpotMethodUnresolved extends HotSpotMethod {
private final Signature signature;
protected JavaType holder;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotNmethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,12 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
-
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.meta.*;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.code.InvalidInstalledCodeException;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
/**
* Implementation of {@link InstalledCode} for code installed as an nmethod. The nmethod stores a
@@ -45,34 +47,24 @@
private final HotSpotResolvedJavaMethod method;
private final boolean isDefault;
- private final boolean isExternal;
public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault) {
- this(method, name, isDefault, false);
- }
-
- public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault, boolean isExternal) {
super(name);
this.method = method;
this.isDefault = isDefault;
- this.isExternal = isExternal;
}
public boolean isDefault() {
return isDefault;
}
- public boolean isExternal() {
- return isExternal;
- }
-
public ResolvedJavaMethod getMethod() {
return method;
}
@Override
public void invalidate() {
- runtime().getCompilerToVM().invalidateInstalledCode(this);
+ compilerToVM().invalidateInstalledCode(this);
}
@Override
@@ -105,8 +97,7 @@
@Override
public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
assert checkArgs(args);
- assert !isExternal();
- return runtime().getCompilerToVM().executeInstalledCode(args, this);
+ return compilerToVM().executeInstalledCode(args, this);
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,13 @@
*/
package jdk.vm.ci.hotspot;
-import java.lang.invoke.*;
-import java.util.*;
+import java.lang.invoke.CallSite;
+import java.util.Objects;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.Assumptions;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.VMConstant;
/**
* Represents a constant non-{@code null} object reference, within the compiler and across the
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,20 +22,26 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.ConstantCallSite;
+import java.lang.invoke.MethodHandle;
-import java.lang.invoke.*;
-
-import jdk.vm.ci.inittimer.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.inittimer.SuppressFBWarnings;
+import jdk.vm.ci.meta.Assumptions;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* Represents a constant non-{@code null} object reference, within the compiler and across the
* compiler/runtime interface.
*/
-public final class HotSpotObjectConstantImpl implements HotSpotObjectConstant, HotSpotProxified {
+final class HotSpotObjectConstantImpl implements HotSpotObjectConstant, HotSpotProxified {
- public static JavaConstant forObject(Object object) {
+ static JavaConstant forObject(Object object) {
return forObject(object, false);
}
@@ -106,21 +112,6 @@
return object;
}
- /**
- * Determines if the object represented by this constant is {@link Object#equals(Object) equal}
- * to a given object.
- */
- public boolean isEqualTo(Object obj) {
- return object.equals(obj);
- }
-
- /**
- * Gets the class of the object represented by this constant.
- */
- public Class<?> getObjectClass() {
- return object.getClass();
- }
-
public boolean isCompressed() {
return compressed;
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotOopMap.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotOopMap.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,6 +22,8 @@
*/
package jdk.vm.ci.hotspot;
+import jdk.vm.ci.inittimer.SuppressFBWarnings;
+
public class HotSpotOopMap {
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int offset;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int count;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,11 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.DeoptimizationReason;
+import jdk.vm.ci.meta.JavaMethodProfile;
+import jdk.vm.ci.meta.JavaTypeProfile;
+import jdk.vm.ci.meta.ProfilingInfo;
+import jdk.vm.ci.meta.TriState;
public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,10 @@
*/
package jdk.vm.ci.hotspot;
-import java.util.*;
+import java.util.Arrays;
-import jdk.vm.ci.code.*;
+import jdk.vm.ci.code.Location;
+import jdk.vm.ci.code.ReferenceMap;
public final class HotSpotReferenceMap extends ReferenceMap {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaField.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaField;
/**
* Represents a field in a HotSpot type.
@@ -45,4 +45,12 @@
* @return true if field has {@link Stable} annotation, false otherwise
*/
boolean isStable();
+
+ /**
+ * If this field is stable, checks if default values (0, null, etc.) should be considered stable
+ * as well.
+ *
+ * @return true if default values should be considered stable, false otherwise
+ */
+ boolean isDefaultStable();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -22,20 +22,27 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
-import static jdk.vm.ci.hotspot.HotSpotResolvedJavaFieldImpl.Options.*;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.options.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.LocationIdentity;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ModifiersProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.options.Option;
+import jdk.vm.ci.options.OptionType;
+import jdk.vm.ci.options.OptionValue;
/**
* Represents a field in a HotSpot type.
*/
-public class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotProxified {
+class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotProxified {
static class Options {
//@formatter:off
@@ -91,7 +98,7 @@
}
}
- public HotSpotResolvedJavaFieldImpl(HotSpotResolvedObjectTypeImpl holder, String name, JavaType type, long offset, int modifiers) {
+ HotSpotResolvedJavaFieldImpl(HotSpotResolvedObjectTypeImpl holder, String name, JavaType type, long offset, int modifiers) {
this.holder = holder;
this.name = name;
this.type = type;
@@ -130,7 +137,7 @@
@Override
public boolean isInternal() {
- return (modifiers & runtime().getConfig().jvmAccFieldInternal) != 0;
+ return (modifiers & config().jvmAccFieldInternal) != 0;
}
/**
@@ -183,7 +190,7 @@
@Override
public boolean isSynthetic() {
- return (runtime().getConfig().syntheticFlag & modifiers) != 0;
+ return (config().syntheticFlag & modifiers) != 0;
}
/**
@@ -192,11 +199,11 @@
* @return true if field has {@link Stable} annotation, false otherwise
*/
public boolean isStable() {
- if ((runtime().getConfig().jvmAccFieldStable & modifiers) != 0) {
+ if ((config().jvmAccFieldStable & modifiers) != 0) {
return true;
}
assert getAnnotation(Stable.class) == null;
- if (ImplicitStableValues.getValue() && isImplicitStableField()) {
+ if (Options.ImplicitStableValues.getValue() && isImplicitStableField()) {
return true;
}
return false;
@@ -243,19 +250,25 @@
}
private boolean isImplicitStableField() {
- if (isSynthetic()) {
- if (isSyntheticImplicitStableField()) {
- return true;
- }
- } else if (isWellKnownImplicitStableField()) {
+ if (isSyntheticEnumSwitchMap()) {
+ return true;
+ }
+ if (isWellKnownImplicitStableField()) {
return true;
}
return false;
}
- private boolean isSyntheticImplicitStableField() {
- assert this.isSynthetic();
- if (isStatic() && isArray()) {
+ public boolean isDefaultStable() {
+ assert this.isStable();
+ if (isSyntheticEnumSwitchMap()) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isSyntheticEnumSwitchMap() {
+ if (isSynthetic() && isStatic() && isArray()) {
if (isFinal() && name.equals("$VALUES") || name.equals("ENUM$VALUES")) {
// generated int[] field for EnumClass::values()
return true;
@@ -281,6 +294,7 @@
}
private static final ResolvedJavaField STRING_VALUE_FIELD;
+
static {
try {
MetaAccessProvider metaAccess = runtime().getHostJVMCIBackend().getMetaAccess();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -22,15 +22,27 @@
*/
package jdk.vm.ci.hotspot;
-import java.lang.reflect.*;
+import java.lang.reflect.Modifier;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.options.Option;
+import jdk.vm.ci.options.OptionType;
+import jdk.vm.ci.options.OptionValue;
/**
* Implementation of {@link JavaMethod} for resolved HotSpot methods.
*/
public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod {
+ public static class Options {
+ // @formatter:off
+ @Option(help = "", type = OptionType.Debug)
+ public static final OptionValue<Boolean> UseProfilingInformation = new OptionValue<>(true);
+ // @formatter:on
+ }
+
/**
* Returns true if this method has a {@code CallerSensitive} annotation.
*
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -22,29 +22,47 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
-import static jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.Options.*;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod.Options.UseProfilingInformation;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Executable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.options.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.DefaultProfilingInfo;
+import jdk.vm.ci.meta.ExceptionHandler;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.LineNumberTable;
+import jdk.vm.ci.meta.LineNumberTableImpl;
+import jdk.vm.ci.meta.Local;
+import jdk.vm.ci.meta.LocalImpl;
+import jdk.vm.ci.meta.LocalVariableTable;
+import jdk.vm.ci.meta.LocalVariableTableImpl;
+import jdk.vm.ci.meta.ModifiersProvider;
+import jdk.vm.ci.meta.ProfilingInfo;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
+import jdk.vm.ci.meta.SpeculationLog;
+import jdk.vm.ci.meta.TriState;
/**
* Implementation of {@link JavaMethod} for resolved HotSpot methods.
*/
-public final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MetaspaceWrapperObject {
-
- public static class Options {
- // @formatter:off
- @Option(help = "", type = OptionType.Debug)
- public static final OptionValue<Boolean> UseProfilingInformation = new OptionValue<>(true);
- // @formatter:on
- }
+final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MetaspaceWrapperObject {
/**
* Reference to metaspace Method object.
@@ -56,7 +74,7 @@
private final HotSpotSignature signature;
private HotSpotMethodData methodData;
private byte[] code;
- private Member toJavaCache;
+ private Executable toJavaCache;
/**
* Gets the holder of a HotSpot metaspace method native object.
@@ -66,10 +84,10 @@
* {@code metaspaceMethod}
*/
private static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final long metaspaceConstMethod = UNSAFE.getAddress(metaspaceMethod + config.methodConstMethodOffset);
final long metaspaceConstantPool = UNSAFE.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset);
- return runtime().getCompilerToVM().getResolvedJavaType(null, metaspaceConstantPool + config.constantPoolHolderOffset, false);
+ return compilerToVM().getResolvedJavaType(null, metaspaceConstantPool + config.constantPoolHolderOffset, false);
}
/**
@@ -94,7 +112,7 @@
this.metaspaceMethod = metaspaceMethod;
this.holder = holder;
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final long constMethod = getConstMethod();
/*
@@ -106,7 +124,7 @@
if (metaspaceConstantPool == holder.getConstantPool().getMetaspaceConstantPool()) {
this.constantPool = holder.getConstantPool();
} else {
- this.constantPool = runtime().getCompilerToVM().getConstantPool(null, constMethod + config.constMethodConstantsOffset);
+ this.constantPool = compilerToVM().getConstantPool(null, constMethod + config.constMethodConstantsOffset);
}
final int nameIndex = UNSAFE.getChar(constMethod + config.constMethodNameIndexOffset);
@@ -126,7 +144,7 @@
*/
private long getConstMethod() {
assert metaspaceMethod != 0;
- return UNSAFE.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset);
+ return UNSAFE.getAddress(metaspaceMethod + config().methodConstMethodOffset);
}
@Override
@@ -152,7 +170,7 @@
* @return flags of this method
*/
private int getFlags() {
- return UNSAFE.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset);
+ return UNSAFE.getByte(metaspaceMethod + config().methodFlagsOffset);
}
/**
@@ -161,7 +179,7 @@
* @return flags of this method's ConstMethod
*/
private int getConstMethodFlags() {
- return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset);
+ return UNSAFE.getChar(getConstMethod() + config().constMethodFlagsOffset);
}
@Override
@@ -172,20 +190,16 @@
/**
* Gets the address of the C++ Method object for this method.
*/
- public JavaConstant getMetaspaceMethodConstant() {
- return HotSpotMetaspaceConstantImpl.forMetaspaceObject(getHostWordKind(), metaspaceMethod, this, false);
+ public Constant getMetaspaceMethodConstant() {
+ return HotSpotMetaspaceConstantImpl.forMetaspaceObject(this, false);
}
- public long getMetaspaceMethod() {
+ public long getMetaspacePointer() {
return metaspaceMethod;
}
- public long getMetaspacePointer() {
- return getMetaspaceMethod();
- }
-
@Override
- public JavaConstant getEncoding() {
+ public Constant getEncoding() {
return getMetaspaceMethodConstant();
}
@@ -194,7 +208,7 @@
* modifiers as well as the HotSpot internal modifiers.
*/
public int getAllModifiers() {
- return UNSAFE.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset);
+ return UNSAFE.getInt(metaspaceMethod + config().methodAccessFlagsOffset);
}
@Override
@@ -213,7 +227,7 @@
return null;
}
if (code == null && holder.isLinked()) {
- code = runtime().getCompilerToVM().getBytecode(this);
+ code = compilerToVM().getBytecode(this);
assert code.length == getCodeSize() : "expected: " + getCodeSize() + ", actual: " + code.length;
}
return code;
@@ -221,20 +235,20 @@
@Override
public int getCodeSize() {
- return UNSAFE.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset);
+ return UNSAFE.getChar(getConstMethod() + config().constMethodCodeSizeOffset);
}
@Override
public ExceptionHandler[] getExceptionHandlers() {
- final boolean hasExceptionTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasExceptionTable) != 0;
+ final boolean hasExceptionTable = (getConstMethodFlags() & config().constMethodHasExceptionTable) != 0;
if (!hasExceptionTable) {
return new ExceptionHandler[0];
}
- HotSpotVMConfig config = runtime().getConfig();
- final int exceptionTableLength = runtime().getCompilerToVM().getExceptionTableLength(this);
+ HotSpotVMConfig config = config();
+ final int exceptionTableLength = compilerToVM().getExceptionTableLength(this);
ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength];
- long exceptionTableElement = runtime().getCompilerToVM().getExceptionTableStart(this);
+ long exceptionTableElement = compilerToVM().getExceptionTableStart(this);
for (int i = 0; i < exceptionTableLength; i++) {
final int startPc = UNSAFE.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset);
@@ -273,7 +287,7 @@
* @return true if CallerSensitive annotation present, false otherwise
*/
public boolean isCallerSensitive() {
- return (getFlags() & runtime().getConfig().methodFlagsCallerSensitive) != 0;
+ return (getFlags() & config().methodFlagsCallerSensitive) != 0;
}
/**
@@ -282,7 +296,7 @@
* @return true if ForceInline annotation present, false otherwise
*/
public boolean isForceInline() {
- return (getFlags() & runtime().getConfig().methodFlagsForceInline) != 0;
+ return (getFlags() & config().methodFlagsForceInline) != 0;
}
/**
@@ -291,14 +305,14 @@
* @return true if DontInline annotation present, false otherwise
*/
public boolean isDontInline() {
- return (getFlags() & runtime().getConfig().methodFlagsDontInline) != 0;
+ return (getFlags() & config().methodFlagsDontInline) != 0;
}
/**
* Manually adds a DontInline annotation to this method.
*/
public void setNotInlineable() {
- runtime().getCompilerToVM().doNotInlineOrCompile(this);
+ compilerToVM().doNotInlineOrCompile(this);
}
/**
@@ -308,7 +322,7 @@
* @return true if special method ignored by security stack walks, false otherwise
*/
public boolean ignoredBySecurityStackWalk() {
- return runtime().getCompilerToVM().methodIsIgnoredBySecurityStackWalk(this);
+ return compilerToVM().methodIsIgnoredBySecurityStackWalk(this);
}
@Override
@@ -326,7 +340,7 @@
if (isAbstract() || isNative()) {
return 0;
}
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getChar(getConstMethod() + config.methodMaxLocalsOffset);
}
@@ -335,7 +349,7 @@
if (isAbstract() || isNative()) {
return 0;
}
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return config.extraStackEntries + UNSAFE.getChar(getConstMethod() + config.constMethodMaxStackOffset);
}
@@ -343,10 +357,10 @@
public StackTraceElement asStackTraceElement(int bci) {
if (bci < 0 || bci >= getCodeSize()) {
// HotSpot code can only construct stack trace elements for valid bcis
- StackTraceElement ste = runtime().getCompilerToVM().getStackTraceElement(this, 0);
+ StackTraceElement ste = compilerToVM().getStackTraceElement(this, 0);
return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1);
}
- return runtime().getCompilerToVM().getStackTraceElement(this, bci);
+ return compilerToVM().getStackTraceElement(this, bci);
}
public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver) {
@@ -361,7 +375,11 @@
// seeing A.foo().
return null;
}
- return runtime().getCompilerToVM().findUniqueConcreteMethod(((HotSpotResolvedObjectTypeImpl) receiver), this);
+ if (this.isDefault()) {
+ // CHA for default methods doesn't work and may crash the VM
+ return null;
+ }
+ return compilerToVM().findUniqueConcreteMethod(((HotSpotResolvedObjectTypeImpl) receiver), this);
}
@Override
@@ -375,7 +393,7 @@
* @return the value of {@code Method::_code}
*/
private long getCompiledCode() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getAddress(metaspaceMethod + config.methodCodeOffset);
}
@@ -395,7 +413,7 @@
public boolean hasCompiledCodeAtLevel(int level) {
long compiledCode = getCompiledCode();
if (compiledCode != 0) {
- return UNSAFE.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level;
+ return UNSAFE.getInt(compiledCode + config().nmethodCompLevelOffset) == level;
}
return false;
}
@@ -407,7 +425,7 @@
ProfilingInfo info;
if (UseProfilingInformation.getValue() && methodData == null) {
- long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + runtime().getConfig().methodDataOffset);
+ long metaspaceMethodData = UNSAFE.getAddress(metaspaceMethod + config().methodDataOffset);
if (metaspaceMethodData != 0) {
methodData = new HotSpotMethodData(metaspaceMethodData, this);
if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) {
@@ -429,7 +447,7 @@
@Override
public void reprofile() {
- runtime().getCompilerToVM().reprofile(this);
+ compilerToVM().reprofile(this);
}
@Override
@@ -439,31 +457,19 @@
@Override
public Annotation[][] getParameterAnnotations() {
- if (isConstructor()) {
- Constructor<?> javaConstructor = toJavaConstructor();
- return javaConstructor == null ? null : javaConstructor.getParameterAnnotations();
- }
- Method javaMethod = toJava();
+ Executable javaMethod = toJava();
return javaMethod == null ? null : javaMethod.getParameterAnnotations();
}
@Override
public Annotation[] getAnnotations() {
- if (isConstructor()) {
- Constructor<?> javaConstructor = toJavaConstructor();
- return javaConstructor == null ? new Annotation[0] : javaConstructor.getAnnotations();
- }
- Method javaMethod = toJava();
+ Executable javaMethod = toJava();
return javaMethod == null ? new Annotation[0] : javaMethod.getAnnotations();
}
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
- if (isConstructor()) {
- Constructor<?> javaConstructor = toJavaConstructor();
- return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass);
- }
- Method javaMethod = toJava();
+ Executable javaMethod = toJava();
return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass);
}
@@ -478,11 +484,7 @@
@Override
public Type[] getGenericParameterTypes() {
- if (isConstructor()) {
- Constructor<?> javaConstructor = toJavaConstructor();
- return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes();
- }
- Method javaMethod = toJava();
+ Executable javaMethod = toJava();
return javaMethod == null ? null : javaMethod.getGenericParameterTypes();
}
@@ -498,25 +500,13 @@
return result;
}
- private Method toJava() {
+ private Executable toJava() {
if (toJavaCache != null) {
- return (Method) toJavaCache;
+ return toJavaCache;
}
try {
- Method result = holder.mirror().getDeclaredMethod(name, signatureToTypes());
- toJavaCache = result;
- return result;
- } catch (NoSuchMethodException | NoClassDefFoundError e) {
- return null;
- }
- }
-
- private Constructor<?> toJavaConstructor() {
- if (toJavaCache != null) {
- return (Constructor<?>) toJavaCache;
- }
- try {
- Constructor<?> result = holder.mirror().getDeclaredConstructor(signatureToTypes());
+ Class<?>[] parameterTypes = signatureToTypes();
+ Executable result = isConstructor() ? holder.mirror().getDeclaredConstructor(parameterTypes) : holder.mirror().getDeclaredMethod(name, parameterTypes);
toJavaCache = result;
return result;
} catch (NoSuchMethodException | NoClassDefFoundError e) {
@@ -529,7 +519,7 @@
if (isDontInline()) {
return false;
}
- return runtime().getCompilerToVM().canInlineMethod(this);
+ return compilerToVM().canInlineMethod(this);
}
@Override
@@ -537,17 +527,17 @@
if (isForceInline()) {
return true;
}
- return runtime().getCompilerToVM().shouldInlineMethod(this);
+ return compilerToVM().shouldInlineMethod(this);
}
@Override
public LineNumberTable getLineNumberTable() {
- final boolean hasLineNumberTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLineNumberTable) != 0;
+ final boolean hasLineNumberTable = (getConstMethodFlags() & config().constMethodHasLineNumberTable) != 0;
if (!hasLineNumberTable) {
return null;
}
- long[] values = runtime().getCompilerToVM().getLineNumberTable(this);
+ long[] values = compilerToVM().getLineNumberTable(this);
if (values == null || values.length == 0) {
// Empty table so treat is as non-existent
return null;
@@ -566,14 +556,14 @@
@Override
public LocalVariableTable getLocalVariableTable() {
- final boolean hasLocalVariableTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLocalVariableTable) != 0;
+ final boolean hasLocalVariableTable = (getConstMethodFlags() & config().constMethodHasLocalVariableTable) != 0;
if (!hasLocalVariableTable) {
return null;
}
- HotSpotVMConfig config = runtime().getConfig();
- long localVariableTableElement = runtime().getCompilerToVM().getLocalVariableTableStart(this);
- final int localVariableTableLength = runtime().getCompilerToVM().getLocalVariableTableLength(this);
+ HotSpotVMConfig config = config();
+ long localVariableTableElement = compilerToVM().getLocalVariableTableStart(this);
+ final int localVariableTableLength = compilerToVM().getLocalVariableTableLength(this);
Local[] locals = new Local[localVariableTableLength];
for (int i = 0; i < localVariableTableLength; i++) {
@@ -606,7 +596,7 @@
if (!isInVirtualMethodTable(resolved)) {
throw new JVMCIError("%s does not have a vtable entry in type %s", this, resolved);
}
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
return config.instanceKlassVtableStartOffset() + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
}
@@ -623,11 +613,11 @@
private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) {
if (!holder.isLinked()) {
- return runtime().getConfig().invalidVtableIndex;
+ return config().invalidVtableIndex;
}
if (holder.isInterface()) {
if (resolved.isInterface()) {
- return runtime().getConfig().invalidVtableIndex;
+ return config().invalidVtableIndex;
}
return getVtableIndexForInterfaceMethod(resolved);
}
@@ -640,8 +630,8 @@
* @return virtual table index
*/
private int getVtableIndex() {
- assert!holder.isInterface();
- HotSpotVMConfig config = runtime().getConfig();
+ assert !holder.isInterface();
+ HotSpotVMConfig config = config();
int result = UNSAFE.getInt(metaspaceMethod + config.methodVtableIndexOffset);
assert result >= config.nonvirtualVtableIndex : "must be linked";
return result;
@@ -649,7 +639,7 @@
private int getVtableIndexForInterfaceMethod(ResolvedJavaType resolved) {
HotSpotResolvedObjectTypeImpl hotspotType = (HotSpotResolvedObjectTypeImpl) resolved;
- return runtime().getCompilerToVM().getVtableIndexForInterfaceMethod(hotspotType, this);
+ return compilerToVM().getVtableIndexForInterfaceMethod(hotspotType, this);
}
/**
@@ -682,14 +672,14 @@
}
public int intrinsicId() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getChar(metaspaceMethod + config.methodIntrinsicIdOffset);
}
@Override
public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) {
- assert!isConstructor();
- Method javaMethod = toJava();
+ assert !isConstructor();
+ Method javaMethod = (Method) toJava();
javaMethod.setAccessible(true);
Object[] objArguments = new Object[arguments.length];
@@ -714,13 +704,13 @@
* @return compile id
*/
public int allocateCompileId(int entryBCI) {
- return runtime().getCompilerToVM().allocateCompileId(this, entryBCI);
+ return compilerToVM().allocateCompileId(this, entryBCI);
}
public boolean hasCodeAtLevel(int entryBCI, int level) {
- if (entryBCI == runtime().getConfig().invocationEntryBci) {
+ if (entryBCI == config().invocationEntryBci) {
return hasCompiledCodeAtLevel(level);
}
- return runtime().getCompilerToVM().hasCompiledCodeForOSR(this, entryBCI, level);
+ return compilerToVM().hasCompiledCodeForOSR(this, entryBCI, level);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -22,11 +22,11 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaType;
public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
- public HotSpotResolvedJavaType(String name) {
+ HotSpotResolvedJavaType(String name) {
super(name);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,14 +22,30 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.meta.Assumptions.*;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
*/
public interface HotSpotResolvedObjectType extends ResolvedJavaType {
+ /**
+ * Gets the JVMCI mirror for a {@link Class} object.
+ *
+ * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
+ */
+ static HotSpotResolvedObjectType fromObjectClass(Class<?> javaClass) {
+ return HotSpotResolvedObjectTypeImpl.fromObjectClass(javaClass);
+ }
+
HotSpotResolvedObjectType getArrayClass();
ResolvedJavaType getComponentType();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,24 +22,44 @@
*/
package jdk.vm.ci.hotspot;
-import static java.util.Objects.*;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
+import static java.util.Objects.requireNonNull;
+import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.nio.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.meta.Assumptions.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.Assumptions.ConcreteMethod;
+import jdk.vm.ci.meta.Assumptions.ConcreteSubtype;
+import jdk.vm.ci.meta.Assumptions.LeafType;
+import jdk.vm.ci.meta.Assumptions.NoFinalizableSubclass;
+import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.MetaUtil;
+import jdk.vm.ci.meta.ModifiersProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.TrustedInterface;
/**
* Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
*/
-public final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, HotSpotProxified, MetaspaceWrapperObject {
+final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, HotSpotProxified, MetaspaceWrapperObject {
/**
* The Java class this type represents.
@@ -58,7 +78,7 @@
*
* @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
*/
- public static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass) {
+ static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass) {
return (HotSpotResolvedObjectTypeImpl) runtime().fromClass(javaClass);
}
@@ -108,11 +128,11 @@
/**
* Gets the metaspace Klass for this type.
*/
- public long getMetaspaceKlass() {
+ long getMetaspaceKlass() {
if (HotSpotJVMCIRuntime.getHostWordKind() == JavaKind.Long) {
- return UNSAFE.getLong(javaClass, (long) runtime().getConfig().klassOffset);
+ return UNSAFE.getLong(javaClass, (long) config().klassOffset);
}
- return UNSAFE.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL;
+ return UNSAFE.getInt(javaClass, (long) config().klassOffset) & 0xFFFFFFFFL;
}
public long getMetaspacePointer() {
@@ -129,7 +149,7 @@
}
public int getAccessFlags() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset);
}
@@ -149,7 +169,7 @@
@Override
public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
if (isArray()) {
return getElementalType().isLeaf() ? new AssumptionResult<>(this) : null;
} else if (isInterface()) {
@@ -214,7 +234,7 @@
* @return value of the subklass field as metaspace klass pointer
*/
private HotSpotResolvedObjectTypeImpl getSubklass() {
- return runtime().getCompilerToVM().getResolvedJavaType(this, runtime().getConfig().subklassOffset, false);
+ return compilerToVM().getResolvedJavaType(this, config().subklassOffset, false);
}
@Override
@@ -241,7 +261,7 @@
if (!isInterface()) {
throw new JVMCIError("Cannot call getSingleImplementor() on a non-interface type: %s", this);
}
- return runtime().getCompilerToVM().getImplementor(this);
+ return compilerToVM().getImplementor(this);
}
public HotSpotResolvedObjectTypeImpl getSupertype() {
@@ -289,14 +309,14 @@
}
@Override
- public JavaConstant getObjectHub() {
+ public Constant getObjectHub() {
return klass();
}
@Override
public AssumptionResult<Boolean> hasFinalizableSubclass() {
assert !isArray();
- if (!runtime().getCompilerToVM().hasFinalizableSubclass(this)) {
+ if (!compilerToVM().hasFinalizableSubclass(this)) {
return new AssumptionResult<>(false, new NoFinalizableSubclass(this));
}
return new AssumptionResult<>(true);
@@ -304,7 +324,7 @@
@Override
public boolean hasFinalizer() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return (getAccessFlags() & config.klassHasFinalizerFlag) != 0;
}
@@ -320,12 +340,12 @@
@Override
public boolean isInitialized() {
- return isArray() ? true : getInitState() == runtime().getConfig().instanceKlassStateFullyInitialized;
+ return isArray() ? true : getInitState() == config().instanceKlassStateFullyInitialized;
}
@Override
public boolean isLinked() {
- return isArray() ? true : getInitState() >= runtime().getConfig().instanceKlassStateLinked;
+ return isArray() ? true : getInitState() >= config().instanceKlassStateLinked;
}
/**
@@ -336,7 +356,7 @@
*/
private int getInitState() {
assert !isArray() : "_init_state only exists in InstanceKlass";
- return UNSAFE.getByte(getMetaspaceKlass() + runtime().getConfig().instanceKlassInitStateOffset) & 0xFF;
+ return UNSAFE.getByte(getMetaspaceKlass() + config().instanceKlassInitStateOffset) & 0xFF;
}
@Override
@@ -405,12 +425,12 @@
}
HotSpotResolvedJavaMethodImpl hotSpotMethod = (HotSpotResolvedJavaMethodImpl) method;
HotSpotResolvedObjectTypeImpl hotSpotCallerType = (HotSpotResolvedObjectTypeImpl) callerType;
- return runtime().getCompilerToVM().resolveMethod(this, hotSpotMethod, hotSpotCallerType);
+ return compilerToVM().resolveMethod(this, hotSpotMethod, hotSpotCallerType);
}
public HotSpotConstantPool getConstantPool() {
if (constantPool == null) {
- constantPool = runtime().getCompilerToVM().getConstantPool(this, runtime().getConfig().instanceKlassConstantsOffset);
+ constantPool = compilerToVM().getConstantPool(this, config().instanceKlassConstantsOffset);
}
return constantPool;
}
@@ -424,7 +444,7 @@
assert !isArray();
assert !isInterface();
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final int layoutHelper = layoutHelper();
assert layoutHelper > config.klassLayoutHelperNeutralValue : "must be instance";
@@ -438,7 +458,7 @@
}
public int layoutHelper() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset);
}
@@ -458,7 +478,7 @@
}
public int getVtableLength() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
if (isInterface() || isArray()) {
/* Everything has the core vtable of java.lang.Object */
return config.baseVtableLength();
@@ -547,7 +567,7 @@
* @param index index to the fields array
*/
public FieldInfo(int index) {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
// Get Klass::_fields
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
@@ -555,19 +575,19 @@
}
private int getAccessFlags() {
- return readFieldSlot(runtime().getConfig().fieldInfoAccessFlagsOffset);
+ return readFieldSlot(config().fieldInfoAccessFlagsOffset);
}
private int getNameIndex() {
- return readFieldSlot(runtime().getConfig().fieldInfoNameIndexOffset);
+ return readFieldSlot(config().fieldInfoNameIndexOffset);
}
private int getSignatureIndex() {
- return readFieldSlot(runtime().getConfig().fieldInfoSignatureIndexOffset);
+ return readFieldSlot(config().fieldInfoSignatureIndexOffset);
}
public int getOffset() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final int lowPacked = readFieldSlot(config.fieldInfoLowPackedOffset);
final int highPacked = readFieldSlot(config.fieldInfoHighPackedOffset);
final int offset = ((highPacked << Short.SIZE) | lowPacked) >> config.fieldInfoTagSize;
@@ -606,7 +626,7 @@
}
private boolean isInternal() {
- return (getAccessFlags() & runtime().getConfig().jvmAccFieldInternal) != 0;
+ return (getAccessFlags() & config().jvmAccFieldInternal) != 0;
}
public boolean isStatic() {
@@ -614,7 +634,7 @@
}
public boolean hasGenericSignature() {
- return (getAccessFlags() & runtime().getConfig().jvmAccFieldHasGenericSignature) != 0;
+ return (getAccessFlags() & config().jvmAccFieldHasGenericSignature) != 0;
}
}
@@ -707,7 +727,7 @@
* See {@code FieldStreamBase::init_generic_signature_start_slot}
*/
private int getFieldCount() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
int metaspaceFieldsLength = UNSAFE.getInt(metaspaceFields + config.arrayU1LengthOffset);
int fieldCount = 0;
@@ -729,7 +749,7 @@
@Override
public String getSourceFileName() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
final int sourceFileNameIndex = UNSAFE.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset);
if (sourceFileNameIndex == 0) {
return null;
@@ -784,21 +804,21 @@
/**
* Gets the metaspace Klass boxed in a {@link JavaConstant}.
*/
- public JavaConstant klass() {
- return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime().getHostJVMCIBackend().getTarget().wordKind, getMetaspaceKlass(), this, false);
+ public Constant klass() {
+ return HotSpotMetaspaceConstantImpl.forMetaspaceObject(this, false);
}
public boolean isPrimaryType() {
- return runtime().getConfig().secondarySuperCacheOffset != superCheckOffset();
+ return config().secondarySuperCacheOffset != superCheckOffset();
}
public int superCheckOffset() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
return UNSAFE.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset);
}
public long prototypeMarkWord() {
- HotSpotVMConfig config = runtime().getConfig();
+ HotSpotVMConfig config = config();
if (isArray()) {
return config.arrayPrototypeMarkWord();
} else {
@@ -874,7 +894,7 @@
}
public ResolvedJavaMethod getClassInitializer() {
- return runtime().getCompilerToVM().getClassInitializer(this);
+ return compilerToVM().getClassInitializer(this);
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,15 +22,21 @@
*/
package jdk.vm.ci.hotspot;
-import static java.util.Objects.*;
+import static java.util.Objects.requireNonNull;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Modifier;
+import java.net.URL;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.common.JVMCIError;
import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* Implementation of {@link JavaType} for primitive HotSpot types.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotRuntimeStub.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2011, 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.code.InstalledCode;
+import jdk.vm.ci.code.InvalidInstalledCodeException;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+/**
+ * Implementation of {@link InstalledCode} for code installed as a RuntimeStub.
+ */
+public class HotSpotRuntimeStub extends HotSpotInstalledCode {
+
+ public HotSpotRuntimeStub(String name) {
+ super(name);
+ }
+
+ public ResolvedJavaMethod getMethod() {
+ return null;
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public void invalidate() {
+ }
+
+ @Override
+ public String toString() {
+ return String.format("InstalledRuntimeStub[stub=%s, codeBlob=0x%x]", name, getAddress());
+ }
+
+ @Override
+ public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
+ throw new InternalError("Cannot call stub " + name);
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSentinelConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSentinelConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,16 +22,23 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.LIRKind;
+import jdk.vm.ci.meta.VMConstant;
+import jdk.vm.ci.meta.Value;
public final class HotSpotSentinelConstant extends Value implements JavaConstant, VMConstant {
- public HotSpotSentinelConstant(JavaKind kind) {
- super(LIRKind.reference(kind));
+ private final JavaKind javaKind;
+
+ public HotSpotSentinelConstant(LIRKind lirKind, JavaKind javaKind) {
+ super(lirKind);
+ this.javaKind = javaKind;
}
public JavaKind getJavaKind() {
- return (JavaKind) getLIRKind().getPlatformKind();
+ return javaKind;
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSignature.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSignature.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,14 @@
*/
package jdk.vm.ci.hotspot;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
/**
* Represents a method signature.
@@ -131,7 +135,7 @@
JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
return runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(kind.toJavaClass());
}
- return new HotSpotUnresolvedJavaType(name, runtime);
+ return HotSpotUnresolvedJavaType.create(runtime, name);
}
@Override
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,13 +22,63 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.SpeculationLog;
-public class HotSpotSpeculationLog extends SpeculationLog {
+public class HotSpotSpeculationLog implements SpeculationLog {
+
+ /** Written by the C++ code that performs deoptimization. */
+ private volatile Object lastFailed;
+
+ /** All speculations that have been a deoptimization reason. */
+ private Set<SpeculationReason> failedSpeculations;
+
+ /** Strong references to all reasons embededded in the current nmethod. */
+ private volatile Collection<SpeculationReason> speculations;
@Override
- public JavaConstant speculate(Object reason) {
- addSpeculation(reason);
+ public synchronized void collectFailedSpeculations() {
+ if (lastFailed != null) {
+ if (failedSpeculations == null) {
+ failedSpeculations = new HashSet<>(2);
+ }
+ failedSpeculations.add((SpeculationReason) lastFailed);
+ lastFailed = null;
+ speculations = null;
+ }
+ }
+
+ @Override
+ public boolean maySpeculate(SpeculationReason reason) {
+ if (failedSpeculations != null && failedSpeculations.contains(reason)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public JavaConstant speculate(SpeculationReason reason) {
+ assert maySpeculate(reason);
+
+ /*
+ * Objects referenced from nmethods are weak references. We need a strong reference to the
+ * reason objects that are embedded in nmethods, so we add them to the speculations
+ * collection.
+ */
+ if (speculations == null) {
+ synchronized (this) {
+ if (speculations == null) {
+ speculations = new ConcurrentLinkedQueue<>();
+ }
+ }
+ }
+ speculations.add(reason);
+
return HotSpotObjectConstantImpl.forObject(reason);
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotStackFrameReference.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotStackFrameReference.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,10 @@
*/
package jdk.vm.ci.hotspot;
-import java.util.*;
+import java.util.Arrays;
-import jdk.vm.ci.code.stack.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.stack.InspectedFrame;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
public class HotSpotStackFrameReference implements InspectedFrame {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotStackIntrospection.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 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.code.stack.InspectedFrameVisitor;
+import jdk.vm.ci.code.stack.StackIntrospection;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+public class HotSpotStackIntrospection implements StackIntrospection {
+
+ protected final HotSpotJVMCIRuntimeProvider runtime;
+
+ public HotSpotStackIntrospection(HotSpotJVMCIRuntimeProvider runtime) {
+ this.runtime = runtime;
+ }
+
+ @Override
+ public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
+ CompilerToVM compilerToVM = runtime.getCompilerToVM();
+ HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMethods, initialSkip);
+ while (current != null) {
+ T result = visitor.visitFrame(current);
+ if (result != null) {
+ return result;
+ }
+ current = compilerToVM.getNextStackFrame(current, matchingMethods, 0);
+ }
+ return null;
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotUnresolvedField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotUnresolvedField.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, 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
@@ -22,18 +22,19 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaField;
+import jdk.vm.ci.meta.JavaType;
/**
* A implementation of {@link JavaField} for an unresolved field.
*/
-public class HotSpotUnresolvedField implements JavaField {
+class HotSpotUnresolvedField implements JavaField {
private final String name;
private final JavaType holder;
private final JavaType type;
- public HotSpotUnresolvedField(JavaType holder, String name, JavaType type) {
+ HotSpotUnresolvedField(JavaType holder, String name, JavaType type) {
this.name = name;
this.type = type;
this.holder = holder;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotUnresolvedJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotUnresolvedJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,16 +22,18 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaType;
/**
* Implementation of {@link JavaType} for unresolved HotSpot classes.
*/
-public class HotSpotUnresolvedJavaType extends HotSpotJavaType {
+final class HotSpotUnresolvedJavaType extends HotSpotJavaType {
private final HotSpotJVMCIRuntimeProvider runtime;
- public HotSpotUnresolvedJavaType(String name, HotSpotJVMCIRuntimeProvider runtime) {
+ private HotSpotUnresolvedJavaType(String name, HotSpotJVMCIRuntimeProvider runtime) {
super(name);
assert name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name;
this.runtime = runtime;
@@ -40,7 +42,7 @@
/**
* Creates an unresolved type for a valid {@link JavaType#getName() type name}.
*/
- public static HotSpotUnresolvedJavaType create(HotSpotJVMCIRuntimeProvider runtime, String name) {
+ static HotSpotUnresolvedJavaType create(HotSpotJVMCIRuntimeProvider runtime, String name) {
return new HotSpotUnresolvedJavaType(name, runtime);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java Wed Nov 04 07:23:23 2015 -1000
@@ -23,14 +23,23 @@
package jdk.vm.ci.hotspot;
import static jdk.vm.ci.common.UnsafeUtil.readCString;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Iterator;
-import sun.misc.*;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.hotspotvmconfig.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMAddress;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMConstant;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMData;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMField;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMManual;
+import jdk.vm.ci.hotspotvmconfig.HotSpotVMType;
+import sun.misc.Unsafe;
//JaCoCo Exclude
@@ -42,13 +51,20 @@
public class HotSpotVMConfig {
/**
+ * Gets the configuration associated with the singleton {@link HotSpotJVMCIRuntime}.
+ */
+ public static HotSpotVMConfig config() {
+ return runtime().getConfig();
+ }
+
+ /**
* Maximum allowed size of allocated area for a frame.
*/
public final int maxFrameSize = 16 * 1024;
public HotSpotVMConfig(CompilerToVM compilerToVm) {
// Get raw pointer to the array that contains all gHotSpotVM values.
- final long gHotSpotVMData = compilerToVm.initializeConfiguration();
+ final long gHotSpotVMData = compilerToVm.initializeConfiguration(this);
assert gHotSpotVMData != 0;
// Make FindBugs happy.
@@ -106,6 +122,8 @@
handleDeoptStub = deoptBlob + UNSAFE.getInt(deoptBlob + codeBlobCodeOffsetOffset) + UNSAFE.getInt(deoptBlob + deoptimizationBlobUnpackOffsetOffset);
uncommonTrapStub = deoptBlob + UNSAFE.getInt(deoptBlob + codeBlobCodeOffsetOffset) + UNSAFE.getInt(deoptBlob + deoptimizationBlobUncommonTrapOffsetOffset);
+ tlabAlignmentReserve = roundUp(threadLocalAllocBufferEndReserve(), minObjAlignment());
+
assert check();
assert HotSpotVMConfigVerifier.check();
}
@@ -844,6 +862,7 @@
@HotSpotVMConstant(name = "ASSERT") @Stable public boolean cAssertions;
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;
@@ -938,6 +957,16 @@
@HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public long cpuERMS;
@HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public long cpuCLMUL;
@HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public long cpuBMI1;
+ @HotSpotVMConstant(name = "VM_Version::CPU_BMI2", archs = {"amd64"}) @Stable public long cpuBMI2;
+ @HotSpotVMConstant(name = "VM_Version::CPU_RTM", archs = {"amd64"}) @Stable public long cpuRTM;
+ @HotSpotVMConstant(name = "VM_Version::CPU_ADX", archs = {"amd64"}) @Stable public long cpuADX;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512F", archs = {"amd64"}) @Stable public long cpuAVX512F;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512DQ", archs = {"amd64"}) @Stable public long cpuAVX512DQ;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512PF", archs = {"amd64"}) @Stable public long cpuAVX512PF;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512ER", archs = {"amd64"}) @Stable public long cpuAVX512ER;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512CD", archs = {"amd64"}) @Stable public long cpuAVX512CD;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512BW", archs = {"amd64"}) @Stable public long cpuAVX512BW;
+ @HotSpotVMConstant(name = "VM_Version::CPU_AVX512VL", archs = {"amd64"}) @Stable public long cpuAVX512VL;
// SPARC specific values
@HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures;
@@ -945,6 +974,26 @@
@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;
+
@HotSpotVMFlag(name = "UseBlockZeroing", archs = {"sparc"}) @Stable public boolean useBlockZeroing;
@HotSpotVMFlag(name = "BlockZeroingLowLimit", archs = {"sparc"}) @Stable public int blockZeroingLowLimit;
@@ -1396,6 +1445,7 @@
@HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
@HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
+ @HotSpotVMManual(name = "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;
@@ -1453,13 +1503,6 @@
return Integer.max(reserveSize, abstractVmVersionReserveForAllocationPrefetch);
}
- /**
- * See: {@code ThreadLocalAllocBuffer::alignment_reserve()}.
- */
- public final int tlabAlignmentReserve() {
- return roundUp(threadLocalAllocBufferEndReserve(), minObjAlignment());
- }
-
@HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
// FIXME This is only temporary until the GC code is changed.
@@ -1688,6 +1731,7 @@
@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::HEAP_TOP_ADDRESS") @Stable public int MARKID_HEAP_TOP_ADDRESS;
@HotSpotVMConstant(name = "CodeInstaller::HEAP_END_ADDRESS") @Stable public int MARKID_HEAP_END_ADDRESS;
@@ -1695,6 +1739,20 @@
@HotSpotVMConstant(name = "CodeInstaller::CRC_TABLE_ADDRESS") @Stable public int MARKID_CRC_TABLE_ADDRESS;
@HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
+ @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;
+
// Checkstyle: resume
private boolean check() {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,16 +22,25 @@
*/
package jdk.vm.ci.hotspot;
-import static java.lang.String.*;
+import static java.lang.String.format;
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.Objects;
-import jdk.internal.org.objectweb.asm.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.Label;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type;
-import jdk.vm.ci.common.*;
-import sun.misc.*;
+import sun.misc.Unsafe;
/**
* A {@link ClassVisitor} that verifies {@link HotSpotVMConfig} does not access {@link Unsafe} from
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,10 @@
*/
package jdk.vm.ci.hotspot;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.meta.JVMCIMetaAccessContext;
+import jdk.vm.ci.meta.ResolvedJavaType;
public interface HotSpotVMEventListener {
@@ -34,7 +36,7 @@
}
/**
- * Notify on successful install into the CodeCache.
+ * Notify on successful install into the code cache.
*
* @param hotSpotCodeCacheProvider
* @param installedCode
@@ -44,14 +46,6 @@
}
/**
- * Perform any extra initialization required.
- *
- * @param runtime
- */
- default void completeInitialization(HotSpotJVMCIRuntime runtime) {
- }
-
- /**
* Create a custom {@link JVMCIMetaAccessContext} to be used for managing the lifetime of loaded
* metadata. It a custom one isn't created then the default implementation will be a single
* context with globally shared instances of {@link ResolvedJavaType} that are never released.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -22,15 +22,14 @@
*/
package jdk.vm.ci.hotspot;
-import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.*;
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE;
-
-import sun.misc.*;
+import sun.misc.Unsafe;
/**
* Class to access the C++ {@code vmSymbols} table.
*/
-public final class HotSpotVmSymbols {
+final class HotSpotVmSymbols {
/**
* Returns the symbol in the {@code vmSymbols} table at position {@code index} as {@link String}
@@ -39,7 +38,7 @@
* @param index position in the symbol table
* @return the symbol at position id
*/
- public static String symbolAt(int index) {
+ static String symbolAt(int index) {
HotSpotJVMCIRuntimeProvider runtime = runtime();
HotSpotVMConfig config = runtime.getConfig();
assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds";
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,7 +28,7 @@
* It would preferable if this were the base class containing the pointer but that would require
* mixins since most of the wrapper types have complex supertype hierarchies.
*/
-public interface MetaspaceWrapperObject {
+interface MetaspaceWrapperObject {
long getMetaspacePointer();
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/Stable.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/Stable.java Wed Nov 04 07:23:23 2015 -1000
@@ -23,11 +23,14 @@
package jdk.vm.ci.hotspot;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
- * This annotation functions as an alias for the sun.invoke.Stable annotation within JVMCI code. It
- * is specially recognized during class file parsing in the same way as that annotation.
+ * This annotation functions as an alias for the java.lang.invoke.Stable annotation within JVMCI
+ * code. It is specially recognized during class file parsing in the same way as that annotation.
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/SuppressFBWarnings.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +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.hotspot;
-
-/**
- * Used to suppress <a href="http://findbugs.sourceforge.net">FindBugs</a> warnings.
- */
-public @interface SuppressFBWarnings {
- /**
- * The set of FindBugs <a
- * href="http://findbugs.sourceforge.net/bugDescriptions.html">warnings</a> that are to be
- * suppressed in annotated element. The value can be a bug category, kind or pattern.
- */
- String[] value();
-
- /**
- * Reason why the warning is suppressed.
- */
- String justification();
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/events/EmptyEventProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/events/EmptyEventProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.hotspot.events;
-import jdk.vm.ci.common.*;
+import jdk.vm.ci.common.JVMCIError;
/**
* An empty implementation for {@link EventProvider}. This implementation is used when no logging is
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMAddress.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMAddress.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Refers to a C++ address in the VM.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+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.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMData.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMData.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Refers to a entry in {@code gHotSpotVMData}.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMField.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+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.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMFlag.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMFlag.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+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.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMManual.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMManual.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Annotates a field in HotSpotVMConfig which is not read from the VM but is calculated manually.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspotvmconfig/src/jdk/vm/ci/hotspotvmconfig/HotSpotVMType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.hotspotvmconfig;
-import java.lang.annotation.*;
+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.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,12 @@
*/
package jdk.vm.ci.meta;
-import java.lang.invoke.*;
-import java.util.*;
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
/**
* Class for recording assumptions made during compilation.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.lang.invoke.*;
+import java.lang.invoke.MethodHandle;
/**
* Reflection operations on values represented as {@linkplain JavaConstant constants}. All methods
@@ -142,8 +142,12 @@
/**
* Check if the constant is embeddable in the code.
+ *
+ * @param constant the constant to test
*/
- boolean isEmbeddable(Constant constant);
+ default boolean isEmbeddable(Constant constant) {
+ return true;
+ }
/**
* Gets access to the internals of {@link MethodHandle}.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/DefaultProfilingInfo.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/DefaultProfilingInfo.java Wed Nov 04 07:23:23 2015 -1000
@@ -93,7 +93,7 @@
@Override
public String toString() {
- return "BaseProfilingInfo<" + this.toString(null, "; ") + ">";
+ return "DefaultProfilingInfo<" + this.toString(null, "; ") + ">";
}
public void setMature() {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ExceptionHandler.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ExceptionHandler.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.Objects;
/**
* Represents an exception handler within the bytecodes.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JVMCIMetaAccessContext.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JVMCIMetaAccessContext.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaField.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,8 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.IllegalFormatException;
+import java.util.UnknownFormatConversionException;
/**
* Represents a reference to a Java field, either resolved or unresolved fields. Fields, like
@@ -77,7 +78,6 @@
* @return the result of formatting this field according to {@code format}
* @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
*/
- @SuppressWarnings("fallthrough")
default String format(String format) throws IllegalFormatException {
StringBuilder sb = new StringBuilder();
int index = 0;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaKind.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaKind.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.lang.reflect.*;
+import java.lang.reflect.Array;
//JaCoCo Exclude
@@ -31,7 +31,7 @@
* {@link JavaKind#Int} for {@code int} and {@link JavaKind#Object} for all object types. A kind has
* a single character short name, a Java name, and a set of flags further describing its behavior.
*/
-public enum JavaKind implements PlatformKind {
+public enum JavaKind {
/** The primitive boolean kind, represented as an int on the stack. */
Boolean('z', "boolean", 1, true, java.lang.Boolean.TYPE, java.lang.Boolean.class),
@@ -70,7 +70,6 @@
private final boolean isStackInt;
private final Class<?> primitiveJavaClass;
private final Class<?> boxedJavaClass;
- private final EnumKey<JavaKind> key = new EnumKey<>(this);
private final int slotCount;
private JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
@@ -113,10 +112,6 @@
return javaName;
}
- public Key getKey() {
- return key;
- }
-
/**
* Checks whether this type is a Java primitive type.
*
@@ -460,37 +455,4 @@
throw new IllegalArgumentException("illegal call to bits on " + this);
}
}
-
- public JavaConstant getDefaultValue() {
- switch (this) {
- case Boolean:
- return JavaConstant.FALSE;
- case Int:
- return JavaConstant.INT_0;
- case Long:
- return JavaConstant.LONG_0;
- case Float:
- return JavaConstant.FLOAT_0;
- case Double:
- return JavaConstant.DOUBLE_0;
- case Object:
- return JavaConstant.NULL_POINTER;
- case Byte:
- case Char:
- case Short:
- return new PrimitiveConstant(this, 0);
- default:
- throw new IllegalArgumentException("illegal call to getDefaultValue on " + this);
- }
- }
-
- @Override
- public int getSizeInBytes() {
- return getByteCount();
- }
-
- @Override
- public int getVectorLength() {
- return 1;
- }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,8 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.IllegalFormatException;
+import java.util.UnknownFormatConversionException;
/**
* Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and
@@ -71,7 +72,6 @@
* @return the result of formatting this method according to {@code format}
* @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
*/
- @SuppressWarnings("fallthrough")
default String format(String format) throws IllegalFormatException {
StringBuilder sb = new StringBuilder();
int index = 0;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaMethodProfile.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaMethodProfile.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import jdk.vm.ci.meta.JavaMethodProfile.*;
+import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod;
/**
* This profile object represents the method profile at a specific BCI. The precision of the
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import static jdk.vm.ci.meta.MetaUtil.*;
+import static jdk.vm.ci.meta.MetaUtil.internalNameToJava;
/**
* Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaTypeProfile.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaTypeProfile.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,9 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.ArrayList;
-import jdk.vm.ci.meta.JavaTypeProfile.*;
+import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType;
/**
* This profile object represents the type profile at a specific BCI. The precision of the supplied
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LIRKind.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LIRKind.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.ArrayList;
/**
* Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the
@@ -57,10 +57,32 @@
*/
public final class LIRKind {
+ private static enum IllegalKind implements PlatformKind {
+ ILLEGAL;
+
+ private final EnumKey<IllegalKind> key = new EnumKey<>(this);
+
+ public Key getKey() {
+ return key;
+ }
+
+ public int getSizeInBytes() {
+ return 0;
+ }
+
+ public int getVectorLength() {
+ return 0;
+ }
+
+ public char getTypeChar() {
+ return '-';
+ }
+ }
+
/**
* The non-type. This uses {@link #unknownReference}, so it can never be part of an oop map.
*/
- public static final LIRKind Illegal = unknownReference(JavaKind.Illegal);
+ public static final LIRKind Illegal = unknownReference(IllegalKind.ILLEGAL);
private final PlatformKind platformKind;
private final int referenceMask;
@@ -70,7 +92,6 @@
private static final int UNKNOWN_REFERENCE = -1;
private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase) {
- assert platformKind != JavaKind.Object : "Kind.Object shouldn't be used in the backend";
this.platformKind = platformKind;
this.referenceMask = referenceMask;
this.derivedReferenceBase = derivedReferenceBase;
@@ -431,21 +452,9 @@
if (src.equals(dst)) {
return true;
}
- /*
- * TODO(je,rs) What we actually want is toStackKind(src.getPlatformKind()).equals(
- * dst.getPlatformKind()) but due to the handling of sub-integer at the current point
- * (phi-)moves from e.g. integer to short can happen. Therefore we compare stack kinds.
- */
- if (toStackKind(src.getPlatformKind()).equals(toStackKind(dst.getPlatformKind()))) {
+ if (src.getPlatformKind().equals(dst.getPlatformKind())) {
return !src.isUnknownReference() || dst.isUnknownReference();
}
return false;
}
-
- private static PlatformKind toStackKind(PlatformKind platformKind) {
- if (platformKind instanceof JavaKind) {
- return ((JavaKind) platformKind).getStackKind();
- }
- return platformKind;
- }
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTableImpl.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTableImpl.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,8 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
public class LocalVariableTableImpl implements LocalVariableTable {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocationIdentity.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocationIdentity.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
+import java.util.IdentityHashMap;
// JaCoCo Exclude
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.meta;
-import java.lang.reflect.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
/**
* Provides access to the metadata of a class typically provided in a class file.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,17 @@
*/
package jdk.vm.ci.meta;
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
/**
* Miscellaneous collection of utility methods used by {@code jdk.vm.ci.meta} and its clients.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MethodHandleAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MethodHandleAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.lang.invoke.*;
+import java.lang.invoke.MethodHandle;
/**
* Interface to access the internals of the {@link MethodHandle} implementation of the VM. An
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ModifiersProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ModifiersProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,20 @@
*/
package jdk.vm.ci.meta;
-import static java.lang.reflect.Modifier.*;
+import static java.lang.reflect.Modifier.ABSTRACT;
+import static java.lang.reflect.Modifier.FINAL;
+import static java.lang.reflect.Modifier.INTERFACE;
+import static java.lang.reflect.Modifier.NATIVE;
+import static java.lang.reflect.Modifier.PRIVATE;
+import static java.lang.reflect.Modifier.PROTECTED;
+import static java.lang.reflect.Modifier.PUBLIC;
+import static java.lang.reflect.Modifier.STATIC;
+import static java.lang.reflect.Modifier.STRICT;
+import static java.lang.reflect.Modifier.SYNCHRONIZED;
+import static java.lang.reflect.Modifier.TRANSIENT;
+import static java.lang.reflect.Modifier.VOLATILE;
-import java.lang.reflect.*;
+import java.lang.reflect.Modifier;
/**
* A Java element (i.e., a class, interface, field or method) that is described by a set of Java
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PlatformKind.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PlatformKind.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,8 +29,6 @@
String name();
- JavaConstant getDefaultValue();
-
public interface Key {
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PrimitiveConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PrimitiveConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.nio.*;
+import java.nio.ByteBuffer;
/**
* Represents a primitive constant value, such as an integer or floating point number, within the
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaField.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,8 @@
*/
package jdk.vm.ci.meta;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
/**
* Represents a reference to a resolved Java field. Fields, like methods and types, are resolved
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,12 @@
*/
package jdk.vm.ci.meta;
-import java.lang.annotation.*;
-import java.lang.invoke.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.invoke.MethodHandle;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
/**
* Represents a resolved Java method. Methods, like fields and types, are resolved through
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,10 @@
*/
package jdk.vm.ci.meta;
-import java.lang.annotation.*;
-import java.net.*;
+import java.lang.annotation.Annotation;
+import java.net.URL;
-import jdk.vm.ci.meta.Assumptions.*;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
/**
* Represents a resolved Java type. Types include primitives, objects, {@code void}, and arrays
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SerializableConstant.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SerializableConstant.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.meta;
-import java.nio.*;
+import java.nio.ByteBuffer;
/**
* Represents a compile-time constant that can be converted to a byte array.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,47 +22,38 @@
*/
package jdk.vm.ci.meta;
-import java.util.*;
-import java.util.concurrent.*;
-
/**
- * Manages a list of unique deoptimization reasons.
+ * Manages unique deoptimization reasons. Reasons are embedded in compiled code and can be
+ * invalidated at run time. Subsequent compilations then should not speculate again on such
+ * invalidated reasons to avoid repeated deoptimization.
*
+ * All methods of this interface are called by the compiler. There is no need for API to register
+ * failed speculations during deoptimization, since every VM has different needs there.
*/
-public abstract class SpeculationLog {
- private volatile Object lastFailed;
- private volatile Collection<Object> speculations;
- private Set<Object> failedSpeculations;
+public interface SpeculationLog {
- public synchronized void collectFailedSpeculations() {
- if (lastFailed != null) {
- if (failedSpeculations == null) {
- failedSpeculations = new HashSet<>(2);
- }
- failedSpeculations.add(lastFailed);
- lastFailed = null;
- speculations = null;
- }
+ /**
+ * Marker interface for speculation objects that can be added to the speculation log.
+ */
+ public interface SpeculationReason {
}
- public boolean maySpeculate(Object reason) {
- if (failedSpeculations != null && failedSpeculations.contains(reason)) {
- return false;
- }
- return true;
- }
+ /**
+ * Must be called before compilation, i.e., before a compiler calls {@link #maySpeculate}.
+ */
+ void collectFailedSpeculations();
- protected void addSpeculation(Object reason) {
- assert maySpeculate(reason);
- if (speculations == null) {
- synchronized (this) {
- if (speculations == null) {
- speculations = new ConcurrentLinkedQueue<>();
- }
- }
- }
- speculations.add(reason);
- }
+ /**
+ * If this method returns true, the compiler is allowed to {@link #speculate} with the given
+ * reason.
+ */
+ boolean maySpeculate(SpeculationReason reason);
- public abstract JavaConstant speculate(Object reason);
+ /**
+ * Registers a speculation that was performed by the compiler.
+ *
+ * @return A compiler constant encapsulating the provided reason. It is usually passed as an
+ * argument to the deoptimization function.
+ */
+ JavaConstant speculate(SpeculationReason reason);
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options.processor/src/jdk/vm/ci/options/processor/OptionProcessor.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options.processor/src/jdk/vm/ci/options/processor/OptionProcessor.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,19 +22,40 @@
*/
package jdk.vm.ci.options.processor;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
-import javax.annotation.processing.*;
-import javax.lang.model.*;
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-import javax.lang.model.util.*;
+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.Modifier;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
import javax.tools.Diagnostic.Kind;
+import javax.tools.JavaFileObject;
-import jdk.vm.ci.options.*;
-
-import javax.tools.*;
+import jdk.vm.ci.options.Option;
+import jdk.vm.ci.options.OptionDescriptor;
+import jdk.vm.ci.options.OptionDescriptors;
+import jdk.vm.ci.options.OptionValue;
/**
* Processes static fields annotated with {@link Option}. An {@link OptionDescriptors}
@@ -105,11 +126,11 @@
DeclaredType declaredOptionValueType = declaredFieldType;
while (!types.isSameType(types.erasure(declaredOptionValueType), types.erasure(optionValueType))) {
List<? extends TypeMirror> directSupertypes = types.directSupertypes(declaredFieldType);
- assert!directSupertypes.isEmpty();
+ assert !directSupertypes.isEmpty();
declaredOptionValueType = (DeclaredType) directSupertypes.get(0);
}
- assert!declaredOptionValueType.getTypeArguments().isEmpty();
+ assert !declaredOptionValueType.getTypeArguments().isEmpty();
String optionType = declaredOptionValueType.getTypeArguments().get(0).toString();
if (optionType.startsWith("java.lang.")) {
optionType = optionType.substring("java.lang.".length());
@@ -194,8 +215,7 @@
if (info.options.size() == 1) {
out.printf(" return %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s);\n", desc, name, type, help, declaringClass, fieldName, optionValue);
} else {
- out.printf(" case \"" + name + "\": return %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s);\n", desc, name, type, help, declaringClass, fieldName,
- optionValue);
+ out.printf(" case \"" + name + "\": return %s.create(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s);\n", desc, name, type, help, declaringClass, fieldName, optionValue);
}
}
out.println(" }");
@@ -241,19 +261,6 @@
}
out.println("}");
}
-
- try {
- createOptionsFile(pkg, topDeclaringClass.toString(), originatingElements);
- } catch (IOException e) {
- processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), info.topDeclaringType);
- }
- }
-
- private void createOptionsFile(String pkg, String relativeName, Element... originatingElements) throws IOException {
- String filename = "META-INF/jvmci.options/" + pkg + "." + relativeName;
- FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements);
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
- writer.close();
}
protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/DerivedOptionValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/DerivedOptionValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,10 @@
*/
package jdk.vm.ci.options;
-import java.io.*;
-import java.util.function.*;
+import java.io.Serializable;
+import java.util.function.Supplier;
-import jdk.vm.ci.options.OptionValue.*;
+import jdk.vm.ci.options.OptionValue.OverrideScope;
/**
* A cached value that needs to be recomputed when an option changes.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/JVMCIJarsOptionDescriptorsProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.options;
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.zip.*;
-
-import jdk.vm.ci.options.OptionsParser.*;
-
-/**
- * Access to the {@link OptionDescriptors} declared by
- * {@code META-INF/services/jdk.vm.ci.options.OptionDescriptors} files in {@code
- * <jre>/lib/jvmci/*.jar}.
- */
-class JVMCIJarsOptionDescriptorsProvider implements OptionDescriptorsProvider {
-
- static final String OptionDescriptorsServiceFile = "META-INF/services/" + OptionDescriptors.class.getName();
-
- private final Iterator<File> jars;
- private final List<OptionDescriptors> optionsDescriptorsList;
-
- JVMCIJarsOptionDescriptorsProvider() {
- List<File> jarsList = findJVMCIJars();
- this.jars = jarsList.iterator();
- this.optionsDescriptorsList = new ArrayList<>(jarsList.size() * 3);
- }
-
- /**
- * Finds the list of JVMCI jars.
- */
- private static List<File> findJVMCIJars() {
- File javaHome = new File(System.getProperty("java.home"));
- File lib = new File(javaHome, "lib");
- File jvmci = new File(lib, "jvmci");
-
- List<File> jarFiles = new ArrayList<>();
- if (jvmci.exists()) {
- for (String fileName : jvmci.list()) {
- if (fileName.endsWith(".jar")) {
- File file = new File(jvmci, fileName);
- if (file.isDirectory()) {
- continue;
- }
- jarFiles.add(file);
- }
- }
- }
- return jarFiles;
- }
-
- public OptionDescriptor get(String name) {
- // Look up loaded option descriptors first
- for (OptionDescriptors optionDescriptors : optionsDescriptorsList) {
- OptionDescriptor desc = optionDescriptors.get(name);
- if (desc != null) {
- return desc;
- }
- }
- while (jars.hasNext()) {
- File path = jars.next();
- try (JarFile jar = new JarFile(path)) {
- ZipEntry entry = jar.getEntry(OptionDescriptorsServiceFile);
- if (entry != null) {
- BufferedReader br = new BufferedReader(new InputStreamReader(jar.getInputStream(entry)));
- String line = null;
- OptionDescriptor desc = null;
- while ((line = br.readLine()) != null) {
- OptionDescriptors options;
- try {
- options = (OptionDescriptors) Class.forName(line).newInstance();
- optionsDescriptorsList.add(options);
- if (desc == null) {
- desc = options.get(name);
- }
- } catch (Exception e) {
- throw new InternalError("Error instantiating class " + line + " read from " + path, e);
- }
- }
- if (desc != null) {
- return desc;
- }
- }
- } catch (IOException e) {
- throw new InternalError("Error reading " + path, e);
- }
- }
- return null;
- }
-}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/NestedBooleanOptionValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/NestedBooleanOptionValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/Option.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/Option.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.options;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Describes the attributes of an option whose {@link OptionValue value} is in a static field
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,9 +22,15 @@
*/
package jdk.vm.ci.options;
-import java.io.*;
-import java.util.*;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
/**
* An option value.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsLoader.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsLoader.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,9 @@
*/
package jdk.vm.ci.options;
-import java.util.*;
+import java.util.ServiceLoader;
+import java.util.SortedMap;
+import java.util.TreeMap;
/**
* Helper class used to load option descriptors. Only to be used in the slow-path.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsParser.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsParser.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,21 +22,33 @@
*/
package jdk.vm.ci.options;
-import static jdk.vm.ci.inittimer.InitTimer.*;
+import static jdk.vm.ci.inittimer.InitTimer.timer;
-import java.io.*;
-import java.util.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Formatter;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.SortedMap;
-import jdk.vm.ci.inittimer.*;
+import jdk.vm.ci.inittimer.InitTimer;
/**
* This class contains methods for parsing JVMCI options and matching them against a set of
- * {@link OptionDescriptors}. The {@link OptionDescriptors} are loaded from JVMCI jars, either
- * {@linkplain JVMCIJarsOptionDescriptorsProvider directly} or via a {@link ServiceLoader}.
+ * {@link OptionDescriptors}. The {@link OptionDescriptors} are loaded via a {@link ServiceLoader}.
*/
public class OptionsParser {
private static final OptionValue<Boolean> PrintFlags = new OptionValue<>(false);
+ private static final OptionValue<Boolean> ShowFlags = new OptionValue<>(false);
/**
* A service for looking up {@link OptionDescriptor}s.
@@ -54,7 +66,7 @@
}
/**
- * Parses the options in {@code <jre>/lib/jvmci/options} if {@code parseOptionsFile == true} and
+ * Parses the options in {@code <jdk>/lib/jvmci.options} if {@code parseOptionsFile == true} and
* the file exists followed by the JVMCI options in {@code options} if {@code options != null}.
*
* Called from VM. This method has an object return type to allow it to be called with a VM
@@ -62,87 +74,158 @@
*
* @param options JVMCI options as serialized (name, value) pairs
* @param parseOptionsFile specifies whether to look for and parse
- * {@code <jre>/lib/jvmci/options}
+ * {@code <jdk>/lib/jvmci.options}
*/
@SuppressWarnings("try")
public static Boolean parseOptionsFromVM(String[] options, boolean parseOptionsFile) {
+
try (InitTimer t = timer("ParseOptions")) {
- JVMCIJarsOptionDescriptorsProvider odp = new JVMCIJarsOptionDescriptorsProvider();
if (parseOptionsFile) {
File javaHome = new File(System.getProperty("java.home"));
File lib = new File(javaHome, "lib");
- File jvmci = new File(lib, "jvmci");
- File jvmciOptions = new File(jvmci, "options");
+ File jvmciOptions = new File(lib, "jvmci.options");
if (jvmciOptions.exists()) {
try (BufferedReader br = new BufferedReader(new FileReader(jvmciOptions))) {
String optionSetting = null;
int lineNo = 1;
+ List<String> optionSettings = new ArrayList<>();
while ((optionSetting = br.readLine()) != null) {
if (!optionSetting.isEmpty() && optionSetting.charAt(0) != '#') {
try {
- parseOptionSetting(optionSetting, null, odp);
+ parseOptionSettingTo(optionSetting, optionSettings);
} catch (Throwable e) {
throw new InternalError("Error parsing " + jvmciOptions + ", line " + lineNo, e);
}
}
lineNo++;
}
+ try {
+ parseOptions(optionSettings.toArray(new String[optionSettings.size()]), null, null, null);
+ } catch (Throwable e) {
+ throw new InternalError("Error parsing an option from " + jvmciOptions, e);
+ }
} catch (IOException e) {
throw new InternalError("Error reading " + jvmciOptions, e);
}
}
}
- if (options != null) {
- assert options.length % 2 == 0;
- for (int i = 0; i < options.length / 2; i++) {
- String name = options[i * 2];
- String value = options[i * 2 + 1];
- parseOption(OptionsLoader.options, name, value, null, odp);
- }
- }
+ parseOptions(options, null, null, null);
}
return Boolean.TRUE;
}
/**
- * Parses a given option setting.
+ * Parses an ordered list of (name, value) pairs assigning values to JVMCI options.
+ *
+ * @param optionSettings JVMCI options as serialized (name, value) pairs
+ * @param setter the object to notify of the parsed option and value
+ * @param odp if non-null, the service to use for looking up {@link OptionDescriptor}s
+ * @param options the options database to use if {@code odp == null}. If
+ * {@code options == null && odp == null}, {@link OptionsLoader#options} is used.
+ * @throws IllegalArgumentException if there's a problem parsing {@code option}
+ */
+ public static void parseOptions(String[] optionSettings, OptionConsumer setter, OptionDescriptorsProvider odp, SortedMap<String, OptionDescriptor> options) {
+ if (optionSettings != null && optionSettings.length != 0) {
+ assert optionSettings.length % 2 == 0;
+
+ moveHelpFlagsToTail(optionSettings);
+
+ for (int i = 0; i < optionSettings.length / 2; i++) {
+ String name = optionSettings[i * 2];
+ String value = optionSettings[i * 2 + 1];
+ parseOption(name, value, setter, odp, options);
+ }
+ if (PrintFlags.getValue() || ShowFlags.getValue()) {
+ Set<String> explicitlyAssigned = new HashSet<>(optionSettings.length / 2);
+ for (int i = 0; i < optionSettings.length / 2; i++) {
+ String name = optionSettings[i * 2];
+ explicitlyAssigned.add(name);
+ }
+ printFlags(resolveOptions(options), "JVMCI", System.out, explicitlyAssigned);
+ if (PrintFlags.getValue()) {
+ System.exit(0);
+ }
+ }
+ }
+ }
+
+ /**
+ * Moves all {@code PrintFlags} and {@code ShowFlags} option settings to the back of
+ * {@code optionSettings}. This allows the help message to show which options had their value
+ * explicitly set (even if to their default value).
+ */
+ private static void moveHelpFlagsToTail(String[] optionSettings) {
+ List<String> tail = null;
+ int insert = 0;
+ for (int i = 0; i < optionSettings.length / 2; i++) {
+ String name = optionSettings[i * 2];
+ String value = optionSettings[i * 2 + 1];
+ if (name.equals("ShowFlags") || name.equals("PrintFlags")) {
+ if (tail == null) {
+ tail = new ArrayList<>(4);
+ insert = i * 2;
+ }
+ tail.add(name);
+ tail.add(value);
+ } else if (tail != null) {
+ optionSettings[insert++] = name;
+ optionSettings[insert++] = value;
+ }
+ }
+ if (tail != null) {
+ assert tail.size() + insert == optionSettings.length;
+ String[] tailArr = tail.toArray(new String[tail.size()]);
+ System.arraycopy(tailArr, 0, optionSettings, insert, tailArr.length);
+ }
+ }
+
+ /**
+ * Parses a given option setting string to a list of (name, value) pairs.
*
* @param optionSetting a string matching the pattern {@code <name>=<value>}
- * @param setter the object to notify of the parsed option and value
*/
- public static void parseOptionSetting(String optionSetting, OptionConsumer setter, OptionDescriptorsProvider odp) {
+ public static void parseOptionSettingTo(String optionSetting, List<String> dst) {
int eqIndex = optionSetting.indexOf('=');
if (eqIndex == -1) {
throw new InternalError("Option setting has does not match the pattern <name>=<value>: " + optionSetting);
}
- String name = optionSetting.substring(0, eqIndex);
- String value = optionSetting.substring(eqIndex + 1);
- parseOption(OptionsLoader.options, name, value, setter, odp);
+ dst.add(optionSetting.substring(0, eqIndex));
+ dst.add(optionSetting.substring(eqIndex + 1));
+ }
+
+ /**
+ * Resolves {@code options} to a non-null value. This ensures {@link OptionsLoader#options} is
+ * only loaded if necessary.
+ */
+ private static SortedMap<String, OptionDescriptor> resolveOptions(SortedMap<String, OptionDescriptor> options) {
+ return options != null ? options : OptionsLoader.options;
}
/**
* Parses a given option name and value.
*
- * @param options
* @param name the option name
* @param valueString the option value as a string
* @param setter the object to notify of the parsed option and value
- * @param odp
- *
+ * @param odp if non-null, the service to use for looking up {@link OptionDescriptor}s
+ * @param options the options database to use if {@code odp == null}. If
+ * {@code options == null && odp == null}, {@link OptionsLoader#options} is used.
* @throws IllegalArgumentException if there's a problem parsing {@code option}
*/
- public static void parseOption(SortedMap<String, OptionDescriptor> options, String name, String valueString, OptionConsumer setter, OptionDescriptorsProvider odp) {
- OptionDescriptor desc = options.get(name);
- if (desc == null && odp != null) {
- desc = odp.get(name);
- }
- if (desc == null && name.equals("PrintFlags")) {
- desc = OptionDescriptor.create("PrintFlags", Boolean.class, "Prints all JVMCI flags and exits", OptionsParser.class, "PrintFlags", PrintFlags);
+ private static void parseOption(String name, String valueString, OptionConsumer setter, OptionDescriptorsProvider odp, SortedMap<String, OptionDescriptor> options) {
+
+ OptionDescriptor desc = odp != null ? odp.get(name) : resolveOptions(options).get(name);
+ if (desc == null) {
+ if (name.equals("PrintFlags")) {
+ desc = OptionDescriptor.create("PrintFlags", Boolean.class, "Prints all JVMCI flags and exits", OptionsParser.class, "PrintFlags", PrintFlags);
+ } else if (name.equals("ShowFlags")) {
+ desc = OptionDescriptor.create("ShowFlags", Boolean.class, "Prints all JVMCI flags and continues", OptionsParser.class, "ShowFlags", ShowFlags);
+ }
}
if (desc == null) {
- List<OptionDescriptor> matches = fuzzyMatch(options, name);
+ List<OptionDescriptor> matches = fuzzyMatch(resolveOptions(options), name);
Formatter msg = new Formatter();
msg.format("Could not find option %s", name);
if (!matches.isEmpty()) {
@@ -182,11 +265,6 @@
} else {
setter.set(desc, value);
}
-
- if (PrintFlags.getValue()) {
- printFlags(options, "JVMCI", System.out);
- System.exit(0);
- }
}
private static long parseLong(String v) {
@@ -252,16 +330,18 @@
return lines;
}
- public static void printFlags(SortedMap<String, OptionDescriptor> sortedOptions, String prefix, PrintStream out) {
+ private static void printFlags(SortedMap<String, OptionDescriptor> sortedOptions, String prefix, PrintStream out, Set<String> explicitlyAssigned) {
out.println("[List of " + prefix + " options]");
for (Map.Entry<String, OptionDescriptor> e : sortedOptions.entrySet()) {
e.getKey();
OptionDescriptor desc = e.getValue();
Object value = desc.getOptionValue().getValue();
List<String> helpLines = wrap(desc.getHelp(), 70);
- out.println(String.format("%9s %-40s = %-14s %s", desc.getType().getSimpleName(), e.getKey(), value, helpLines.get(0)));
+ String name = e.getKey();
+ String assign = explicitlyAssigned.contains(name) ? ":=" : " =";
+ out.printf("%9s %-40s %s %-14s %s%n", desc.getType().getSimpleName(), name, assign, value, helpLines.get(0));
for (int i = 1; i < helpLines.size(); i++) {
- out.println(String.format("%67s %s", " ", helpLines.get(i)));
+ out.printf("%67s %s%n", " ", helpLines.get(i));
}
}
}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCI.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.runtime;
-import java.util.*;
+import java.util.Formatter;
public class JVMCI {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIBackend.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIBackend.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,8 +22,11 @@
*/
package jdk.vm.ci.runtime;
-import jdk.vm.ci.code.*;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.code.CodeCacheProvider;
+import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.code.stack.StackIntrospection;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.MetaAccessProvider;
/**
* A JVMCI backend encapsulates the capabilities needed by a Java based compiler for compiling and
@@ -35,11 +38,13 @@
private final MetaAccessProvider metaAccess;
private final CodeCacheProvider codeCache;
private final ConstantReflectionProvider constantReflection;
+ private final StackIntrospection stackIntrospection;
- public JVMCIBackend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection) {
+ public JVMCIBackend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, StackIntrospection stackIntrospection) {
this.metaAccess = metaAccess;
this.codeCache = codeCache;
this.constantReflection = constantReflection;
+ this.stackIntrospection = stackIntrospection;
}
public MetaAccessProvider getMetaAccess() {
@@ -57,4 +62,8 @@
public TargetDescription getTarget() {
return codeCache.getTarget();
}
+
+ public StackIntrospection getStackIntrospection() {
+ return stackIntrospection;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompiler.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.runtime;
+
+import jdk.vm.ci.code.CompilationRequest;
+
+public interface JVMCICompiler {
+ int INVOCATION_ENTRY_BCI = -1;
+
+ /**
+ * Services a compilation request. This object should compile the method to machine code and
+ * install it in the code cache if the compilation is successful.
+ */
+ void compileMethod(CompilationRequest request);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.runtime;
+
+/**
+ * Factory for a JVMCI compiler.
+ */
+public interface JVMCICompilerFactory {
+
+ /**
+ * Get the name of this compiler. The compiler will be selected when the jvmci.compiler system
+ * property is equal to this name.
+ */
+ String getCompilerName();
+
+ /**
+ * Create a new instance of the {@link JVMCICompiler}.
+ */
+ JVMCICompiler createCompiler(JVMCIRuntime runtime);
+
+ /**
+ * In a tiered system it might be advantageous for startup to keep the JVMCI compiler from
+ * compiling itself so provide a hook to request that certain packages are compiled only by an
+ * optimizing first tier. The prefixes should class or package names using / as the separator,
+ * i.e. jdk/vm/ci for instance.
+ *
+ * @return 0 or more Strings identifying packages that should by compiled by the first tier
+ * only.
+ */
+ default String[] getTrivialPrefixes() {
+ return null;
+ }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIRuntime.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCIRuntime.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*/
package jdk.vm.ci.runtime;
-import jdk.vm.ci.code.*;
+import jdk.vm.ci.code.Architecture;
/**
* Interface for accessing the {@link JVMCI} APIs supported by the runtime.
@@ -30,6 +30,11 @@
public interface JVMCIRuntime {
/**
+ * Gets the default system compiler.
+ */
+ JVMCICompiler getCompiler();
+
+ /**
* Gets the host JVMCI backend.
*/
JVMCIBackend getHostJVMCIBackend();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service.processor/src/jdk/vm/ci/service/processor/ServiceProviderProcessor.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service.processor/src/jdk/vm/ci/service/processor/ServiceProviderProcessor.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,18 +22,25 @@
*/
package jdk.vm.ci.service.processor;
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
-import javax.annotation.processing.*;
-import javax.lang.model.*;
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
+import javax.annotation.processing.AbstractProcessor;
+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.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic.Kind;
+import javax.tools.FileObject;
+import javax.tools.StandardLocation;
-import jdk.vm.ci.service.*;
-
-import javax.tools.*;
+import jdk.vm.ci.service.ServiceProvider;
@SupportedAnnotationTypes("jdk.vm.ci.service.ServiceProvider")
public class ServiceProviderProcessor extends AbstractProcessor {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/.checkstyle_checks.xml Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/.checkstyle_checks.xml Wed Nov 04 07:23:23 2015 -1000
@@ -32,6 +32,10 @@
<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
+ <module name="AvoidStarImport">
+ <property name="allowClassImports" value="false"/>
+ <property name="allowStaticMemberImports" value="false"/>
+ </module>
<module name="NoWhitespaceBefore">
<property name="tokens" value="SEMI,DOT,POST_DEC,POST_INC"/>
</module>
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/src/jdk/vm/ci/service/ServiceProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/src/jdk/vm/ci/service/ServiceProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.service;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Annotates a service provider than can be loaded via {@linkplain Services#load(Class)} or
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/src/jdk/vm/ci/service/Services.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.service/src/jdk/vm/ci/service/Services.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,10 @@
*/
package jdk.vm.ci.service;
-import java.util.*;
+import java.util.Formatter;
+import java.util.Iterator;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
/**
* A mechanism for accessing service providers via JVMCI.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARC.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,14 +22,18 @@
*/
package jdk.vm.ci.sparc;
-import static java.nio.ByteOrder.*;
-import static jdk.vm.ci.code.MemoryBarriers.*;
+import static java.nio.ByteOrder.BIG_ENDIAN;
+import static jdk.vm.ci.code.MemoryBarriers.LOAD_LOAD;
+import static jdk.vm.ci.code.MemoryBarriers.LOAD_STORE;
+import static jdk.vm.ci.code.MemoryBarriers.STORE_STORE;
-import java.util.*;
+import java.util.Set;
-import jdk.vm.ci.code.*;
+import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.Register.RegisterCategory;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.PlatformKind;
/**
* Represents the SPARC architecture.
@@ -37,95 +41,50 @@
public class SPARC extends Architecture {
public static final RegisterCategory CPU = new RegisterCategory("CPU");
+ public static final RegisterCategory FPUs = new RegisterCategory("FPUs");
+ public static final RegisterCategory FPUd = new RegisterCategory("FPUd");
+ public static final RegisterCategory FPUq = new RegisterCategory("FPUq");
// General purpose registers
- public static final Register r0 = new Register(0, 0, "g0", CPU);
- public static final Register r1 = new Register(1, 1, "g1", CPU);
- public static final Register r2 = new Register(2, 2, "g2", CPU);
- public static final Register r3 = new Register(3, 3, "g3", CPU);
- public static final Register r4 = new Register(4, 4, "g4", CPU);
- public static final Register r5 = new Register(5, 5, "g5", CPU);
- public static final Register r6 = new Register(6, 6, "g6", CPU);
- public static final Register r7 = new Register(7, 7, "g7", CPU);
-
- public static final Register r8 = new Register(8, 8, "o0", CPU);
- public static final Register r9 = new Register(9, 9, "o1", CPU);
- public static final Register r10 = new Register(10, 10, "o2", CPU);
- public static final Register r11 = new Register(11, 11, "o3", CPU);
- public static final Register r12 = new Register(12, 12, "o4", CPU);
- public static final Register r13 = new Register(13, 13, "o5", CPU);
- public static final Register r14 = new Register(14, 14, "o6", CPU);
- public static final Register r15 = new Register(15, 15, "o7", CPU);
+ public static final Register g0 = new Register(0, 0, "g0", CPU);
+ public static final Register g1 = new Register(1, 1, "g1", CPU);
+ public static final Register g2 = new Register(2, 2, "g2", CPU);
+ public static final Register g3 = new Register(3, 3, "g3", CPU);
+ public static final Register g4 = new Register(4, 4, "g4", CPU);
+ public static final Register g5 = new Register(5, 5, "g5", CPU);
+ public static final Register g6 = new Register(6, 6, "g6", CPU);
+ public static final Register g7 = new Register(7, 7, "g7", CPU);
- public static final Register r16 = new Register(16, 16, "l0", CPU);
- public static final Register r17 = new Register(17, 17, "l1", CPU);
- public static final Register r18 = new Register(18, 18, "l2", CPU);
- public static final Register r19 = new Register(19, 19, "l3", CPU);
- public static final Register r20 = new Register(20, 20, "l4", CPU);
- public static final Register r21 = new Register(21, 21, "l5", CPU);
- public static final Register r22 = new Register(22, 22, "l6", CPU);
- public static final Register r23 = new Register(23, 23, "l7", CPU);
-
- public static final Register r24 = new Register(24, 24, "i0", CPU);
- public static final Register r25 = new Register(25, 25, "i1", CPU);
- public static final Register r26 = new Register(26, 26, "i2", CPU);
- public static final Register r27 = new Register(27, 27, "i3", CPU);
- public static final Register r28 = new Register(28, 28, "i4", CPU);
- public static final Register r29 = new Register(29, 29, "i5", CPU);
- public static final Register r30 = new Register(30, 30, "i6", CPU);
- public static final Register r31 = new Register(31, 31, "i7", CPU);
+ public static final Register o0 = new Register(8, 8, "o0", CPU);
+ public static final Register o1 = new Register(9, 9, "o1", CPU);
+ public static final Register o2 = new Register(10, 10, "o2", CPU);
+ public static final Register o3 = new Register(11, 11, "o3", CPU);
+ public static final Register o4 = new Register(12, 12, "o4", CPU);
+ public static final Register o5 = new Register(13, 13, "o5", CPU);
+ public static final Register o6 = new Register(14, 14, "o6", CPU);
+ public static final Register o7 = new Register(15, 15, "o7", CPU);
- public static final Register g0 = r0;
- public static final Register g1 = r1;
- public static final Register g2 = r2;
- public static final Register g3 = r3;
- public static final Register g4 = r4;
- public static final Register g5 = r5;
- public static final Register g6 = r6;
- public static final Register g7 = r7;
-
- public static final Register o0 = r8;
- public static final Register o1 = r9;
- public static final Register o2 = r10;
- public static final Register o3 = r11;
- public static final Register o4 = r12;
- public static final Register o5 = r13;
- public static final Register o6 = r14;
- public static final Register o7 = r15;
+ public static final Register l0 = new Register(16, 16, "l0", CPU);
+ public static final Register l1 = new Register(17, 17, "l1", CPU);
+ public static final Register l2 = new Register(18, 18, "l2", CPU);
+ public static final Register l3 = new Register(19, 19, "l3", CPU);
+ public static final Register l4 = new Register(20, 20, "l4", CPU);
+ public static final Register l5 = new Register(21, 21, "l5", CPU);
+ public static final Register l6 = new Register(22, 22, "l6", CPU);
+ public static final Register l7 = new Register(23, 23, "l7", CPU);
- public static final Register l0 = r16;
- public static final Register l1 = r17;
- public static final Register l2 = r18;
- public static final Register l3 = r19;
- public static final Register l4 = r20;
- public static final Register l5 = r21;
- public static final Register l6 = r22;
- public static final Register l7 = r23;
-
- public static final Register i0 = r24;
- public static final Register i1 = r25;
- public static final Register i2 = r26;
- public static final Register i3 = r27;
- public static final Register i4 = r28;
- public static final Register i5 = r29;
- public static final Register i6 = r30;
- public static final Register i7 = r31;
+ public static final Register i0 = new Register(24, 24, "i0", CPU);
+ public static final Register i1 = new Register(25, 25, "i1", CPU);
+ public static final Register i2 = new Register(26, 26, "i2", CPU);
+ public static final Register i3 = new Register(27, 27, "i3", CPU);
+ public static final Register i4 = new Register(28, 28, "i4", CPU);
+ public static final Register i5 = new Register(29, 29, "i5", CPU);
+ public static final Register i6 = new Register(30, 30, "i6", CPU);
+ public static final Register i7 = new Register(31, 31, "i7", CPU);
public static final Register sp = o6;
public static final Register fp = i6;
- // @formatter:off
- public static final Register[] cpuRegisters = {
- r0, r1, r2, r3, r4, r5, r6, r7,
- r8, r9, r10, r11, r12, r13, r14, r15,
- r16, r17, r18, r19, r20, r21, r22, r23,
- r24, r25, r26, r27, r28, r29, r30, r31
- };
- // @formatter:on
-
- public static final RegisterCategory FPUs = new RegisterCategory("FPUs", cpuRegisters.length);
- public static final RegisterCategory FPUd = new RegisterCategory("FPUd", cpuRegisters.length + 32);
-
// Floating point registers
public static final Register f0 = new Register(32, 0, "f0", FPUs);
public static final Register f1 = new Register(33, 1, "f1", FPUs);
@@ -163,67 +122,111 @@
public static final Register f30 = new Register(62, 30, "f30", FPUs);
public static final Register f31 = new Register(63, 31, "f31", FPUs);
- public static final Register d0 = new Register(32, getDoubleEncoding(0), "d0", FPUs);
- public static final Register d2 = new Register(34, getDoubleEncoding(2), "d2", FPUs);
- public static final Register d4 = new Register(36, getDoubleEncoding(4), "d4", FPUs);
- public static final Register d6 = new Register(38, getDoubleEncoding(6), "d6", FPUs);
- public static final Register d8 = new Register(40, getDoubleEncoding(8), "d8", FPUs);
- public static final Register d10 = new Register(42, getDoubleEncoding(10), "d10", FPUs);
- public static final Register d12 = new Register(44, getDoubleEncoding(12), "d12", FPUs);
- public static final Register d14 = new Register(46, getDoubleEncoding(14), "d14", FPUs);
+ // Double precision registers
+ public static final Register d0 = new Register(64, getDoubleEncoding(0), "d0", FPUd);
+ public static final Register d2 = new Register(65, getDoubleEncoding(2), "d2", FPUd);
+ public static final Register d4 = new Register(66, getDoubleEncoding(4), "d4", FPUd);
+ public static final Register d6 = new Register(67, getDoubleEncoding(6), "d6", FPUd);
+ public static final Register d8 = new Register(68, getDoubleEncoding(8), "d8", FPUd);
+ public static final Register d10 = new Register(69, getDoubleEncoding(10), "d10", FPUd);
+ public static final Register d12 = new Register(70, getDoubleEncoding(12), "d12", FPUd);
+ public static final Register d14 = new Register(71, getDoubleEncoding(14), "d14", FPUd);
- public static final Register d16 = new Register(48, getDoubleEncoding(16), "d16", FPUs);
- public static final Register d18 = new Register(50, getDoubleEncoding(18), "d18", FPUs);
- public static final Register d20 = new Register(52, getDoubleEncoding(20), "d20", FPUs);
- public static final Register d22 = new Register(54, getDoubleEncoding(22), "d22", FPUs);
- public static final Register d24 = new Register(56, getDoubleEncoding(24), "d24", FPUs);
- public static final Register d26 = new Register(58, getDoubleEncoding(26), "d26", FPUs);
- public static final Register d28 = new Register(60, getDoubleEncoding(28), "d28", FPUs);
- public static final Register d30 = new Register(62, getDoubleEncoding(28), "d28", FPUs);
+ public static final Register d16 = new Register(72, getDoubleEncoding(16), "d16", FPUd);
+ public static final Register d18 = new Register(73, getDoubleEncoding(18), "d18", FPUd);
+ public static final Register d20 = new Register(74, getDoubleEncoding(20), "d20", FPUd);
+ public static final Register d22 = new Register(75, getDoubleEncoding(22), "d22", FPUd);
+ public static final Register d24 = new Register(76, getDoubleEncoding(24), "d24", FPUd);
+ public static final Register d26 = new Register(77, getDoubleEncoding(26), "d26", FPUd);
+ public static final Register d28 = new Register(78, getDoubleEncoding(28), "d28", FPUd);
+ public static final Register d30 = new Register(79, getDoubleEncoding(28), "d28", FPUd);
+
+ public static final Register d32 = new Register(80, getDoubleEncoding(32), "d32", FPUd);
+ public static final Register d34 = new Register(81, getDoubleEncoding(34), "d34", FPUd);
+ public static final Register d36 = new Register(82, getDoubleEncoding(36), "d36", FPUd);
+ public static final Register d38 = new Register(83, getDoubleEncoding(38), "d38", FPUd);
+ public static final Register d40 = new Register(84, getDoubleEncoding(40), "d40", FPUd);
+ public static final Register d42 = new Register(85, getDoubleEncoding(42), "d42", FPUd);
+ public static final Register d44 = new Register(86, getDoubleEncoding(44), "d44", FPUd);
+ public static final Register d46 = new Register(87, getDoubleEncoding(46), "d46", FPUd);
- public static final Register d32 = new Register(64, getDoubleEncoding(32), "d32", FPUd);
- public static final Register d34 = new Register(65, getDoubleEncoding(34), "d34", FPUd);
- public static final Register d36 = new Register(66, getDoubleEncoding(36), "d36", FPUd);
- public static final Register d38 = new Register(67, getDoubleEncoding(38), "d38", FPUd);
- public static final Register d40 = new Register(68, getDoubleEncoding(40), "d40", FPUd);
- public static final Register d42 = new Register(69, getDoubleEncoding(42), "d42", FPUd);
- public static final Register d44 = new Register(70, getDoubleEncoding(44), "d44", FPUd);
- public static final Register d46 = new Register(71, getDoubleEncoding(46), "d46", FPUd);
+ public static final Register d48 = new Register(88, getDoubleEncoding(48), "d48", FPUd);
+ public static final Register d50 = new Register(89, getDoubleEncoding(50), "d50", FPUd);
+ public static final Register d52 = new Register(90, getDoubleEncoding(52), "d52", FPUd);
+ public static final Register d54 = new Register(91, getDoubleEncoding(54), "d54", FPUd);
+ public static final Register d56 = new Register(92, getDoubleEncoding(56), "d56", FPUd);
+ public static final Register d58 = new Register(93, getDoubleEncoding(58), "d58", FPUd);
+ public static final Register d60 = new Register(94, getDoubleEncoding(60), "d60", FPUd);
+ public static final Register d62 = new Register(95, getDoubleEncoding(62), "d62", FPUd);
- public static final Register d48 = new Register(72, getDoubleEncoding(48), "d48", FPUd);
- public static final Register d50 = new Register(73, getDoubleEncoding(50), "d50", FPUd);
- public static final Register d52 = new Register(74, getDoubleEncoding(52), "d52", FPUd);
- public static final Register d54 = new Register(75, getDoubleEncoding(54), "d54", FPUd);
- public static final Register d56 = new Register(76, getDoubleEncoding(56), "d56", FPUd);
- public static final Register d58 = new Register(77, getDoubleEncoding(58), "d58", FPUd);
- public static final Register d60 = new Register(78, getDoubleEncoding(60), "d60", FPUd);
- public static final Register d62 = new Register(79, getDoubleEncoding(62), "d62", FPUd);
+ // Quad precision registers
+ public static final Register q0 = new Register(96, getQuadncoding(0), "q0", FPUq);
+ public static final Register q4 = new Register(97, getQuadncoding(4), "q4", FPUq);
+ public static final Register q8 = new Register(98, getQuadncoding(8), "q8", FPUq);
+ public static final Register q12 = new Register(99, getQuadncoding(12), "q12", FPUq);
+ public static final Register q16 = new Register(100, getQuadncoding(16), "q16", FPUq);
+ public static final Register q20 = new Register(101, getQuadncoding(20), "q20", FPUq);
+ public static final Register q24 = new Register(102, getQuadncoding(24), "q24", FPUq);
+ public static final Register q28 = new Register(103, getQuadncoding(28), "q28", FPUq);
+
+ public static final Register q32 = new Register(104, getQuadncoding(32), "q32", FPUq);
+ public static final Register q36 = new Register(105, getQuadncoding(36), "q36", FPUq);
+ public static final Register q40 = new Register(106, getQuadncoding(40), "q40", FPUq);
+ public static final Register q44 = new Register(107, getQuadncoding(44), "q44", FPUq);
+ public static final Register q48 = new Register(108, getQuadncoding(48), "q48", FPUq);
+ public static final Register q52 = new Register(109, getQuadncoding(52), "q52", FPUq);
+ public static final Register q56 = new Register(110, getQuadncoding(56), "q56", FPUq);
+ public static final Register q60 = new Register(111, getQuadncoding(60), "q60", FPUq);
// @formatter:off
- public static final Register[] fpuRegisters = {
+ public static final Register[] cpuRegisters = {
+ g0, g1, g2, g3, g4, g5, g6, g7,
+ o0, o1, o2, o3, o4, o5, o6, o7,
+ l0, l1, l2, l3, l4, l5, l6, l7,
+ i0, i1, i2, i3, i4, i5, i6, i7
+ };
+
+ public static final Register[] fpusRegisters = {
+ f0, f1, f2, f3, f4, f5, f6, f7,
+ f8, f9, f10, f11, f12, f13, f14, f15,
+ f16, f17, f18, f19, f20, f21, f22, f23,
+ f24, f25, f26, f27, f28, f29, f30, f31
+ };
+
+ public static final Register[] fpudRegisters = {
+ d0, d2, d4, d6, d8, d10, d12, d14,
+ d16, d18, d20, d22, d24, d26, d28, d30,
+ d32, d34, d36, d38, d40, d42, d44, d46,
+ d48, d50, d52, d54, d56, d58, d60, d62
+ };
+
+ public static final Register[] fpuqRegisters = {
+ q0, q4, q8, q12,
+ q16, q20, q24, q28,
+ q32, q36, q40, q44,
+ q48, q52, q56, q60,
+ };
+
+ public static final Register[] allRegisters = {
+ g0, g1, g2, g3, g4, g5, g6, g7,
+ o0, o1, o2, o3, o4, o5, o6, o7,
+ l0, l1, l2, l3, l4, l5, l6, l7,
+ i0, i1, i2, i3, i4, i5, i6, i7,
+
f0, f1, f2, f3, f4, f5, f6, f7,
f8, f9, f10, f11, f12, f13, f14, f15,
f16, f17, f18, f19, f20, f21, f22, f23,
f24, f25, f26, f27, f28, f29, f30, f31,
- d32, d34, d36, d38, d40, d42, d44, d46,
- d48, d50, d52, d54, d56, d58, d60, d62
- };
- // @formatter:on
- // @formatter:off
- public static final Register[] allRegisters = {
- // CPU
- r0, r1, r2, r3, r4, r5, r6, r7,
- r8, r9, r10, r11, r12, r13, r14, r15,
- r16, r17, r18, r19, r20, r21, r22, r23,
- r24, r25, r26, r27, r28, r29, r30, r31,
- // FPU
- f0, f1, f2, f3, f4, f5, f6, f7,
- f8, f9, f10, f11, f12, f13, f14, f15,
- f16, f17, f18, f19, f20, f21, f22, f23,
- f24, f25, f26, f27, f28, f29, f30, f31,
+ d0, d2, d4, d6, d8, d10, d12, d14,
+ d16, d18, d20, d22, d24, d26, d28, d30,
d32, d34, d36, d38, d40, d42, d44, d46,
- d48, d50, d52, d54, d56, d58, d60, d62
+ d48, d50, d52, d54, d56, d58, d60, d62,
+
+ q0, q4, q8, q12,
+ q16, q20, q24, q28,
+ q32, q36, q40, q44,
+ q48, q52, q56, q60,
};
// @formatter:on
@@ -231,18 +234,6 @@
* Stack bias for stack and frame pointer loads.
*/
public static final int STACK_BIAS = 0x7ff;
- /**
- * In fact there are 64 single floating point registers, 32 of them could be accessed. TODO:
- * Improve handling of these float registers
- */
- public static final int FLOAT_REGISTER_COUNT = 64;
-
- /**
- * Alignment for valid memory access.
- */
- public static final int MEMORY_ACCESS_ALIGN = 4;
-
- public static final int INSTRUCTION_SIZE = 4;
/**
* Size to keep free for flushing the register-window to stack.
@@ -252,90 +243,87 @@
public final Set<CPUFeature> features;
public SPARC(Set<CPUFeature> features) {
- super("SPARC", JavaKind.Long, BIG_ENDIAN, false, allRegisters, LOAD_LOAD | LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8);
+ super("SPARC", SPARCKind.XWORD, BIG_ENDIAN, false, allRegisters, LOAD_LOAD | LOAD_STORE | STORE_STORE, 1, 8);
this.features = features;
}
@Override
- public boolean canStoreValue(RegisterCategory category, PlatformKind lirKind) {
- if (!(lirKind instanceof JavaKind)) {
- return false;
- }
+ public Register[] getAvailableValueRegisters() {
+ return allRegisters;
+ }
- JavaKind kind = (JavaKind) lirKind;
- if (category.equals(CPU)) {
- switch (kind) {
- case Boolean:
- case Byte:
- case Char:
- case Short:
- case Int:
- case Long:
- return true;
- }
- } else if (category.equals(FPUs) && kind.equals(JavaKind.Float)) {
- return true;
- } else if (category.equals(FPUd) && kind.equals(JavaKind.Double)) {
- return true;
+ @Override
+ public boolean canStoreValue(RegisterCategory category, PlatformKind kind) {
+ SPARCKind sparcKind = (SPARCKind) kind;
+ switch (sparcKind) {
+ case BYTE:
+ case HWORD:
+ case WORD:
+ case XWORD:
+ return CPU.equals(category);
+ case SINGLE:
+ case V32_BYTE:
+ case V32_HWORD:
+ return FPUs.equals(category);
+ case DOUBLE:
+ case V64_BYTE:
+ case V64_HWORD:
+ case V64_WORD:
+ case V64_SINGLE:
+ return FPUd.equals(category);
+ case QUAD:
+ return FPUq.equals(category);
+ default:
+ return false;
}
- return false;
}
@Override
public PlatformKind getLargestStorableKind(RegisterCategory category) {
if (category.equals(CPU)) {
- return JavaKind.Long;
+ return SPARCKind.XWORD;
} else if (category.equals(FPUd)) {
- return JavaKind.Double;
+ return SPARCKind.DOUBLE;
} else if (category.equals(FPUs)) {
- return JavaKind.Float;
+ return SPARCKind.SINGLE;
+ } else if (category.equals(FPUq)) {
+ return SPARCKind.QUAD;
} else {
- return JavaKind.Illegal;
+ throw new IllegalArgumentException("Unknown register category: " + category);
}
}
@Override
public PlatformKind getPlatformKind(JavaKind javaKind) {
- if (javaKind.isObject()) {
- return JavaKind.Long;
- } else {
- return javaKind;
+ switch (javaKind) {
+ case Boolean:
+ case Byte:
+ return SPARCKind.BYTE;
+ case Short:
+ case Char:
+ return SPARCKind.HWORD;
+ case Int:
+ return SPARCKind.WORD;
+ case Long:
+ case Object:
+ return SPARCKind.XWORD;
+ case Float:
+ return SPARCKind.SINGLE;
+ case Double:
+ return SPARCKind.DOUBLE;
+ default:
+ throw new IllegalArgumentException("Unknown JavaKind: " + javaKind);
}
}
- public static int spillSlotSize(TargetDescription td, PlatformKind kind) {
- return Math.max(td.getSizeInBytes(kind), MEMORY_ACCESS_ALIGN);
- }
-
- public static int getDoubleEncoding(int reg) {
+ private static int getDoubleEncoding(int reg) {
assert reg < 64 && ((reg & 1) == 0);
- // ignore v8 assertion for now
return (reg & 0x1e) | ((reg & 0x20) >> 5);
}
- public static boolean isCPURegister(Register r) {
- return r.getRegisterCategory().equals(CPU);
- }
-
- public static boolean isCPURegister(Register... regs) {
- for (Register reg : regs) {
- if (!isCPURegister(reg)) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean isGlobalRegister(Register r) {
- return isCPURegister(r) && g0.number <= r.number && r.number <= g7.number;
- }
-
- public static boolean isSingleFloatRegister(Register r) {
- return r.name.startsWith("f");
- }
-
- public static boolean isDoubleFloatRegister(Register r) {
- return r.name.startsWith("d");
+ private static int getQuadncoding(int reg) {
+ assert reg < 64 && ((reg & 1) == 0);
+ return (reg & 0x1c) | ((reg & 0x20) >> 5);
}
public Set<CPUFeature> getFeatures() {
@@ -351,6 +339,24 @@
VIS2,
VIS3,
CBCOND,
- BLOCK_ZEROING
+ V8,
+ HARDWARE_MUL32,
+ HARDWARE_DIV32,
+ HARDWARE_FSMULD,
+ HARDWARE_POPC,
+ V9,
+ SUN4V,
+ BLK_INIT_INSTRUCTIONS,
+ FMAF,
+ FMAU,
+ SPARC64_FAMILY,
+ M_FAMILY,
+ T_FAMILY,
+ T1_MODEL,
+ SPARC5,
+ AES,
+ SHA1,
+ SHA256,
+ SHA512
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2015, 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.sparc;
+
+import jdk.vm.ci.meta.PlatformKind;
+
+public enum SPARCKind implements PlatformKind {
+ BYTE(1),
+ HWORD(2),
+ WORD(4),
+ XWORD(8),
+ SINGLE(4),
+ DOUBLE(8),
+ QUAD(16),
+
+ V32_BYTE(4, BYTE),
+ V32_HWORD(4, HWORD),
+
+ V64_BYTE(8, BYTE),
+ V64_HWORD(8, HWORD),
+ V64_WORD(8, WORD),
+ V64_SINGLE(8, SINGLE);
+
+ private final int size;
+ private final int vectorLength;
+
+ private final SPARCKind scalar;
+ private final EnumKey<SPARCKind> key = new EnumKey<>(this);
+
+ private SPARCKind(int size) {
+ this.size = size;
+ this.scalar = this;
+ this.vectorLength = 1;
+ }
+
+ private SPARCKind(int size, SPARCKind scalar) {
+ this.size = size;
+ this.scalar = scalar;
+
+ assert size % scalar.size == 0;
+ this.vectorLength = size / scalar.size;
+ }
+
+ public SPARCKind getScalar() {
+ return scalar;
+ }
+
+ public int getSizeInBytes() {
+ return size;
+ }
+
+ public int getSizeInBits() {
+ return getSizeInBytes() * 8;
+ }
+
+ public int getVectorLength() {
+ return vectorLength;
+ }
+
+ public Key getKey() {
+ return key;
+ }
+
+ public boolean isInteger() {
+ switch (this) {
+ case BYTE:
+ case HWORD:
+ case WORD:
+ case XWORD:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ public boolean isFloat() {
+ return !isInteger();
+ }
+
+ public char getTypeChar() {
+ switch (this) {
+ case BYTE:
+ return 'b';
+ case HWORD:
+ return 'h';
+ case WORD:
+ return 'w';
+ case XWORD:
+ return 'd';
+ case SINGLE:
+ return 'S';
+ case DOUBLE:
+ case V64_BYTE:
+ case V64_HWORD:
+ case V64_WORD:
+ return 'D';
+ default:
+ return '-';
+ }
+ }
+}
--- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -65,6 +65,8 @@
}
inline void os::dll_unload(void *lib) { ::dlclose(lib); }
+inline const int os::default_file_open_flags() { return 0;}
+
inline DIR* os::opendir(const char* dirname) {
assert(dirname != NULL, "just checking");
return ::opendir(dirname);
--- a/hotspot/src/share/vm/code/nmethod.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/code/nmethod.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -1350,20 +1350,17 @@
// Unregister must be done before the state change
Universe::heap()->unregister_nmethod(this);
+ _state = unloaded;
+
#if INCLUDE_JVMCI
// The method can only be unloaded after the pointer to the installed code
// Java wrapper is no longer alive. Here we need to clear out this weak
// reference to the dead object. Nulling out the reference has to happen
// after the method is unregistered since the original value may be still
// tracked by the rset.
- if (_jvmci_installed_code != NULL) {
- InstalledCode::set_address(_jvmci_installed_code, 0);
- _jvmci_installed_code = NULL;
- }
+ maybe_invalidate_installed_code();
#endif
- _state = unloaded;
-
// Log the unloading.
log_state_change();
@@ -1525,12 +1522,8 @@
} else {
assert(state == not_entrant, "other cases may need to be handled differently");
}
-#if INCLUDE_JVMCI
- if (_jvmci_installed_code != NULL) {
- // Break the link between nmethod and InstalledCode such that the nmethod can subsequently be flushed safely.
- InstalledCode::set_address(_jvmci_installed_code, 0);
- }
-#endif
+
+ JVMCI_ONLY(maybe_invalidate_installed_code());
if (TraceCreateZombies) {
ResourceMark m;
@@ -3384,6 +3377,22 @@
#endif // !PRODUCT
#if INCLUDE_JVMCI
+void nmethod::maybe_invalidate_installed_code() {
+ if (_jvmci_installed_code != NULL) {
+ if (!is_alive()) {
+ // Break the link between nmethod and InstalledCode such that the nmethod
+ // can subsequently be flushed safely. The link must be maintained while
+ // the method could have live activations since invalidateInstalledCode
+ // might want to invalidate all existing activations.
+ InstalledCode::set_address(_jvmci_installed_code, 0);
+ InstalledCode::set_entryPoint(_jvmci_installed_code, 0);
+ _jvmci_installed_code = NULL;
+ } else if (is_not_entrant()) {
+ InstalledCode::set_entryPoint(_jvmci_installed_code, 0);
+ }
+ }
+}
+
char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) {
if (!this->is_compiled_by_jvmci()) {
return NULL;
--- a/hotspot/src/share/vm/code/nmethod.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/code/nmethod.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -603,6 +603,7 @@
oop jvmci_installed_code() { return _jvmci_installed_code ; }
char* jvmci_installed_code_name(char* buf, size_t buflen);
void set_jvmci_installed_code(oop installed_code) { _jvmci_installed_code = installed_code; }
+ void maybe_invalidate_installed_code();
oop speculation_log() { return _speculation_log ; }
void set_speculation_log(oop speculation_log) { _speculation_log = speculation_log; }
#endif
--- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -162,6 +162,9 @@
bool is_jvmci() { return _type == jvmci; }
bool is_shark() { return _type == shark; }
+ // Extra tests to identify trivial methods for the tiered compilation policy.
+ virtual bool is_trivial(Method* method) { return false; }
+
// Customization
virtual void initialize () = 0;
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -480,7 +480,7 @@
} while (should_repeat == true);
#if INCLUDE_JVMCI
- if (UseJVMCICompiler && h_method->method_data() != NULL) {
+ if (EnableJVMCI && h_method->method_data() != NULL) {
ResourceMark rm(thread);
ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci, NULL);
if (pdata != NULL && pdata->is_BitData()) {
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -142,42 +142,38 @@
return map;
}
-static void record_metadata_reference(oop obj, jlong prim, jboolean compressed, OopRecorder* oop_recorder) {
+Metadata* CodeInstaller::record_metadata_reference(Handle& constant) {
+ oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
- if (compressed) {
- assert(Klass::decode_klass((narrowKlass) prim) == klass, "%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim);
- } else {
- assert((Klass*) prim == klass, "%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim);
- }
- int index = oop_recorder->find_index(klass);
- TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), klass->name()->as_C_string());
+ assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass));
+ int index = _oop_recorder->find_index(klass);
+ TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
+ return klass;
} else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
- assert(!compressed, "unexpected compressed method pointer %s @ " INTPTR_FORMAT " = " PTR64_FORMAT, method->name()->as_C_string(), p2i(method), prim);
- int index = oop_recorder->find_index(method);
- TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), method->name()->as_C_string());
+ assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method));
+ int index = _oop_recorder->find_index(method);
+ TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string());
+ return method;
} else {
- assert(java_lang_String::is_instance(obj),
- "unexpected metadata reference (%s) for constant " JLONG_FORMAT " (" PTR64_FORMAT ")", obj->klass()->name()->as_C_string(), prim, prim);
+ fatal("unexpected metadata reference for constant of type %s", obj->klass()->name()->as_C_string());
+ return NULL;
}
}
-// Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectTypeImpl.klass()).
-static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
- if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
- oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
- jlong prim = HotSpotMetaspaceConstantImpl::primitive(constant);
- assert(obj != NULL, "must have an object");
- assert(prim != 0, "must have a primitive value");
+#ifdef _LP64
+narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle& constant) {
+ oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
+ assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer");
+ assert(obj->is_a(HotSpotResolvedObjectTypeImpl::klass()), "unexpected compressed pointer of type %s", obj->klass()->name()->as_C_string());
- record_metadata_reference(obj, prim, false, oop_recorder);
- }
+ Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
+ int index = _oop_recorder->find_index(klass);
+ TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
+ return Klass::encode_klass(klass);
}
-
-static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) {
- record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
-}
+#endif
Location::Type CodeInstaller::get_oop_type(oop value) {
oop lirKind = Value::lirKind(value);
@@ -253,7 +249,6 @@
}
return value;
} else if (value->is_a(JavaConstant::klass())) {
- record_metadata_in_constant(value, _oop_recorder);
if (value->is_a(PrimitiveConstant::klass())) {
if (value->is_a(RawConstant::klass())) {
jlong prim = PrimitiveConstant::primitive(value);
@@ -379,14 +374,15 @@
}
}
}
- objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
- if (!methods.is_null()) {
- int length = methods->length();
- for (int i = 0; i < length; ++i) {
- Handle method_handle = methods->obj_at(i);
- methodHandle method = getMethodFromHotSpotMethod(method_handle());
-
- _dependencies->assert_evol_method(method());
+ if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
+ objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
+ if (!methods.is_null()) {
+ int length = methods->length();
+ for (int i = 0; i < length; ++i) {
+ Handle method_handle = methods->obj_at(i);
+ methodHandle method = getMethodFromHotSpotMethod(method_handle());
+ _dependencies->assert_evol_method(method());
+ }
}
}
}
@@ -543,7 +539,7 @@
}
int CodeInstaller::estimate_stubs_size() {
- // Return size for all stubs.
+ // Estimate the number of static call stubs that might be emitted.
int static_call_stubs = 0;
objArrayOop sites = this->sites();
for (int i = 0; i < sites->length(); i++) {
@@ -564,6 +560,7 @@
// perform data and call relocation on the CodeBuffer
JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
+ HandleMark hm;
objArrayHandle sites = this->sites();
int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
@@ -606,14 +603,22 @@
Handle reference = CompilationResult_DataPatch::reference(patch);
assert(reference->is_a(CompilationResult_ConstantReference::klass()), "patch in data section must be a ConstantReference");
Handle constant = CompilationResult_ConstantReference::constant(reference);
+ address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
- record_metadata_in_patch(constant, _oop_recorder);
+ if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
+#ifdef _LP64
+ *((narrowKlass*) dest) = record_narrow_metadata_reference(constant);
+#else
+ fatal("unexpected compressed Klass* in 32-bit mode");
+#endif
+ } else {
+ *((Metadata**) dest) = record_metadata_reference(constant);
+ }
} else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
Handle obj = HotSpotObjectConstantImpl::object(constant);
jobject value = JNIHandles::make_local(obj());
int oop_index = _oop_recorder->find_index(value);
- address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
if (HotSpotObjectConstantImpl::compressed(constant)) {
#ifdef _LP64
_constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const);
@@ -960,7 +965,7 @@
if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
pd_patch_OopConstant(pc_offset, constant);
} else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
- record_metadata_in_patch(constant, _oop_recorder);
+ pd_patch_MetaspaceConstant(pc_offset, constant);
} else if (constant->is_a(HotSpotSentinelConstant::klass())) {
fatal("sentinel constant unsupported");
} else {
@@ -1014,6 +1019,7 @@
case POLL_RETURN_FAR:
pd_relocate_poll(pc, id);
break;
+ case CARD_TABLE_SHIFT:
case CARD_TABLE_ADDRESS:
case HEAP_TOP_ADDRESS:
case HEAP_END_ADDRESS:
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -107,10 +107,11 @@
POLL_FAR = 13,
POLL_RETURN_FAR = 14,
CARD_TABLE_ADDRESS = 15,
- HEAP_TOP_ADDRESS = 16,
- HEAP_END_ADDRESS = 17,
- NARROW_KLASS_BASE_ADDRESS = 18,
- CRC_TABLE_ADDRESS = 19,
+ CARD_TABLE_SHIFT = 16,
+ HEAP_TOP_ADDRESS = 17,
+ HEAP_END_ADDRESS = 18,
+ NARROW_KLASS_BASE_ADDRESS = 19,
+ CRC_TABLE_ADDRESS = 20,
INVOKE_INVALID = -1
};
@@ -155,8 +156,8 @@
jint pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method);
void pd_patch_OopConstant(int pc_offset, Handle& constant);
+ void pd_patch_MetaspaceConstant(int pc_offset, Handle& constant);
void pd_patch_DataSectionReference(int pc_offset, int data_offset);
- void pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst);
void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination);
void pd_relocate_JavaMethod(oop method, jint pc_offset);
void pd_relocate_poll(address pc, jint mark);
@@ -170,11 +171,10 @@
objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
#endif
- void record_resolved(oop obj);
-
oop word_kind() { return (oop) JNIHandles::resolve(_word_kind_handle); }
public:
+
CodeInstaller() : _arena(mtCompiler) {}
JVMCIEnv::CodeInstallResult gather_metadata(Handle target, Handle& compiled_code, CodeMetadata& metadata);
@@ -191,6 +191,11 @@
ScopeValue* get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
+ Metadata* record_metadata_reference(Handle& constant);
+#ifdef _LP64
+ narrowKlass record_narrow_metadata_reference(Handle& constant);
+#endif
+
// extract the fields of the CompilationResult
void initialize_fields(oop target, oop target_method);
void initialize_dependencies(oop target_method, OopRecorder* oop_recorder);
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -57,6 +57,10 @@
}
void JVMCICompiler::bootstrap() {
+ if (Arguments::mode() == Arguments::_int) {
+ // Nothing to do in -Xint mode
+ return;
+ }
#ifndef PRODUCT
// We turn off CompileTheWorld so that compilation requests are not
// ignored during bootstrap or that JVMCI can be compiled by C1/C2.
@@ -125,22 +129,40 @@
Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
JavaValue method_result(T_OBJECT);
- {
+ JavaCallArguments args;
+ args.push_long((jlong) (address) method());
+ JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(),
+ vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, THREAD);
+
+ if (!HAS_PENDING_EXCEPTION) {
+ JavaValue result(T_VOID);
JavaCallArguments args;
- args.push_long((jlong) (address) method());
- JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_ABORT);
+ args.push_oop(receiver);
+ args.push_oop((oop)method_result.get_jobject());
+ args.push_int(entry_bci);
+ args.push_long((jlong) (address) env);
+ args.push_int(env->task()->compile_id());
+ JavaCalls::call_special(&result, receiver->klass(),
+ vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
}
- JavaValue result(T_VOID);
- JavaCallArguments args;
- args.push_oop(receiver);
- args.push_oop((oop)method_result.get_jobject());
- args.push_int(entry_bci);
- args.push_long((jlong) (address) env);
- args.push_int(env->task()->compile_id());
- JavaCalls::call_special(&result, receiver->klass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, CHECK_ABORT);
+ // An uncaught exception was thrown during compilation. Generally these
+ // should be handled by the Java code in some useful way but if they leak
+ // through to here report them instead of dying or silently ignoring them.
+ if (HAS_PENDING_EXCEPTION) {
+ Handle throwable = PENDING_EXCEPTION;
+ CLEAR_PENDING_EXCEPTION;
- _methodsCompiled++;
+ JVMCIRuntime::call_printStackTrace(throwable, THREAD);
+ if (HAS_PENDING_EXCEPTION) {
+ CLEAR_PENDING_EXCEPTION;
+ }
+
+ // Something went wrong so disable compilation at this level
+ method->set_not_compilable(CompLevel_full_optimization);
+ } else {
+ _methodsCompiled++;
+ }
}
@@ -149,6 +171,13 @@
ShouldNotReachHere();
}
+bool JVMCICompiler::is_trivial(Method* method) {
+ if (_bootstrapping) {
+ return false;
+ }
+ return JVMCIRuntime::treat_as_trivial(method);
+}
+
// Print compilation timers and statistics
void JVMCICompiler::print_timers() {
print_compilation_timers();
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -73,6 +73,8 @@
void compile_method(methodHandle target, int entry_bci, JVMCIEnv* env);
+ virtual bool is_trivial(Method* method);
+
// Print compilation timers and statistics
virtual void print_timers();
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -84,6 +84,24 @@
return NULL;
}
+void CompilerToVM::invalidate_installed_code(Handle installedCode, TRAPS) {
+ if (installedCode() == NULL) {
+ THROW(vmSymbols::java_lang_NullPointerException());
+ }
+ jlong nativeMethod = InstalledCode::address(installedCode);
+ nmethod* nm = (nmethod*)nativeMethod;
+ assert(nm == NULL || nm->jvmci_installed_code() == installedCode(), "sanity check");
+ if (nm != NULL && nm->is_alive()) {
+ // The nmethod state machinery maintains the link between the
+ // HotSpotInstalledCode and nmethod* so as long as the nmethod appears to be
+ // alive assume there is work to do and deoptimize the nmethod.
+ nm->mark_for_deoptimization();
+ VM_Deoptimize op;
+ VMThread::execute(&op);
+ }
+ InstalledCode::set_address(installedCode, 0);
+}
+
extern "C" {
extern VMStructEntry* gHotSpotVMStructs;
extern uint64_t gHotSpotVMStructEntryTypeNameOffset;
@@ -538,8 +556,8 @@
if (!method->method_holder()->is_interface()) {
THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string()));
}
- if (!InstanceKlass::cast(klass)->is_initialized()) {
- THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be initialized", klass->external_name()));
+ if (!InstanceKlass::cast(klass)->is_linked()) {
+ THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name()));
}
return LinkResolver::vtable_index_of_interface_method(klass, method);
C2V_END
@@ -670,8 +688,13 @@
} else {
if (!installed_code_handle.is_null()) {
assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type");
+ CompilerToVM::invalidate_installed_code(installed_code_handle, CHECK_0);
InstalledCode::set_address(installed_code_handle, (jlong) cb);
- InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
+ if (cb->is_nmethod()) {
+ InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->as_nmethod_or_null()->verified_entry_point());
+ } else {
+ InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->code_begin());
+ }
if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
HotSpotInstalledCode::set_size(installed_code_handle, cb->size());
HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin());
@@ -782,10 +805,19 @@
stats->_osr.reset();
C2V_END
-C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jlong codeBlob))
+C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject installedCode))
ResourceMark rm;
HandleMark hm;
+ if (installedCode == NULL) {
+ THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "installedCode is null");
+ }
+
+ jlong codeBlob = InstalledCode::address(installedCode);
+ if (codeBlob == 0L) {
+ return NULL;
+ }
+
CodeBlob* cb = (CodeBlob*) (address) codeBlob;
if (cb == NULL) {
return NULL;
@@ -936,15 +968,9 @@
C2V_END
-C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject hotspotInstalledCode))
- jlong nativeMethod = InstalledCode::address(hotspotInstalledCode);
- nmethod* m = (nmethod*)nativeMethod;
- if (m != NULL && !m->is_not_entrant()) {
- m->mark_for_deoptimization();
- VM_Deoptimize op;
- VMThread::execute(&op);
- }
- InstalledCode::set_address(hotspotInstalledCode, 0);
+C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject installed_code))
+ Handle installed_code_handle = JNIHandles::resolve(installed_code);
+ CompilerToVM::invalidate_installed_code(installed_code_handle, CHECK);
C2V_END
C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr))
@@ -991,7 +1017,8 @@
objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods);
for (int i = 0; i < methods_oop->length(); i++) {
- if (CompilerToVM::asMethod(methods_oop->obj_at(i)) == method) {
+ oop resolved = methods_oop->obj_at(i);
+ if (resolved->is_a(HotSpotResolvedJavaMethodImpl::klass()) && CompilerToVM::asMethod(resolved) == method) {
return true;
}
}
@@ -1284,11 +1311,29 @@
tty->flush();
C2V_END
+C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position))
+ ResourceMark rm;
+ MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data);
+ ProfileData* profile_data = mdo->data_at(position);
+ if (mdo->is_valid(profile_data)) {
+ return profile_data->size_in_bytes();
+ }
+ DataLayout* data = mdo->extra_data_base();
+ DataLayout* end = mdo->extra_data_limit();
+ for (;; data = mdo->next_extra(data)) {
+ assert(data < end, "moved past end of extra data");
+ profile_data = data->data_in();
+ if (mdo->dp_to_di(profile_data->dp()) == position) {
+ return profile_data->size_in_bytes();
+ }
+ }
+ THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position));
+C2V_END
+
#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
-#define SPECULATION_LOG "Ljdk/vm/ci/meta/SpeculationLog;"
#define STRING "Ljava/lang/String;"
#define OBJECT "Ljava/lang/Object;"
#define CLASS "Ljava/lang/Class;"
@@ -1300,8 +1345,10 @@
#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_METADATA "Ljdk/vm/ci/hotspot/HotSpotMetaData;"
#define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;"
+#define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;"
#define METASPACE_METHOD_DATA "J"
JNINativeMethod CompilerToVM::methods[] = {
@@ -1339,12 +1386,12 @@
{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"()J", FN_PTR(initializeConfiguration)},
- {CC"installCode", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I", FN_PTR(installCode)},
+ {CC"initializeConfiguration", CC"("HS_CONFIG")J", FN_PTR(initializeConfiguration)},
+ {CC"installCode", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG")I", FN_PTR(installCode)},
{CC"getMetadata", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE HS_METADATA")I", FN_PTR(getMetadata)},
{CC"notifyCompilationStatistics", CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V", FN_PTR(notifyCompilationStatistics)},
{CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)},
- {CC"disassembleCodeBlob", CC"(J)"STRING, FN_PTR(disassembleCodeBlob)},
+ {CC"disassembleCodeBlob", CC"("INSTALLED_CODE")"STRING, FN_PTR(disassembleCodeBlob)},
{CC"executeInstalledCode", CC"(["OBJECT INSTALLED_CODE")"OBJECT, FN_PTR(executeInstalledCode)},
{CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)},
{CC"getLocalVariableTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getLocalVariableTableStart)},
@@ -1357,11 +1404,12 @@
{CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)},
{CC"hasCompiledCodeForOSR", CC"("HS_RESOLVED_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)},
{CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)},
- {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["HS_RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
+ {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
{CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)},
{CC"shouldDebugNonSafepoints", CC"()Z", FN_PTR(shouldDebugNonSafepoints)},
{CC"writeDebugOutput", CC"([BII)V", FN_PTR(writeDebugOutput)},
{CC"flushDebugOutput", CC"()V", FN_PTR(flushDebugOutput)},
+ {CC"methodDataProfileDataSize", CC"(JI)I", FN_PTR(methodDataProfileDataSize)},
};
int CompilerToVM::methods_count() {
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -97,6 +97,8 @@
static oop get_jvmci_method(methodHandle method, TRAPS);
static oop get_jvmci_type(KlassHandle klass, TRAPS);
+
+ static void invalidate_installed_code(Handle installedCode, TRAPS);
};
class JavaArgumentUnboxer : public SignatureIterator {
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -494,12 +494,12 @@
MethodData* mdp = method()->method_data();
if (mdp != NULL) {
mdp->inc_decompile_count();
+#ifdef ASSERT
if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {
- // TODO (chaeubl) enable this in the fastdebug build only once we are more stable
ResourceMark m;
tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
- //ShouldNotReachHere();
}
+#endif
}
// All buffers in the CodeBuffer are allocated in the CodeCache.
--- a/hotspot/src/share/vm/jvmci/jvmciJavaClasses.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciJavaClasses.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -71,7 +71,6 @@
void JVMCIJavaClasses::compute_offsets() {
COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
- guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!");
}
#define EMPTY0
--- a/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -65,6 +65,7 @@
end_class \
start_class(InstalledCode) \
long_field(InstalledCode, address) \
+ long_field(InstalledCode, entryPoint) \
long_field(InstalledCode, version) \
oop_field(InstalledCode, name, "Ljava/lang/String;") \
end_class \
@@ -215,8 +216,7 @@
boolean_field(HotSpotObjectConstantImpl, compressed) \
end_class \
start_class(HotSpotMetaspaceConstantImpl) \
- long_field(HotSpotMetaspaceConstantImpl, primitive) \
- oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljava/lang/Object;") \
+ oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljdk/vm/ci/hotspot/MetaspaceWrapperObject;") \
boolean_field(HotSpotMetaspaceConstantImpl, compressed) \
end_class \
start_class(HotSpotSentinelConstant) \
@@ -261,11 +261,11 @@
end_class \
start_class(StackLockValue) \
oop_field(StackLockValue, owner, "Ljdk/vm/ci/meta/JavaValue;") \
- oop_field(StackLockValue, slot, "Ljdk/vm/ci/code/StackSlotValue;") \
+ oop_field(StackLockValue, slot, "Ljdk/vm/ci/meta/AllocatableValue;") \
boolean_field(StackLockValue, eliminated) \
end_class \
- start_class(SpeculationLog) \
- oop_field(SpeculationLog, lastFailed, "Ljava/lang/Object;") \
+ start_class(HotSpotSpeculationLog) \
+ oop_field(HotSpotSpeculationLog, lastFailed, "Ljava/lang/Object;") \
end_class \
start_class(HotSpotStackFrameReference) \
oop_field(HotSpotStackFrameReference, compilerToVM, "Ljdk/vm/ci/hotspot/CompilerToVM;") \
@@ -292,9 +292,11 @@
start_class(HotSpotConstantPool) \
long_field(HotSpotConstantPool, metaspaceConstantPool) \
end_class \
+ start_class(HotSpotJVMCIRuntime) \
+ objArrayOop_field(HotSpotJVMCIRuntime, trivialPrefixes, "[Ljava/lang/String;") \
+ end_class \
/* end*/
-
#define START_CLASS(name) \
class name : AllStatic { \
private: \
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -52,6 +52,8 @@
const char* JVMCIRuntime::_compiler = NULL;
int JVMCIRuntime::_options_count = 0;
SystemProperty** JVMCIRuntime::_options = NULL;
+int JVMCIRuntime::_trivial_prefixes_count = 0;
+char** JVMCIRuntime::_trivial_prefixes = NULL;
bool JVMCIRuntime::_shutdown_called = false;
static const char* OPTION_PREFIX = "jvmci.option.";
@@ -433,12 +435,13 @@
}
JRT_END
-JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags))
- bool string = mask_bits_are_true(flags, LOG_OBJECT_STRING);
- bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS);
- bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE);
- if (!string) {
- if (!addr && obj->is_oop_or_null(true)) {
+JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline))
+ ttyLocker ttyl;
+
+ if (obj == NULL) {
+ tty->print("NULL");
+ } else if (obj->is_oop_or_null(true) && (!as_string || !java_lang_String::is_instance(obj))) {
+ if (obj->is_oop_or_null(true)) {
char buf[O_BUFLEN];
tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
} else {
@@ -628,10 +631,10 @@
static bool jvmci_options_file_exists() {
const char* home = Arguments::get_java_home();
- size_t path_len = strlen(home) + strlen("/lib/jvmci/options") + 1;
+ size_t path_len = strlen(home) + strlen("/lib/jvmci.options") + 1;
char path[JVM_MAXPATHLEN];
char sep = os::file_separator()[0];
- jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci%coptions", home, sep, sep, sep);
+ jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci.options", home, sep, sep);
struct stat st;
return os::stat(path, &st) == 0;
}
@@ -656,7 +659,8 @@
for (int i = 0; i < _options_count; i++) {
SystemProperty* prop = _options[i];
oop name = java_lang_String::create_oop_from_str(prop->key() + OPTION_PREFIX_LEN, CHECK);
- oop value = java_lang_String::create_oop_from_str(prop->value(), CHECK);
+ const char* prop_value = prop->value() != NULL ? prop->value() : "";
+ oop value = java_lang_String::create_oop_from_str(prop_value, CHECK);
options->obj_at_put(i * 2, name);
options->obj_at_put((i * 2) + 1, value);
}
@@ -682,6 +686,20 @@
Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
"runtime",
"()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK);
+ objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result);
+ if (trivial_prefixes != NULL) {
+ char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler);
+ for (int i = 0; i < trivial_prefixes->length(); i++) {
+ oop str = trivial_prefixes->obj_at(i);
+ if (str == NULL) {
+ THROW(vmSymbols::java_lang_NullPointerException());
+ } else {
+ prefixes[i] = strdup(java_lang_String::as_utf8_string(str));
+ }
+ }
+ _trivial_prefixes = prefixes;
+ _trivial_prefixes_count = trivial_prefixes->length();
+ }
_HotSpotJVMCIRuntime_initialized = true;
_HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result());
}
@@ -877,15 +895,27 @@
_compiler = compiler;
}
-jint JVMCIRuntime::save_options(SystemProperty* props) {
+void JVMCIRuntime::maybe_print_flags(TRAPS) {
+ if (_options != NULL) {
+ for (int i = 0; i < _options_count; i++) {
+ SystemProperty* p = _options[i];
+ const char* name = p->key() + OPTION_PREFIX_LEN;
+ if (strcmp(name, "PrintFlags") == 0 || strcmp(name, "ShowFlags") == 0) {
+ JVMCIRuntime::initialize_well_known_classes(CHECK);
+ HandleMark hm;
+ ResourceMark rm;
+ JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
+ return;
+ }
+ }
+ }
+}
+
+void JVMCIRuntime::save_options(SystemProperty* props) {
int count = 0;
SystemProperty* first = NULL;
for (SystemProperty* p = props; p != NULL; p = p->next()) {
if (strncmp(p->key(), OPTION_PREFIX, OPTION_PREFIX_LEN) == 0) {
- if (p->value() == NULL || strlen(p->value()) == 0) {
- jio_fprintf(defaultStream::output_stream(), "JVMCI option %s must have non-zero length value\n", p->key());
- return JNI_ERR;
- }
if (first == NULL) {
first = p;
}
@@ -905,7 +935,6 @@
}
assert (insert_pos - _options == count, "must be");
}
- return JNI_OK;
}
void JVMCIRuntime::shutdown() {
@@ -921,6 +950,20 @@
}
}
+bool JVMCIRuntime::treat_as_trivial(Method* method) {
+ if (_HotSpotJVMCIRuntime_initialized) {
+ oop loader = method->method_holder()->class_loader();
+ if (loader == NULL) {
+ for (int i = 0; i < _trivial_prefixes_count; i++) {
+ if (method->method_holder()->name()->starts_with(_trivial_prefixes[i])) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
void JVMCIRuntime::call_printStackTrace(Handle exception, Thread* thread) {
assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
JavaValue result(T_VOID);
@@ -949,18 +992,18 @@
void JVMCIRuntime::parse_lines(char* path, ParseClosure* closure, bool warnStatFailure) {
struct stat st;
- if (os::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file
- int file_handle = os::open(path, 0, 0);
+ if (::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file
+ int file_handle = ::open(path, os::default_file_open_flags(), 0);
if (file_handle != -1) {
char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal);
int num_read;
- num_read = (int) os::read(file_handle, (char*) buffer, st.st_size);
+ num_read = (int) ::read(file_handle, (char*) buffer, st.st_size);
if (num_read == -1) {
warning("Error reading file %s due to %s", path, strerror(errno));
} else if (num_read != st.st_size) {
warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, (size_t) st.st_size, path);
}
- os::close(file_handle);
+ ::close(file_handle);
closure->set_filename(path);
if (num_read == st.st_size) {
buffer[num_read] = '\0';
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -54,24 +54,6 @@
void set_filename(char* path) {_filename = path; _lineNo = 0;}
};
-#define CHECK_ABORT THREAD); \
- if (HAS_PENDING_EXCEPTION) { \
- char buf[256]; \
- jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
- JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
- return; \
- } \
- (void)(0
-
-#define CHECK_ABORT_(result) THREAD); \
- if (HAS_PENDING_EXCEPTION) { \
- char buf[256]; \
- jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
- JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
- return result; \
- } \
- (void)(0
-
class JVMCIRuntime: public AllStatic {
private:
static jobject _HotSpotJVMCIRuntime_instance;
@@ -81,6 +63,9 @@
static int _options_count;
static SystemProperty** _options;
+ static int _trivial_prefixes_count;
+ static char** _trivial_prefixes;
+
static bool _shutdown_called;
/**
@@ -108,9 +93,14 @@
* when JVMCI is initialized.
*
* @param props the head of the system property list
- * @return JNI_ERR if a JVMCI option has a zero length value, JNI_OK otherwise
*/
- static jint save_options(SystemProperty* props);
+ static void save_options(SystemProperty* props);
+
+ /**
+ * If either the PrintFlags or ShowFlags JVMCI option is present,
+ * then JVMCI is initialized to show the help message.
+ */
+ static void maybe_print_flags(TRAPS);
static bool is_HotSpotJVMCIRuntime_initialized() { return _HotSpotJVMCIRuntime_initialized; }
@@ -150,6 +140,7 @@
return _shutdown_called;
}
+ static bool treat_as_trivial(Method* method);
static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure);
/**
@@ -162,6 +153,24 @@
*/
static void call_printStackTrace(Handle exception, Thread* thread);
+#define CHECK_ABORT THREAD); \
+ if (HAS_PENDING_EXCEPTION) { \
+ char buf[256]; \
+ jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
+ JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+ return; \
+ } \
+ (void)(0
+
+#define CHECK_ABORT_(result) THREAD); \
+ if (HAS_PENDING_EXCEPTION) { \
+ char buf[256]; \
+ jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
+ JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+ return result; \
+ } \
+ (void)(0
+
static BasicType kindToBasicType(jchar ch);
// The following routines are all called from compiled JVMCI code
@@ -183,13 +192,11 @@
static oopDesc* load_and_clear_exception(JavaThread* thread);
static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3);
static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline);
- // Note: Must be kept in sync with constants in com.oracle.graal.replacements.Log
- enum {
- LOG_OBJECT_NEWLINE = 0x01,
- LOG_OBJECT_STRING = 0x02,
- LOG_OBJECT_ADDRESS = 0x04
- };
- static void log_object(JavaThread* thread, oopDesc* msg, jint flags);
+ // Print the passed in object, optionally followed by a newline. If
+ // as_string is true and the object is a java.lang.String then it
+ // printed as a string, otherwise the type of the object is printed
+ // followed by its address.
+ static void log_object(JavaThread* thread, oopDesc* object, bool as_string, bool newline);
static void write_barrier_pre(JavaThread* thread, oopDesc* obj);
static void write_barrier_post(JavaThread* thread, void* card);
static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child);
--- a/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/systemDictionary_jvmci.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -47,6 +47,8 @@
do_klass(HotSpotOopMap_klass, jdk_vm_ci_hotspot_HotSpotOopMap, Jvmci) \
do_klass(HotSpotConstantPool_klass, jdk_vm_ci_hotspot_HotSpotConstantPool, Jvmci) \
do_klass(HotSpotJVMCIMetaAccessContext_klass, jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext, Jvmci) \
+ do_klass(HotSpotJVMCIRuntime_klass, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, Jvmci) \
+ do_klass(HotSpotSpeculationLog_klass, jdk_vm_ci_hotspot_HotSpotSpeculationLog, 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) \
@@ -74,7 +76,6 @@
do_klass(StackSlot_klass, jdk_vm_ci_code_StackSlot, Jvmci) \
do_klass(StackLockValue_klass, jdk_vm_ci_code_StackLockValue, Jvmci) \
do_klass(VirtualObject_klass, jdk_vm_ci_code_VirtualObject, Jvmci) \
- do_klass(SpeculationLog_klass, jdk_vm_ci_meta_SpeculationLog, Jvmci) \
do_klass(JavaConstant_klass, jdk_vm_ci_meta_JavaConstant, Jvmci) \
do_klass(PrimitiveConstant_klass, jdk_vm_ci_meta_PrimitiveConstant, Jvmci) \
do_klass(RawConstant_klass, jdk_vm_ci_meta_RawConstant, Jvmci) \
--- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -70,6 +70,20 @@
declare_constant(CompilerToVM::KLASS_TAG) \
declare_constant(CompilerToVM::SYMBOL_TAG) \
\
+ declare_constant(BitData::exception_seen_flag) \
+ declare_constant(BitData::null_seen_flag) \
+ declare_constant(CounterData::count_off) \
+ declare_constant(JumpData::taken_off_set) \
+ declare_constant(JumpData::displacement_off_set) \
+ declare_constant(ReceiverTypeData::nonprofiled_count_off_set) \
+ declare_constant(ReceiverTypeData::receiver_type_row_cell_count) \
+ declare_constant(ReceiverTypeData::receiver0_offset) \
+ declare_constant(ReceiverTypeData::count0_offset) \
+ declare_constant(BranchData::not_taken_off_set) \
+ declare_constant(ArrayData::array_len_off_set) \
+ declare_constant(ArrayData::array_start_off_set) \
+ declare_constant(MultiBranchData::per_case_cell_count) \
+ \
declare_constant(CodeInstaller::VERIFIED_ENTRY) \
declare_constant(CodeInstaller::UNVERIFIED_ENTRY) \
declare_constant(CodeInstaller::OSR_ENTRY) \
@@ -84,6 +98,7 @@
declare_constant(CodeInstaller::POLL_RETURN_NEAR) \
declare_constant(CodeInstaller::POLL_FAR) \
declare_constant(CodeInstaller::POLL_RETURN_FAR) \
+ declare_constant(CodeInstaller::CARD_TABLE_SHIFT) \
declare_constant(CodeInstaller::CARD_TABLE_ADDRESS) \
declare_constant(CodeInstaller::HEAP_TOP_ADDRESS) \
declare_constant(CodeInstaller::HEAP_END_ADDRESS) \
--- a/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/jvmci/vmSymbols_jvmci.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -48,6 +48,8 @@
template(jdk_vm_ci_hotspot_HotSpotOopMap, "jdk/vm/ci/hotspot/HotSpotOopMap") \
template(jdk_vm_ci_hotspot_HotSpotConstantPool, "jdk/vm/ci/hotspot/HotSpotConstantPool") \
template(jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext, "jdk/vm/ci/hotspot/HotSpotJVMCIMetaAccessContext") \
+ 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_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") \
@@ -61,7 +63,6 @@
template(jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass, "jdk/vm/ci/meta/Assumptions$NoFinalizableSubclass") \
template(jdk_vm_ci_meta_Assumptions_ConcreteMethod, "jdk/vm/ci/meta/Assumptions$ConcreteMethod") \
template(jdk_vm_ci_meta_Assumptions_CallSiteTargetValue, "jdk/vm/ci/meta/Assumptions$CallSiteTargetValue") \
- template(jdk_vm_ci_meta_SpeculationLog, "jdk/vm/ci/meta/SpeculationLog") \
template(jdk_vm_ci_code_Architecture, "jdk/vm/ci/code/Architecture") \
template(jdk_vm_ci_code_TargetDescription, "jdk/vm/ci/code/TargetDescription") \
template(jdk_vm_ci_code_CompilationResult_Call, "jdk/vm/ci/code/CompilationResult$Call") \
--- a/hotspot/src/share/vm/oops/methodData.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/oops/methodData.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -1102,7 +1102,9 @@
return new VirtualCallTypeData(this);
case DataLayout::parameters_type_data_tag:
return new ParametersTypeData(this);
- };
+ case DataLayout::speculative_trap_data_tag:
+ return new SpeculativeTrapData(this);
+ }
}
// Iteration over data.
--- a/hotspot/src/share/vm/oops/methodData.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/oops/methodData.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -535,6 +535,7 @@
//
// A BitData holds a flag or two in its header.
class BitData : public ProfileData {
+ friend class VMStructs;
protected:
enum {
// null_seen:
@@ -603,6 +604,7 @@
//
// A CounterData corresponds to a simple counter.
class CounterData : public BitData {
+ friend class VMStructs;
protected:
enum {
count_off,
@@ -667,6 +669,7 @@
// plus a data displacement, used for realigning the data pointer to
// the corresponding target bci.
class JumpData : public ProfileData {
+ friend class VMStructs;
protected:
enum {
taken_off_set,
@@ -1173,6 +1176,7 @@
// that the check is reached, and a series of (Klass*, count) pairs
// which are used to store a type profile for the receiver of the check.
class ReceiverTypeData : public CounterData {
+ friend class VMStructs;
protected:
enum {
#if INCLUDE_JVMCI
@@ -1678,6 +1682,7 @@
// It consists of taken and not_taken counts as well as a data displacement
// for the taken case.
class BranchData : public JumpData {
+ friend class VMStructs;
protected:
enum {
not_taken_off_set = jump_cell_count,
@@ -1754,6 +1759,7 @@
// not have a statically known size. It consists of an array length
// and an array start.
class ArrayData : public ProfileData {
+ friend class VMStructs;
protected:
friend class DataLayout;
@@ -1831,6 +1837,7 @@
// of (count, displacement) pairs, which count the number of times each
// case was taken and specify the data displacment for each branch target.
class MultiBranchData : public ArrayData {
+ friend class VMStructs;
protected:
enum {
default_count_off_set,
--- a/hotspot/src/share/vm/prims/whitebox.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -1028,17 +1028,19 @@
CodeBlobStub(const CodeBlob* blob) :
name(os::strdup(blob->name())),
size(blob->size()),
- blob_type(WhiteBox::get_blob_type(blob)) { }
+ blob_type(WhiteBox::get_blob_type(blob)),
+ address((jlong) blob) { }
~CodeBlobStub() { os::free((void*) name); }
const char* const name;
- const int size;
- const int blob_type;
+ const jint size;
+ const jint blob_type;
+ const jlong address;
};
static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) {
jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
CHECK_JNI_EXCEPTION_(env, NULL);
- jobjectArray result = env->NewObjectArray(3, clazz, NULL);
+ jobjectArray result = env->NewObjectArray(4, clazz, NULL);
jstring name = env->NewStringUTF(cb->name);
CHECK_JNI_EXCEPTION_(env, NULL);
@@ -1052,6 +1054,10 @@
CHECK_JNI_EXCEPTION_(env, NULL);
env->SetObjectArrayElement(result, 2, obj);
+ obj = longBox(thread, env, cb->address);
+ CHECK_JNI_EXCEPTION_(env, NULL);
+ env->SetObjectArrayElement(result, 3, obj);
+
return result;
}
@@ -1092,9 +1098,9 @@
CHECK_JNI_EXCEPTION_(env, NULL);
env->SetObjectArrayElement(result, 3, id);
- jobject address = longBox(thread, env, (jlong) code);
+ jobject entry_point = longBox(thread, env, (jlong) code->entry_point());
CHECK_JNI_EXCEPTION_(env, NULL);
- env->SetObjectArrayElement(result, 4, address);
+ env->SetObjectArrayElement(result, 4, entry_point);
return result;
WB_END
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -3481,33 +3481,8 @@
sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
#if INCLUDE_JVMCI
- jint res = JVMCIRuntime::save_options(_system_properties);
- if (res != JNI_OK) {
- return res;
- }
-
if (EnableJVMCI) {
- // Append lib/jvmci/*.jar to boot class path
- char jvmciDir[JVM_MAXPATHLEN];
- const char* fileSep = os::file_separator();
- jio_snprintf(jvmciDir, sizeof(jvmciDir), "%s%slib%sjvmci", Arguments::get_java_home(), fileSep, fileSep);
- DIR* dir = os::opendir(jvmciDir);
- if (dir != NULL) {
- struct dirent *entry;
- char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(jvmciDir), mtInternal);
- while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
- const char* name = entry->d_name;
- const char* ext = name + strlen(name) - 4;
- if (ext > name && strcmp(ext, ".jar") == 0) {
- char fileName[JVM_MAXPATHLEN];
- jio_snprintf(fileName, sizeof(fileName), "%s%s%s", jvmciDir, fileSep, name);
- scp_p->add_suffix(fileName);
- scp_assembly_required = true;
- }
- }
- FREE_C_HEAP_ARRAY(char, dbuf);
- os::closedir(dir);
- }
+ JVMCIRuntime::save_options(_system_properties);
}
#endif // INCLUDE_JVMCI
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -1461,14 +1461,14 @@
oop speculation_log = nm->speculation_log();
if (speculation_log != NULL) {
if (TraceDeoptimization || TraceUncollectedSpeculations) {
- if (SpeculationLog::lastFailed(speculation_log) != NULL) {
+ if (HotSpotSpeculationLog::lastFailed(speculation_log) != NULL) {
tty->print_cr("A speculation that was not collected by the compiler is being overwritten");
}
}
if (TraceDeoptimization) {
tty->print_cr("Saving speculation to speculation log");
}
- SpeculationLog::set_lastFailed(speculation_log, speculation);
+ HotSpotSpeculationLog::set_lastFailed(speculation_log, speculation);
} else {
if (TraceDeoptimization) {
tty->print_cr("Speculation present but no speculation log");
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp Wed Nov 04 07:23:23 2015 -1000
@@ -68,6 +68,14 @@
method->is_constant_getter()) {
return true;
}
+#if INCLUDE_JVMCI
+ if (UseJVMCICompiler) {
+ if (TieredCompilation && CompileBroker::compiler(CompLevel_full_optimization) != NULL &&
+ CompileBroker::compiler(CompLevel_full_optimization)->is_trivial(method)) {
+ return true;
+ }
+ }
+#endif
if (method->has_loops() || method->code_size() >= 15) {
return false;
}
--- a/hotspot/src/share/vm/runtime/thread.cpp Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Nov 04 07:23:23 2015 -1000
@@ -3625,6 +3625,7 @@
if (jvmciCompiler != NULL) {
JVMCIRuntime::save_compiler(jvmciCompiler);
}
+ JVMCIRuntime::maybe_print_flags(CHECK_JNI_ERR);
}
#endif // INCLUDE_JVMCI
--- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -27,32 +27,41 @@
* @bug 8136421
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
* @library /testlibrary /../../test/lib /
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @compile ./common/CompilerToVMHelper.java
+ * @run main ClassFileInstaller jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xbootclasspath/a:.
+ * -XX:+EnableJVMCI
* compiler.jvmci.SecurityRestrictionsTest
* NO_SEC_MAN
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xbootclasspath/a:.
+ * -XX:+EnableJVMCI
* compiler.jvmci.SecurityRestrictionsTest
* NO_PERM
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xbootclasspath/a:.
+ * -XX:+EnableJVMCI
* compiler.jvmci.SecurityRestrictionsTest
* ALL_PERM
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xbootclasspath/a:.
+ * -XX:+EnableJVMCI
* compiler.jvmci.SecurityRestrictionsTest
* NO_JVMCI_ACCESS_PERM
- * @run main/othervm -XX:+UnlockExperimentalVMOptions
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xbootclasspath/a:.
+ * -XX:-EnableJVMCI
* compiler.jvmci.SecurityRestrictionsTest
* NO_JVMCI
*/
package compiler.jvmci;
-import jdk.vm.ci.hotspot.CompilerToVM;
import jdk.test.lib.Utils;
import java.lang.InternalError;
+import java.lang.reflect.Constructor;
import java.security.AccessControlException;
import java.security.Permission;
import java.util.PropertyPermission;
import java.util.function.Consumer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class SecurityRestrictionsTest {
@@ -164,7 +173,14 @@
}
}
};
- Utils.runAndCheckException(CompilerToVM::new, exceptionCheck);
+ Utils.runAndCheckException(() -> {
+ try {
+ // CompilerToVM::<cinit> provokes CompilerToVM::<init>
+ Class.forName("jdk.vm.ci.hotspot.CompilerToVMHelper");
+ } catch (ClassNotFoundException e) {
+ throw new Error("TESTBUG : " + e, e);
+ }
+ }, exceptionCheck);
}
public SecurityManager getSecurityManager() {
--- a/hotspot/test/compiler/jvmci/common/CTVMUtilities.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/common/CTVMUtilities.java Wed Nov 04 07:23:23 2015 -1000
@@ -27,15 +27,16 @@
import java.lang.reflect.Executable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
public class CTVMUtilities {
/*
* A method to return HotSpotResolvedJavaMethod object using class object
* and method as input
*/
- public static HotSpotResolvedJavaMethodImpl getResolvedMethod(Class<?> cls,
+ public static HotSpotResolvedJavaMethod getResolvedMethod(Class<?> cls,
Executable method) {
if (!(method instanceof Method || method instanceof Constructor)) {
throw new Error("wrong executable type " + method.getClass());
@@ -54,8 +55,20 @@
return CompilerToVMHelper.getResolvedJavaMethodAtSlot(cls, slot);
}
- public static HotSpotResolvedJavaMethodImpl getResolvedMethod(
+ public static HotSpotResolvedJavaMethod getResolvedMethod(
Executable method) {
return getResolvedMethod(method.getDeclaringClass(), method);
}
+
+ public static InstalledCode getInstalledCode(String name, long address,
+ long entryPoint) {
+ return new InstalledCodeStub(name, address, entryPoint);
+ }
+ private static class InstalledCodeStub extends InstalledCode {
+ private InstalledCodeStub(String name, long address, long entryPoint) {
+ super(name);
+ this.address = address;
+ this.entryPoint = entryPoint;
+ }
+ }
}
--- a/hotspot/test/compiler/jvmci/common/CompilerToVMHelper.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/common/CompilerToVMHelper.java Wed Nov 04 07:23:23 2015 -1000
@@ -26,115 +26,120 @@
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.code.TargetDescription;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.meta.SpeculationLog;
-/*
+/**
* A simple "proxy" class to get test access to CompilerToVM package-private methods
*/
public class CompilerToVMHelper {
public static final CompilerToVM CTVM = new CompilerToVM();
- public static byte[] getBytecode(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getBytecode(method);
+ public static byte[] getBytecode(HotSpotResolvedJavaMethod method) {
+ return CTVM.getBytecode((HotSpotResolvedJavaMethodImpl)method);
}
- public static int getExceptionTableLength(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getExceptionTableLength(method);
+ public static int getExceptionTableLength(HotSpotResolvedJavaMethod method) {
+ return CTVM.getExceptionTableLength((HotSpotResolvedJavaMethodImpl)method);
}
- public static long getExceptionTableStart(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getExceptionTableStart(method);
+ public static long getExceptionTableStart(HotSpotResolvedJavaMethod method) {
+ return CTVM.getExceptionTableStart((HotSpotResolvedJavaMethodImpl)method);
}
- public static boolean canInlineMethod(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.canInlineMethod(method);
+ public static boolean canInlineMethod(HotSpotResolvedJavaMethod method) {
+ return CTVM.canInlineMethod((HotSpotResolvedJavaMethodImpl)method);
}
- public static boolean shouldInlineMethod(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.shouldInlineMethod(method);
+ public static boolean shouldInlineMethod(HotSpotResolvedJavaMethod method) {
+ return CTVM.shouldInlineMethod((HotSpotResolvedJavaMethodImpl)method);
}
- public static HotSpotResolvedJavaMethodImpl findUniqueConcreteMethod(
- HotSpotResolvedObjectTypeImpl actualHolderType,
- HotSpotResolvedJavaMethodImpl method) {
- return CTVM.findUniqueConcreteMethod(actualHolderType, method);
+ public static HotSpotResolvedJavaMethod findUniqueConcreteMethod(
+ HotSpotResolvedObjectType actualHolderType,
+ HotSpotResolvedJavaMethod method) {
+ return CTVM.findUniqueConcreteMethod((HotSpotResolvedObjectTypeImpl) actualHolderType, (HotSpotResolvedJavaMethodImpl)method);
}
- public static HotSpotResolvedObjectTypeImpl getImplementor(HotSpotResolvedObjectTypeImpl type) {
- return CTVM.getImplementor(type);
+ public static HotSpotResolvedObjectType getImplementor(HotSpotResolvedObjectType type) {
+ return CTVM.getImplementor((HotSpotResolvedObjectTypeImpl) type);
}
- public static boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.methodIsIgnoredBySecurityStackWalk(method);
+ public static boolean methodIsIgnoredBySecurityStackWalk(HotSpotResolvedJavaMethod method) {
+ return CTVM.methodIsIgnoredBySecurityStackWalk((HotSpotResolvedJavaMethodImpl)method);
}
- public static HotSpotResolvedObjectTypeImpl lookupType(String name,
+ public static HotSpotResolvedObjectType lookupType(String name,
Class<?> accessingClass, boolean resolve) {
return CTVM.lookupType(name, accessingClass, resolve);
}
- public static Object resolveConstantInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.resolveConstantInPool(constantPool, cpi);
+ public static Object resolveConstantInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.resolveConstantInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static Object resolvePossiblyCachedConstantInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.resolvePossiblyCachedConstantInPool(constantPool, cpi);
+ public static Object resolvePossiblyCachedConstantInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.resolvePossiblyCachedConstantInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static int lookupNameAndTypeRefIndexInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupNameAndTypeRefIndexInPool(constantPool, cpi);
+ public static int lookupNameAndTypeRefIndexInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.lookupNameAndTypeRefIndexInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static String lookupNameInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupNameInPool(constantPool, cpi);
+ public static String lookupNameInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.lookupNameInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static String lookupSignatureInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupSignatureInPool(constantPool, cpi);
+ public static String lookupSignatureInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.lookupSignatureInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static int lookupKlassRefIndexInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupKlassRefIndexInPool(constantPool, cpi);
+ public static int lookupKlassRefIndexInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.lookupKlassRefIndexInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static Object lookupKlassInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupKlassInPool(constantPool, cpi);
+ public static Object lookupKlassInPool(ConstantPool constantPool, int cpi) {
+ return CTVM.lookupKlassInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static HotSpotResolvedJavaMethodImpl lookupMethodInPool(
- HotSpotConstantPool constantPool, int cpi, byte opcode) {
- return CTVM.lookupMethodInPool(constantPool, cpi, opcode);
+ public static HotSpotResolvedJavaMethod lookupMethodInPool(
+ ConstantPool constantPool, int cpi, byte opcode) {
+ return CTVM.lookupMethodInPool((HotSpotConstantPool) constantPool, cpi, opcode);
}
- public static void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi) {
- CTVM.resolveInvokeDynamicInPool(constantPool, cpi);
+ public static void resolveInvokeDynamicInPool(
+ ConstantPool constantPool, int cpi) {
+ CTVM.resolveInvokeDynamicInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi) {
- CTVM.resolveInvokeHandleInPool(constantPool, cpi);
+ public static void resolveInvokeHandleInPool(
+ ConstantPool constantPool, int cpi) {
+ CTVM.resolveInvokeHandleInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static HotSpotResolvedObjectTypeImpl resolveTypeInPool(
- HotSpotConstantPool constantPool, int cpi) throws LinkageError {
- return CTVM.resolveTypeInPool(constantPool, cpi);
+ public static HotSpotResolvedObjectType resolveTypeInPool(
+ ConstantPool constantPool, int cpi) {
+ return CTVM.resolveTypeInPool((HotSpotConstantPool) constantPool, cpi);
}
- public static HotSpotResolvedObjectTypeImpl resolveFieldInPool(
- HotSpotConstantPool constantPool, int cpi, byte opcode, long[] info) {
- return CTVM.resolveFieldInPool(constantPool, cpi, opcode, info);
+ public static HotSpotResolvedObjectType resolveFieldInPool(
+ ConstantPool constantPool, int cpi, byte opcode, long[] info) {
+ return CTVM.resolveFieldInPool((HotSpotConstantPool) constantPool, cpi, opcode, info);
}
public static int constantPoolRemapInstructionOperandFromCache(
- HotSpotConstantPool constantPool, int cpci) {
- return CTVM.constantPoolRemapInstructionOperandFromCache(constantPool, cpci);
+ ConstantPool constantPool, int cpci) {
+ return CTVM.constantPoolRemapInstructionOperandFromCache((HotSpotConstantPool) constantPool, cpci);
}
- public static Object lookupAppendixInPool(HotSpotConstantPool constantPool, int cpi) {
- return CTVM.lookupAppendixInPool(constantPool, cpi);
+ public static Object lookupAppendixInPool(
+ ConstantPool constantPool, int cpi) {
+ return CTVM.lookupAppendixInPool((HotSpotConstantPool) constantPool, cpi);
}
public static int installCode(TargetDescription target,
- HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog) {
+ HotSpotCompiledCode compiledCode, InstalledCode code, HotSpotSpeculationLog speculationLog) {
return CTVM.installCode(target, compiledCode, code, speculationLog);
}
@@ -144,10 +149,10 @@
}
public static void notifyCompilationStatistics(int id,
- HotSpotResolvedJavaMethodImpl method, boolean osr,
+ HotSpotResolvedJavaMethod method, boolean osr,
int processedBytecodes, long time, long timeUnitsPerSecond,
InstalledCode installedCode) {
- CTVM.notifyCompilationStatistics(id, method, osr, processedBytecodes,
+ CTVM.notifyCompilationStatistics(id, (HotSpotResolvedJavaMethodImpl) method, osr, processedBytecodes,
time, timeUnitsPerSecond, installedCode);
}
@@ -155,28 +160,28 @@
CTVM.resetCompilationStatistics();
}
- public static long initializeConfiguration() {
- return CTVM.initializeConfiguration();
+ public static long initializeConfiguration(HotSpotVMConfig config) {
+ return CTVM.initializeConfiguration(config);
}
- public static HotSpotResolvedJavaMethodImpl resolveMethod(
- HotSpotResolvedObjectTypeImpl exactReceiver,
- HotSpotResolvedJavaMethodImpl method,
- HotSpotResolvedObjectTypeImpl caller) {
- return CTVM.resolveMethod(exactReceiver, method, caller);
+ public static HotSpotResolvedJavaMethod resolveMethod(
+ HotSpotResolvedObjectType exactReceiver,
+ HotSpotResolvedJavaMethod method,
+ HotSpotResolvedObjectType caller) {
+ return CTVM.resolveMethod((HotSpotResolvedObjectTypeImpl) exactReceiver, (HotSpotResolvedJavaMethodImpl) method, (HotSpotResolvedObjectTypeImpl) caller);
}
- public static HotSpotResolvedJavaMethodImpl getClassInitializer(
- HotSpotResolvedObjectTypeImpl type) {
- return CTVM.getClassInitializer(type);
+ public static HotSpotResolvedJavaMethod getClassInitializer(
+ HotSpotResolvedObjectType type) {
+ return CTVM.getClassInitializer((HotSpotResolvedObjectTypeImpl) type);
}
- public static boolean hasFinalizableSubclass(HotSpotResolvedObjectTypeImpl type) {
- return CTVM.hasFinalizableSubclass(type);
+ public static boolean hasFinalizableSubclass(HotSpotResolvedObjectType type) {
+ return CTVM.hasFinalizableSubclass((HotSpotResolvedObjectTypeImpl) type);
}
- public static HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(Class<?> holder,
- int slot) {
+ public static HotSpotResolvedJavaMethodImpl getResolvedJavaMethodAtSlot(
+ Class<?> holder, int slot) {
return CTVM.getResolvedJavaMethodAtSlot(holder, slot);
}
@@ -184,13 +189,13 @@
return CTVM.getMaxCallTargetOffset(address);
}
- public static String disassembleCodeBlob(long codeBlob) {
+ public static String disassembleCodeBlob(InstalledCode codeBlob) {
return CTVM.disassembleCodeBlob(codeBlob);
}
public static StackTraceElement getStackTraceElement(
- HotSpotResolvedJavaMethodImpl method, int bci) {
- return CTVM.getStackTraceElement(method, bci);
+ HotSpotResolvedJavaMethod method, int bci) {
+ return CTVM.getStackTraceElement((HotSpotResolvedJavaMethodImpl)method, bci);
}
public static Object executeInstalledCode(Object[] args,
@@ -198,28 +203,28 @@
return CTVM.executeInstalledCode(args, installedCode);
}
- public static long[] getLineNumberTable(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getLineNumberTable(method);
+ public static long[] getLineNumberTable(HotSpotResolvedJavaMethod method) {
+ return CTVM.getLineNumberTable((HotSpotResolvedJavaMethodImpl)method);
}
- public static int getLocalVariableTableLength(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getLocalVariableTableLength(method);
+ public static int getLocalVariableTableLength(HotSpotResolvedJavaMethod method) {
+ return CTVM.getLocalVariableTableLength((HotSpotResolvedJavaMethodImpl)method);
}
- public static long getLocalVariableTableStart(HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getLocalVariableTableStart(method);
+ public static long getLocalVariableTableStart(HotSpotResolvedJavaMethod method) {
+ return CTVM.getLocalVariableTableStart((HotSpotResolvedJavaMethodImpl)method);
}
public static Object readUncompressedOop(long address) {
return CTVM.readUncompressedOop(address);
}
- public static void doNotInlineOrCompile(HotSpotResolvedJavaMethodImpl method) {
- CTVM.doNotInlineOrCompile(method);
+ public static void doNotInlineOrCompile(HotSpotResolvedJavaMethod method) {
+ CTVM.doNotInlineOrCompile((HotSpotResolvedJavaMethodImpl)method);
}
- public static void reprofile(HotSpotResolvedJavaMethodImpl method) {
- CTVM.reprofile(method);
+ public static void reprofile(HotSpotResolvedJavaMethod method) {
+ CTVM.reprofile((HotSpotResolvedJavaMethodImpl)method);
}
public static void invalidateInstalledCode(InstalledCode installedCode) {
@@ -234,14 +239,14 @@
return CTVM.isMature(metaspaceMethodData);
}
- public static int allocateCompileId(HotSpotResolvedJavaMethodImpl method,
+ public static int allocateCompileId(HotSpotResolvedJavaMethod method,
int entryBCI) {
- return CTVM.allocateCompileId(method, entryBCI);
+ return CTVM.allocateCompileId((HotSpotResolvedJavaMethodImpl) method, entryBCI);
}
public static boolean hasCompiledCodeForOSR(
- HotSpotResolvedJavaMethodImpl method, int entryBCI, int level) {
- return CTVM.hasCompiledCodeForOSR(method, entryBCI, level);
+ HotSpotResolvedJavaMethod method, int entryBCI, int level) {
+ return CTVM.hasCompiledCodeForOSR((HotSpotResolvedJavaMethodImpl) method, entryBCI, level);
}
public static String getSymbol(long metaspaceSymbol) {
@@ -250,7 +255,7 @@
public static HotSpotStackFrameReference getNextStackFrame(
HotSpotStackFrameReference frame,
- HotSpotResolvedJavaMethodImpl[] methods, int initialSkip) {
+ ResolvedJavaMethod[] methods, int initialSkip) {
return CTVM.getNextStackFrame(frame, methods, initialSkip);
}
@@ -259,9 +264,9 @@
CTVM.materializeVirtualObjects(stackFrame, invalidate);
}
- public static int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectTypeImpl type,
- HotSpotResolvedJavaMethodImpl method) {
- return CTVM.getVtableIndexForInterfaceMethod(type, method);
+ public static int getVtableIndexForInterfaceMethod(HotSpotResolvedObjectType type,
+ HotSpotResolvedJavaMethod method) {
+ return CTVM.getVtableIndexForInterfaceMethod((HotSpotResolvedObjectTypeImpl) type, (HotSpotResolvedJavaMethodImpl) method);
}
public static boolean shouldDebugNonSafepoints() {
@@ -276,7 +281,7 @@
CTVM.flushDebugOutput();
}
- public static HotSpotResolvedJavaMethodImpl getResolvedJavaMethod(Object base,
+ public static HotSpotResolvedJavaMethod getResolvedJavaMethod(Object base,
long displacement) {
return CTVM.getResolvedJavaMethod(base, displacement);
}
@@ -285,8 +290,24 @@
return CTVM.getConstantPool(base, displacement);
}
- public static HotSpotResolvedObjectTypeImpl getResolvedJavaType(Object base,
+ public static HotSpotResolvedObjectType getResolvedJavaType(Object base,
long displacement, boolean compressed) {
return CTVM.getResolvedJavaType(base, displacement, compressed);
}
+
+ public static long getMetaspacePointer(Object o) {
+ return ((MetaspaceWrapperObject) o).getMetaspacePointer();
+ }
+
+ public static Class<?> CompilerToVMClass() {
+ return CompilerToVM.class;
+ }
+
+ public static Class<?> HotSpotConstantPoolClass() {
+ return HotSpotConstantPool.class;
+ }
+
+ public static Class<?> getMirror(HotSpotResolvedObjectType type) {
+ return ((HotSpotResolvedJavaType) type).mirror();
+ }
}
--- a/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/common/JVMCIHelpers.java Wed Nov 04 07:23:23 2015 -1000
@@ -24,10 +24,11 @@
package compiler.jvmci.common;
import jdk.vm.ci.code.Architecture;
+import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.hotspot.HotSpotVMEventListener;
-import jdk.vm.ci.compiler.Compiler;
-import jdk.vm.ci.compiler.CompilerFactory;
import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.runtime.JVMCICompiler;
+import jdk.vm.ci.runtime.JVMCICompilerFactory;
import jdk.vm.ci.runtime.JVMCIRuntime;
/*
@@ -39,16 +40,15 @@
// just empty, using default interface methods
}
- public static class EmptyHotspotCompiler implements Compiler {
+ public static class EmptyHotspotCompiler implements JVMCICompiler {
@Override
- public void compileMethod(ResolvedJavaMethod method, int entryBCI,
- long jvmciEnv, int id) {
+ public void compileMethod(CompilationRequest request) {
// do nothing
}
}
- public static class EmptyCompilerFactory implements CompilerFactory {
+ public static class EmptyCompilerFactory implements JVMCICompilerFactory {
@Override
public String getCompilerName() {
@@ -56,12 +56,7 @@
}
@Override
- public Architecture initializeArchitecture(Architecture arch) {
- return arch;
- }
-
- @Override
- public Compiler createCompiler(JVMCIRuntime runtime) {
+ public JVMCICompiler createCompiler(JVMCIRuntime runtime) {
return new EmptyHotspotCompiler();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/PublicMetaspaceWrapperObject.java Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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;
+
+/**
+ * A public available version of MetaspaceWrapperObject interface.
+ */
+public interface PublicMetaspaceWrapperObject extends MetaspaceWrapperObject { }
--- a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.compiler.Compiler Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
--- a/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.compiler.CompilerFactory Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.JVMCICompiler Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,1 @@
+compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.JVMCICompilerFactory Wed Nov 04 07:23:23 2015 -1000
@@ -0,0 +1,1 @@
+compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
--- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -34,6 +34,7 @@
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
* -XX:-BackgroundCompilation
+ -XX:+LogCompilation
* compiler.jvmci.compilerToVM.AllocateCompileIdTest
*/
@@ -51,7 +52,7 @@
import compiler.jvmci.common.testcases.TestCase;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.test.lib.Asserts;
import jdk.test.lib.Pair;
import jdk.test.lib.Utils;
@@ -74,8 +75,9 @@
try {
Class<?> aClass = DummyClass.class;
Method method = aClass.getMethod("withLoop");
- result.add(new CompileCodeTestCase(method, 17));
- result.add(new CompileCodeTestCase(method, -1));
+ Object receiver = new DummyClass();
+ result.add(new CompileCodeTestCase(receiver, method, 17));
+ result.add(new CompileCodeTestCase(receiver, method, -1));
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e, e);
}
@@ -90,16 +92,19 @@
try {
Class<?> aClass = DummyClass.class;
+ Object receiver = new DummyClass();
Method method = aClass.getMethod("dummyInstanceFunction");
// greater than bytecode.length
int[] bcis = new int[] {30, 50, 200};
for (int bci : bcis) {
- result.add(new Pair<>(new CompileCodeTestCase(method, bci),
+ result.add(new Pair<>(
+ new CompileCodeTestCase(receiver, method, bci),
IllegalArgumentException.class));
}
bcis = new int[] {-4, -50, -200};
for (int bci : bcis) {
- result.add(new Pair<>(new CompileCodeTestCase(method, bci),
+ result.add(new Pair<>(
+ new CompileCodeTestCase(receiver, method, bci),
IllegalArgumentException.class));
}
} catch (NoSuchMethodException e) {
@@ -111,8 +116,10 @@
private void runSanityCorrectTest(CompileCodeTestCase testCase) {
System.out.println(testCase);
Executable aMethod = testCase.executable;
+ // to generate ciTypeFlow
+ System.out.println(testCase.invoke(Utils.getNullValues(aMethod.getParameterTypes())));
int bci = testCase.bci;
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
int wbCompileID = getWBCompileID(testCase);
int id = CompilerToVMHelper.allocateCompileId(method, bci);
@@ -140,7 +147,7 @@
Class<? extends Throwable> exception = testCase.second;
Executable aMethod = testCase.first.executable;
int bci = testCase.first.bci;
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
Utils.runAndCheckException(
() -> CompilerToVMHelper.allocateCompileId(method, bci),
--- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -45,7 +45,7 @@
import java.util.Arrays;
import java.util.List;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.test.lib.Asserts;
import sun.hotspot.WhiteBox;
@@ -59,7 +59,7 @@
}
private static void runSanityTest(Executable aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
boolean canInline = CompilerToVMHelper.canInlineMethod(method);
boolean expectedCanInline = !WB.testSetDontInlineMethod(aMethod,
--- a/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java Wed Nov 04 07:23:23 2015 -1000
@@ -24,12 +24,17 @@
package compiler.jvmci.compilerToVM;
+import compiler.jvmci.common.CTVMUtilities;
import compiler.testlibrary.CompilerUtils;
import jdk.test.lib.Utils;
+import jdk.vm.ci.code.InstalledCode;
import sun.hotspot.WhiteBox;
import sun.hotspot.code.NMethod;
import java.lang.reflect.Executable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
@@ -37,12 +42,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import jdk.test.lib.Pair;
/**
* A test case for tests which require compiled code.
*/
-public final class CompileCodeTestCase {
- public static final Map<Class<?>, Object> RECEIVERS;
+public class CompileCodeTestCase {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final int COMP_LEVEL;
static {
@@ -56,21 +61,51 @@
Interface.class,
Dummy.class,
DummyEx.class};
+ private static final Map<Class<?>, Object> RECEIVERS;
+ public final Object receiver;
public final Executable executable;
public final int bci;
private final boolean isOsr;
- public CompileCodeTestCase(Executable executable, int bci) {
+ public CompileCodeTestCase(Object receiver, Executable executable,
+ int bci) {
+ this.receiver = receiver;
this.executable = executable;
this.bci = bci;
- isOsr = bci >= 0;
+ isOsr = (bci >= 0);
}
public NMethod compile() {
return compile(COMP_LEVEL);
}
+ public Pair<Object, ? extends Throwable> invoke(Object[] args) {
+ boolean old = executable.isAccessible();
+ executable.setAccessible(true);
+ try {
+ try {
+ if (executable instanceof Method) {
+ Method m = (Method) executable;
+ return new Pair<>(m.invoke(receiver, args), null);
+ }
+
+ if (executable instanceof Constructor) {
+ Constructor c = (Constructor) executable;
+ return new Pair<>(c.newInstance(args), null);
+ }
+ } catch (InvocationTargetException e) {
+ return new Pair<>(null, e.getCause());
+ } catch (Throwable e) {
+ return new Pair<>(null, e);
+ }
+ } finally {
+ executable.setAccessible(old);
+ }
+ throw new Error(executable + " has unsupported type "
+ + executable.getClass());
+ }
+
public NMethod compile(int level) {
boolean enqueued = WB.enqueueMethodForCompilation(executable,
level, bci);
@@ -86,13 +121,17 @@
public static List<CompileCodeTestCase> generate(int bci) {
ArrayList<CompileCodeTestCase> result = new ArrayList<>();
for (Class<?> aClass : CLASSES) {
+ Object receiver = RECEIVERS.get(aClass);
+ if (receiver == null) {
+ throw new Error("TESTBUG : no receiver for class " + aClass);
+ }
for (Executable m : aClass.getDeclaredConstructors()) {
- result.add(new CompileCodeTestCase(m, bci));
+ result.add(new CompileCodeTestCase(receiver, m, bci));
}
Arrays.stream(aClass.getDeclaredMethods())
.filter(m -> !Modifier.isAbstract(m.getModifiers()))
.filter(m -> !Modifier.isNative(m.getModifiers()))
- .map(m -> new CompileCodeTestCase(m, bci))
+ .map(m -> new CompileCodeTestCase(receiver, m, bci))
.forEach(result::add);
}
return result;
@@ -102,6 +141,14 @@
return NMethod.get(executable, isOsr);
}
+ public InstalledCode toInstalledCode() {
+ NMethod nmethod = toNMethod();
+ long address = nmethod == null ? 0L : nmethod.address;
+ long entryPoint = nmethod == null ? 0L : nmethod.entry_point;
+ return CTVMUtilities.getInstalledCode(
+ executable.getName(), address, entryPoint);
+ }
+
@Override
public String toString() {
return "CompileCodeTestCase{" +
--- a/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java Wed Nov 04 07:23:23 2015 -1000
@@ -26,8 +26,7 @@
import java.util.HashMap;
import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.internal.misc.SharedSecrets;
import sun.reflect.ConstantPool;
@@ -35,15 +34,15 @@
* Common class for jdk.vm.ci.hotspot.CompilerToVM constant pool tests
*/
public class ConstantPoolTestCase {
-
private final Map<ConstantPoolTestsHelper.ConstantTypes, Validator> typeTests;
public static interface Validator {
- void validate(HotSpotConstantPool constantPoolCTVM, ConstantPool constantPoolSS,
+ void validate(jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
+ ConstantPool constantPoolSS,
ConstantPoolTestsHelper.DummyClasses dummyClass, int index);
}
- public ConstantPoolTestCase(Map<ConstantPoolTestsHelper.ConstantTypes, Validator> typeTests) {
+ public ConstantPoolTestCase(Map<ConstantPoolTestsHelper.ConstantTypes,Validator> typeTests) {
this.typeTests = new HashMap<>();
this.typeTests.putAll(typeTests);
}
@@ -120,9 +119,10 @@
for (ConstantPoolTestsHelper.DummyClasses dummyClass
: ConstantPoolTestsHelper.DummyClasses.values()) {
System.out.printf("%nTesting dummy %s%n", dummyClass.klass);
- HotSpotResolvedObjectTypeImpl holder = HotSpotResolvedObjectTypeImpl
+ HotSpotResolvedObjectType holder = HotSpotResolvedObjectType
.fromObjectClass(dummyClass.klass);
- HotSpotConstantPool constantPoolCTVM = holder.getConstantPool();
+ jdk.vm.ci.meta.ConstantPool constantPoolCTVM
+ = holder.getConstantPool();
ConstantPool constantPoolSS = SharedSecrets.getJavaLangAccess().
getConstantPool(dummyClass.klass);
for (Integer i : dummyClass.cp.keySet()) {
--- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -42,10 +42,12 @@
package compiler.jvmci.compilerToVM;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.code.InstalledCode;
import jdk.test.lib.Asserts;
import sun.hotspot.code.NMethod;
import java.util.List;
+import jdk.test.lib.Utils;
public class DisassembleCodeBlobTest {
@@ -56,12 +58,23 @@
= CompileCodeTestCase.generate(/* bci = */ -1);
testCases.addAll(CompileCodeTestCase.generate(/* bci = */ 0));
testCases.forEach(test::check);
+ testCases.stream().findAny().ifPresent(test::checkZero);
test.checkNull();
}
private void checkNull() {
- String str = CompilerToVMHelper.disassembleCodeBlob(0L);
- Asserts.assertNull(str, "not null string returned for null pointer");
+ Utils.runAndCheckException(
+ () -> CompilerToVMHelper.disassembleCodeBlob(null),
+ NullPointerException.class);
+ }
+
+ private void checkZero(CompileCodeTestCase testCase) {
+ System.out.println("checkZero for " + testCase);
+ testCase.deoptimize();
+ InstalledCode installedCode = testCase.toInstalledCode();
+ String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
+ Asserts.assertNull(str, testCase
+ + " : non-null return value for invalid installCode");
}
private void check(CompileCodeTestCase testCase) {
@@ -71,12 +84,13 @@
if (nMethod == null) {
throw new Error(testCase + " : method is not compiled");
}
- String str = CompilerToVMHelper.disassembleCodeBlob(nMethod.address);
+ InstalledCode installedCode = testCase.toInstalledCode();
+ String str = CompilerToVMHelper.disassembleCodeBlob(installedCode);
if (str != null) {
Asserts.assertGT(str.length(), 0,
testCase + " : returned string has to be non-zero length");
}
- String str2 = CompilerToVMHelper.disassembleCodeBlob(nMethod.address);
+ String str2 = CompilerToVMHelper.disassembleCodeBlob(installedCode);
Asserts.assertEQ(str, str2,
testCase + " : 2nd invocation returned different value");
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -45,7 +45,7 @@
import java.util.Arrays;
import java.util.List;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.test.lib.Asserts;
import sun.hotspot.WhiteBox;
@@ -59,7 +59,7 @@
}
private static void runSanityTest(Executable aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
boolean canInline = CompilerToVMHelper.canInlineMethod(method);
Asserts.assertTrue(canInline, "Unexpected initial " +
--- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -4,6 +4,7 @@
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
import jdk.test.lib.Pair;
import sun.hotspot.code.NMethod;
@@ -35,7 +36,6 @@
public class ExecuteInstalledCodeTest {
-
public static void main(String[] args) {
ExecuteInstalledCodeTest test = new ExecuteInstalledCodeTest();
List<CompileCodeTestCase> testCases = new ArrayList<>();
@@ -54,15 +54,14 @@
// to have a clean state
testCase.deoptimize();
Pair<Object, ? extends Throwable> reflectionResult;
- Object[] args = getArguments(testCase.executable);
- reflectionResult = invoke(testCase, args);
+ Object[] args = Utils.getNullValues(
+ testCase.executable.getParameterTypes());
+ reflectionResult = testCase.invoke(args);
NMethod nMethod = testCase.compile();
if (nMethod == null) {
throw new Error(testCase + " : nmethod is null");
}
- InstalledCode installedCode = new InstalledCode(
- testCase.executable.getName());
- installedCode.setAddress(nMethod.address);
+ InstalledCode installedCode = testCase.toInstalledCode();
Object result = null;
Throwable expectedException = reflectionResult.second;
boolean gotException = true;
@@ -107,70 +106,10 @@
if (!Modifier.isStatic(testCase.executable.getModifiers())) {
// add instance as 0th arg
Object[] newArgs = new Object[args.length + 1];
- newArgs[0] = getReciever(testCase);
+ newArgs[0] = testCase.receiver;
System.arraycopy(args, 0, newArgs, 1, args.length);
args = newArgs;
}
return args;
}
-
- private Object getReciever(CompileCodeTestCase testCase) {
- return CompileCodeTestCase.RECEIVERS.get(
- testCase.executable.getDeclaringClass());
- }
-
- public Pair<Object, ? extends Throwable> invoke(
- CompileCodeTestCase testCase, Object[] args) {
- Executable executable = testCase.executable;
- boolean old = executable.isAccessible();
- executable.setAccessible(true);
- try {
- try {
- if (executable instanceof Method) {
- Method m = (Method) executable;
- return new Pair<>(m.invoke(getReciever(testCase), args), null);
- }
-
- if (executable instanceof Constructor) {
- Constructor c = (Constructor) executable;
- return new Pair<>(c.newInstance(args), null);
- }
- } catch (InvocationTargetException e) {
- return new Pair<>(null, e.getCause());
- } catch (Throwable e) {
- return new Pair<>(null, e);
- }
- } finally {
- executable.setAccessible(old);
- }
- throw new Error(executable + " has unsupported type "
- + executable.getClass());
- }
-
- private Object[] getArguments(Executable method) {
- Class<?>[] params = method.getParameterTypes();
- Object[] result = new Object[params.length];
- int i = 0;
- for (Class<?> aClass : params) {
- result[i++] = getArgument(aClass);
- }
- return result;
- }
- private static Map<Class<?>, Object> DEFAULT_VALUES = new HashMap<>();
- static {
- DEFAULT_VALUES.put(boolean.class, false);
- DEFAULT_VALUES.put(byte.class, (byte) 0);
- DEFAULT_VALUES.put(short.class, (short) 0);
- DEFAULT_VALUES.put(char.class, '\0');
- DEFAULT_VALUES.put(int.class, 0);
- DEFAULT_VALUES.put(long.class, 0L);
- DEFAULT_VALUES.put(float.class, 0.0f);
- DEFAULT_VALUES.put(double.class, 0.0d);
- }
- private Object getArgument(Class<?> aClass) {
- if (aClass.isPrimitive()) {
- return DEFAULT_VALUES.get(aClass);
- }
- return null;
- }
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -45,8 +45,8 @@
import java.util.HashSet;
import java.util.Set;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -97,26 +97,26 @@
private void runTest(TestCase tcase) throws NoSuchMethodException {
System.out.println(tcase);
Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
- HotSpotResolvedJavaMethodImpl testMethod = CTVMUtilities
- .getResolvedMethod(tcase.reciever, method);
- HotSpotResolvedObjectTypeImpl resolvedType = CompilerToVMHelper
- .lookupType(Utils.toJVMTypeSignature(tcase.reciever), getClass(),
+ HotSpotResolvedJavaMethod testMethod = CTVMUtilities
+ .getResolvedMethod(tcase.receiver, method);
+ HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
+ .lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
/* resolve = */ true);
- HotSpotResolvedJavaMethodImpl concreteMethod = CompilerToVMHelper
+ HotSpotResolvedJavaMethod concreteMethod = CompilerToVMHelper
.findUniqueConcreteMethod(resolvedType, testMethod);
Asserts.assertEQ(concreteMethod, tcase.isPositive ? testMethod : null,
"Unexpected concrete method for " + tcase.methodName);
}
private static class TestCase {
- public final Class<?> reciever;
+ public final Class<?> receiver;
public final Class<?> holder;
public final String methodName;
public final boolean isPositive;
public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
String methodName) {
- this.reciever = clazz;
+ this.receiver = clazz;
this.methodName = methodName;
this.isPositive = isPositive;
this.holder = holder;
@@ -124,8 +124,8 @@
@Override
public String toString() {
- return String.format("CASE: reciever=%s, holder=%s, method=%s,"
- + " isPositive=%s", reciever.getName(),
+ return String.format("CASE: receiver=%s, holder=%s, method=%s,"
+ + " isPositive=%s", receiver.getName(),
holder.getName(), methodName, isPositive);
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -40,7 +40,7 @@
import compiler.jvmci.common.testcases.TestCase;
import java.lang.reflect.Executable;
import java.lang.reflect.Modifier;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.test.lib.Asserts;
@@ -53,7 +53,7 @@
}
private static void runSanityTest(Executable aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
byte[] bytecode = CompilerToVMHelper.getBytecode(method);
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -44,8 +44,8 @@
import java.util.HashSet;
import java.util.Set;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -78,10 +78,10 @@
private void runTest(TestCase tcase) {
System.out.println(tcase);
String className = tcase.holder.getName();
- HotSpotResolvedObjectTypeImpl resolvedClazz = CompilerToVMHelper
+ HotSpotResolvedObjectType resolvedClazz = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.holder),
getClass(), /* resolve = */ true);
- HotSpotResolvedJavaMethodImpl initializer = CompilerToVMHelper
+ HotSpotResolvedJavaMethod initializer = CompilerToVMHelper
.getClassInitializer(resolvedClazz);
if (tcase.isPositive) {
Asserts.assertNotNull(initializer, "Couldn't get initializer for "
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -27,12 +27,13 @@
* @bug 8136421
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
* @library /testlibrary /../../test/lib /
- * @compile ../common/CompilerToVMHelper.java
+ * @compile ../common/CompilerToVMHelper.java ../common/PublicMetaspaceWrapperObject.java
* @build sun.hotspot.WhiteBox
* compiler.jvmci.compilerToVM.GetConstantPoolTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* jdk.vm.ci.hotspot.CompilerToVMHelper
+ * jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI compiler.jvmci.compilerToVM.GetConstantPoolTest
@@ -40,11 +41,11 @@
package compiler.jvmci.compilerToVM;
import java.lang.reflect.Field;
+import jdk.vm.ci.meta.ConstantPool;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
-import jdk.vm.ci.hotspot.MetaspaceWrapperObject;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
import sun.misc.Unsafe;
@@ -56,25 +57,26 @@
private static enum TestCase {
NULL_BASE {
@Override
- HotSpotConstantPool getConstantPool() {
+ ConstantPool getConstantPool() {
return CompilerToVMHelper.getConstantPool(null,
getPtrToCpAddress());
}
},
JAVA_METHOD_BASE {
@Override
- HotSpotConstantPool getConstantPool() {
- HotSpotResolvedJavaMethodImpl methodInstance
+ ConstantPool getConstantPool() {
+ HotSpotResolvedJavaMethod methodInstance
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(
TEST_CLASS, 0);
Field field;
try {
- field = HotSpotResolvedJavaMethodImpl
- .class.getDeclaredField("metaspaceMethod");
+ // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod
+ field = methodInstance.getClass()
+ .getDeclaredField("metaspaceMethod");
field.setAccessible(true);
field.set(methodInstance, getPtrToCpAddress());
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getConstantPool(methodInstance, 0L);
@@ -82,12 +84,12 @@
},
CONSTANT_POOL_BASE {
@Override
- HotSpotConstantPool getConstantPool() {
- HotSpotConstantPool cpInst;
+ ConstantPool getConstantPool() {
+ ConstantPool cpInst;
try {
cpInst = CompilerToVMHelper.getConstantPool(null,
getPtrToCpAddress());
- Field field = HotSpotConstantPool.class
+ Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, getPtrToCpAddress());
@@ -99,12 +101,12 @@
},
CONSTANT_POOL_BASE_IN_TWO {
@Override
- HotSpotConstantPool getConstantPool() {
+ ConstantPool getConstantPool() {
long ptr = getPtrToCpAddress();
- HotSpotConstantPool cpInst;
+ ConstantPool cpInst;
try {
cpInst = CompilerToVMHelper.getConstantPool(null, ptr);
- Field field = HotSpotConstantPool.class
+ Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, ptr / 2L);
@@ -117,12 +119,12 @@
},
CONSTANT_POOL_BASE_ZERO {
@Override
- HotSpotConstantPool getConstantPool() {
+ ConstantPool getConstantPool() {
long ptr = getPtrToCpAddress();
- HotSpotConstantPool cpInst;
+ ConstantPool cpInst;
try {
cpInst = CompilerToVMHelper.getConstantPool(null, ptr);
- Field field = HotSpotConstantPool.class
+ Field field = CompilerToVMHelper.HotSpotConstantPoolClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, 0L);
@@ -134,9 +136,9 @@
},
OBJECT_TYPE_BASE {
@Override
- HotSpotConstantPool getConstantPool() {
- HotSpotResolvedObjectTypeImpl type
- = HotSpotResolvedObjectTypeImpl.fromObjectClass(
+ ConstantPool getConstantPool() {
+ HotSpotResolvedObjectType type
+ = HotSpotResolvedObjectType.fromObjectClass(
OBJECT_TYPE_BASE.getClass());
long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE);
return CompilerToVMHelper.getConstantPool(type,
@@ -144,26 +146,28 @@
}
},
;
- abstract HotSpotConstantPool getConstantPool();
+ abstract ConstantPool getConstantPool();
}
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Unsafe UNSAFE = Utils.getUnsafe();
+
private static final Class TEST_CLASS = GetConstantPoolTest.class;
private static final long CP_ADDRESS
= WB.getConstantPool(GetConstantPoolTest.class);
public void test(TestCase testCase) {
System.out.println(testCase.name());
- HotSpotConstantPool cp = testCase.getConstantPool();
+ ConstantPool cp = testCase.getConstantPool();
String cpStringRep = cp.toString();
- if (!cpStringRep.contains(HotSpotConstantPool.class.getSimpleName())
+ String cpClassSimpleName
+ = CompilerToVMHelper.HotSpotConstantPoolClass().getSimpleName();
+ if (!cpStringRep.contains(cpClassSimpleName)
|| !cpStringRep.contains(TEST_CLASS.getName())) {
String msg = String.format("%s : "
+ " Constant pool is not valid."
+ " String representation should contain \"%s\" and \"%s\"",
- testCase.name(),
- HotSpotConstantPool.class.getSimpleName(),
+ testCase.name(), cpClassSimpleName,
TEST_CLASS.getName());
throw new AssertionError(msg);
}
@@ -180,8 +184,7 @@
private static void testObjectBase() {
try {
- HotSpotConstantPool cp
- = CompilerToVMHelper.getConstantPool(new Object(), 0L);
+ Object cp = CompilerToVMHelper.getConstantPool(new Object(), 0L);
throw new AssertionError("Test OBJECT_BASE."
+ " Expected IllegalArgumentException has not been caught");
} catch (IllegalArgumentException iae) {
@@ -190,8 +193,8 @@
}
private static void testMetaspaceWrapperBase() {
try {
- HotSpotConstantPool cp = CompilerToVMHelper.getConstantPool(
- new MetaspaceWrapperObject() {
+ Object cp = CompilerToVMHelper.getConstantPool(
+ new PublicMetaspaceWrapperObject() {
@Override
public long getMetaspacePointer() {
return getPtrToCpAddress();
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -42,7 +42,7 @@
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
@@ -76,7 +76,7 @@
private static void runSanityTest(Executable aMethod,
Integer expectedTableLength) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
int tableLength = CompilerToVMHelper.getExceptionTableLength(method);
Asserts.assertEQ(tableLength, expectedTableLength, aMethod
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -51,7 +51,7 @@
import java.util.Set;
import java.util.stream.Stream;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -98,12 +98,12 @@
private void runTest(TestCase tcase) {
System.out.println(tcase);
- HotSpotResolvedObjectTypeImpl resolvedIface = CompilerToVMHelper
+ HotSpotResolvedObjectType resolvedIface = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.anInterface),
getClass(), /* resolve = */ true);
- HotSpotResolvedObjectTypeImpl resolvedImplementer = CompilerToVMHelper
+ HotSpotResolvedObjectType resolvedImplementer = CompilerToVMHelper
.getImplementor(resolvedIface);
- HotSpotResolvedObjectTypeImpl resolvedExpected = null;
+ HotSpotResolvedObjectType resolvedExpected = null;
if (tcase.expectedImplementer != null) {
resolvedExpected = CompilerToVMHelper.lookupType(Utils
.toJVMTypeSignature(tcase.expectedImplementer),
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -39,7 +39,7 @@
import compiler.jvmci.common.CTVMUtilities;
import compiler.jvmci.common.testcases.TestCase;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
@@ -67,7 +67,7 @@
}
public static void runSanityTest(Executable aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
long[] lineNumbers = CompilerToVMHelper.getLineNumberTable(method);
long[] expectedLineNumbers = getExpectedLineNumbers(aMethod);
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -42,7 +42,7 @@
package compiler.jvmci.compilerToVM;
import compiler.jvmci.common.CTVMUtilities;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
@@ -100,7 +100,7 @@
private static void runSanityTest(Executable aMethod,
Integer expectedTableLength) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
int tblLength = CompilerToVMHelper.getLocalVariableTableLength(method);
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -37,20 +37,19 @@
import compiler.jvmci.common.CTVMUtilities;
import java.lang.reflect.Method;
-import jdk.vm.ci.hotspot.CompilerToVM;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.test.lib.Asserts;
public class GetNextStackFrameTest {
private static final int RECURSION_AMOUNT = 3;
- private static final HotSpotResolvedJavaMethodImpl REC_FRAME_METHOD;
- private static final HotSpotResolvedJavaMethodImpl FRAME1_METHOD;
- private static final HotSpotResolvedJavaMethodImpl FRAME2_METHOD;
- private static final HotSpotResolvedJavaMethodImpl FRAME3_METHOD;
- private static final HotSpotResolvedJavaMethodImpl FRAME4_METHOD;
- private static final HotSpotResolvedJavaMethodImpl RUN_METHOD;
+ private static final ResolvedJavaMethod REC_FRAME_METHOD;
+ private static final ResolvedJavaMethod FRAME1_METHOD;
+ private static final ResolvedJavaMethod FRAME2_METHOD;
+ private static final ResolvedJavaMethod FRAME3_METHOD;
+ private static final ResolvedJavaMethod FRAME4_METHOD;
+ private static final ResolvedJavaMethod RUN_METHOD;
static {
Method method;
@@ -69,7 +68,7 @@
method = Thread.class.getDeclaredMethod("run");
RUN_METHOD = CTVMUtilities.getResolvedMethod(Thread.class, method);
} catch (NoSuchMethodException e) {
- throw new Error("TEST BUG: can't find a test method", e);
+ throw new Error("TEST BUG: can't find a test method : " + e, e);
}
}
@@ -126,7 +125,7 @@
*/
private void findFirst() {
checkNextFrameFor(null /* topmost frame */,
- new HotSpotResolvedJavaMethodImpl[]
+ new ResolvedJavaMethod[]
{FRAME2_METHOD, FRAME3_METHOD, FRAME4_METHOD},
FRAME4_METHOD, 0);
}
@@ -139,26 +138,26 @@
// Check that we would get a frame 4 starting from the topmost frame
HotSpotStackFrameReference nextStackFrame = checkNextFrameFor(
null /* topmost frame */,
- new HotSpotResolvedJavaMethodImpl[] {FRAME4_METHOD},
+ new ResolvedJavaMethod[] {FRAME4_METHOD},
FRAME4_METHOD, 0);
// Check that we would get a frame 3 starting from frame 4 when we try
// to search one of the next two frames
nextStackFrame = checkNextFrameFor(nextStackFrame,
- new HotSpotResolvedJavaMethodImpl[] {FRAME3_METHOD,
+ new ResolvedJavaMethod[] {FRAME3_METHOD,
FRAME2_METHOD},
FRAME3_METHOD, 0);
// Check that we would get a frame 1
nextStackFrame = checkNextFrameFor(nextStackFrame,
- new HotSpotResolvedJavaMethodImpl[] {FRAME1_METHOD},
+ new ResolvedJavaMethod[] {FRAME1_METHOD},
FRAME1_METHOD, 0);
// Check that we would skip (RECURSION_AMOUNT - 1) methods and find a
// recursionFrame starting from frame 1
nextStackFrame = checkNextFrameFor(nextStackFrame,
- new HotSpotResolvedJavaMethodImpl[] {REC_FRAME_METHOD},
+ new ResolvedJavaMethod[] {REC_FRAME_METHOD},
REC_FRAME_METHOD, RECURSION_AMOUNT - 1);
// Check that we would get a Thread::run method frame;
nextStackFrame = checkNextFrameFor(nextStackFrame,
- new HotSpotResolvedJavaMethodImpl[] {RUN_METHOD},
+ new ResolvedJavaMethod[] {RUN_METHOD},
RUN_METHOD, 0);
// Check that there are no more frames after thread's run method
nextStackFrame = CompilerToVMHelper.getNextStackFrame(nextStackFrame,
@@ -187,7 +186,7 @@
// Get frame 4
HotSpotStackFrameReference nextStackFrame = CompilerToVMHelper
.getNextStackFrame(null /* topmost frame */,
- new HotSpotResolvedJavaMethodImpl[] {FRAME4_METHOD}, 0);
+ new ResolvedJavaMethod[] {FRAME4_METHOD}, 0);
// Get frame 2 by skipping one method starting from frame 4
checkNextFrameFor(nextStackFrame, null /* any */,
FRAME2_METHOD , 1 /* skip one */);
@@ -198,15 +197,18 @@
*/
private void findYourself() {
Method method;
+ Class<?> aClass = CompilerToVMHelper.CompilerToVMClass();
try {
- method = CompilerToVM.class.getDeclaredMethod("getNextStackFrame",
- HotSpotStackFrameReference.class,
- HotSpotResolvedJavaMethodImpl[].class, int.class);
+ method = aClass.getDeclaredMethod(
+ "getNextStackFrame",
+ HotSpotStackFrameReference.class,
+ ResolvedJavaMethod[].class,
+ int.class);
} catch (NoSuchMethodException e) {
- throw new Error("TEST BUG: can't find getNextStackFrame method");
+ throw new Error("TEST BUG: can't find getNextStackFrame : " + e, e);
}
- HotSpotResolvedJavaMethodImpl self
- = CTVMUtilities.getResolvedMethod(CompilerToVM.class, method);
+ ResolvedJavaMethod self
+ = CTVMUtilities.getResolvedMethod(aClass, method);
checkNextFrameFor(null /* topmost frame */, null /* any */, self, 0);
}
@@ -221,8 +223,8 @@
*/
private HotSpotStackFrameReference checkNextFrameFor(
HotSpotStackFrameReference currentFrame,
- HotSpotResolvedJavaMethodImpl[] searchMethods,
- HotSpotResolvedJavaMethodImpl expected,
+ ResolvedJavaMethod[] searchMethods,
+ ResolvedJavaMethod expected,
int skip) {
HotSpotStackFrameReference nextStackFrame = CompilerToVMHelper
.getNextStackFrame(currentFrame, searchMethods, skip);
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -36,7 +36,7 @@
package compiler.jvmci.compilerToVM;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
import java.util.HashMap;
@@ -94,7 +94,7 @@
}
private static void testSlotBigger(Class<?> holder) {
- HotSpotResolvedJavaMethodImpl method
+ HotSpotResolvedJavaMethod method
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(holder, 50);
Asserts.assertNull(method, "Got method for non existing slot 50 in "
+ holder);
@@ -102,10 +102,14 @@
private static void testCorrectMethods(Class<?> holder, int methodsNumber) {
for (int i = 0; i < methodsNumber; i++) {
- HotSpotResolvedJavaMethodImpl method = CompilerToVMHelper
+ String caseName = String.format("slot %d in %s",
+ i, holder.getCanonicalName());
+ HotSpotResolvedJavaMethod method = CompilerToVMHelper
.getResolvedJavaMethodAtSlot(holder, i);
- Asserts.assertNotNull(method, "Did not got method for slot " + i
- + " in class " + holder.getCanonicalName());
+ Asserts.assertNotNull(method, caseName + " did not got method");
+ Asserts.assertEQ(holder,
+ CompilerToVMHelper.getMirror(method.getDeclaringClass()),
+ caseName + " : unexpected declaring class");
}
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -27,11 +27,13 @@
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
* @library / /testlibrary /../../test/lib
* @compile ../common/CompilerToVMHelper.java
+ * ../common/PublicMetaspaceWrapperObject.java
* @build compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest
* @run main ClassFileInstaller
* sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* jdk.vm.ci.hotspot.CompilerToVMHelper
+ * jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest
@@ -40,8 +42,8 @@
package compiler.jvmci.compilerToVM;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.MetaspaceWrapperObject;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
@@ -53,23 +55,20 @@
private static enum TestCase {
NULL_BASE {
@Override
- HotSpotResolvedJavaMethodImpl getResolvedJavaMethod() {
+ HotSpotResolvedJavaMethod getResolvedJavaMethod() {
return CompilerToVMHelper.getResolvedJavaMethod(
null, getPtrToMethod());
}
},
JAVA_METHOD_BASE {
@Override
- HotSpotResolvedJavaMethodImpl getResolvedJavaMethod() {
- HotSpotResolvedJavaMethodImpl methodInstance
+ HotSpotResolvedJavaMethod getResolvedJavaMethod() {
+ HotSpotResolvedJavaMethod methodInstance
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(
- TEST_CLASS, 0);
- Field field;
+ TEST_CLASS, 0);
try {
- field = HotSpotResolvedJavaMethodImpl
- .class.getDeclaredField("metaspaceMethod");
- field.setAccessible(true);
- field.set(methodInstance, getPtrToMethod());
+ METASPACE_METHOD_FIELD.set(methodInstance,
+ getPtrToMethod());
} catch (ReflectiveOperationException e) {
throw new Error("TEST BUG : " + e, e);
}
@@ -79,19 +78,15 @@
},
JAVA_METHOD_BASE_IN_TWO {
@Override
- HotSpotResolvedJavaMethodImpl getResolvedJavaMethod() {
+ HotSpotResolvedJavaMethod getResolvedJavaMethod() {
long ptr = getPtrToMethod();
- HotSpotResolvedJavaMethodImpl methodInstance
+ HotSpotResolvedJavaMethod methodInstance
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(
TEST_CLASS, 0);
- Field field;
try {
- field = HotSpotResolvedJavaMethodImpl
- .class.getDeclaredField("metaspaceMethod");
- field.setAccessible(true);
- field.set(methodInstance, ptr / 2L);
+ METASPACE_METHOD_FIELD.set(methodInstance, ptr / 2L);
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getResolvedJavaMethod(methodInstance,
ptr - ptr / 2L);
@@ -99,36 +94,42 @@
},
JAVA_METHOD_BASE_ZERO {
@Override
- HotSpotResolvedJavaMethodImpl getResolvedJavaMethod() {
+ HotSpotResolvedJavaMethod getResolvedJavaMethod() {
long ptr = getPtrToMethod();
- HotSpotResolvedJavaMethodImpl methodInstance
+ HotSpotResolvedJavaMethod methodInstance
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(
TEST_CLASS, 0);
- Field field;
try {
- field = HotSpotResolvedJavaMethodImpl
- .class.getDeclaredField("metaspaceMethod");
- field.setAccessible(true);
- field.set(methodInstance, 0L);
+ METASPACE_METHOD_FIELD.set(methodInstance, 0L);
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getResolvedJavaMethod(methodInstance,
ptr);
}
}
;
- abstract HotSpotResolvedJavaMethodImpl getResolvedJavaMethod();
+ abstract HotSpotResolvedJavaMethod getResolvedJavaMethod();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final WhiteBox WB = WhiteBox.getWhiteBox();
+ private static final Field METASPACE_METHOD_FIELD;
private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;
private static final long PTR;
static {
- HotSpotResolvedJavaMethodImpl method
+ HotSpotResolvedJavaMethod method
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(TEST_CLASS, 0);
- PTR = method.getMetaspacePointer();
+ try {
+ // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod
+ METASPACE_METHOD_FIELD = method.getClass()
+ .getDeclaredField("metaspaceMethod");
+ METASPACE_METHOD_FIELD.setAccessible(true);
+ PTR = (long) METASPACE_METHOD_FIELD.get(method);
+ } catch (ReflectiveOperationException e) {
+ throw new Error("TESTBUG : " + e, e);
+ }
+
}
private static long getPtrToMethod() {
@@ -144,10 +145,11 @@
public void test(TestCase testCase) {
System.out.println(testCase.name());
- HotSpotResolvedJavaMethodImpl result = testCase.getResolvedJavaMethod();
+ HotSpotResolvedJavaMethod result = testCase.getResolvedJavaMethod();
Asserts.assertNotNull(result, testCase + " : got null");
- Asserts.assertEQ(result.getDeclaringClass().mirror(), TEST_CLASS,
- testCase + " : returned method has unexpected declaring class");
+ Asserts.assertEQ(TEST_CLASS,
+ CompilerToVMHelper.getMirror(result.getDeclaringClass()),
+ testCase + " : unexpected declaring class");
}
public static void main(String[] args) {
@@ -161,9 +163,9 @@
private static void testMetaspaceWrapperBase() {
try {
- HotSpotResolvedJavaMethodImpl method
+ HotSpotResolvedJavaMethod method
= CompilerToVMHelper.getResolvedJavaMethod(
- new MetaspaceWrapperObject() {
+ new PublicMetaspaceWrapperObject() {
@Override
public long getMetaspacePointer() {
return getPtrToMethod();
@@ -171,18 +173,18 @@
}, 0L);
throw new AssertionError("Test METASPACE_WRAPPER_BASE."
+ " Expected IllegalArgumentException has not been caught");
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException e) {
// expected
}
}
private static void testObjectBase() {
try {
- HotSpotResolvedJavaMethodImpl method
+ HotSpotResolvedJavaMethod method
= CompilerToVMHelper.getResolvedJavaMethod(new Object(), 0L);
throw new AssertionError("Test OBJECT_BASE."
+ " Expected IllegalArgumentException has not been caught");
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException e) {
// expected
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -27,11 +27,13 @@
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
* @library / /testlibrary /../../test/lib
* @compile ../common/CompilerToVMHelper.java
+ * ../common/PublicMetaspaceWrapperObject.java
* @build compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest
* @run main ClassFileInstaller
* sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* jdk.vm.ci.hotspot.CompilerToVMHelper
+ * jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockExperimentalVMOptions
* -XX:+EnableJVMCI -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:+UseCompressedOops
@@ -45,11 +47,11 @@
package compiler.jvmci.compilerToVM;
import java.lang.reflect.Field;
+import jdk.vm.ci.meta.ConstantPool;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
-import jdk.vm.ci.hotspot.MetaspaceWrapperObject;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
+import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
@@ -59,21 +61,22 @@
private static enum TestCase {
NULL_BASE {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
+ HotSpotResolvedObjectType getResolvedJavaType() {
return CompilerToVMHelper.getResolvedJavaType(
null, getPtrToKlass(), COMPRESSED);
}
},
JAVA_METHOD_BASE {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
- HotSpotResolvedJavaMethodImpl methodInstance
+ HotSpotResolvedObjectType getResolvedJavaType() {
+ HotSpotResolvedJavaMethod methodInstance
= CompilerToVMHelper.getResolvedJavaMethodAtSlot(
TEST_CLASS, 0);
Field field;
try {
- field = HotSpotResolvedJavaMethodImpl
- .class.getDeclaredField("metaspaceMethod");
+ // jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl.metaspaceMethod
+ field = methodInstance.getClass()
+ .getDeclaredField("metaspaceMethod");
field.setAccessible(true);
field.set(methodInstance, getPtrToKlass());
} catch (ReflectiveOperationException e) {
@@ -86,17 +89,18 @@
},
CONSTANT_POOL_BASE {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
- HotSpotConstantPool cpInst;
+ HotSpotResolvedObjectType getResolvedJavaType() {
+ ConstantPool cpInst;
try {
cpInst = CompilerToVMHelper.getConstantPool(null,
getPtrToKlass());
- Field field = HotSpotConstantPool.class
+ // jdk.vm.ci.hotspot.HotSpotConstantPool.metaspaceConstantPool
+ Field field = cpInst.getClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, getPtrToKlass());
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getResolvedJavaType(cpInst,
0L, COMPRESSED);
@@ -104,17 +108,18 @@
},
CONSTANT_POOL_BASE_IN_TWO {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
+ HotSpotResolvedObjectType getResolvedJavaType() {
long ptr = getPtrToKlass();
- HotSpotConstantPool cpInst = HotSpotResolvedObjectTypeImpl
- .fromObjectClass(TEST_CLASS).getConstantPool();
+ ConstantPool cpInst = HotSpotResolvedObjectType
+ .fromObjectClass(TEST_CLASS)
+ .getConstantPool();
try {
- Field field = HotSpotConstantPool.class
+ Field field = cpInst.getClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, ptr / 2L);
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getResolvedJavaType(cpInst,
ptr - ptr / 2L, COMPRESSED);
@@ -122,17 +127,18 @@
},
CONSTANT_POOL_BASE_ZERO {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
+ HotSpotResolvedObjectType getResolvedJavaType() {
long ptr = getPtrToKlass();
- HotSpotConstantPool cpInst = HotSpotResolvedObjectTypeImpl
- .fromObjectClass(TEST_CLASS).getConstantPool();
+ ConstantPool cpInst = HotSpotResolvedObjectType
+ .fromObjectClass(TEST_CLASS)
+ .getConstantPool();
try {
- Field field = HotSpotConstantPool.class
+ Field field = cpInst.getClass()
.getDeclaredField("metaspaceConstantPool");
field.setAccessible(true);
field.set(cpInst, 0L);
} catch (ReflectiveOperationException e) {
- throw new Error("TESTBUG : " + e.getMessage(), e);
+ throw new Error("TESTBUG : " + e, e);
}
return CompilerToVMHelper.getResolvedJavaType(cpInst,
ptr, COMPRESSED);
@@ -140,9 +146,9 @@
},
OBJECT_TYPE_BASE {
@Override
- HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
- HotSpotResolvedObjectTypeImpl type
- = HotSpotResolvedObjectTypeImpl.fromObjectClass(
+ HotSpotResolvedObjectType getResolvedJavaType() {
+ HotSpotResolvedObjectType type
+ = HotSpotResolvedObjectType.fromObjectClass(
OBJECT_TYPE_BASE.getClass());
long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE);
return CompilerToVMHelper.getResolvedJavaType(type,
@@ -150,7 +156,7 @@
}
},
;
- abstract HotSpotResolvedObjectTypeImpl getResolvedJavaType();
+ abstract HotSpotResolvedObjectType getResolvedJavaType();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
@@ -176,9 +182,10 @@
public void test(TestCase testCase) {
System.out.println(testCase.name());
- HotSpotResolvedObjectTypeImpl type = testCase.getResolvedJavaType();
- Asserts.assertEQ(type.mirror(), TEST_CLASS, testCase +
- " Unexpected Class returned by getResolvedJavaType");
+ HotSpotResolvedObjectType type = testCase.getResolvedJavaType();
+ Asserts.assertEQ(TEST_CLASS,
+ CompilerToVMHelper.getMirror(type),
+ testCase + " : unexpected class returned");
}
public static void main(String[] args) {
@@ -192,9 +199,9 @@
private static void testMetaspaceWrapperBase() {
try {
- HotSpotResolvedObjectTypeImpl type
+ HotSpotResolvedObjectType type
= CompilerToVMHelper.getResolvedJavaType(
- new MetaspaceWrapperObject() {
+ new PublicMetaspaceWrapperObject() {
@Override
public long getMetaspacePointer() {
return getPtrToKlass();
@@ -209,7 +216,7 @@
private static void testObjectBase() {
try {
- HotSpotResolvedObjectTypeImpl type
+ HotSpotResolvedObjectType type
= CompilerToVMHelper.getResolvedJavaType(new Object(), 0L,
COMPRESSED);
throw new AssertionError("Test OBJECT_BASE."
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -41,7 +41,7 @@
import java.lang.reflect.Modifier;
import java.util.HashMap;
import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
@@ -53,7 +53,7 @@
}
private static void runSanityTest(Executable aMethod, int[] bcis) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
String className = aMethod.getDeclaringClass().getName();
int lastDot = className.lastIndexOf('.');
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -52,7 +52,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.meta.ConstantPool;
import jdk.test.lib.Utils;
@@ -76,7 +76,7 @@
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG: can't find test method", e);
}
- HotSpotResolvedJavaMethodImpl resolvedMethod
+ HotSpotResolvedJavaMethod resolvedMethod
= CTVMUtilities.getResolvedMethod(aClass, method);
List<String> symbols;
try {
@@ -101,7 +101,7 @@
}
}
- private List<String> getSymbols(HotSpotResolvedJavaMethodImpl
+ private List<String> getSymbols(HotSpotResolvedJavaMethod
metaspaceMethod) throws ReflectiveOperationException {
List<String> symbols = new ArrayList<>();
ConstantPool pool = metaspaceMethod.getConstantPool();
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -53,8 +53,8 @@
import java.util.Set;
import java.util.stream.Stream;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -125,10 +125,10 @@
private void runTest(TestCase tcase) throws NoSuchMethodException {
System.out.println(tcase);
Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
- HotSpotResolvedObjectTypeImpl metaspaceKlass = CompilerToVMHelper
+ HotSpotResolvedObjectType metaspaceKlass = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.receiver),
getClass(), /* resolve = */ true);
- HotSpotResolvedJavaMethodImpl metaspaceMethod = CTVMUtilities
+ HotSpotResolvedJavaMethod metaspaceMethod = CTVMUtilities
.getResolvedMethod(tcase.holder, method);
int index = 0;
try {
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -47,9 +47,10 @@
import java.util.List;
import compiler.testlibrary.CompilerUtils;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
import sun.hotspot.code.NMethod;
public class HasCompiledCodeForOSRTest {
@@ -63,7 +64,8 @@
try {
Class<?> aClass = DummyClass.class;
- testCases.add(new CompileCodeTestCase(
+ Object receiver = new DummyClass();
+ testCases.add(new CompileCodeTestCase(receiver,
aClass.getMethod("withLoop"), 17));
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG : " + e.getMessage(), e);
@@ -74,8 +76,9 @@
private static void runSanityTest(CompileCodeTestCase testCase) {
System.out.println(testCase);
Executable aMethod = testCase.executable;
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
+ testCase.invoke(Utils.getNullValues(aMethod.getParameterTypes()));
testCase.deoptimize();
int[] levels = CompilerUtils.getAvailableCompilationLevels();
// not compiled
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -45,7 +45,7 @@
import java.util.Set;
import java.util.stream.Stream;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -81,7 +81,7 @@
private void runTest(TestCase tcase) {
System.out.println(tcase);
- HotSpotResolvedObjectTypeImpl metaspaceKlass = CompilerToVMHelper
+ HotSpotResolvedObjectType metaspaceKlass = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.aClass),
getClass(), /* resolve = */ true);
Asserts.assertEQ(tcase.expected,
--- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -44,6 +44,7 @@
import java.util.Objects;
import java.util.function.Consumer;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.misc.Unsafe;
@@ -72,7 +73,7 @@
private void runTest(List<TestCase> tcases) {
VMStructDataReader reader = new VMStructDataReader(
- CompilerToVMHelper.initializeConfiguration());
+ CompilerToVMHelper.initializeConfiguration(HotSpotJVMCIRuntime.runtime().getConfig()));
while (reader.hasNext()) {
VMFieldData data = reader.next();
for (TestCase tcase : tcases) {
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -41,14 +41,25 @@
package compiler.jvmci.compilerToVM;
+import compiler.jvmci.common.CTVMUtilities;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
import sun.hotspot.code.NMethod;
import java.util.List;
+import jdk.vm.ci.code.CodeCacheProvider;
+import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
public class InvalidateInstalledCodeTest {
+ private static final CodeCacheProvider CACHE_PROVIDER
+ = HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend()
+ .getCodeCache();
+
public static void main(String[] args) {
InvalidateInstalledCodeTest test
= new InvalidateInstalledCodeTest();
@@ -60,26 +71,37 @@
}
private void checkNull() {
- InstalledCode installedCode = new InstalledCode("<null>");
- installedCode.setAddress(0);
- CompilerToVMHelper.invalidateInstalledCode(installedCode);
+ Utils.runAndCheckException(
+ () -> CompilerToVMHelper.invalidateInstalledCode(null),
+ NullPointerException.class);
}
private void check(CompileCodeTestCase testCase) {
System.out.println(testCase);
- // to have a clean state
- NMethod beforeInvalidation = testCase.deoptimizeAndCompile();
- if (beforeInvalidation == null) {
- throw new Error("method is not compiled, testCase " + testCase);
+ HotSpotResolvedJavaMethod javaMethod
+ = CTVMUtilities.getResolvedMethod(testCase.executable);
+ HotSpotCompilationRequest compRequest = new HotSpotCompilationRequest(
+ javaMethod, testCase.bci, /* jvmciEnv = */ 0L);
+ String name = testCase.executable.getName();
+ CompilationResult compResult = new CompilationResult(name);
+ // to pass sanity check of default -1
+ compResult.setTotalFrameSize(0);
+ InstalledCode installedCode = CACHE_PROVIDER.installCode(
+ compRequest, compResult,
+ new InstalledCode(name), /* speculationLog = */ null,
+ /* isDefault = */ false);
+ Asserts.assertTrue(installedCode.isValid(), testCase
+ + " : code is invalid even before invalidation");
+
+ NMethod beforeInvalidation = testCase.toNMethod();
+ if (beforeInvalidation != null) {
+ throw new Error("TESTBUG : " + testCase + " : nmethod isn't found");
}
-
// run twice to verify how it works if method is already invalidated
for (int i = 0; i < 2; ++i) {
- InstalledCode installedCode = new InstalledCode(
- testCase.executable.getName());
- installedCode.setAddress(beforeInvalidation.address);
-
CompilerToVMHelper.invalidateInstalledCode(installedCode);
+ Asserts.assertFalse(installedCode.isValid(), testCase
+ + " : code is valid after invalidation, i = " + i);
NMethod afterInvalidation = testCase.toNMethod();
if (afterInvalidation != null) {
System.err.println("before: " + beforeInvalidation);
@@ -87,8 +109,6 @@
throw new AssertionError(testCase
+ " : method hasn't been invalidated, i = " + i);
}
- Asserts.assertFalse(installedCode.isValid(), testCase
- + " : code is valid after invalidation, i = " + i);
}
}
}
--- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,7 +22,7 @@
*
*/
-/**
+/*
* @test
* @bug 8136421
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
@@ -40,7 +40,6 @@
package compiler.jvmci.compilerToVM;
-import jdk.vm.ci.hotspot.CompilerToVM;
import jdk.vm.ci.runtime.JVMCI;
import jdk.test.lib.Asserts;
@@ -88,9 +87,12 @@
private JVM_RegisterJVMCINatives() {
Method method;
try {
- method = CompilerToVM.class.getDeclaredMethod("registerNatives");
+ method = Class.forName("jdk.vm.ci.hotspot.CompilerToVM",
+ /* initialize = */ false,
+ this.getClass().getClassLoader())
+ .getDeclaredMethod("registerNatives");
method.setAccessible(true);
- } catch (NoSuchMethodException e) {
+ } catch (ReflectiveOperationException e) {
throw new Error("can't find CompilerToVM::registerNatives", e);
}
registerNatives = method;
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -44,8 +44,7 @@
import java.util.HashMap;
import java.util.Map;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import sun.reflect.ConstantPool;
/**
@@ -62,16 +61,16 @@
testCase.test();
}
- public static void validate(HotSpotConstantPool constantPoolCTVM,
+ public static void validate(jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
ConstantPool constantPoolSS,
ConstantPoolTestsHelper.DummyClasses dummyClass, int i) {
Object classToVerify = CompilerToVMHelper
.lookupKlassInPool(constantPoolCTVM, i);
- if (!(classToVerify instanceof HotSpotResolvedObjectTypeImpl)
+ if (!(classToVerify instanceof HotSpotResolvedObjectType)
&& !(classToVerify instanceof String)) {
String msg = String.format("Output of method"
+ " CTVM.lookupKlassInPool is neither"
- + " a HotSpotResolvedObjectTypeImpl, nor a String");
+ + " a HotSpotResolvedObjectType, nor a String");
throw new AssertionError(msg);
}
int classNameIndex = (int) dummyClass.cp.get(i).value;
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -42,7 +42,7 @@
import java.util.HashSet;
import java.util.Set;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
@@ -86,7 +86,7 @@
private void runTest(TestCase tcase) {
System.out.println(tcase);
- HotSpotResolvedObjectTypeImpl metaspaceKlass;
+ HotSpotResolvedObjectType metaspaceKlass;
try {
metaspaceKlass = CompilerToVMHelper.lookupType(tcase.className,
tcase.accessing, tcase.resolve);
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -46,19 +46,21 @@
package compiler.jvmci.compilerToVM;
-import compiler.jvmci.common.CTVMUtilities;
-import compiler.testlibrary.CompilerUtils;
+import java.lang.reflect.Method;
+import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
+
+import compiler.jvmci.common.CTVMUtilities;
+import compiler.testlibrary.CompilerUtils;
+
import sun.hotspot.WhiteBox;
-import java.lang.reflect.Method;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotStackFrameReference;
public class MaterializeVirtualObjectTest {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Method METHOD;
- private static final HotSpotResolvedJavaMethodImpl RESOLVED_METHOD;
+ private static final ResolvedJavaMethod RESOLVED_METHOD;
private static final boolean INVALIDATE = Boolean.getBoolean(
"compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate");
@@ -113,7 +115,7 @@
if (materialize) {
HotSpotStackFrameReference hsFrame = CompilerToVMHelper
.getNextStackFrame(/* topmost frame */ null,
- new HotSpotResolvedJavaMethodImpl[]{
+ new ResolvedJavaMethod[]{
RESOLVED_METHOD}, /* don't skip any */ 0);
Asserts.assertNotNull(hsFrame, getName() + " : got null frame");
Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
--- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -41,7 +41,7 @@
import java.lang.reflect.Executable;
import java.util.HashMap;
import java.util.Map;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.test.lib.Asserts;
@@ -54,7 +54,7 @@
}
private static void runSanityTest(Executable aMethod, Boolean expected) {
- HotSpotResolvedJavaMethodImpl method
+ HotSpotResolvedJavaMethod method
= CTVMUtilities.getResolvedMethod(aMethod);
boolean isIgnored = CompilerToVMHelper
.methodIsIgnoredBySecurityStackWalk(method);
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -46,7 +46,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.meta.ProfilingInfo;
import jdk.test.lib.Asserts;
@@ -78,7 +78,7 @@
}
private static void runSanityTest(Method aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
ProfilingInfo startProfile = method.getProfilingInfo();
Asserts.assertFalse(startProfile.isMature(), aMethod
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -42,7 +42,6 @@
import java.util.HashMap;
import java.util.Map;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
import jdk.test.lib.Asserts;
import sun.reflect.ConstantPool;
@@ -62,7 +61,8 @@
testCase.test();
}
- private static void validateMethodHandle(HotSpotConstantPool constantPoolCTVM,
+ private static void validateMethodHandle(
+ jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
ConstantPool constantPoolSS,
ConstantPoolTestsHelper.DummyClasses dummyClass, int index) {
Object constantInPool = CompilerToVMHelper
@@ -77,7 +77,8 @@
}
}
- private static void validateMethodType(HotSpotConstantPool constantPoolCTVM,
+ private static void validateMethodType(
+ jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
ConstantPool constantPoolSS,
ConstantPoolTestsHelper.DummyClasses dummyClass, int index) {
Object constantInPool = CompilerToVMHelper
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -49,8 +49,8 @@
import java.util.HashSet;
import java.util.Set;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.misc.Unsafe;
@@ -125,16 +125,16 @@
private void runTest(TestCase tcase) throws NoSuchMethodException {
System.out.println(tcase);
- HotSpotResolvedJavaMethodImpl metaspaceMethod = CTVMUtilities
+ HotSpotResolvedJavaMethod metaspaceMethod = CTVMUtilities
.getResolvedMethod(tcase.holder,
tcase.holder.getDeclaredMethod(tcase.methodName));
- HotSpotResolvedObjectTypeImpl holderMetaspace = CompilerToVMHelper
+ HotSpotResolvedObjectType holderMetaspace = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.holder),
getClass(), /* resolve = */ true);
- HotSpotResolvedObjectTypeImpl callerMetaspace = CompilerToVMHelper
+ HotSpotResolvedObjectType callerMetaspace = CompilerToVMHelper
.lookupType(Utils.toJVMTypeSignature(tcase.caller),
getClass(), /* resolve = */ true);
- HotSpotResolvedJavaMethodImpl resolvedMetaspaceMethod
+ HotSpotResolvedJavaMethod resolvedMetaspaceMethod
= CompilerToVMHelper.resolveMethod(holderMetaspace,
metaspaceMethod, callerMetaspace);
if (tcase.isPositive) {
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -44,8 +44,7 @@
import java.util.HashMap;
import java.util.Map;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotConstantPool;
-import jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import sun.reflect.ConstantPool;
/**
@@ -62,10 +61,11 @@
testCase.test();
}
- public static void validate(HotSpotConstantPool constantPoolCTVM,
+ public static void validate(
+ jdk.vm.ci.meta.ConstantPool constantPoolCTVM,
ConstantPool constantPoolSS,
ConstantPoolTestsHelper.DummyClasses dummyClass, int i) {
- HotSpotResolvedObjectTypeImpl typeToVerify = CompilerToVMHelper
+ HotSpotResolvedObjectType typeToVerify = CompilerToVMHelper
.resolveTypeInPool(constantPoolCTVM, i);
int classNameIndex = (int) dummyClass.cp.get(i).value;
String classNameToRefer = constantPoolSS.getUTF8At(classNameIndex);
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -45,7 +45,7 @@
import java.util.Arrays;
import java.util.List;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.test.lib.Asserts;
import sun.hotspot.WhiteBox;
@@ -59,7 +59,7 @@
}
private static void runSanityTest(Executable aMethod) {
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
boolean shouldInline = CompilerToVMHelper.shouldInlineMethod(method);
boolean expectedShouldInline = WB.testSetForceInlineMethod(aMethod,
--- a/hotspot/test/compiler/jvmci/events/JvmciCompleteInitializationTest.config Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-compiler.jvmci.events.JvmciCompleteInitializationTest
--- a/hotspot/test/compiler/jvmci/events/JvmciCompleteInitializationTest.java Tue Nov 03 20:12:51 2015 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-/*
- * @test
- * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
- * @library / /testlibrary
- * @build compiler.jvmci.common.JVMCIHelpers
- * compiler.jvmci.events.JvmciCompleteInitializationTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciCompleteInitializationTest.config
- * ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener
- * @run main ClassFileInstaller
- * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
- * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
- * compiler.jvmci.events.JvmciCompleteInitializationTest
- * jdk.test.lib.Asserts
- * @run main/othervm -XX:+UnlockExperimentalVMOptions
- * -Xbootclasspath/a:.
- * -XX:+EnableJVMCI
- * -Dcompiler.jvmci.events.JvmciCompleteInitializationTest.positive=true
- * compiler.jvmci.events.JvmciCompleteInitializationTest
- * @run main/othervm -XX:+UnlockExperimentalVMOptions
- * -Xbootclasspath/a:.
- * -XX:-EnableJVMCI
- * -Dcompiler.jvmci.events.JvmciCompleteInitializationTest.positive=false
- * compiler.jvmci.events.JvmciCompleteInitializationTest
- */
-
-package compiler.jvmci.events;
-
-import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.HotSpotVMEventListener;
-import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
-
-public class JvmciCompleteInitializationTest implements HotSpotVMEventListener {
- private static final boolean IS_POSITIVE = Boolean.getBoolean(
- "compiler.jvmci.events.JvmciCompleteInitializationTest.positive");
- private static volatile int completeInitializationCount = 0;
- private static volatile String errorMessage = "";
-
- public static void main(String args[]) {
- if (completeInitializationCount != 0) {
- throw new Error("Unexpected completeInitialization events"
- + " count at start");
- }
- initializeRuntime();
- int expectedEventCount = IS_POSITIVE ? 1 : 0;
- Asserts.assertEQ(completeInitializationCount, expectedEventCount,
- "Unexpected completeInitialization events count"
- + " after JVMCI init");
- initializeRuntime();
- Asserts.assertEQ(completeInitializationCount, expectedEventCount,
- "Unexpected completeInitialization events count"
- + " after 2nd JVMCI init");
- Asserts.assertTrue(errorMessage.isEmpty(), errorMessage);
- }
-
- private static void initializeRuntime() {
- Error t = null;
- try {
- /* in case JVMCI disabled, an InternalError on initialization
- and NoClassDefFound on 2nd try */
- HotSpotJVMCIRuntime.runtime();
- } catch (Error e) {
- t = e;
- }
- if (IS_POSITIVE) {
- Asserts.assertNull(t, "Caught unexpected exception");
- } else {
- Asserts.assertNotNull(t, "Got no expected error");
- }
- }
-
- @Override
- public void completeInitialization(HotSpotJVMCIRuntime
- hotSpotJVMCIRuntime) {
- completeInitializationCount++;
- if (hotSpotJVMCIRuntime == null) {
- errorMessage += " HotSpotJVMCIRuntime is null.";
- }
- }
-}
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -61,8 +61,9 @@
import jdk.vm.ci.code.CompilationResult;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
+import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
-import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethodImpl;
+import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
public class JvmciNotifyInstallEventTest implements HotSpotVMEventListener {
private static final String METHOD_NAME = "testMethod";
@@ -99,17 +100,18 @@
} catch (NoSuchMethodException e) {
throw new Error("TEST BUG: Can't find " + METHOD_NAME, e);
}
- HotSpotResolvedJavaMethodImpl method = CTVMUtilities
+ HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(SimpleClass.class, testMethod);
CompilationResult compResult = new CompilationResult(METHOD_NAME);
+ HotSpotCompilationRequest compRequest = new HotSpotCompilationRequest(method, -1, 0L);
// to pass sanity check of default -1
compResult.setTotalFrameSize(0);
- codeCache.installMethod(method, compResult, /* jvmciEnv = */ 0L,
+ codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null,
/* isDefault = */ false);
Asserts.assertEQ(gotInstallNotification, 1,
"Got unexpected event count after 1st install attempt");
// since "empty" compilation result is ok, a second attempt should be ok
- codeCache.installMethod(method, compResult, /* jvmciEnv = */ 0L,
+ codeCache.installCode(compRequest, compResult, /* installedCode = */ null, /* speculationLog = */ null,
/* isDefault = */ false);
Asserts.assertEQ(gotInstallNotification, 2,
"Got unexpected event count after 2nd install attempt");
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.options.test/src/jdk/vm/ci/options/test/NestedBooleanOptionValueTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.options.test/src/jdk/vm/ci/options/test/NestedBooleanOptionValueTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,12 +29,20 @@
package jdk.vm.ci.options.test;
-import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.*;
-import static org.junit.Assert.*;
-import jdk.vm.ci.options.*;
-import jdk.vm.ci.options.OptionValue.*;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.Master0;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.Master1;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.Master2;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.NestedOption0;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.NestedOption1;
+import static jdk.vm.ci.options.test.NestedBooleanOptionValueTest.Options.NestedOption2;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import jdk.vm.ci.options.NestedBooleanOptionValue;
+import jdk.vm.ci.options.OptionDescriptor;
+import jdk.vm.ci.options.OptionValue;
+import jdk.vm.ci.options.OptionValue.OverrideScope;
-import org.junit.*;
+import org.junit.Test;
public class NestedBooleanOptionValueTest {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.options.test/src/jdk/vm/ci/options/test/TestOptionValue.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.options.test/src/jdk/vm/ci/options/test/TestOptionValue.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,15 +29,21 @@
package jdk.vm.ci.options.test;
-import static jdk.vm.ci.options.test.TestOptionValue.Options.*;
-import static org.junit.Assert.*;
-
-import java.util.*;
+import static jdk.vm.ci.options.test.TestOptionValue.Options.Mutable;
+import static jdk.vm.ci.options.test.TestOptionValue.Options.SecondMutable;
+import static jdk.vm.ci.options.test.TestOptionValue.Options.Stable;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import jdk.vm.ci.options.*;
-import jdk.vm.ci.options.OptionValue.*;
+import java.util.Arrays;
-import org.junit.*;
+import jdk.vm.ci.options.OptionDescriptor;
+import jdk.vm.ci.options.OptionValue;
+import jdk.vm.ci.options.OptionValue.OverrideScope;
+import jdk.vm.ci.options.StableOptionValue;
+
+import org.junit.Test;
@SuppressWarnings("try")
public class TestOptionValue {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,9 +30,11 @@
package jdk.vm.ci.runtime.test;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
-import org.junit.*;
+import org.junit.Assert;
+import org.junit.Test;
public class ConstantTest extends FieldUniverse {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/FieldUniverse.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,11 @@
*/
package jdk.vm.ci.runtime.test;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaField;
/**
* Context for field related tests.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/MethodUniverse.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,10 +22,12 @@
*/
package jdk.vm.ci.runtime.test;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
/**
* Context for method related tests.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,11 +22,14 @@
*/
package jdk.vm.ci.runtime.test;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Method;
+import java.util.Arrays;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.Signature;
+import jdk.vm.ci.runtime.JVMCI;
class NameAndSignature {
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,22 +30,31 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
-import java.io.*;
-import java.lang.instrument.*;
-import java.lang.management.*;
-import java.lang.reflect.*;
-import java.nio.file.*;
-import java.security.*;
-import java.util.*;
-import java.util.jar.*;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.lang.instrument.Instrumentation;
+import java.lang.management.ManagementFactory;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
-import javax.tools.*;
+import javax.tools.ToolProvider;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
-import org.junit.*;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Tests that {@link ResolvedJavaMethod}s are safe in the context of class redefinition being used
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,11 +29,14 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCI;
-import org.junit.*;
+import org.junit.Test;
public class ResolvedJavaTypeResolveConcreteMethodTest {
public final MetaAccessProvider metaAccess;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java Wed Nov 04 07:23:23 2015 -1000
@@ -29,11 +29,14 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.runtime.JVMCI;
-import org.junit.*;
+import org.junit.Test;
public class ResolvedJavaTypeResolveMethodTest {
public final MetaAccessProvider metaAccess;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,14 +30,20 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.reflect.Array;
+import java.util.List;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,14 +30,19 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.util.Map;
-import java.lang.reflect.*;
-import java.util.*;
+import jdk.vm.ci.meta.JavaField;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.*;
-
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link JavaField}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,14 +30,17 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Method;
+import java.util.Map;
-import java.lang.reflect.*;
-import java.util.*;
+import jdk.vm.ci.meta.JavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.*;
-
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link JavaMethod}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,10 +30,11 @@
package jdk.vm.ci.runtime.test;
-import jdk.vm.ci.meta.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.JavaType;
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link JavaType}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,14 +30,22 @@
package jdk.vm.ci.runtime.test;
-import static jdk.vm.ci.meta.MetaUtil.*;
-import static org.junit.Assert.*;
+import static jdk.vm.ci.meta.MetaUtil.toInternalName;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
-import java.lang.reflect.*;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.*;
-
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link MetaAccessProvider}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,15 +30,27 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.LocationIdentity;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
-import org.junit.*;
+import org.junit.Test;
/**
* Tests for {@link ResolvedJavaField}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,16 +30,35 @@
package jdk.vm.ci.runtime.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
-import java.lang.annotation.*;
-import java.lang.invoke.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodHandle;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
-import jdk.vm.ci.meta.*;
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ExceptionHandler;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
-import org.junit.*;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Tests for {@link ResolvedJavaMethod}.
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Wed Nov 04 07:23:23 2015 -1000
@@ -30,19 +30,42 @@
package jdk.vm.ci.runtime.test;
-import static java.lang.reflect.Modifier.*;
-import static org.junit.Assert.*;
+import static java.lang.reflect.Modifier.isAbstract;
+import static java.lang.reflect.Modifier.isFinal;
+import static java.lang.reflect.Modifier.isPrivate;
+import static java.lang.reflect.Modifier.isProtected;
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
-import jdk.vm.ci.common.*;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.meta.Assumptions.*;
+import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.meta.Assumptions.AssumptionResult;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaKind;
+import jdk.vm.ci.meta.ModifiersProvider;
+import jdk.vm.ci.meta.ResolvedJavaField;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.TrustedInterface;
-import org.junit.*;
+import org.junit.Test;
import sun.reflect.ConstantPool;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java Wed Nov 04 07:23:23 2015 -1000
@@ -22,20 +22,42 @@
*/
package jdk.vm.ci.runtime.test;
-import static java.lang.reflect.Modifier.*;
+import static java.lang.reflect.Modifier.isFinal;
+import static java.lang.reflect.Modifier.isStatic;
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.AbstractCollection;
+import java.util.AbstractList;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.Queue;
-import java.util.stream.*;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
-import jdk.vm.ci.meta.*;
-import jdk.vm.ci.runtime.*;
+import jdk.vm.ci.meta.ConstantReflectionProvider;
+import jdk.vm.ci.meta.JavaConstant;
+import jdk.vm.ci.meta.JavaField;
+import jdk.vm.ci.meta.MetaAccessProvider;
+import jdk.vm.ci.meta.ResolvedJavaType;
+import jdk.vm.ci.meta.TrustedInterface;
+import jdk.vm.ci.runtime.JVMCI;
-import org.junit.*;
+import org.junit.Test;
-import sun.misc.*;
+import sun.misc.Unsafe;
//JaCoCo Exclude
--- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java Tue Nov 03 20:12:51 2015 +0300
+++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java Wed Nov 04 07:23:23 2015 -1000
@@ -41,6 +41,8 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.function.BooleanSupplier;
@@ -594,5 +596,25 @@
}
return result;
}
+
+ public static Object[] getNullValues(Class<?>... types) {
+ Object[] result = new Object[types.length];
+ int i = 0;
+ for (Class<?> type : types) {
+ result[i++] = NULL_VALUES.get(type);
+ }
+ return result;
+ }
+ private static Map<Class<?>, Object> NULL_VALUES = new HashMap<>();
+ static {
+ NULL_VALUES.put(boolean.class, false);
+ NULL_VALUES.put(byte.class, (byte) 0);
+ NULL_VALUES.put(short.class, (short) 0);
+ NULL_VALUES.put(char.class, '\0');
+ NULL_VALUES.put(int.class, 0);
+ NULL_VALUES.put(long.class, 0L);
+ NULL_VALUES.put(float.class, 0.0f);
+ NULL_VALUES.put(double.class, 0.0d);
+ }
}