aboutsummaryrefslogtreecommitdiff
path: root/dexlib2/src/main/java
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2016-08-17 11:39:28 +0100
committerNarayan Kamath <narayan@google.com>2016-08-17 13:15:18 +0100
commit99b80bbc5a55f53e73a143a90f94faefbd5e4f7f (patch)
treea3b4c835cda443a7f3a43e71ea96347d98f403c0 /dexlib2/src/main/java
parentafc1f1593936326e1c99f8328bbce8b495865000 (diff)
downloadsmali-99b80bbc5a55f53e73a143a90f94faefbd5e4f7f.tar.gz
Revert "Add lambda experimental dalvik opcodes"
This reverts commit 144951a9e9e6c87866245f2bdeebf0ebedaa0e38.
Diffstat (limited to 'dexlib2/src/main/java')
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/Format.java1
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/Opcode.java9
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java15
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction25x.java82
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java2
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction25x.java83
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/CodeItem.java27
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/OneFixedFourParameterRegisterInstruction.java47
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/formats/Instruction25x.java37
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction.java2
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction25x.java97
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/util/Preconditions.java9
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java3
-rw-r--r--dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java14
14 files changed, 0 insertions, 428 deletions
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/Format.java b/dexlib2/src/main/java/org/jf/dexlib2/Format.java
index 42e8e144..fd90a6dd 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/Format.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/Format.java
@@ -51,7 +51,6 @@ public enum Format {
Format22t(4),
Format22x(4),
Format23x(4),
- Format25x(4),
Format30t(6),
Format31c(6),
Format31i(6),
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java b/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
index 9559760a..138c6c63 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
@@ -305,15 +305,6 @@ public enum Opcode
SPARSE_SWITCH_PAYLOAD(0x200, "sparse-switch-payload", ReferenceType.NONE, Format.SparseSwitchPayload, 0),
ARRAY_PAYLOAD(0x300, "array-payload", ReferenceType.NONE, Format.ArrayPayload, 0),
- // Reuse the deprecated f3-ff opcodes in Art:
- INVOKE_LAMBDA(allArtVersions(0xf3),"invoke-lambda", ReferenceType.NONE, Format.Format25x, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT | Opcode.EXPERIMENTAL),
- // TODO: What about JUMBO support if the string ID is too large?
- CAPTURE_VARIABLE(allArtVersions(0xf5), "capture-variable", ReferenceType.STRING, Format.Format21c, Opcode.EXPERIMENTAL),
- CREATE_LAMBDA(allArtVersions(0xf6), "create-lambda", ReferenceType.METHOD, Format.Format21c, Opcode.SETS_REGISTER | Opcode.EXPERIMENTAL),
- // TODO: do we need a capture/liberate wide?
- LIBERATE_VARIABLE(allArtVersions(0xf7), "liberate-variable", ReferenceType.STRING, Format.Format22c, Opcode.SETS_REGISTER | Opcode.EXPERIMENTAL),
- BOX_LAMBDA(allArtVersions(0xf8), "box-lambda", ReferenceType.NONE, Format.Format22x, Opcode.SETS_REGISTER | Opcode.EXPERIMENTAL),
- UNBOX_LAMBDA(allArtVersions(0xf9), "unbox-lambda", ReferenceType.TYPE, Format.Format22c, Opcode.SETS_REGISTER | Opcode.EXPERIMENTAL),
INVOKE_POLYMORPHIC(firstApi(0xfa, 26), "invoke-polymorphic", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format45cc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
INVOKE_POLYMORPHIC_RANGE(firstApi(0xfb, 26), "invoke-polymorphic/range", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format4rcc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT);
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 b1e5dbbf..148bafd1 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java
@@ -615,9 +615,6 @@ public class MutableMethodImplementation implements MethodImplementation {
case Format23x:
setInstruction(location, newBuilderInstruction23x((Instruction23x) instruction));
return;
- case Format25x:
- setInstruction(location, newBuilderInstruction25x((Instruction25x) instruction));
- return;
case Format30t:
setInstruction(location, newBuilderInstruction30t(location.codeAddress,
codeAddressToIndex,
@@ -872,18 +869,6 @@ public class MutableMethodImplementation implements MethodImplementation {
}
@Nonnull
- private BuilderInstruction25x newBuilderInstruction25x(@Nonnull Instruction25x instruction) {
- return new BuilderInstruction25x(
- instruction.getOpcode(),
- instruction.getParameterRegisterCount(),
- instruction.getRegisterFixedC(),
- instruction.getRegisterParameterD(),
- instruction.getRegisterParameterE(),
- instruction.getRegisterParameterF(),
- instruction.getRegisterParameterG());
- }
-
- @Nonnull
private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) {
return new BuilderInstruction3rc(
instruction.getOpcode(),
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction25x.java b/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction25x.java
deleted file mode 100644
index 3783d2b6..00000000
--- a/dexlib2/src/main/java/org/jf/dexlib2/builder/instruction/BuilderInstruction25x.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2015, 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.Instruction25x;
-import org.jf.dexlib2.util.Preconditions;
-
-import javax.annotation.Nonnull;
-
-public class BuilderInstruction25x extends BuilderInstruction implements Instruction25x {
- public static final Format FORMAT = Format.Format25x;
-
- protected final int parameterRegisterCount;
- protected final int registerClosure;
- protected final int registerD;
- protected final int registerE;
- protected final int registerF;
- protected final int registerG;
-
- public BuilderInstruction25x(@Nonnull Opcode opcode,
- int parameterRegisterCount,
- int registerClosure,
- int registerD,
- int registerE,
- int registerF,
- int registerG) {
- super(opcode);
- this.parameterRegisterCount =
- Preconditions.check25xParameterRegisterCount(parameterRegisterCount);
- this.registerClosure = Preconditions.checkNibbleRegister(registerClosure); //at least 1 reg
- this.registerD = (parameterRegisterCount>0) ?
- Preconditions.checkNibbleRegister(registerD) : 0;
- this.registerE = (parameterRegisterCount>1) ?
- Preconditions.checkNibbleRegister(registerE) : 0;
- this.registerF = (parameterRegisterCount>2) ?
- Preconditions.checkNibbleRegister(registerF) : 0;
- this.registerG = (parameterRegisterCount>3) ?
- Preconditions.checkNibbleRegister(registerG) : 0;
- }
-
- @Override public int getRegisterCount() { return parameterRegisterCount + 1; }
- @Override public int getParameterRegisterCount() { return parameterRegisterCount; }
- @Override public int getRegisterFixedC() { return registerClosure; }
- @Override public int getRegisterParameterD() { return registerD; }
- @Override public int getRegisterParameterE() { return registerE; }
- @Override public int getRegisterParameterF() { return registerF; }
- @Override public int getRegisterParameterG() { return registerG; }
-
- @Override public Format getFormat() { return FORMAT; }
-}
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java
index 2973398a..975e6813 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction.java
@@ -115,8 +115,6 @@ public abstract class DexBackedInstruction implements Instruction {
return new DexBackedInstruction22x(dexFile, opcode, instructionStartOffset);
case Format23x:
return new DexBackedInstruction23x(dexFile, opcode, instructionStartOffset);
- case Format25x:
- return new DexBackedInstruction25x(dexFile, opcode, instructionStartOffset);
case Format30t:
return new DexBackedInstruction30t(dexFile, opcode, instructionStartOffset);
case Format31c:
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction25x.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction25x.java
deleted file mode 100644
index 80fb8767..00000000
--- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/instruction/DexBackedInstruction25x.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2015, 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.dexbacked.instruction;
-
-import org.jf.dexlib2.Opcode;
-import org.jf.dexlib2.dexbacked.DexBackedDexFile;
-import org.jf.dexlib2.iface.instruction.formats.Instruction25x;
-import org.jf.util.NibbleUtils;
-
-import javax.annotation.Nonnull;
-
-public class DexBackedInstruction25x extends DexBackedInstruction implements Instruction25x {
- public DexBackedInstruction25x(@Nonnull DexBackedDexFile dexFile,
- @Nonnull Opcode opcode,
- int instructionStart) {
- super(dexFile, opcode, instructionStart);
- }
-
- @Override
- public int getRegisterCount() {
- return getParameterRegisterCount() + 1;
- }
-
- @Override
- public int getParameterRegisterCount() {
- return NibbleUtils.extractHighUnsignedNibble(dexFile.readUbyte(instructionStart + 1));
- }
-
- @Override
- public int getRegisterFixedC() {
- return NibbleUtils.extractLowUnsignedNibble(dexFile.readUbyte(instructionStart + 2));
- }
-
- @Override
- public int getRegisterParameterD() {
- return NibbleUtils.extractHighUnsignedNibble(dexFile.readUbyte(instructionStart + 2));
- }
-
- @Override
- public int getRegisterParameterE() {
- return NibbleUtils.extractLowUnsignedNibble(dexFile.readUbyte(instructionStart + 3));
- }
-
- @Override
- public int getRegisterParameterF() {
- return NibbleUtils.extractHighUnsignedNibble(dexFile.readUbyte(instructionStart + 3));
- }
-
- @Override
- public int getRegisterParameterG() {
- return NibbleUtils.extractLowUnsignedNibble(dexFile.readUbyte(instructionStart + 1));
- }
-
-}
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/CodeItem.java b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/CodeItem.java
index 27d72ad1..eeaff457 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/CodeItem.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/raw/CodeItem.java
@@ -129,9 +129,6 @@ public class CodeItem {
case Format10x:
annotateInstruction10x(out, instruction);
break;
- case Format25x:
- annotateInstruction25x(out, (Instruction25x) instruction);
- break;
case Format35c:
annotateInstruction35c(out, (Instruction35c)instruction);
break;
@@ -285,30 +282,6 @@ public class CodeItem {
instruction.getOpcode().name, Joiner.on(", ").join(args), reference));
}
- private void annotateInstruction25x(@Nonnull AnnotatedBytes out,
- @Nonnull Instruction25x instruction) {
- List<String> args = Lists.newArrayList();
-
- int registerCount = instruction.getRegisterCount(); //at least 1.
- if (registerCount == 2) {
- args.add(formatRegister(instruction.getRegisterParameterD()));
- } else if (registerCount == 3) {
- args.add(formatRegister(instruction.getRegisterParameterD()));
- args.add(formatRegister(instruction.getRegisterParameterE()));
- } else if (registerCount == 4) {
- args.add(formatRegister(instruction.getRegisterParameterD()));
- args.add(formatRegister(instruction.getRegisterParameterE()));
- args.add(formatRegister(instruction.getRegisterParameterF()));
- } else if (registerCount == 5) {
- args.add(formatRegister(instruction.getRegisterParameterD()));
- args.add(formatRegister(instruction.getRegisterParameterE()));
- args.add(formatRegister(instruction.getRegisterParameterF()));
- args.add(formatRegister(instruction.getRegisterParameterG()));
- }
- out.annotate(6, String.format("%s %s, {%s}",
- instruction.getOpcode().name, instruction.getRegisterFixedC(), Joiner.on(", ").join(args)));
- }
-
private void annotateInstruction3rc(@Nonnull AnnotatedBytes out, @Nonnull Instruction3rc instruction) {
int startRegister = instruction.getStartRegister();
int endRegister = startRegister + instruction.getRegisterCount() - 1;
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/OneFixedFourParameterRegisterInstruction.java b/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/OneFixedFourParameterRegisterInstruction.java
deleted file mode 100644
index c03bff77..00000000
--- a/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/OneFixedFourParameterRegisterInstruction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2015, 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.iface.instruction;
-
-public interface OneFixedFourParameterRegisterInstruction extends VariableRegisterInstruction {
- int getRegisterFixedC();
- int getRegisterParameterD();
- int getRegisterParameterE();
- int getRegisterParameterF();
- int getRegisterParameterG();
-
- /** Returns the count of just the parameter register counts; in range of [0, 4] */
- int getParameterRegisterCount();
-
- /** Includes the total sum of both fixed and parameter register counts; at least 1 */
- @Override
- int getRegisterCount();
-}
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/formats/Instruction25x.java b/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/formats/Instruction25x.java
deleted file mode 100644
index 51df2dee..00000000
--- a/dexlib2/src/main/java/org/jf/dexlib2/iface/instruction/formats/Instruction25x.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2015, 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.iface.instruction.formats;
-
-import org.jf.dexlib2.iface.instruction.OneFixedFourParameterRegisterInstruction;
-
-public interface Instruction25x extends OneFixedFourParameterRegisterInstruction {
-}
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction.java b/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction.java
index ed50ef5b..432f1930 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction.java
@@ -97,8 +97,6 @@ public abstract class ImmutableInstruction implements Instruction {
return ImmutableInstruction22x.of((Instruction22x)instruction);
case Format23x:
return ImmutableInstruction23x.of((Instruction23x)instruction);
- case Format25x:
- return ImmutableInstruction25x.of((Instruction25x) instruction);
case Format30t:
return ImmutableInstruction30t.of((Instruction30t)instruction);
case Format31c:
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction25x.java b/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction25x.java
deleted file mode 100644
index 2f31eaea..00000000
--- a/dexlib2/src/main/java/org/jf/dexlib2/immutable/instruction/ImmutableInstruction25x.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2015, 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.immutable.instruction;
-
-import org.jf.dexlib2.Format;
-import org.jf.dexlib2.Opcode;
-import org.jf.dexlib2.iface.instruction.formats.Instruction25x;
-import org.jf.dexlib2.util.Preconditions;
-
-import javax.annotation.Nonnull;
-
-public class ImmutableInstruction25x extends ImmutableInstruction implements Instruction25x {
- public static final Format FORMAT = Format.Format25x;
-
- protected final int parameterRegisterCount;
- protected final int registerClosure;
- protected final int registerD;
- protected final int registerE;
- protected final int registerF;
- protected final int registerG;
-
- public ImmutableInstruction25x(@Nonnull Opcode opcode,
- int parameterRegisterCount,
- int registerClosure,
- int registerD,
- int registerE,
- int registerF,
- int registerG) {
- super(opcode);
- this.parameterRegisterCount =
- Preconditions.check25xParameterRegisterCount(parameterRegisterCount);
- this.registerClosure = Preconditions.checkNibbleRegister(registerClosure);
- this.registerD = (parameterRegisterCount>0) ?
- Preconditions.checkNibbleRegister(registerD) : 0;
- this.registerE = (parameterRegisterCount>1) ?
- Preconditions.checkNibbleRegister(registerE) : 0;
- this.registerF = (parameterRegisterCount>2) ?
- Preconditions.checkNibbleRegister(registerF) : 0;
- this.registerG = (parameterRegisterCount>3) ?
- Preconditions.checkNibbleRegister(registerG) : 0;
- }
-
- public static ImmutableInstruction25x of(Instruction25x instruction) {
- if (instruction instanceof ImmutableInstruction25x) {
- return (ImmutableInstruction25x)instruction;
- }
- return new ImmutableInstruction25x(
- instruction.getOpcode(),
- instruction.getRegisterCount(),
- instruction.getRegisterFixedC(),
- instruction.getRegisterParameterD(),
- instruction.getRegisterParameterE(),
- instruction.getRegisterParameterF(),
- instruction.getRegisterParameterG());
- }
-
-
- @Override public int getParameterRegisterCount() { return parameterRegisterCount; }
- @Override public int getRegisterCount() { return parameterRegisterCount + 1; }
-
- @Override public int getRegisterFixedC() { return registerClosure; }
- @Override public int getRegisterParameterD() { return registerD; }
- @Override public int getRegisterParameterE() { return registerE; }
- @Override public int getRegisterParameterF() { return registerF; }
- @Override public int getRegisterParameterG() { return registerG; }
-
- @Override public Format getFormat() { return FORMAT; }
-}
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/util/Preconditions.java b/dexlib2/src/main/java/org/jf/dexlib2/util/Preconditions.java
index 3b30d075..2f9fe2d7 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/util/Preconditions.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/util/Preconditions.java
@@ -133,15 +133,6 @@ public class Preconditions {
return registerCount;
}
- public static int check25xParameterRegisterCount(int registerCount) {
- if (registerCount < 0 || registerCount > 4) {
- throw new IllegalArgumentException(
- String.format("Invalid parameter register count: %d. " +
- "Must be between 0 and 4, inclusive.", registerCount));
- }
- return registerCount;
- }
-
public static int checkRegisterRangeCount(int registerCount) {
if ((registerCount & 0xFFFFFF00) != 0) {
throw new IllegalArgumentException(
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 5329351e..6ca1ce93 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/DexWriter.java
@@ -1006,9 +1006,6 @@ public abstract class DexWriter<
case Format23x:
instructionWriter.write((Instruction23x)instruction);
break;
- case Format25x:
- instructionWriter.write((Instruction25x)instruction);
- break;
case Format30t:
instructionWriter.write((Instruction30t)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 c240c515..1b883f1f 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/writer/InstructionWriter.java
@@ -343,20 +343,6 @@ public class InstructionWriter<StringRef extends StringReference, TypeRef extend
}
}
- public void write(@Nonnull Instruction25x instruction) {
- try {
- writer.write(getOpcodeValue(instruction.getOpcode()));
- writer.write(packNibbles(
- instruction.getRegisterParameterG(), instruction.getParameterRegisterCount()));
- writer.write(packNibbles(
- instruction.getRegisterFixedC(), instruction.getRegisterParameterD()));
- writer.write(packNibbles(
- instruction.getRegisterParameterE(), instruction.getRegisterParameterF()));
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
-
public void write(@Nonnull Instruction3rc instruction) {
try {
writer.write(getOpcodeValue(instruction.getOpcode()));