# HG changeset patch # User Doug Simon # Date 1399456312 -7200 # Node ID 9d456ffc6120d60799aa28e82e0dcad75f52853f # Parent 217c721b1ee13d75fa500b696d7fe18112ea9231 HSAIL: fixed Windows build diff -r 217c721b1ee1 -r 9d456ffc6120 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Wed May 07 11:44:00 2014 +0200 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java Wed May 07 11:51:52 2014 +0200 @@ -766,17 +766,16 @@ int numStackSlots = (numStackSlotBytes + 7) / 8; final int offsetToDeoptSaveStates = config.hsailSaveStatesOffset0; - final int sizeofKernelDeoptHeader = config.hsailKernelDeoptimizationHeaderSize; final int bytesPerSaveArea = 4 * numSRegs + 8 * numDRegs + 8 * numStackSlots; - final int sizeofKernelDeopt = sizeofKernelDeoptHeader + bytesPerSaveArea; + final int sizeofKernelDeopt = config.hsailKernelDeoptimizationHeaderSize + config.hsailFrameHeaderSize + bytesPerSaveArea; final int offsetToNeverRanArray = config.hsailNeverRanArrayOffset; final int offsetToDeoptNextIndex = config.hsailDeoptNextIndexOffset; final int offsetToDeoptimizationWorkItem = config.hsailDeoptimizationWorkItem; final int offsetToDeoptimizationReason = config.hsailDeoptimizationReason; - final int offsetToDeoptimizationFrame = config.hsailDeoptimizationFrame; + final int offsetToDeoptimizationFrame = config.hsailKernelDeoptimizationHeaderSize; final int offsetToFramePc = config.hsailFramePcOffset; final int offsetToNumSaves = config.hsailFrameNumSRegOffset; - final int offsetToSaveArea = config.hsailFrameSaveAreaOffset; + final int offsetToSaveArea = config.hsailFrameHeaderSize; AllocatableValue scratch64 = HSAIL.d16.asValue(wordKind); AllocatableValue cuSaveAreaPtr = HSAIL.d17.asValue(wordKind); @@ -1149,10 +1148,10 @@ int longSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Long); int intSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Int); if (regNumber >= HSAIL.s0.number && regNumber <= HSAIL.s31.number) { - long offset = config.hsailFrameSaveAreaOffset + intSize * (regNumber - HSAIL.s0.number); + long offset = config.hsailFrameHeaderSize + intSize * (regNumber - HSAIL.s0.number); location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); } else if (regNumber >= HSAIL.d0.number && regNumber <= HSAIL.d15.number) { - long offset = config.hsailFrameSaveAreaOffset + intSize * numSRegs + longSize * (regNumber - HSAIL.d0.number); + long offset = config.hsailFrameHeaderSize + intSize * numSRegs + longSize * (regNumber - HSAIL.d0.number); location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); } else { throw GraalInternalError.shouldNotReachHere("unknown hsail register: " + regNumber); @@ -1167,7 +1166,7 @@ if ((slotSizeInBits == 32) || (slotSizeInBits == 64)) { int longSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Long); int intSize = providers.getCodeCache().getTarget().arch.getSizeInBytes(Kind.Int); - long offset = config.hsailFrameSaveAreaOffset + (intSize * numSRegs) + (longSize * numDRegs) + HSAIL.getStackOffsetStart(slot, slotSizeInBits); + long offset = config.hsailFrameHeaderSize + (intSize * numSRegs) + (longSize * numDRegs) + HSAIL.getStackOffsetStart(slot, slotSizeInBits); LocationNode location = ConstantLocationNode.create(FINAL_LOCATION, valueKind, offset, hostGraph); ValueNode valueNode = hostGraph.unique(new FloatingReadNode(hsailFrame, location, null, StampFactory.forKind(valueKind))); return valueNode; diff -r 217c721b1ee1 -r 9d456ffc6120 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed May 07 11:44:00 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed May 07 11:51:52 2014 +0200 @@ -1029,12 +1029,11 @@ @HotSpotVMField(name = "Hsail::HSAILKernelDeoptimization::_workitemid", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailDeoptimizationWorkItem; @HotSpotVMField(name = "Hsail::HSAILKernelDeoptimization::_actionAndReason", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailDeoptimizationReason; - @HotSpotVMField(name = "Hsail::HSAILKernelDeoptimization::_first_frame", type = "HSAILFrame", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailDeoptimizationFrame; @HotSpotVMField(name = "HSAILFrame::_pc_offset", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFramePcOffset; @HotSpotVMField(name = "HSAILFrame::_num_s_regs", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFrameNumSRegOffset; @HotSpotVMField(name = "HSAILFrame::_num_d_regs", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailFrameNumDRegOffset; - @HotSpotVMConstant(name = "sizeof(HSAILFrame)") @Stable public int hsailFrameSaveAreaOffset; + @HotSpotVMConstant(name = "sizeof(HSAILFrame)") @Stable public int hsailFrameHeaderSize; @HotSpotVMConstant(name = "sizeof(Hsail::HSAILKernelDeoptimization)") @Stable public int hsailKernelDeoptimizationHeaderSize; @HotSpotVMField(name = "Hsail::HSAILDeoptimizationInfo::_deopt_save_states[0]", type = "Hsail::HSAILKernelDeoptimization", get = HotSpotVMField.Type.OFFSET) @Stable public int hsailSaveStatesOffset0; diff -r 217c721b1ee1 -r 9d456ffc6120 src/gpu/hsail/vm/gpu_hsail.hpp --- a/src/gpu/hsail/vm/gpu_hsail.hpp Wed May 07 11:44:00 2014 +0200 +++ b/src/gpu/hsail/vm/gpu_hsail.hpp Wed May 07 11:51:52 2014 +0200 @@ -32,7 +32,7 @@ class Hsail : public Gpu { public: - class HSAILKernelDeoptimization { + class HSAILKernelDeoptimization VALUE_OBJ_CLASS_SPEC { friend class VMStructs; private: // TODO: separate workitemid and actionAndReason out @@ -40,14 +40,16 @@ // for now, though we only ever have one hsail fram jint _workitemid; jint _actionAndReason; - // the first (innermost) "hsail frame" starts here - HSAILFrame _first_frame; + // the first (innermost) "hsail frame" starts after the above fields public: inline jint workitem() { return _workitemid; } inline jint reason() { return _actionAndReason; } - inline jint pc_offset() { return _first_frame.pc_offset(); } - inline HSAILFrame *first_frame() { return &_first_frame; } + inline jint pc_offset() { return first_frame()->pc_offset(); } + inline HSAILFrame *first_frame() { + // starts after the "header" fields + return (HSAILFrame *) (((jbyte *) this) + sizeof(*this)); + } }; // 8 compute units * 40 waves per cu * wavesize 64 @@ -75,7 +77,7 @@ _deopt_next_index = 0; _num_slots = numSlots; _bytesPerSaveArea = bytesPerSaveArea; - _deopt_span = sizeof(HSAILKernelDeoptimization) + bytesPerSaveArea; + _deopt_span = sizeof(HSAILKernelDeoptimization) + sizeof(HSAILFrame) + bytesPerSaveArea; if (TraceGPUInteraction) { tty->print_cr("HSAILDeoptimizationInfo allocated, %d slots of size %d, total size = 0x%lx bytes", _num_slots, _deopt_span, (_num_slots * _deopt_span + sizeof(HSAILDeoptimizationInfo))); } diff -r 217c721b1ee1 -r 9d456ffc6120 src/gpu/hsail/vm/gpu_hsail_Frame.hpp --- a/src/gpu/hsail/vm/gpu_hsail_Frame.hpp Wed May 07 11:44:00 2014 +0200 +++ b/src/gpu/hsail/vm/gpu_hsail_Frame.hpp Wed May 07 11:51:52 2014 +0200 @@ -29,14 +29,13 @@ #include "code/debugInfo.hpp" #include "code/location.hpp" -class HSAILFrame { +class HSAILFrame VALUE_OBJ_CLASS_SPEC { friend class VMStructs; private: jint _pc_offset; // The HSAIL "pc_offset" where the exception happens jbyte _num_s_regs; jbyte _num_d_regs; jshort _num_stack_slots; - jbyte _save_area[0]; // save area size can vary per kernel compilation public: // Accessors @@ -44,29 +43,30 @@ jint num_s_regs() {return _num_s_regs; } jint num_d_regs() {return _num_d_regs; } jint num_stack_slots() {return _num_stack_slots; } + jbyte * data_start() {return (jbyte *) this + sizeof(*this); } jlong get_d_reg(int idx) { int ofst = num_s_regs() * 4 + idx * 8; - return(*(jlong *) (_save_area + ofst)); + return(*(jlong *) (data_start() + ofst)); } jint get_s_reg(int idx) { int ofst = idx * 4; - return(*(jint *) (_save_area + ofst)); + return(*(jint *) (data_start() + ofst)); } void put_d_reg(int idx, jlong val) { int ofst = num_s_regs() * 4 + idx * 8; - (*(jlong *) (_save_area + ofst)) = val; + (*(jlong *) (data_start() + ofst)) = val; } jint get_stackslot32(int stackOffset) { int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset; - return(*(jint *) (_save_area + ofst)); + return(*(jint *) (data_start() + ofst)); } jlong get_stackslot64(int stackOffset) { int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset; - return(*(jlong *) (_save_area + ofst)); + return(*(jlong *) (data_start() + ofst)); } void put_stackslot64(int stackOffset, jlong val) { int ofst = num_s_regs() * 4 + num_d_regs() * 8 + stackOffset; - (*(jlong *) (_save_area + ofst)) = val; + (*(jlong *) (data_start() + ofst)) = val; } }; diff -r 217c721b1ee1 -r 9d456ffc6120 src/gpu/hsail/vm/vmStructs_hsail.hpp --- a/src/gpu/hsail/vm/vmStructs_hsail.hpp Wed May 07 11:44:00 2014 +0200 +++ b/src/gpu/hsail/vm/vmStructs_hsail.hpp Wed May 07 11:51:52 2014 +0200 @@ -40,7 +40,6 @@ \ nonstatic_field(Hsail::HSAILKernelDeoptimization, _workitemid, jint) \ nonstatic_field(Hsail::HSAILKernelDeoptimization, _actionAndReason, jint) \ - nonstatic_field(Hsail::HSAILKernelDeoptimization, _first_frame, HSAILFrame) \ \ nonstatic_field(Hsail::HSAILDeoptimizationInfo, _notice_safepoints, jint*) \ nonstatic_field(Hsail::HSAILDeoptimizationInfo, _deopt_occurred, jint) \