// It is an interface, do it the hard way
// Load reference
final RefItem ref = vstack.popRef();
ref.load(eContext);
final GPR refr = ref.getRegister();
// Allocate tmp registers
final GPR classr = (GPR) L1AHelper.requestRegister(eContext,
JvmType.REFERENCE, false);
final GPR cntr = (GPR) L1AHelper.requestRegister(eContext,
JvmType.INT, false);
final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext,
JvmType.REFERENCE, false);
final Label curInstrLabel = getCurInstrLabel();
/* Objectref is already on the stack */
writeResolveAndLoadClassToReg(classRef, classr);
helper.writeClassInitialize(curInstrLabel, classr, tmpr, resolvedType);
final Label trueLabel = new Label(curInstrLabel + "io-true");
final Label endLabel = new Label(curInstrLabel + "io-end");
/* Is instanceof? */
instanceOf(refr, classr, tmpr, cntr, trueLabel, false);
final IntItem result = (IntItem) L1AHelper.requestWordRegister(eContext, JvmType.INT, false);
final GPR resultr = result.getRegister();
/* Not instanceof */
// TODO: use setcc instead of jumps
os.writeXOR(resultr, resultr);
os.writeJMP(endLabel);
os.setObjectRef(trueLabel);
os.writeMOV_Const(resultr, 1);
// Push result
os.setObjectRef(endLabel);
ref.release(eContext);
vstack.push(result);
// Release
pool.release(classr);
pool.release(tmpr);
pool.release(cntr);
} else {
// It is a class, do the fast way
//vstack.push(eContext); // just a (slow) test
// Load reference
final RefItem ref = vstack.popRef();
ref.load(eContext);
final GPR refr = ref.getRegister();
// Allocate tmp registers
final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext,
JvmType.REFERENCE, false);
final IntItem result = (IntItem) L1AHelper.requestWordRegister(
eContext, JvmType.INT, true);
// Is instanceof