From: <cap...@us...> - 2007-03-18 22:49:42
|
Revision: 4 http://svn.sourceforge.net/pearcolator/?rev=4&view=rev Author: captain5050 Date: 2007-03-18 15:49:42 -0700 (Sun, 18 Mar 2007) Log Message: ----------- More build fixes Modified Paths: -------------- src/org/binarytranslator/arch/ppc/decoder/PPC2IR.java src/org/binarytranslator/arch/ppc/decoder/PPC_InstructionDecoder.java src/org/binarytranslator/arch/x86/decoder/X86_Registers.java src/org/binarytranslator/generic/decoder/DecoderUtils.java src/org/binarytranslator/generic/os/process/ProcessSpace.java src/org/binarytranslator/vmInterface/DBT_ConvertBinaryToHIR.java src/org/binarytranslator/vmInterface/DBT_Trace.java Modified: src/org/binarytranslator/arch/ppc/decoder/PPC2IR.java =================================================================== --- src/org/binarytranslator/arch/ppc/decoder/PPC2IR.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/arch/ppc/decoder/PPC2IR.java 2007-03-18 22:49:42 UTC (rev 4) @@ -363,7 +363,7 @@ } OPT_RegisterOperand lt = new OPT_RegisterOperand(crFieldMap_Lt[crf], VM_TypeReference.Boolean); OPT_RegisterOperand gt = new OPT_RegisterOperand(crFieldMap_Gt[crf], VM_TypeReference.Boolean); - OPT_RegisterOperand lt = new OPT_RegisterOperand(crFieldMap_Eq[crf], VM_TypeReference.Boolean); + OPT_RegisterOperand eq = new OPT_RegisterOperand(crFieldMap_Eq[crf], VM_TypeReference.Boolean); OPT_RegisterOperand so = new OPT_RegisterOperand(crFieldMap_SO[crf], VM_TypeReference.Boolean); OPT_RegisterOperand arrayref = gc.temps.makeTemp(VM_TypeReference.BooleanArray); @@ -384,9 +384,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_gt"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_gt"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -397,9 +397,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_eq"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_eq"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -410,9 +410,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_so"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_so"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -434,7 +434,7 @@ { OPT_RegisterOperand lt = new OPT_RegisterOperand(crFieldMap_Lt[crf], VM_TypeReference.Boolean); OPT_RegisterOperand gt = new OPT_RegisterOperand(crFieldMap_Gt[crf], VM_TypeReference.Boolean); - OPT_RegisterOperand lt = new OPT_RegisterOperand(crFieldMap_Eq[crf], VM_TypeReference.Boolean); + OPT_RegisterOperand eq = new OPT_RegisterOperand(crFieldMap_Eq[crf], VM_TypeReference.Boolean); OPT_RegisterOperand so = new OPT_RegisterOperand(crFieldMap_SO[crf], VM_TypeReference.Boolean); OPT_RegisterOperand arrayref = gc.temps.makeTemp(VM_TypeReference.BooleanArray); @@ -455,9 +455,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_gt"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_gt"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -468,9 +468,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_eq"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_eq"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -481,9 +481,9 @@ arrayref, new OPT_IntConstantOperand(crf), new OPT_LocationOperand(VM_TypeReference.BooleanArray), new OPT_TrueGuardOperand())); - VM_FieldReference ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_so"), - VM_Atom.findOrCreateAsciiAtom("[Z") - ).asFieldReference(); + ref = VM_MemberReference.findOrCreate(psTref,VM_Atom.findOrCreateAsciiAtom("crf_so"), + VM_Atom.findOrCreateAsciiAtom("[Z") + ).asFieldReference(); appendInstructionToCurrentBlock(GetField.create(GETFIELD, arrayref, gc.makeLocal(1,psTref), new OPT_AddressConstantOperand(ref.peekResolvedField().getOffset()), @@ -915,13 +915,13 @@ int crf = crb >> 2; switch(crb & 0x3) { case 0: - return ppc2ir.getCR_Lt_Register(crf); + return getCR_Lt_Register(crf); case 1: - return ppc2ir.getCR_Gt_Register(crf); + return getCR_Gt_Register(crf); case 2: - return ppc2ir.getCR_Eq_Register(crf); + return getCR_Eq_Register(crf); case 3: - return ppc2ir.getCR_SO_Register(crf); + return getCR_SO_Register(crf); default: DBT_OptimizingCompilerException.UNREACHABLE(); } Modified: src/org/binarytranslator/arch/ppc/decoder/PPC_InstructionDecoder.java =================================================================== --- src/org/binarytranslator/arch/ppc/decoder/PPC_InstructionDecoder.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/arch/ppc/decoder/PPC_InstructionDecoder.java 2007-03-18 22:49:42 UTC (rev 4) @@ -589,7 +589,7 @@ OPT_BranchProfileOperand likelyOp = ppc2ir.getConditionalBranchProfileOperand(likely); // Grab the flag to compare - OPT_RegisterOperand flag = getCRB_Register(BI); + OPT_RegisterOperand flag = ppc2ir.getCRB_Register(BI); // The condition to test OPT_ConditionOperand condOp; Modified: src/org/binarytranslator/arch/x86/decoder/X86_Registers.java =================================================================== --- src/org/binarytranslator/arch/x86/decoder/X86_Registers.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/arch/x86/decoder/X86_Registers.java 2007-03-18 22:49:42 UTC (rev 4) @@ -8,9 +8,7 @@ */ package org.binarytranslator.arch.x86; -import org.binarytranslator.generic.memory.Registers; - -public class X86_Registers extends Registers { +public class X86_Registers { String[] name32 = {"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"}; private int[] GP32 = new int[8]; Modified: src/org/binarytranslator/generic/decoder/DecoderUtils.java =================================================================== --- src/org/binarytranslator/generic/decoder/DecoderUtils.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/generic/decoder/DecoderUtils.java 2007-03-18 22:49:42 UTC (rev 4) @@ -1282,71 +1282,4 @@ public OPT_RegisterOperand makeTemp(VM_TypeReference type) { return gc.temps.makeTemp(type); } - - /** - * Remove conditional moves - */ - static void eliminateConditionalMoves(OPT_IR ir) { - OPT_BasicBlock curBB = ir.gc.prologue; - while(curBB != null) { - OPT_Instruction curInstr = curBB.firstInstruction(); - loop_over_instructions: - while(BBend.conforms(curInstr) == false) { - if(CondMove.conforms(curInstr) && (curInstr.operator() == INT_COND_MOVE)) { - OPT_BasicBlock compareBlock; // block containing compare instruction - OPT_BasicBlock trueBlock; // block containing true payload - OPT_BasicBlock falseBlock; // block containing false payload - OPT_BasicBlock restOfBlock; // the rest of the block - - // Set up blocks - compareBlock = curBB; - trueBlock = new OPT_BasicBlock(0, ir.gc.inlineSequence, ir.gc.cfg); - falseBlock = new OPT_BasicBlock(0, ir.gc.inlineSequence, ir.gc.cfg); - restOfBlock = compareBlock.splitNodeAt(curInstr, ir); - ir.gc.cfg.linkInCodeOrder(compareBlock, falseBlock); - ir.gc.cfg.linkInCodeOrder(falseBlock, trueBlock); - ir.gc.cfg.linkInCodeOrder(trueBlock, restOfBlock); - - // Set up values - OPT_RegisterOperand result = CondMove.getResult(curInstr); - OPT_Operand val1 = CondMove.getVal1(curInstr); - OPT_Operand val2 = CondMove.getVal2(curInstr); - OPT_ConditionOperand cond = CondMove.getCond(curInstr); - OPT_Operand trueValue = CondMove.getTrueValue(curInstr); - OPT_Operand falseValue = CondMove.getFalseValue(curInstr); - - // Create comparison - OPT_Operator cmpType; - if(val1.isInt()){ - cmpType = INT_IFCMP; - } - else if (val1.isDouble()){ - cmpType = DOUBLE_IFCMP; - } - else { - throw new Error("Unexpected type of val1: " + val1); - } - IfCmp.mutate(curInstr, cmpType, null, val1, val2, cond, trueBlock.makeJumpTarget(), OPT_BranchProfileOperand.likely()); - compareBlock.deleteNormalOut(); - compareBlock.insertOut(trueBlock); - compareBlock.insertOut(falseBlock); - - // Create false code - falseBlock.appendInstruction(Move.create(INT_MOVE, result, falseValue)); - falseBlock.appendInstruction(Goto.create(GOTO,restOfBlock.makeJumpTarget())); - falseBlock.insertOut(restOfBlock); - - // Create true code - trueBlock.appendInstruction(Move.create(INT_MOVE, result, trueValue)); - trueBlock.insertOut(restOfBlock); - - // Move along - curBB = restOfBlock; - curInstr = curBB.firstInstruction(); - } - curInstr = curInstr.nextInstructionInCodeOrder(); - } - curBB = curBB.nextBasicBlockInCodeOrder(); - } - } } Modified: src/org/binarytranslator/generic/os/process/ProcessSpace.java =================================================================== --- src/org/binarytranslator/generic/os/process/ProcessSpace.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/generic/os/process/ProcessSpace.java 2007-03-18 22:49:42 UTC (rev 4) @@ -284,7 +284,7 @@ * system) */ public synchronized void replaceCompiledTrace(VM_CompiledMethod cm, DBT_Trace trace) { - VM_CodeArray code = cm.getInstructions(); + VM_CodeArray code = cm.getEntryCodeArray(); codeHash.put(new Integer(trace.pc), code); } @@ -304,7 +304,7 @@ trace.compile(); VM_CompiledMethod cm = trace.getCurrentCompiledMethod(); replaceCompiledTrace(cm, trace); - return cm.getInstructions(); + return cm.getEntryCodeArray(); } /** Modified: src/org/binarytranslator/vmInterface/DBT_ConvertBinaryToHIR.java =================================================================== --- src/org/binarytranslator/vmInterface/DBT_ConvertBinaryToHIR.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/vmInterface/DBT_ConvertBinaryToHIR.java 2007-03-18 22:49:42 UTC (rev 4) @@ -9,11 +9,27 @@ package org.binarytranslator.vmInterface; import org.binarytranslator.generic.decoder.DecoderUtils; import org.jikesrvm.opt.OPT_CompilerPhase; -import org.jikesrvm.opt.ir.OPT_IR; +import org.jikesrvm.VM_Configuration; + +import org.jikesrvm.opt.ir.OPT_BasicBlock; import org.jikesrvm.opt.ir.OPT_GenerationContext; import org.jikesrvm.opt.ir.OPT_HIRInfo; -import org.jikesrvm.VM_Configuration; +import org.jikesrvm.opt.ir.OPT_IR; +import org.jikesrvm.opt.ir.OPT_Instruction; +import static org.jikesrvm.opt.ir.OPT_Operators.*; +import org.jikesrvm.opt.ir.OPT_Operator; +import org.jikesrvm.opt.ir.BBend; +import org.jikesrvm.opt.ir.CondMove; +import org.jikesrvm.opt.ir.Goto; +import org.jikesrvm.opt.ir.IfCmp; +import org.jikesrvm.opt.ir.Move; + +import org.jikesrvm.opt.ir.OPT_Operand; +import org.jikesrvm.opt.ir.OPT_BranchProfileOperand; +import org.jikesrvm.opt.ir.OPT_ConditionOperand; +import org.jikesrvm.opt.ir.OPT_RegisterOperand; + /** * The OPT_CompilerPhase which translates from PowerPC machine code * into HIR. It is used in PPC_OptimizationPlanner (in place of @@ -61,10 +77,76 @@ } if (VM_Configuration.BuildForPowerPC) { - DecoderUtils.eliminateConditionalMoves(ir); + eliminateConditionalMoves(ir); } } protected abstract void generateHIR(OPT_GenerationContext gc); - protected abstract void eliminateConditionalMoves(OPT_IR ir); + + /** + * Remove conditional moves + */ + public static void eliminateConditionalMoves(OPT_IR ir) { + OPT_BasicBlock curBB = ir.gc.prologue; + while(curBB != null) { + OPT_Instruction curInstr = curBB.firstInstruction(); + loop_over_instructions: + while(BBend.conforms(curInstr) == false) { + if(CondMove.conforms(curInstr) && (curInstr.operator() == INT_COND_MOVE)) { + OPT_BasicBlock compareBlock; // block containing compare instruction + OPT_BasicBlock trueBlock; // block containing true payload + OPT_BasicBlock falseBlock; // block containing false payload + OPT_BasicBlock restOfBlock; // the rest of the block + + // Set up blocks + compareBlock = curBB; + trueBlock = new OPT_BasicBlock(0, ir.gc.inlineSequence, ir.gc.cfg); + falseBlock = new OPT_BasicBlock(0, ir.gc.inlineSequence, ir.gc.cfg); + restOfBlock = compareBlock.splitNodeAt(curInstr, ir); + ir.gc.cfg.linkInCodeOrder(compareBlock, falseBlock); + ir.gc.cfg.linkInCodeOrder(falseBlock, trueBlock); + ir.gc.cfg.linkInCodeOrder(trueBlock, restOfBlock); + + // Set up values + OPT_RegisterOperand result = CondMove.getResult(curInstr); + OPT_Operand val1 = CondMove.getVal1(curInstr); + OPT_Operand val2 = CondMove.getVal2(curInstr); + OPT_ConditionOperand cond = CondMove.getCond(curInstr); + OPT_Operand trueValue = CondMove.getTrueValue(curInstr); + OPT_Operand falseValue = CondMove.getFalseValue(curInstr); + + // Create comparison + OPT_Operator cmpType; + if(val1.isInt()){ + cmpType = INT_IFCMP; + } + else if (val1.isDouble()){ + cmpType = DOUBLE_IFCMP; + } + else { + throw new Error("Unexpected type of val1: " + val1); + } + IfCmp.mutate(curInstr, cmpType, null, val1, val2, cond, trueBlock.makeJumpTarget(), OPT_BranchProfileOperand.likely()); + compareBlock.deleteNormalOut(); + compareBlock.insertOut(trueBlock); + compareBlock.insertOut(falseBlock); + + // Create false code + falseBlock.appendInstruction(Move.create(INT_MOVE, result, falseValue)); + falseBlock.appendInstruction(Goto.create(GOTO,restOfBlock.makeJumpTarget())); + falseBlock.insertOut(restOfBlock); + + // Create true code + trueBlock.appendInstruction(Move.create(INT_MOVE, result, trueValue)); + trueBlock.insertOut(restOfBlock); + + // Move along + curBB = restOfBlock; + curInstr = curBB.firstInstruction(); + } + curInstr = curInstr.nextInstructionInCodeOrder(); + } + curBB = curBB.nextBasicBlockInCodeOrder(); + } + } } Modified: src/org/binarytranslator/vmInterface/DBT_Trace.java =================================================================== --- src/org/binarytranslator/vmInterface/DBT_Trace.java 2007-03-16 23:59:58 UTC (rev 3) +++ src/org/binarytranslator/vmInterface/DBT_Trace.java 2007-03-18 22:49:42 UTC (rev 4) @@ -67,7 +67,7 @@ */ private static VM_Class dummyRunner; private static VM_NormalMethod invokeCode; - private static int invokeCode_modifiers; + private static short invokeCode_modifiers; private static VM_TypeReference dummyRunnerTypeRef; private static VM_MemberReference dummyRunnerMemRef; private static VM_Atom invokeCodeDescriptor; @@ -125,14 +125,14 @@ invokeCode.getOperandWords(), invokeCode.bytecodes, invokeCode.getExceptionHandlerMap(), - new int[0], null, null, null, null, null, null, null); + new int[0], null, null, null, null, null); - this.offset = VM_Statics.allocateSlot(VM_Statics.METHOD) << LOG_BYTES_IN_INT; + this.offset = invokeCode.getOffset().toInt(); - this.summary |= HAS_ALLOCATION | HAS_THROW | HAS_INVOKE | - HAS_FIELD_READ | HAS_FIELD_WRITE | HAS_ARRAY_READ | HAS_ARRAY_WRITE | - HAS_COND_BRANCH | HAS_SWITCH | HAS_BACK_BRANCH | - 256; + this.summaryFlags |= HAS_ALLOCATION | HAS_THROW | HAS_INVOKE | + HAS_FIELD_READ | HAS_FIELD_WRITE | HAS_ARRAY_READ | HAS_ARRAY_WRITE | + HAS_COND_BRANCH | HAS_SWITCH | HAS_BACK_BRANCH; + this.summarySize = 256; this.ps = ps; pc = startPC; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |