public static InstructionMethodItem makeInstructionFormatMethodItem( MethodDefinition methodDef, int codeAddress, Instruction instruction) { if (instruction instanceof OffsetInstruction) { return new OffsetInstructionFormatMethodItem(methodDef.classDef.options, methodDef, codeAddress, (OffsetInstruction)instruction); } if (instruction instanceof UnresolvedOdexInstruction) { return new UnresolvedOdexInstructionMethodItem(methodDef, codeAddress, (UnresolvedOdexInstruction)instruction); } switch (instruction.getOpcode().format) { case ArrayPayload: return new ArrayDataMethodItem(methodDef, codeAddress, (ArrayPayload)instruction); case PackedSwitchPayload: return new PackedSwitchMethodItem(methodDef, codeAddress, (PackedSwitchPayload)instruction); case SparseSwitchPayload: return new SparseSwitchMethodItem(methodDef, codeAddress, (SparseSwitchPayload)instruction); default: return new InstructionMethodItem<Instruction>(methodDef, codeAddress, instruction); } } }
@Override public boolean writeTo(IndentingWriter writer) throws IOException { if (commentedOut) { writer = new CommentingIndentingWriter(writer); } writer.write(".sparse-switch\n"); writer.indent(4); for (SparseSwitchTarget target: targets) { IntegerRenderer.writeTo(writer, target.getKey()); writer.write(" -> "); target.writeTargetTo(writer); writeCommentIfResourceId(writer, target.getKey()); writer.write('\n'); } writer.deindent(4); writer.write(".end sparse-switch"); return true; }
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write(".sparse-switch\n"); writer.indent(4); for (SparseSwitchTarget target: targets) { IntegerRenderer.writeTo(writer, target.getKey()); writer.write(" -> "); target.writeTargetTo(writer); writeResourceId(writer, target.getKey()); writer.write('\n'); } writer.deindent(4); writer.write(".end sparse-switch"); return true; }
@Override public boolean writeTo(IndentingWriter writer) throws IOException { if (commentedOut) { writer = new CommentingIndentingWriter(writer); } writer.write(".sparse-switch\n"); writer.indent(4); for (SparseSwitchTarget target: targets) { IntegerRenderer.writeTo(writer, target.getKey()); writer.write(" -> "); target.writeTargetTo(writer); writeCommentIfResourceId(writer, target.getKey()); writer.write('\n'); } writer.deindent(4); writer.write(".end sparse-switch"); return true; }
public static InstructionMethodItem makeInstructionFormatMethodItem( MethodDefinition methodDef, int codeAddress, Instruction instruction) { if (instruction instanceof OffsetInstruction) { return new OffsetInstructionFormatMethodItem(methodDef.classDef.options, methodDef, codeAddress, (OffsetInstruction)instruction); } if (instruction instanceof UnresolvedOdexInstruction) { return new UnresolvedOdexInstructionMethodItem(methodDef, codeAddress, (UnresolvedOdexInstruction)instruction); } switch (instruction.getOpcode().format) { case ArrayPayload: return new ArrayDataMethodItem(methodDef, codeAddress, (ArrayPayload)instruction); case PackedSwitchPayload: return new PackedSwitchMethodItem(methodDef, codeAddress, (PackedSwitchPayload)instruction); case SparseSwitchPayload: return new SparseSwitchMethodItem(methodDef, codeAddress, (SparseSwitchPayload)instruction); default: return new InstructionMethodItem<Instruction>(methodDef, codeAddress, instruction); } } }
public static InstructionMethodItem makeInstructionFormatMethodItem( MethodDefinition methodDef, int codeAddress, Instruction instruction) { if (instruction instanceof OffsetInstruction) { return new OffsetInstructionFormatMethodItem(methodDef.classDef.options, methodDef, codeAddress, (OffsetInstruction)instruction); } if (instruction instanceof UnresolvedOdexInstruction) { return new UnresolvedOdexInstructionMethodItem(methodDef, codeAddress, (UnresolvedOdexInstruction)instruction); } switch (instruction.getOpcode().format) { case ArrayPayload: return new ArrayDataMethodItem(methodDef, codeAddress, (ArrayPayload)instruction); case PackedSwitchPayload: return new PackedSwitchMethodItem(methodDef, codeAddress, (PackedSwitchPayload)instruction); case SparseSwitchPayload: return new SparseSwitchMethodItem(methodDef, codeAddress, (SparseSwitchPayload)instruction); default: return new InstructionMethodItem<Instruction>(methodDef, codeAddress, instruction); } } }