/** * Gets whether the address range for the given two blocks is valid * for a catch handler. This is true as long as the covered range is * under 65536 code units. * * @param start {@code non-null;} the start block for the range (inclusive) * @param end {@code non-null;} the start block for the range (also inclusive) * @param addresses {@code non-null;} address objects for each block * @return {@code true} if the range is valid as a catch range */ private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses) { if (start == null) { throw new NullPointerException("start == null"); } if (end == null) { throw new NullPointerException("end == null"); } // See above about selection of instructions. int startAddress = addresses.getLast(start).getAddress(); int endAddress = addresses.getEnd(end).getAddress(); return (endAddress - startAddress) <= MAX_CATCH_RANGE; } }
/** * Constructs an instance. * * @param method {@code non-null;} the method to have block addresses for */ public BlockAddresses(RopMethod method) { BasicBlockList blocks = method.getBlocks(); int maxLabel = blocks.getMaxLabel(); this.starts = new CodeAddress[maxLabel]; this.lasts = new CodeAddress[maxLabel]; this.ends = new CodeAddress[maxLabel]; setupArrays(method); }
CodeAddress startAddress = addresses.getStart(block); output.add(startAddress); translationVisitor.setBlock(block, addresses.getLast(block)); block.getInsns().forEach(translationVisitor); output.add(addresses.getEnd(block)); output.reverseBranch(1, addresses.getStart(succ)); } else { new TargetInsn(Dops.GOTO, lastInsn.getPosition(), RegisterSpecList.EMPTY, addresses.getStart(succ)); output.add(insn);
int target = block.getSuccessors().get(1); di = new TargetInsn(opcode, pos, getRegs(insn), addresses.getStart(target)); break;
this.positionInfo = positionInfo; this.locals = locals; this.addresses = new BlockAddresses(method); this.paramSize = paramSize; this.order = null;
CodeAddress startAddress = addresses.getStart(block); output.add(startAddress); translationVisitor.setBlock(block, addresses.getLast(block)); block.getInsns().forEach(translationVisitor); output.add(addresses.getEnd(block)); output.reverseBranch(1, addresses.getStart(succ)); } else { new TargetInsn(Dops.GOTO, lastInsn.getPosition(), RegisterSpecList.EMPTY, addresses.getStart(succ)); output.add(insn);
int target = block.getSuccessors().get(1); di = new TargetInsn(opcode, pos, getRegs(insn), addresses.getStart(target)); break;
this.positionInfo = positionInfo; this.locals = locals; this.addresses = new BlockAddresses(method); this.paramSize = paramSize; this.order = null;
CodeAddress startAddress = addresses.getStart(block); output.add(startAddress); translationVisitor.setBlock(block, addresses.getLast(block)); block.getInsns().forEach(translationVisitor); output.add(addresses.getEnd(block)); output.reverseBranch(1, addresses.getStart(succ)); } else { new TargetInsn(Dops.GOTO, lastInsn.getPosition(), RegisterSpecList.EMPTY, addresses.getStart(succ)); output.add(insn);
/** * Gets whether the address range for the given two blocks is valid * for a catch handler. This is true as long as the covered range is * under 65536 code units. * * @param start {@code non-null;} the start block for the range (inclusive) * @param end {@code non-null;} the start block for the range (also inclusive) * @param addresses {@code non-null;} address objects for each block * @return {@code true} if the range is valid as a catch range */ private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses) { if (start == null) { throw new NullPointerException("start == null"); } if (end == null) { throw new NullPointerException("end == null"); } // See above about selection of instructions. int startAddress = addresses.getLast(start).getAddress(); int endAddress = addresses.getEnd(end).getAddress(); return (endAddress - startAddress) <= MAX_CATCH_RANGE; } }
int target = block.getSuccessors().get(1); di = new TargetInsn(opcode, pos, getRegs(insn), addresses.getStart(target)); break;
/** * Constructs an instance. * * @param method {@code non-null;} the method to have block addresses for */ public BlockAddresses(RopMethod method) { BasicBlockList blocks = method.getBlocks(); int maxLabel = blocks.getMaxLabel(); this.starts = new CodeAddress[maxLabel]; this.lasts = new CodeAddress[maxLabel]; this.ends = new CodeAddress[maxLabel]; setupArrays(method); }
this.positionInfo = positionInfo; this.locals = locals; this.addresses = new BlockAddresses(method); this.paramSize = paramSize; this.order = null;
CodeAddress startAddress = addresses.getStart(block); output.add(startAddress); translationVisitor.setBlock(block, addresses.getLast(block)); block.getInsns().forEach(translationVisitor); output.add(addresses.getEnd(block)); output.reverseBranch(1, addresses.getStart(succ)); } else { new TargetInsn(Dops.GOTO, lastInsn.getPosition(), RegisterSpecList.EMPTY, addresses.getStart(succ)); output.add(insn);
/** * Gets whether the address range for the given two blocks is valid * for a catch handler. This is true as long as the covered range is * under 65536 code units. * * @param start {@code non-null;} the start block for the range (inclusive) * @param end {@code non-null;} the start block for the range (also inclusive) * @param addresses {@code non-null;} address objects for each block * @return {@code true} if the range is valid as a catch range */ private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses) { if (start == null) { throw new NullPointerException("start == null"); } if (end == null) { throw new NullPointerException("end == null"); } // See above about selection of instructions. int startAddress = addresses.getLast(start).getAddress(); int endAddress = addresses.getEnd(end).getAddress(); return (endAddress - startAddress) <= MAX_CATCH_RANGE; } }
int target = block.getSuccessors().get(1); di = new TargetInsn(opcode, pos, getRegs(insn), addresses.getStart(target)); break;
/** * Constructs an instance. * * @param method {@code non-null;} the method to have block addresses for */ public BlockAddresses(RopMethod method) { BasicBlockList blocks = method.getBlocks(); int maxLabel = blocks.getMaxLabel(); this.starts = new CodeAddress[maxLabel]; this.lasts = new CodeAddress[maxLabel]; this.ends = new CodeAddress[maxLabel]; setupArrays(method); }
this.positionInfo = positionInfo; this.locals = locals; this.addresses = new BlockAddresses(method); this.paramSize = paramSize; this.order = null;
CodeAddress startAddress = addresses.getStart(block); output.add(startAddress); translationVisitor.setBlock(block, addresses.getLast(block)); block.getInsns().forEach(translationVisitor); output.add(addresses.getEnd(block)); output.reverseBranch(1, addresses.getStart(succ)); } else { new TargetInsn(Dops.GOTO, lastInsn.getPosition(), RegisterSpecList.EMPTY, addresses.getStart(succ)); output.add(insn);
/** * Gets whether the address range for the given two blocks is valid * for a catch handler. This is true as long as the covered range is * under 65536 code units. * * @param start {@code non-null;} the start block for the range (inclusive) * @param end {@code non-null;} the start block for the range (also inclusive) * @param addresses {@code non-null;} address objects for each block * @return {@code true} if the range is valid as a catch range */ private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses) { if (start == null) { throw new NullPointerException("start == null"); } if (end == null) { throw new NullPointerException("end == null"); } // See above about selection of instructions. int startAddress = addresses.getLast(start).getAddress(); int endAddress = addresses.getEnd(end).getAddress(); return (endAddress - startAddress) <= MAX_CATCH_RANGE; } }