use of org.jikesrvm.compilers.common.assembler.ForwardReference in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method emit_regular_lcmp.
/*
* comparison ops
*/
@Override
protected void emit_regular_lcmp() {
popLong(T3, T2);
popLong(T1, T0);
ForwardReference fr_end_1;
ForwardReference fr_end_2;
if (VM.BuildFor64Addr) {
asm.emitCMPD(T0, T2);
ForwardReference fr1 = asm.emitForwardBC(LT);
ForwardReference fr2 = asm.emitForwardBC(GT);
// a == b
asm.emitLVAL(T0, 0);
fr_end_1 = asm.emitForwardB();
fr1.resolve(asm);
// a < b
asm.emitLVAL(T0, -1);
fr_end_2 = asm.emitForwardB();
fr2.resolve(asm);
} else {
// ah ? al
asm.emitCMP(T1, T3);
ForwardReference fr1 = asm.emitForwardBC(LT);
ForwardReference fr2 = asm.emitForwardBC(GT);
// al ? bl (logical compare)
asm.emitCMPL(T0, T2);
ForwardReference fr3 = asm.emitForwardBC(LT);
ForwardReference fr4 = asm.emitForwardBC(GT);
// a == b
asm.emitLVAL(T0, 0);
fr_end_1 = asm.emitForwardB();
fr1.resolve(asm);
fr3.resolve(asm);
// a < b
asm.emitLVAL(T0, -1);
fr_end_2 = asm.emitForwardB();
fr2.resolve(asm);
fr4.resolve(asm);
}
// a > b
asm.emitLVAL(T0, 1);
fr_end_1.resolve(asm);
fr_end_2.resolve(asm);
pushInt(T0);
}
use of org.jikesrvm.compilers.common.assembler.ForwardReference in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method emit_regular_DFcmpGL.
@Override
protected void emit_regular_DFcmpGL(boolean single, boolean unorderedGT) {
if (single) {
popFloat(F1);
popFloat(F0);
} else {
popDouble(F1);
popDouble(F0);
}
// pre-load T0
asm.emitLVAL(T0, unorderedGT ? -1 : 1);
asm.emitFCMPU(F0, F1);
// value in T0 is good
ForwardReference golden = asm.emitForwardBC(unorderedGT ? LT : GT);
// branch and zero T0
ForwardReference equals = asm.emitForwardBC(EQ);
// value is either unordered or GT/LT
asm.emitLVAL(T0, unorderedGT ? 1 : -1);
ForwardReference unordered = asm.emitForwardB();
equals.resolve(asm);
asm.emitLVAL(T0, 0);
golden.resolve(asm);
unordered.resolve(asm);
pushInt(T0);
}
use of org.jikesrvm.compilers.common.assembler.ForwardReference in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method genCondBranch.
/**
* Emit the code for a bytecode level conditional branch
* @param cc the condition code to branch on
* @param bTarget the target bytecode index
*/
private void genCondBranch(int cc, int bTarget) {
if (options.PROFILE_EDGE_COUNTERS) {
// Allocate 2 counters, taken and not taken
int entry = edgeCounterIdx;
edgeCounterIdx += 2;
// Load counter array for this method
loadCounterArray(T0);
// Flip conditions so we can jump over the increment of the taken counter.
ForwardReference fr = asm.emitForwardBC(Assembler.flipCode(cc));
// Increment taken counter & jump to target
incEdgeCounter(T0, T1, T2, entry + EdgeCounts.TAKEN);
asm.emitB(bytecodeMap[bTarget], bTarget);
// Not taken
fr.resolve(asm);
incEdgeCounter(T0, T1, T2, entry + EdgeCounts.NOT_TAKEN);
} else {
if (bTarget - SHORT_FORWARD_LIMIT < biStart) {
asm.emitShortBC(cc, bytecodeMap[bTarget], bTarget);
} else {
asm.emitBC(cc, bytecodeMap[bTarget], bTarget);
}
}
}
use of org.jikesrvm.compilers.common.assembler.ForwardReference in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method emit_checkcast_final.
@Override
protected void emit_checkcast_final(RVMType type) {
// load the object being checked
peekAddr(T0, 0);
// check for null
asm.emitCMPAddrI(T0, 0);
ForwardReference isNull = asm.emitForwardBC(EQ);
// TIB of "this" object
asm.baselineEmitLoadTIB(T0, T0);
// TIB of LHS type
asm.emitLAddrToc(T1, type.getTibOffset());
// TIBs equal?
asm.emitCMP(T0, T1);
// TODO: encode "y" bit that branch is likely taken.
ForwardReference fr = asm.emitForwardBC(EQ);
// encoding of TRAP_ALWAYS CHECKCAST
asm.emitTWI(31, GPR.R12, CHECKCAST_TRAP);
fr.resolve(asm);
isNull.resolve(asm);
}
use of org.jikesrvm.compilers.common.assembler.ForwardReference in project JikesRVM by JikesRVM.
the class BaselineCompilerImpl method emit_instanceof_final.
@Override
protected void emit_instanceof_final(RVMType type) {
// load object from stack
popAddr(T0);
// check for null
asm.emitCMPAddrI(T0, 0);
ForwardReference isNull = asm.emitForwardBC(EQ);
// compare TIB of object to desired TIB and set T0 to 1 (true) if equal
// TIB of "this" object
asm.baselineEmitLoadTIB(T0, T0);
// TIB of LHS type
asm.emitLAddrToc(T1, type.getTibOffset());
// TIBs equal?
asm.emitCMP(T0, T1);
ForwardReference notMatched = asm.emitForwardBC(NE);
asm.emitLVAL(T0, 1);
ForwardReference done = asm.emitForwardB();
// set T1 to 0 (false)
isNull.resolve(asm);
notMatched.resolve(asm);
asm.emitLVAL(T0, 0);
// push T0, containing the result of the instanceof comparision, to the stack.
done.resolve(asm);
pushInt(T0);
}
Aggregations