Lines Matching refs:offset

116         int offset  = 0;
117 while (offset < codeAttribute.u4codeLength)
119 Instruction instruction = InstructionFactory.create(codeAttribute.code, offset);
120 int instructionLength = instruction.length(offset);
123 if (branchTargetFinder.isSubroutine(offset) &&
124 branchTargetFinder.isSubroutineReturning(offset))
129 System.out.println(" Skipping original subroutine instruction "+instruction.toString(offset));
132 // Append a label at this offset instead.
133 codeAttributeComposer.appendLabel(offset);
138 instruction.accept(clazz, method, codeAttribute, offset, this);
141 offset += instructionLength;
152 System.out.println(" Appending label after code at ["+offset+"]");
229 public void visitAnyInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, Instruction instruction)
232 codeAttributeComposer.appendInstruction(offset, instruction);
236 public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
242 if (branchTargetFinder.subroutineEnd(offset) == offset + variableInstruction.length(offset))
246 System.out.println(" Replacing subroutine return at ["+offset+"] by a label");
249 // Append a label at this offset instead of the subroutine return.
250 codeAttributeComposer.appendLabel(offset);
256 System.out.println(" Replacing subroutine return at ["+offset+"] by a simple branch");
262 branchTargetFinder.subroutineEnd(offset) - offset);
264 codeAttributeComposer.appendInstruction(offset, replacementInstruction);
267 else if (branchTargetFinder.isSubroutineStart(offset))
271 System.out.println(" Replacing first subroutine instruction at ["+offset+"] by a label");
274 // Append a label at this offset instead of saving the subroutine
276 codeAttributeComposer.appendLabel(offset);
281 codeAttributeComposer.appendInstruction(offset, variableInstruction);
286 public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
293 int branchTarget = offset + branchOffset;
298 // Append a label at this offset instead of the subroutine invocation.
299 codeAttributeComposer.appendLabel(offset);
305 offset,
312 System.out.println("Replacing subroutine invocation at ["+offset+"] by a simple branch");
320 codeAttributeComposer.appendInstruction(offset, replacementInstruction);
326 codeAttributeComposer.appendInstruction(offset, branchInstruction);
342 for (int offset = startPC; offset < endPC; offset++)
344 if (branchTargetFinder.isSubroutineInvocation(offset))
346 Instruction instruction = InstructionFactory.create(codeAttribute.code, offset);
347 int instructionLength = instruction.length(offset);
350 if (!exceptionInfo.isApplicable(offset + ((BranchInstruction)instruction).branchOffset))
354 System.out.println(" Appending extra exception ["+startPC+" -> "+offset+"] -> "+handlerPC);
359 offset,
364 startPC = offset + instructionLength;