|
From: <mic...@us...> - 2007-08-21 15:35:45
|
Revision: 170
http://pearcolator.svn.sourceforge.net/pearcolator/?rev=170&view=rev
Author: michael_baer
Date: 2007-08-21 08:29:38 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
- Increase ARM heap & stack size to 4MB when loading embedded system images
- Move some OPT_Operand.copy() calls around
Modified Paths:
--------------
src/org/binarytranslator/DBT_Options.java
src/org/binarytranslator/arch/arm/decoder/ARM2IR.java
src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java
src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java
src/org/binarytranslator/generic/decoder/CodeTranslator.java
src/org/binarytranslator/generic/execution/InterpreterController.java
Modified: src/org/binarytranslator/DBT_Options.java
===================================================================
--- src/org/binarytranslator/DBT_Options.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/DBT_Options.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -25,7 +25,7 @@
public final static boolean buildForSunVM = false;
/** Enable the profiling of application during interpretation? */
- public final static boolean profileDuringInterpretation = true;
+ public final static boolean profileDuringInterpretation = false;
/** Are unimplemented system calls fatal? */
public final static boolean unimplementedSystemCallsFatal = false;
Modified: src/org/binarytranslator/arch/arm/decoder/ARM2IR.java
===================================================================
--- src/org/binarytranslator/arch/arm/decoder/ARM2IR.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/arch/arm/decoder/ARM2IR.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -413,7 +413,7 @@
appendInstruction(BooleanCmp.create(BOOLEAN_CMP_INT, flagRegister, op1.copy(), op2.copy(), OPT_ConditionOperand.BORROW_FROM_SUB().flipCode(), new OPT_BranchProfileOperand()));
}
else {
- appendInstruction(BooleanCmp.create(BOOLEAN_CMP_INT, getFlag(Flag.Carry), op1.copy(), op2.copy(), OPT_ConditionOperand.LOWER().flipCode(), new OPT_BranchProfileOperand()));
+ appendInstruction(BooleanCmp.create(BOOLEAN_CMP_INT, flagRegister, op1.copy(), op2.copy(), OPT_ConditionOperand.LOWER().flipCode(), new OPT_BranchProfileOperand()));
}
break;
@@ -431,7 +431,7 @@
case Add:
case LogicalOpAfterAdd:
if (ARM_Options.useOptimizedFlags) {
- appendInstruction(BooleanCmp.create(BOOLEAN_CMP_INT, getFlag(Flag.Overflow), op1.copy(), op2.copy(), OPT_ConditionOperand.OVERFLOW_FROM_ADD(), OPT_BranchProfileOperand.unlikely()));
+ appendInstruction(BooleanCmp.create(BOOLEAN_CMP_INT, flagRegister, op1.copy(), op2.copy(), OPT_ConditionOperand.OVERFLOW_FROM_ADD(), OPT_BranchProfileOperand.unlikely()));
}
else {
OPT_RegisterOperand tmp1 = getTempInt(5);
@@ -442,7 +442,7 @@
appendInstruction(Binary.create(INT_SUB, tmp2.copyRO(), new OPT_IntConstantOperand(Integer.MIN_VALUE), op2.copy()));
appendInstruction(BooleanCmp2.create(BOOLEAN_CMP2_INT_AND, tmp_bool.copyRO(), op2.copy(), new OPT_IntConstantOperand(0), OPT_ConditionOperand.GREATER_EQUAL(), new OPT_BranchProfileOperand(), op1.copy(), tmp1.copy(), OPT_ConditionOperand.GREATER(), OPT_BranchProfileOperand.unlikely()));
appendInstruction(BooleanCmp2.create(BOOLEAN_CMP2_INT_AND, getFlag(Flag.Overflow), op2.copy(), new OPT_IntConstantOperand(0), OPT_ConditionOperand.LESS() , new OPT_BranchProfileOperand(), op1.copy(), tmp2.copy(), OPT_ConditionOperand.LESS(), OPT_BranchProfileOperand.unlikely()));
- appendInstruction(Binary.create(INT_OR, getFlag(Flag.Overflow), getFlag(Flag.Overflow), tmp_bool.copy()));
+ appendInstruction(Binary.create(INT_OR, flagRegister, getFlag(Flag.Overflow), tmp_bool.copy()));
}
break;
Modified: src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java
===================================================================
--- src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/arch/arm/decoder/ARM_Translator.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -186,10 +186,10 @@
ARM_Translator translator, OperandWrapper operand) {
ResolvedOperand result = new ResolvedOperand_WithShifterCarryOut(translator, operand);
- return result.getValue();
+ return result.getValue().copy();
}
- public final OPT_Operand getValue() {
+ private final OPT_Operand getValue() {
return value;
}
@@ -235,7 +235,7 @@
else {
OPT_RegisterOperand tmp = translator.arm2ir.getTempInt(9);
translator.arm2ir.appendInstruction(Binary.create(INT_ADD, tmp, translator.arm2ir.getRegister(operand.getRegister()), new OPT_IntConstantOperand(operand.getOffset())));
- value = tmp.copy();
+ value = tmp;
}
return;
@@ -382,7 +382,7 @@
curBlock.insertOut(block1);
OPT_Operand carryFlag = translator.arm2ir.readCarryFlag(translator.lazy);
translator.arm2ir.appendInstruction(Binary.create(INT_USHR, resultRegister, shiftedOperand.copy(), new OPT_IntConstantOperand(1)));
- translator.arm2ir.appendInstruction(IfCmp.create(INT_IFCMP, translator.arm2ir.getTempValidation(0), carryFlag, new OPT_IntConstantOperand(1), OPT_ConditionOperand.NOT_EQUAL(), nextBlock.makeJumpTarget(), new OPT_BranchProfileOperand()));
+ translator.arm2ir.appendInstruction(IfCmp.create(INT_IFCMP, validation, carryFlag, new OPT_IntConstantOperand(1), OPT_ConditionOperand.NOT_EQUAL(), nextBlock.makeJumpTarget(), new OPT_BranchProfileOperand()));
//Block 1
translator.arm2ir.setCurrentBlock(block1);
@@ -519,15 +519,15 @@
//block 2 - shift < 32 && shift != 0
translator.arm2ir.setCurrentBlock(block2);
block2.insertOut(nextBlock);
- translator.arm2ir.appendInstruction(Binary.create(INT_SHR, resultRegister, shiftedOperand, shiftAmount.copy()) );
+ translator.arm2ir.appendInstruction(Binary.create(INT_SHR, resultRegister, shiftedOperand.copy(), shiftAmount.copy()) );
translator.arm2ir.appendInstruction(Binary.create(INT_ADD, tmp, shiftAmount.copy(), new OPT_IntConstantOperand(-1)) );
- translator.arm2ir.appendBitTest(getShifterCarryOutTarget(), shiftedOperand, tmp.copy());
+ translator.arm2ir.appendBitTest(getShifterCarryOutTarget(), shiftedOperand.copy(), tmp.copy());
translator.arm2ir.appendInstruction(Goto.create(GOTO, nextBlock.makeJumpTarget()));
//block 3 - shift >= 32
translator.arm2ir.setCurrentBlock(block3);
block3.insertOut(nextBlock);
- translator.arm2ir.appendBitTest(getShifterCarryOutTarget(), shiftedOperand, 31);
+ translator.arm2ir.appendBitTest(getShifterCarryOutTarget(), shiftedOperand.copy(), 31);
translator.arm2ir.appendInstruction(Binary.create(INT_MUL, resultRegister.copyRO(), getShifterCarryOutTarget(), new OPT_IntConstantOperand(-1)) ); //creates either 0xFFFFFFFF if the bit is set, or 0 otherwise
translator.arm2ir.appendInstruction(Goto.create(GOTO, nextBlock.makeJumpTarget()));
@@ -563,7 +563,7 @@
//block 2 - Shift != 0 && Shift < 32
translator.arm2ir.setCurrentBlock(block2);
block2.insertOut(nextBlock);
- translator.arm2ir.appendInstruction(Binary.create(INT_SUB, tmp, new OPT_IntConstantOperand(32), shiftAmount) );
+ translator.arm2ir.appendInstruction(Binary.create(INT_SUB, tmp, new OPT_IntConstantOperand(32), shiftAmount.copy() ) );
translator.arm2ir.appendBitTest(getShifterCarryOutTarget(), shiftedOperand.copy(), tmp.copy());
translator.arm2ir.appendInstruction(Binary.create(INT_SHL, resultRegister, shiftedOperand.copy(), shiftAmount.copy()));
translator.arm2ir.appendInstruction(Goto.create(GOTO, nextBlock.makeJumpTarget()));
@@ -1600,7 +1600,7 @@
@Override
public void translate() {
- //Call Integer.numberOfLeadingZeros() to obtain the result of this operation
+ //Call Integer.numberOfLeadingZeros() to obtain the result of this operation
OPT_RegisterOperand result = getResultRegister();
VM_TypeReference IntegerType = VM_TypeReference
@@ -1647,7 +1647,7 @@
//swap exchanges the value of a memory address with the value in a register
if (!i.swapByte) {
ps.memory.translateLoad32(memAddr, tmp);
- ps.memory.translateStore32(memAddr, arm2ir.getRegister(i.Rm));
+ ps.memory.translateStore32(memAddr.copy(), arm2ir.getRegister(i.Rm));
//according to the ARM architecture reference, the value loaded from a memory address is rotated
//by the number of ones in the first two bits of the address
@@ -1659,8 +1659,8 @@
arm2ir.appendRotateRight(result, tmp.copy(), rotation.copy());
}
else {
- ps.memory.translateLoadUnsigned8(memAddr.copy(), tmp);
- ps.memory.translateStore8(memAddr, arm2ir.getRegister(i.Rm));
+ ps.memory.translateLoadUnsigned8(memAddr, tmp);
+ ps.memory.translateStore8(memAddr.copy(), arm2ir.getRegister(i.Rm));
arm2ir.appendInstruction(Move.create(INT_MOVE, result, tmp.copy()));
}
}
@@ -1959,7 +1959,7 @@
//set the correct processor mode (thumb or not)
OPT_Instruction s = createCallToRegisters("setThumbMode", "(Z)V", 1);
- Call.setParam(s, 1, enableThumb);
+ Call.setParam(s, 1, enableThumb.copy());
arm2ir.appendCustomCall(s);
//jump to the target address. Because we might have switched to thumb mode, we are
@@ -1999,7 +1999,7 @@
arm2ir.appendInstruction(Binary.create(INT_MUL, tmp, operand1, operand2));
OPT_Operand operand3 = arm2ir.getRegister(i.Rn);
- arm2ir.appendInstruction(Binary.create(INT_ADD, result.copyRO(), tmp.copy(), operand3));
+ arm2ir.appendInstruction(Binary.create(INT_ADD, result, tmp.copy(), operand3));
}
else {
arm2ir.appendInstruction(Binary.create(INT_MUL, result, operand1, operand2));
@@ -2050,7 +2050,7 @@
}
//multiply the two operands
- arm2ir.appendInstruction(Binary.create(LONG_MUL, result.copyRO(), operand1.copy(), operand2.copy()));
+ arm2ir.appendInstruction(Binary.create(LONG_MUL, result, operand1.copy(), operand2.copy()));
if (i.accumulate) {
//treat the accum. value as an unsigned value
@@ -2247,7 +2247,7 @@
//stores the current operating mode
OPT_RegisterOperand currentOperatingMode = null;
- if (i.forceUserMode) {
+ if (i.forceUserMode) {
OPT_Instruction call_getOperatingMode = createCallToRegisters("getOperatingMode", "()A", 0);
currentOperatingMode = arm2ir.getTempOperatingMode();
@@ -2364,7 +2364,7 @@
else {
//add the offset to the base address and write the result back into Rn
OPT_Operand resolvedOffset = resolveOffset();
- arm2ir.appendInstruction(Binary.create(INT_ADD, writeBackTarget, address, resolvedOffset));
+ arm2ir.appendInstruction(Binary.create(INT_ADD, writeBackTarget, address.copy(), resolvedOffset));
}
}
Modified: src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java
===================================================================
--- src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/arch/arm/os/process/image/ARM_ImageProcessSpace.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -14,8 +14,8 @@
public class ARM_ImageProcessSpace extends ARM_ProcessSpace {
private AngelSystemCalls sysCalls;
- private final int STACK_SIZE = 4096 * 100;
- private final int HEAP_SIZE = 4096 * 100;
+ private final int STACK_SIZE = 4096 * 1000;
+ private final int HEAP_SIZE = 4096 * 1000;
public ARM_ImageProcessSpace() {
super();
Modified: src/org/binarytranslator/generic/decoder/CodeTranslator.java
===================================================================
--- src/org/binarytranslator/generic/decoder/CodeTranslator.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/generic/decoder/CodeTranslator.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -695,7 +695,7 @@
unresolvedDynamicBranches.add(unresolvedInfo);
setCurrentBlock(fallThrough);
- appendRecordUncaughtBranch(currentPC, targetAddress.copyRO(), branchType, retAddr);
+ appendRecordUncaughtBranch(currentPC, targetAddress, branchType, retAddr);
appendTraceExit((Laziness) lazyStateAtJump.clone(), targetAddress);
}
Modified: src/org/binarytranslator/generic/execution/InterpreterController.java
===================================================================
--- src/org/binarytranslator/generic/execution/InterpreterController.java 2007-08-20 21:08:34 UTC (rev 169)
+++ src/org/binarytranslator/generic/execution/InterpreterController.java 2007-08-21 15:29:38 UTC (rev 170)
@@ -20,7 +20,8 @@
while (!ps.finished) {
- Interpreter.Instruction instruction = interpreter.decode(pc);
+ Interpreter.Instruction instruction = interpreter.decode(pc);
+ //System.out.println(String.format("[%x] %s", pc, instruction.toString()));
instruction.execute();
int nextInstruction = instruction.getSuccessor(pc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|