@Nonnull public Label newLabelForIndex(int instructionIndex) { if (instructionIndex < 0 || instructionIndex >= instructionList.size()) { throw new IndexOutOfBoundsException(String.format("instruction index %d out of bounds", instructionIndex)); } MethodLocation referent = instructionList.get(instructionIndex); return referent.addNewLabel(); }
@Nonnull public Label newLabelForAddress(int codeAddress) { if (codeAddress < 0 || codeAddress > instructionList.get(instructionList.size() - 1).codeAddress) { throw new IndexOutOfBoundsException(String.format("codeAddress %d out of bounds", codeAddress)); } MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddress)); return referent.addNewLabel(); }
@Nonnull private Label newLabel(@Nonnull int[] codeAddressToIndex, int codeAddress) { MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddressToIndex, codeAddress)); return referent.addNewLabel(); }
@Test public void replaceInstructionExecutesNewNodeCorrectly() { manipulator = OptimizerTester.getGraphManipulator(CLASS_NAME, "constantPredicate()I"); BuilderInstruction returnVoid = manipulator.getNodePile(4).get(0).getOp().getInstruction(); Label target = returnVoid.getLocation().addNewLabel(); // GOTO_32 shifts addresses around so mappings could break BuilderInstruction replacement = new BuilderInstruction30t(Opcode.GOTO_32, target); manipulator.replaceInstruction(1, replacement); testHeritage(manipulator, 0); }
@Nonnull public Label newLabelForIndex(int instructionIndex) { if (instructionIndex < 0 || instructionIndex >= instructionList.size()) { throw new IndexOutOfBoundsException(String.format("instruction index %d out of bounds", instructionIndex)); } MethodLocation referent = instructionList.get(instructionIndex); return referent.addNewLabel(); }
@Nonnull public Label newLabelForIndex(int instructionIndex) { if (instructionIndex < 0 || instructionIndex >= instructionList.size()) { throw new IndexOutOfBoundsException(String.format("instruction index %d out of bounds", instructionIndex)); } MethodLocation referent = instructionList.get(instructionIndex); return referent.addNewLabel(); }
@Nonnull public Label newLabelForIndex(int instructionIndex) { if (instructionIndex < 0 || instructionIndex >= instructionList.size()) { throw new IndexOutOfBoundsException(String.format("instruction index %d out of bounds", instructionIndex)); } MethodLocation referent = instructionList.get(instructionIndex); return referent.addNewLabel(); }
@Nonnull public Label newLabelForAddress(int codeAddress) { if (codeAddress < 0 || codeAddress > instructionList.get(instructionList.size()-1).codeAddress) { throw new IndexOutOfBoundsException(String.format("codeAddress %d out of bounds", codeAddress)); } MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddress)); return referent.addNewLabel(); }
@Nonnull private Label newLabel(@Nonnull int[] codeAddressToIndex, int codeAddress) { MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddressToIndex, codeAddress)); return referent.addNewLabel(); }
@Nonnull private Label newLabel(@Nonnull int[] codeAddressToIndex, int codeAddress) { MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddressToIndex, codeAddress)); return referent.addNewLabel(); }
@Nonnull public Label newLabelForAddress(int codeAddress) { if (codeAddress < 0 || codeAddress > instructionList.get(instructionList.size()-1).codeAddress) { throw new IndexOutOfBoundsException(String.format("codeAddress %d out of bounds", codeAddress)); } MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddress)); return referent.addNewLabel(); }
@Nonnull public Label newLabelForAddress(int codeAddress) { if (codeAddress < 0 || codeAddress > instructionList.get(instructionList.size() - 1).codeAddress) { throw new IndexOutOfBoundsException(String.format("codeAddress %d out of bounds", codeAddress)); } MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddress)); return referent.addNewLabel(); }
@Nonnull private Label newLabel(@Nonnull int[] codeAddressToIndex, int codeAddress) { MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddressToIndex, codeAddress)); return referent.addNewLabel(); }
@Nonnull private Label newLabel(@Nonnull int[] codeAddressToIndex, int codeAddress) { MethodLocation referent = instructionList.get(mapCodeAddressToIndex(codeAddressToIndex, codeAddress)); return referent.addNewLabel(); }
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }