| 1275 | } |
| 1276 | |
| 1277 | @Override |
| 1278 | public void visitLdcInsn(final Object value) { |
| 1279 | lastBytecodeOffset = code.length; |
| 1280 | // Add the instruction to the bytecode of the method. |
| 1281 | Symbol constantSymbol = symbolTable.addConstant(value); |
| 1282 | int constantIndex = constantSymbol.index; |
| 1283 | boolean isLongOrDouble = |
| 1284 | constantSymbol.tag == Symbol.CONSTANT_LONG_TAG |
| 1285 | || constantSymbol.tag == Symbol.CONSTANT_DOUBLE_TAG; |
| 1286 | if (isLongOrDouble) { |
| 1287 | code.put12(Constants.LDC2_W, constantIndex); |
| 1288 | } else if (constantIndex >= 256) { |
| 1289 | code.put12(Constants.LDC_W, constantIndex); |
| 1290 | } else { |
| 1291 | code.put11(Opcodes.LDC, constantIndex); |
| 1292 | } |
| 1293 | // If needed, update the maximum stack size and number of locals, and stack map frames. |
| 1294 | if (currentBasicBlock != null) { |
| 1295 | if (compute == COMPUTE_ALL_FRAMES || compute == COMPUTE_INSERTED_FRAMES) { |
| 1296 | currentBasicBlock.frame.execute(Opcodes.LDC, 0, constantSymbol, symbolTable); |
| 1297 | } else { |
| 1298 | int size = relativeStackSize + (isLongOrDouble ? 2 : 1); |
| 1299 | if (size > maxRelativeStackSize) { |
| 1300 | maxRelativeStackSize = size; |
| 1301 | } |
| 1302 | relativeStackSize = size; |
| 1303 | } |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | @Override |
| 1308 | public void visitIincInsn(final int var, final int increment) { |