From d4702a45a78b5345dcd33b4b14e7791045658e0f Mon Sep 17 00:00:00 2001 From: Daniel Bali Date: Tue, 16 May 2017 14:00:52 -0700 Subject: [PATCH] Add basic support for ODEX instructions --- .../builder/MutableMethodImplementation.java | 68 ++++++++++++++++ .../instruction/BuilderInstruction22cs.java | 65 +++++++++++++++ .../instruction/BuilderInstruction35mi.java | 80 +++++++++++++++++++ .../instruction/BuilderInstruction35ms.java | 79 ++++++++++++++++++ .../instruction/BuilderInstruction3rmi.java | 65 +++++++++++++++ .../instruction/BuilderInstruction3rms.java | 66 +++++++++++++++ .../java/org/jf/dexlib2/writer/DexWriter.java | 15 ++++ .../jf/dexlib2/writer/InstructionWriter.java | 57 +++++++++++++ 8 files changed, 495 insertions(+) create mode 100644 dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction22cs.java create mode 100644 dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35mi.java create mode 100644 dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35ms.java create mode 100644 dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rmi.java create mode 100644 dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rms.java diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java index 148bafd1..a77ae253 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java @@ -601,6 +601,9 @@ public class MutableMethodImplementation implements MethodImplementation { case Format22c: setInstruction(location, newBuilderInstruction22c((Instruction22c) instruction)); return; + case Format22cs: + setInstruction(location, newBuilderInstruction22cs((Instruction22cs) instruction)); + return; case Format22s: setInstruction(location, newBuilderInstruction22s((Instruction22s) instruction)); return; @@ -636,9 +639,21 @@ public class MutableMethodImplementation implements MethodImplementation { case Format35c: setInstruction(location, newBuilderInstruction35c((Instruction35c) instruction)); return; + case Format35mi: + setInstruction(location, newBuilderInstruction35mi((Instruction35mi) instruction)); + return; + case Format35ms: + setInstruction(location, newBuilderInstruction35ms((Instruction35ms) instruction)); + return; case Format3rc: setInstruction(location, newBuilderInstruction3rc((Instruction3rc)instruction)); return; + case Format3rmi: + setInstruction(location, newBuilderInstruction3rmi((Instruction3rmi)instruction)); + return; + case Format3rms: + setInstruction(location, newBuilderInstruction3rms((Instruction3rms)instruction)); + return; case Format51l: setInstruction(location, newBuilderInstruction51l((Instruction51l)instruction)); return; @@ -770,6 +785,15 @@ public class MutableMethodImplementation implements MethodImplementation { instruction.getReference()); } + @Nonnull + private BuilderInstruction22cs newBuilderInstruction22cs(@Nonnull Instruction22cs instruction) { + return new BuilderInstruction22cs( + instruction.getOpcode(), + instruction.getRegisterA(), + instruction.getRegisterB(), + instruction.getFieldOffset()); + } + @Nonnull private BuilderInstruction22s newBuilderInstruction22s(@Nonnull Instruction22s instruction) { return new BuilderInstruction22s( @@ -868,6 +892,32 @@ public class MutableMethodImplementation implements MethodImplementation { instruction.getReference()); } + @Nonnull + private BuilderInstruction35mi newBuilderInstruction35mi(@Nonnull Instruction35mi instruction) { + return new BuilderInstruction35mi( + instruction.getOpcode(), + instruction.getRegisterCount(), + instruction.getRegisterC(), + instruction.getRegisterD(), + instruction.getRegisterE(), + instruction.getRegisterF(), + instruction.getRegisterG(), + instruction.getInlineIndex()); + } + + @Nonnull + private BuilderInstruction35ms newBuilderInstruction35ms(@Nonnull Instruction35ms instruction) { + return new BuilderInstruction35ms( + instruction.getOpcode(), + instruction.getRegisterCount(), + instruction.getRegisterC(), + instruction.getRegisterD(), + instruction.getRegisterE(), + instruction.getRegisterF(), + instruction.getRegisterG(), + instruction.getVtableIndex()); + } + @Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( @@ -877,6 +927,24 @@ public class MutableMethodImplementation implements MethodImplementation { instruction.getReference()); } + @Nonnull + private BuilderInstruction3rmi newBuilderInstruction3rmi(@Nonnull Instruction3rmi instruction) { + return new BuilderInstruction3rmi( + instruction.getOpcode(), + instruction.getStartRegister(), + instruction.getRegisterCount(), + instruction.getInlineIndex()); + } + + @Nonnull + private BuilderInstruction3rms newBuilderInstruction3rms(@Nonnull Instruction3rms instruction) { + return new BuilderInstruction3rms( + instruction.getOpcode(), + instruction.getStartRegister(), + instruction.getRegisterCount(), + instruction.getVtableIndex()); + } + @Nonnull private BuilderInstruction51l newBuilderInstruction51l(@Nonnull Instruction51l instruction) { return new BuilderInstruction51l( diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction22cs.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction22cs.java new file mode 100644 index 00000000..e43f39da --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction22cs.java @@ -0,0 +1,65 @@ +/* + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.jf.dexlib2.builder.instruction; + +import org.jf.dexlib2.Format; +import org.jf.dexlib2.Opcode; +import org.jf.dexlib2.builder.BuilderInstruction; +import org.jf.dexlib2.iface.instruction.formats.Instruction22c; +import org.jf.dexlib2.iface.instruction.formats.Instruction22cs; +import org.jf.dexlib2.iface.reference.Reference; +import org.jf.dexlib2.util.Preconditions; + +import javax.annotation.Nonnull; + +public class BuilderInstruction22cs extends BuilderInstruction implements Instruction22cs { + public static final Format FORMAT = Format.Format22cs; + + protected final int registerA; + protected final int registerB; + protected final int fieldOffset; + + public BuilderInstruction22cs(@Nonnull Opcode opcode, + int registerA, + int registerB, + int fieldOffset) { + super(opcode); + this.registerA = Preconditions.checkNibbleRegister(registerA); + this.registerB = Preconditions.checkNibbleRegister(registerB); + this.fieldOffset = fieldOffset; + } + + @Override public int getRegisterA() { return registerA; } + @Override public int getRegisterB() { return registerB; } + @Override public int getFieldOffset() { return fieldOffset; } + @Override public Format getFormat() { return FORMAT; } +} \ No newline at end of file diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35mi.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35mi.java new file mode 100644 index 00000000..43aed787 --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35mi.java @@ -0,0 +1,80 @@ +/* + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.jf.dexlib2.builder.instruction; + +import org.jf.dexlib2.Format; +import org.jf.dexlib2.Opcode; +import org.jf.dexlib2.builder.BuilderInstruction; +import org.jf.dexlib2.iface.instruction.formats.Instruction35mi; +import org.jf.dexlib2.util.Preconditions; + +import javax.annotation.Nonnull; + +public class BuilderInstruction35mi extends BuilderInstruction implements Instruction35mi { + public static final Format FORMAT = Format.Format35mi; + + protected final int registerCount; + protected final int registerC; + protected final int registerD; + protected final int registerE; + protected final int registerF; + protected final int registerG; + protected final int inlineIndex; + + public BuilderInstruction35mi(@Nonnull Opcode opcode, + int registerCount, + int registerC, + int registerD, + int registerE, + int registerF, + int registerG, + int inlineIndex) { + super(opcode); + this.registerCount = Preconditions.check35cAnd45ccRegisterCount(registerCount); + this.registerC = (registerCount>0) ? Preconditions.checkNibbleRegister(registerC) : 0; + this.registerD = (registerCount>1) ? Preconditions.checkNibbleRegister(registerD) : 0; + this.registerE = (registerCount>2) ? Preconditions.checkNibbleRegister(registerE) : 0; + this.registerF = (registerCount>3) ? Preconditions.checkNibbleRegister(registerF) : 0; + this.registerG = (registerCount>4) ? Preconditions.checkNibbleRegister(registerG) : 0; + this.inlineIndex = inlineIndex; + } + + @Override public int getRegisterCount() { return registerCount; } + @Override public int getRegisterC() { return registerC; } + @Override public int getRegisterD() { return registerD; } + @Override public int getRegisterE() { return registerE; } + @Override public int getRegisterF() { return registerF; } + @Override public int getRegisterG() { return registerG; } + @Override public int getInlineIndex() { return inlineIndex; } + @Override public Format getFormat() { return FORMAT; } + +} diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35ms.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35ms.java new file mode 100644 index 00000000..824dbd8e --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction35ms.java @@ -0,0 +1,79 @@ +/* + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.jf.dexlib2.builder.instruction; + +import org.jf.dexlib2.Format; +import org.jf.dexlib2.Opcode; +import org.jf.dexlib2.builder.BuilderInstruction; +import org.jf.dexlib2.iface.instruction.formats.Instruction35ms; +import org.jf.dexlib2.util.Preconditions; + +import javax.annotation.Nonnull; + +public class BuilderInstruction35ms extends BuilderInstruction implements Instruction35ms { + public static final Format FORMAT = Format.Format35ms; + + protected final int registerCount; + protected final int registerC; + protected final int registerD; + protected final int registerE; + protected final int registerF; + protected final int registerG; + protected final int vtableIndex; + + public BuilderInstruction35ms(@Nonnull Opcode opcode, + int registerCount, + int registerC, + int registerD, + int registerE, + int registerF, + int registerG, + int vtableIndex) { + super(opcode); + this.registerCount = Preconditions.check35cAnd45ccRegisterCount(registerCount); + this.registerC = (registerCount>0) ? Preconditions.checkNibbleRegister(registerC) : 0; + this.registerD = (registerCount>1) ? Preconditions.checkNibbleRegister(registerD) : 0; + this.registerE = (registerCount>2) ? Preconditions.checkNibbleRegister(registerE) : 0; + this.registerF = (registerCount>3) ? Preconditions.checkNibbleRegister(registerF) : 0; + this.registerG = (registerCount>4) ? Preconditions.checkNibbleRegister(registerG) : 0; + this.vtableIndex = vtableIndex; + } + + @Override public int getRegisterCount() { return registerCount; } + @Override public int getRegisterC() { return registerC; } + @Override public int getRegisterD() { return registerD; } + @Override public int getRegisterE() { return registerE; } + @Override public int getRegisterF() { return registerF; } + @Override public int getRegisterG() { return registerG; } + @Override public int getVtableIndex() { return vtableIndex; } + @Override public Format getFormat() { return FORMAT; } +} diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rmi.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rmi.java new file mode 100644 index 00000000..1df7b308 --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rmi.java @@ -0,0 +1,65 @@ +/* + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.jf.dexlib2.builder.instruction; + +import org.jf.dexlib2.Format; +import org.jf.dexlib2.Opcode; +import org.jf.dexlib2.builder.BuilderInstruction; +import org.jf.dexlib2.iface.instruction.formats.Instruction3rmi; +import org.jf.dexlib2.iface.instruction.formats.Instruction3rms; +import org.jf.dexlib2.util.Preconditions; + +import javax.annotation.Nonnull; + +public class BuilderInstruction3rmi extends BuilderInstruction implements Instruction3rmi { + public static final Format FORMAT = Format.Format3rmi; + + protected final int startRegister; + protected final int registerCount; + protected final int inlineIndex; + + public BuilderInstruction3rmi(@Nonnull Opcode opcode, + int startRegister, + int registerCount, + int inlineIndex) { + super(opcode); + this.startRegister = Preconditions.checkShortRegister(startRegister); + this.registerCount = Preconditions.checkRegisterRangeCount(registerCount); + this.inlineIndex = inlineIndex; + } + + @Override public int getStartRegister() { return startRegister; } + @Override public int getRegisterCount() { return registerCount; } + @Override public int getInlineIndex() { return inlineIndex; } + @Override public Format getFormat() { return FORMAT; } +} + diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rms.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rms.java new file mode 100644 index 00000000..bd73901f --- /dev/null +++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction3rms.java @@ -0,0 +1,66 @@ +/* + * Copyright 2012, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.jf.dexlib2.builder.instruction; + +import org.jf.dexlib2.Format; +import org.jf.dexlib2.Opcode; +import org.jf.dexlib2.builder.BuilderInstruction; +import org.jf.dexlib2.iface.instruction.formats.Instruction3rc; +import org.jf.dexlib2.iface.instruction.formats.Instruction3rms; +import org.jf.dexlib2.iface.reference.Reference; +import org.jf.dexlib2.util.Preconditions; + +import javax.annotation.Nonnull; + +public class BuilderInstruction3rms extends BuilderInstruction implements Instruction3rms { + public static final Format FORMAT = Format.Format3rms; + + protected final int startRegister; + protected final int registerCount; + protected final int vtableIndex; + + public BuilderInstruction3rms(@Nonnull Opcode opcode, + int startRegister, + int registerCount, + int vtableIndex) { + super(opcode); + this.startRegister = Preconditions.checkShortRegister(startRegister); + this.registerCount = Preconditions.checkRegisterRangeCount(registerCount); + this.vtableIndex = vtableIndex; + } + + @Override public int getStartRegister() { return startRegister; } + @Override public int getRegisterCount() { return registerCount; } + @Override public int getVtableIndex() { return vtableIndex; } + @Override public Format getFormat() { return FORMAT; } +} + diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java index 00cce65d..1b0d9df0 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java @@ -1017,6 +1017,9 @@ public abstract class DexWriter< case Format22c: instructionWriter.write((Instruction22c)instruction); break; + case Format22cs: + instructionWriter.write((Instruction22cs)instruction); + break; case Format22s: instructionWriter.write((Instruction22s)instruction); break; @@ -1047,9 +1050,21 @@ public abstract class DexWriter< case Format35c: instructionWriter.write((Instruction35c)instruction); break; + case Format35mi: + instructionWriter.write((Instruction35mi)instruction); + break; + case Format35ms: + instructionWriter.write((Instruction35ms)instruction); + break; case Format3rc: instructionWriter.write((Instruction3rc)instruction); break; + case Format3rmi: + instructionWriter.write((Instruction3rmi)instruction); + break; + case Format3rms: + instructionWriter.write((Instruction3rms)instruction); + break; case Format45cc: instructionWriter.write((Instruction45cc)instruction); break; diff --git a/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java b/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java index 1b883f1f..f6fd52fd 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java @@ -239,6 +239,16 @@ public class InstructionWriter