public MethodBody(final MethodDefinition methodDefinition) { _method = VerifyArgument.notNull(methodDefinition, "methodDefinition"); _instructions = new InstructionCollection(); _variables = new VariableDefinitionCollection(methodDefinition); _exceptionHandlers = new Collection<>(); }
final Instruction afterTry = _instructions.tryGetAtOffset(entry.getEndOffset()); _instructions.atOffset(entry.getStartOffset()), afterTry != null ? afterTry.getPrevious() : last(_instructions) ), new InstructionBlock( _instructions.atOffset(entry.getHandlerOffset()), _instructions.atOffset(entry.getHandlerOffset()) handler = ExceptionHandler.createCatch( new InstructionBlock( _instructions.atOffset(entry.getStartOffset()), afterTry != null ? afterTry.getPrevious() : last(_instructions) ), new InstructionBlock( _instructions.atOffset(entry.getHandlerOffset()), _instructions.atOffset(entry.getHandlerOffset()) ), entry.getCatchType()
final int jumpIndex = instructions.indexOf(reference); final List<Instruction> originalContents = new ArrayList<>(); newStart.setOperand(null); instructions.addAll(jumpIndex, toList(contents)); instructions.add(jumpIndex, new Instruction(OpCode.GOTO, newStart)); instructions.remove(reference); instructions.recomputeOffsets();
final Instruction target = body.atOffset(targetOffset); switchInfo.setDefaultTarget(body.atOffset(defaultOffset)); targets[targetIndex] = body.atOffset(targetOffset); targets[targetIndex] = body.atOffset(targetOffset); body.add(instruction); for (int i = 0; i < body.size(); i++) { final Instruction instruction = body.get(i); final OpCode code = instruction.getOpCode(); final Object operand = instruction.hasOperand() ? instruction.getOperand(0) : null;
final Instruction handlerStart = instructions.atOffset(entry.getHandlerOffset()); final ControlFlowNode handlerStartNode = builder.findNode(handlerStart); final Instruction lastInstruction = instructions.get(instructions.size() - 1); instructions.atOffset(entry.getStartOffset()), lastInstruction ); instructions.atOffset(entry.getStartOffset()), instructions.atOffset(entry.getEndOffset()).getPrevious() );
private static InstructionCollection copyInstructions(final List<Instruction> instructions) { final InstructionCollection instructionsCopy = new InstructionCollection(); final Map<Instruction, Instruction> oldToNew = new IdentityHashMap<>(); instructionsCopy.add(copy); oldToNew.put(instruction, copy); instructionsCopy.recomputeOffsets();
final List<ByteCode> body = new ArrayList<>(instructions.size()); final StackMappingVisitor stackMapper = new StackMappingVisitor(); final InstructionVisitor instructionVisitor = stackMapper.visitBody(_body);
@Override protected void beforeSet(final int index, final Instruction item) { final Instruction current = get(index); item.setPrevious(current.getPrevious()); item.setNext(current.getNext()); current.setPrevious(null); current.setNext(null); }
private List<SubroutineInfo> findSubroutines() { final InstructionCollection instructions = _instructions; if (instructions.isEmpty()) { return Collections.emptyList();
@Override protected final void freezeCore() { _instructions.freezeIfUnfrozen(); _variables.freezeIfUnfrozen(); _exceptionHandlers.freezeIfUnfrozen(); super.freezeCore(); }
final int jumpIndex = instructions.indexOf(reference); final List<Instruction> originalContents = new ArrayList<>(); newStart.setOperand(null); instructions.addAll(jumpIndex, toList(contents)); instructions.add(jumpIndex, new Instruction(OpCode.GOTO, newStart)); instructions.remove(reference); instructions.recomputeOffsets();
final Instruction target = body.atOffset(targetOffset); switchInfo.setDefaultTarget(body.atOffset(defaultOffset)); targets[targetIndex] = body.atOffset(targetOffset); targets[targetIndex] = body.atOffset(targetOffset); body.add(instruction); for (int i = 0; i < body.size(); i++) { final Instruction instruction = body.get(i); final OpCode code = instruction.getOpCode(); final Object operand = instruction.hasOperand() ? instruction.getOperand(0) : null;
final Instruction handlerStart = instructions.atOffset(entry.getHandlerOffset()); final ControlFlowNode handlerStartNode = builder.findNode(handlerStart); final Instruction lastInstruction = instructions.get(instructions.size() - 1); instructions.atOffset(entry.getStartOffset()), lastInstruction ); instructions.atOffset(entry.getStartOffset()), instructions.atOffset(entry.getEndOffset()).getPrevious() );
private static InstructionCollection copyInstructions(final List<Instruction> instructions) { final InstructionCollection instructionsCopy = new InstructionCollection(); final Map<Instruction, Instruction> oldToNew = new IdentityHashMap<>(); instructionsCopy.add(copy); oldToNew.put(instruction, copy); instructionsCopy.recomputeOffsets();