List of usage examples for org.eclipse.jdt.internal.compiler.codegen Opcodes OPC_pop
byte OPC_pop
To view the source code for org.eclipse.jdt.internal.compiler.codegen Opcodes OPC_pop.
Click Source Link
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.BytecodeTransformer.java
License:Open Source License
/** Look for the nop pattern of a local var that is used to * prepare for lifting. If the pattern is found, patch all those * opcodes, that are constant (see class comment in Lifting). *///ww w. j av a2 s. c o m private int checkPatchLiftingNops(byte[] code, int idx) { int i; // Expecting 6 nops: for (i = idx + 1; i < idx + 6; i++) if (code[i] != Opcodes.OPC_nop) return -1; // Expecting aload_<loadPos>: int loadPos = OTByteCodes.getAloadPos(code[idx + 6], code[idx + 7]); if (loadPos == -1) return -1; int storeStart = (loadPos > 3) ? 8 : 7; // depends on space for pos operand // Expecting 3 nops: for (i = idx + storeStart; i < idx + storeStart + 3; i++) if (code[i] != Opcodes.OPC_nop) return -1; // Expecting astore_<storePos>: int storePos = OTByteCodes.getAstorePos(code[idx + 10], code[idx + 11]); if (storePos == -1) return -1; // Full match, start patching: // patching 6 nops: code[idx + 0] = Opcodes.OPC_aload_0; code[idx + 1] = Opcodes.OPC_invokevirtual; // [idx+2/3]: space for "_OT$initCaches" code[idx + 4] = Opcodes.OPC_pop; code[idx + 5] = Opcodes.OPC_aload_0; // leave aload<loadPos> if (loadPos > 3) idx++; // patching 3 nops: code[idx + 7] = Opcodes.OPC_invokevirtual; // [idx+8/9]: space for _OT$liftTo<Role> // leave astore<storePos> if (storePos > 3) loadPos += 0x2000; // flag to client that longer byte code is used return loadPos; }