Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ public X86BytecodeVisitor(NativeStream outputStream, CompiledMethod cm,

private final void assertCondition(boolean cond, String message) {
if (!cond)
throw new Error("assert failed at addresss " + curAddress + ": "
throw new Error("assert failed at address " + curAddress + ": "
+ message);
}

private final void assertCondition(boolean cond, String message,
Object param) {
if (!cond)
throw new Error("assert failed at addresss " + curAddress + ": "
throw new Error("assert failed at address " + curAddress + ": "
+ message + param);
}

Expand Down Expand Up @@ -1928,84 +1928,13 @@ public final void visit_dup2_x1() {
}

/**
* @see org.jnode.vm.bytecode.BytecodeVisitor#visit_dup2_x2()
*
public final void visit_dup2_x2() {
if(countBytecode) { counters.getCounter("dup2_x2").inc(); }

// Push all on the stack, since this opcode is just too complicated
vstack.push(eContext);

System.out.println("####### dup2_x2");

final Item v1 = vstack.pop1();
final Item v2 = vstack.pop1();
final int c1 = v1.getCategory();
final int c2 = v2.getCategory();

// Perform a stack swap independent of the actual form
os.writePOP(helper.AAX); // Value1
os.writePOP(helper.ABX); // Value2
os.writePOP(helper.ACX); // Value3
os.writePOP(helper.ADX); // Value4
os.writePUSH(helper.ABX); // Value2
os.writePUSH(helper.AAX); // Value1
os.writePUSH(helper.ADX); // Value4
os.writePUSH(helper.ACX); // Value3
os.writePUSH(helper.ABX); // Value2
os.writePUSH(helper.AAX); // Value1

// Now update the operandstack
// cope with brain-dead definition from Sun (look-like somebody there
// was to eager to optimize this and it landed in the compiler...
if (c2 == 2) {
// form 4
assertCondition(c1 == 2, "category mismatch");
vstack.push1(ifac.createStack(v1.getType()));
vstack.push1(v2);
vstack.push1(v1);
} else {
final Item v3 = vstack.pop1();
int c3 = v3.getCategory();
if (c1 == 2) {
// form 2
assertCondition(c3 == 1, "category mismatch");
vstack.push1(ifac.createStack(v1.getType()));
vstack.push1(v3);
vstack.push1(v2);
vstack.push1(v1);
} else if (c3 == 2) {
// form 3
vstack.push1(ifac.createStack(v2.getType()));
vstack.push1(ifac.createStack(v1.getType()));
vstack.push1(v3);
vstack.push1(v2);
vstack.push1(v1);
} else {
// form 1
final Item v4 = vstack.pop1();
vstack.push1(ifac.createStack(v2.getType()));
vstack.push1(ifac.createStack(v1.getType()));
vstack.push1(v4);
vstack.push1(v3);
vstack.push1(v2);
vstack.push1(v1);
}
}
}*/

/**
* New version, corrects issue 760
*
* @see org.jnode.vm.bytecode.BytecodeVisitor#visit_dup2_x2()
*/
public final void visit_dup2_x2() {

// Push all on the stack, since this opcode is just too complicated
vstack.push(eContext);

System.out.println("NEW dup2_x2");

final Item v1 = vstack.pop1();
final Item v2 = vstack.pop1();
final int c1 = v1.getCategory();
Expand Down
Loading