mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 12:20:11 +02:00
Add support for Format5rc
This commit is contained in:
parent
8d323b3c48
commit
c4db7e2473
@ -202,6 +202,7 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
writeVtableIndex(writer);
|
||||
return true;
|
||||
case Format3rc:
|
||||
case Format5rc:
|
||||
writeOpcode(writer);
|
||||
writer.write(' ');
|
||||
writeInvokeRangeRegisters(writer);
|
||||
|
@ -3402,7 +3402,7 @@ public class MethodAnalyzer {
|
||||
assert false;
|
||||
}
|
||||
|
||||
Instruction3rc deodexedInstruction = new Instruction3rc(deodexedOpcode, instruction.getRegCount(),
|
||||
Instruction3rc deodexedInstruction = new Instruction3rc(deodexedOpcode, (short)instruction.getRegCount(),
|
||||
instruction.getStartRegister(), inlineMethodIdItem);
|
||||
|
||||
analyzedInstruction.setDeodexedInstruction(deodexedInstruction);
|
||||
@ -3511,7 +3511,7 @@ public class MethodAnalyzer {
|
||||
opcode = Opcode.INVOKE_VIRTUAL_RANGE;
|
||||
}
|
||||
|
||||
deodexedInstruction = new Instruction3rc(opcode, instruction.getRegCount(),
|
||||
deodexedInstruction = new Instruction3rc(opcode, (short)instruction.getRegCount(),
|
||||
instruction.getStartRegister(), methodIdItem);
|
||||
} else {
|
||||
Instruction35ms instruction = (Instruction35ms)analyzedInstruction.instruction;
|
||||
|
@ -64,6 +64,7 @@ public enum Format {
|
||||
Format41c(Instruction41c.Factory, 8),
|
||||
Format51l(Instruction51l.Factory, 10),
|
||||
Format52c(Instruction52c.Factory, 10),
|
||||
Format5rc(Instruction5rc.Factory, 10),
|
||||
ArrayData(null, -1, true),
|
||||
PackedSwitchData(null, -1, true),
|
||||
SparseSwitchData(null, -1, true),
|
||||
|
@ -94,6 +94,10 @@ public class Instruction35c extends InstructionWithReference implements FiveRegi
|
||||
}
|
||||
|
||||
protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) {
|
||||
if(getReferencedItem().getIndex() > 0xFFFF) {
|
||||
throw new RuntimeException(String.format("%s index is too large. Use the %s/jumbo instruction instead.", opcode.referenceType.name(), opcode.name));
|
||||
}
|
||||
|
||||
out.writeByte(opcode.value);
|
||||
out.writeByte((regCount << 4) | regA);
|
||||
out.writeShort(getReferencedItem().getIndex());
|
||||
@ -105,7 +109,7 @@ public class Instruction35c extends InstructionWithReference implements FiveRegi
|
||||
return Format.Format35c;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return regCount;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class Instruction35mi extends Instruction implements FiveRegisterInstruct
|
||||
return Format.Format35ms;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return regCount;
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
return Format.Format35ms;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return regCount;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class Instruction35s extends InstructionWithReference implements FiveRegi
|
||||
return Format.Format35s;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return regCount;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,10 @@ public class Instruction3rc extends InstructionWithReference implements Register
|
||||
}
|
||||
|
||||
protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) {
|
||||
if(getReferencedItem().getIndex() > 0xFFFF) {
|
||||
throw new RuntimeException(String.format("%s index is too large. Use the jumbo variant of the instruction instead.", opcode.referenceType.name()));
|
||||
}
|
||||
|
||||
out.writeByte(opcode.value);
|
||||
out.writeByte(regCount);
|
||||
out.writeShort(this.getReferencedItem().getIndex());
|
||||
@ -89,7 +93,7 @@ public class Instruction3rc extends InstructionWithReference implements Register
|
||||
return Format.Format3rc;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return (short)(regCount & 0xFF);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class Instruction3rmi extends Instruction implements RegisterRangeInstruc
|
||||
return Format.Format3rms;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return (short)(regCount & 0xFF);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class Instruction3rms extends Instruction implements RegisterRangeInstruc
|
||||
return Format.Format3rms;
|
||||
}
|
||||
|
||||
public short getRegCount() {
|
||||
public int getRegCount() {
|
||||
return (short)(regCount & 0xFF);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright 2011, 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.dexlib.Code.Format;
|
||||
|
||||
import org.jf.dexlib.Code.Instruction;
|
||||
import org.jf.dexlib.Code.InstructionWithReference;
|
||||
import org.jf.dexlib.Code.Opcode;
|
||||
import org.jf.dexlib.Code.RegisterRangeInstruction;
|
||||
import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Item;
|
||||
import org.jf.dexlib.MethodIdItem;
|
||||
import org.jf.dexlib.TypeIdItem;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
import static org.jf.dexlib.Code.Opcode.*;
|
||||
|
||||
public class Instruction5rc extends InstructionWithJumboReference implements RegisterRangeInstruction {
|
||||
public static final InstructionFactory Factory = new Factory();
|
||||
private short regCount;
|
||||
private short startReg;
|
||||
|
||||
public Instruction5rc(Opcode opcode, int regCount, int startReg, Item referencedItem) {
|
||||
super(opcode, referencedItem);
|
||||
|
||||
if (regCount >= 1 << 16) {
|
||||
throw new RuntimeException("regCount must be less than 65536");
|
||||
}
|
||||
if (regCount < 0) {
|
||||
throw new RuntimeException("regCount cannot be negative");
|
||||
}
|
||||
|
||||
if (startReg >= 1 << 16) {
|
||||
throw new RuntimeException("The beginning register of the range must be less than 65536");
|
||||
}
|
||||
if (startReg < 0) {
|
||||
throw new RuntimeException("The beginning register of the range cannot be negative");
|
||||
}
|
||||
|
||||
this.regCount = (short)regCount;
|
||||
this.startReg = (short)startReg;
|
||||
|
||||
checkItem(opcode, referencedItem, regCount);
|
||||
}
|
||||
|
||||
private Instruction5rc(DexFile dexFile, Opcode opcode, byte[] buffer, int bufferIndex) {
|
||||
super(dexFile, opcode, buffer, bufferIndex);
|
||||
|
||||
this.regCount = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 6);
|
||||
this.startReg = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 8);
|
||||
|
||||
checkItem(opcode, getReferencedItem(), getRegCount());
|
||||
}
|
||||
|
||||
protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) {
|
||||
out.writeByte(0xff);
|
||||
out.writeByte(opcode.value);
|
||||
out.writeInt(this.getReferencedItem().getIndex());
|
||||
out.writeShort(regCount);
|
||||
out.writeShort(startReg);
|
||||
}
|
||||
|
||||
public Format getFormat() {
|
||||
return Format.Format5rc;
|
||||
}
|
||||
|
||||
public int getRegCount() {
|
||||
return regCount & 0xFFFF;
|
||||
}
|
||||
|
||||
public int getStartRegister() {
|
||||
return startReg & 0xFFFF;
|
||||
}
|
||||
|
||||
private static void checkItem(Opcode opcode, Item item, int regCount) {
|
||||
if (opcode == FILLED_NEW_ARRAY_JUMBO) {
|
||||
//check data for filled-new-array/jumbo opcode
|
||||
String type = ((TypeIdItem) item).getTypeDescriptor();
|
||||
if (type.charAt(0) != '[') {
|
||||
throw new RuntimeException("The type must be an array type");
|
||||
}
|
||||
if (type.charAt(1) == 'J' || type.charAt(1) == 'D') {
|
||||
throw new RuntimeException("The type cannot be an array of longs or doubles");
|
||||
}
|
||||
} else if (opcode.value >= INVOKE_VIRTUAL_JUMBO.value && opcode.value <= INVOKE_INTERFACE_JUMBO.value) {
|
||||
//check data for invoke-*/range opcodes
|
||||
MethodIdItem methodIdItem = (MethodIdItem) item;
|
||||
int parameterRegisterCount = methodIdItem.getPrototype().getParameterRegisterCount();
|
||||
if (opcode != INVOKE_STATIC_JUMBO) {
|
||||
parameterRegisterCount++;
|
||||
}
|
||||
if (parameterRegisterCount != regCount) {
|
||||
throw new RuntimeException("regCount does not match the number of arguments of the method");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class Factory implements InstructionFactory {
|
||||
public Instruction makeInstruction(DexFile dexFile, Opcode opcode, byte[] buffer, int bufferIndex) {
|
||||
return new Instruction5rc(dexFile, opcode, buffer, bufferIndex);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,5 +29,5 @@
|
||||
package org.jf.dexlib.Code;
|
||||
|
||||
public interface InvokeInstruction {
|
||||
short getRegCount();
|
||||
int getRegCount();
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ public enum Opcode
|
||||
INSTANCE_OF_JUMBO((short)0xff02, "instance-of/jumbo", ReferenceType.type, Format.Format52c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER),
|
||||
NEW_INSTANCE_JUMBO((short)0xff03, "new-instance/jumbo", ReferenceType.type, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER),
|
||||
NEW_ARRAY_JUMBO((short)0xff04, "new-array/jumbo", ReferenceType.type, Format.Format52c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER),
|
||||
|
||||
FILLED_NEW_ARRAY_JUMBO((short)0xff05, "filled-new-array/jumbo", ReferenceType.type, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
|
||||
IGET_JUMBO((short)0xff06, "iget/jumbo", ReferenceType.field, Format.Format52c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER),
|
||||
IGET_WIDE_JUMBO((short)0xff07, "iget-wide/jumbo", ReferenceType.field, Format.Format52c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER | Opcode.SETS_WIDE_REGISTER),
|
||||
IGET_OBJECT_JUMBO((short)0xff08, "iget-object/jumbo", ReferenceType.field, Format.Format52c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_REGISTER),
|
||||
@ -315,7 +315,12 @@ public enum Opcode
|
||||
SPUT_BOOLEAN_JUMBO((short)0xff1e, "sput-boolean/jumbo", ReferenceType.field, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE),
|
||||
SPUT_BYTE_JUMBO((short)0xff1f, "sput-byte/jumbo", ReferenceType.field, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE),
|
||||
SPUT_CHAR_JUMBO((short)0xff20, "sput-char/jumbo", ReferenceType.field, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE),
|
||||
SPUT_SHORT_JUMBO((short)0xff21, "sput-short/jumbo", ReferenceType.field, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE);
|
||||
SPUT_SHORT_JUMBO((short)0xff21, "sput-short/jumbo", ReferenceType.field, Format.Format41c, Opcode.CAN_THROW | Opcode.CAN_CONTINUE),
|
||||
INVOKE_VIRTUAL_JUMBO((short)0xff22, "invoke-virtual/jumbo", ReferenceType.method, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
|
||||
INVOKE_SUPER_JUMBO((short)0xff23, "invoke-super/jumbo", ReferenceType.method, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
|
||||
INVOKE_DIRECT_JUMBO((short)0xff24, "invoke-direct/jumbo", ReferenceType.method, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
|
||||
INVOKE_STATIC_JUMBO((short)0xff25, "invoke-static/jumbo", ReferenceType.method, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
|
||||
INVOKE_INTERFACE_JUMBO((short)0xff26, "invoke-interface/jumbo", ReferenceType.method, Format.Format5rc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT);
|
||||
|
||||
private static Opcode[] opcodesByValue;
|
||||
private static Opcode[] expandedOpcodesByValue;
|
||||
|
@ -61,6 +61,17 @@
|
||||
<dumpFile>target/jumbo-field-tests/classes.dump</dumpFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jumbo-method-tests</id>
|
||||
<goals>
|
||||
<goal>assemble</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirectory>src/test/smali/jumbo-method-tests</sourceDirectory>
|
||||
<outputFile>target/jumbo-method-tests/classes.dex</outputFile>
|
||||
<dumpFile>target/jumbo-method-tests/classes.dump</dumpFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -122,6 +133,20 @@
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jumbo-method-tests</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<finalName>jumbo-method-tests</finalName>
|
||||
<descriptors>
|
||||
<descriptor>src/assemble/jumbo-method-tests.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -172,6 +197,17 @@
|
||||
<destinationFileOrDirectory>/data/local/jumbo-field-tests.zip</destinationFileOrDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jumbo-method-tests</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>push</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceFileOrDirectory>${project.build.directory}/jumbo-method-tests.zip</sourceFileOrDirectory>
|
||||
<destinationFileOrDirectory>/data/local/jumbo-method-tests.zip</destinationFileOrDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -251,6 +287,24 @@
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jumbo-method-tests</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>adb</executable>
|
||||
<arguments>
|
||||
<argument>shell</argument>
|
||||
<argument>dalvikvm</argument>
|
||||
<argument>-cp</argument>
|
||||
<argument>/data/local/junit-4.6.zip:/data/local/jumbo-method-tests.zip</argument>
|
||||
<argument>org/junit/runner/JUnitCore</argument>
|
||||
<argument>AllTests</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
44
smali-integration-tests/src/assemble/jumbo-method-tests.xml
Normal file
44
smali-integration-tests/src/assemble/jumbo-method-tests.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<!--
|
||||
~ Copyright 2011, 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.
|
||||
-->
|
||||
|
||||
<assembly>
|
||||
<id>zip</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<files>
|
||||
<file>
|
||||
<source>target/jumbo-method-tests/classes.dex</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,41 @@
|
||||
.class public LAssert;
|
||||
.super Ljava/lang/Object;
|
||||
.source "Assert.smali"
|
||||
|
||||
#junit's Assert doesn't have an AssertEquals method for ints, only longs
|
||||
.method public static assertEquals(II)V
|
||||
.registers 4
|
||||
|
||||
int-to-long v0, p1
|
||||
int-to-long p0, p0
|
||||
|
||||
invoke-static/jumbo {v0 .. p1}, Lorg/junit/Assert;->assertEquals(JJ)V
|
||||
return-void
|
||||
.end method
|
||||
|
||||
#junit's Assert doesn't have an AssertEquals method for floats, only doubles
|
||||
.method public static assertEquals(FF)V
|
||||
.registers 6
|
||||
|
||||
float-to-double v0, p0
|
||||
float-to-double v2, p1
|
||||
|
||||
const-wide v4, .00001
|
||||
|
||||
invoke-static/jumbo {v0..v5}, Lorg/junit/Assert;->assertEquals(DDD)V
|
||||
return-void
|
||||
.end method
|
||||
|
||||
#convenience method that supplies a default "Delta" argument
|
||||
.method public static assertEquals(DD)V
|
||||
.registers 6
|
||||
|
||||
move-wide v0, p0
|
||||
move-wide v2, p2
|
||||
|
||||
const-wide v4, .00001
|
||||
|
||||
invoke-static/jumbo {v0..v5}, Lorg/junit/Assert;->assertEquals(DDD)V
|
||||
|
||||
return-void
|
||||
.end method
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,39 @@
|
||||
#Copyright 2011, 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.
|
||||
|
||||
.class public LAllTests;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.annotation runtime Lorg/junit/runner/RunWith;
|
||||
value = Lorg/junit/runners/Suite;
|
||||
.end annotation
|
||||
|
||||
.annotation runtime Lorg/junit/runners/Suite$SuiteClasses;
|
||||
value = { LFormat5rc; }
|
||||
.end annotation
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,34 @@
|
||||
#Copyright 2011, 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.
|
||||
|
||||
.class public abstract interface LzzzRangeMethodsInterface;
|
||||
.super Ljava/lang/Object;
|
||||
|
||||
.method public abstract interfaceMethodTest(IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII)I
|
||||
.end method
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@
|
||||
|
||||
.annotation runtime Lorg/junit/runners/Suite$SuiteClasses;
|
||||
value = { LFormat41c;,
|
||||
LFormat52c;
|
||||
LFormat52c;,
|
||||
LFormat5rc;
|
||||
}
|
||||
.end annotation
|
@ -734,6 +734,16 @@ INSTRUCTION_FORMAT52c_FIELD
|
||||
| 'iput-char/jumbo'
|
||||
| 'iput-short/jumbo';
|
||||
|
||||
INSTRUCTION_FORMAT5rc_METHOD
|
||||
: 'invoke-virtual/jumbo'
|
||||
| 'invoke-super/jumbo'
|
||||
| 'invoke-direct/jumbo'
|
||||
| 'invoke-static/jumbo'
|
||||
| 'invoke-interface/jumbo';
|
||||
|
||||
INSTRUCTION_FORMAT5rc_TYPE
|
||||
: 'filled-new-array/jumbo';
|
||||
|
||||
|
||||
/**********************************************************
|
||||
* Types
|
||||
|
@ -122,6 +122,8 @@ tokens {
|
||||
I_STATEMENT_FORMAT51l;
|
||||
I_STATEMENT_FORMAT52c_TYPE;
|
||||
I_STATEMENT_FORMAT52c_FIELD;
|
||||
I_STATEMENT_FORMAT5rc_METHOD;
|
||||
I_STATEMENT_FORMAT5rc_TYPE;
|
||||
I_STATEMENT_ARRAY_DATA;
|
||||
I_STATEMENT_PACKED_SWITCH;
|
||||
I_STATEMENT_SPARSE_SWITCH;
|
||||
@ -853,6 +855,12 @@ instruction returns [int size]
|
||||
| //e.g. iput-object/jumbo v1, v0 Lorg/jf/HelloWorld2/HelloWorld2;->helloWorld:Ljava/lang/String;
|
||||
INSTRUCTION_FORMAT52c_FIELD REGISTER COMMA REGISTER COMMA fully_qualified_field {$size = Format.Format52c.size;}
|
||||
-> ^(I_STATEMENT_FORMAT52c_FIELD[$start, "I_STATEMENT_FORMAT52c_FIELD"] INSTRUCTION_FORMAT52c_FIELD REGISTER REGISTER fully_qualified_field)
|
||||
| //e.g. invoke-virtual/jumbo {v25..v26}, java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||||
INSTRUCTION_FORMAT5rc_METHOD OPEN_BRACE register_range CLOSE_BRACE COMMA fully_qualified_method {$size = Format.Format5rc.size;}
|
||||
-> ^(I_STATEMENT_FORMAT5rc_METHOD[$start, "I_STATEMENT_FORMAT5rc_METHOD"] INSTRUCTION_FORMAT5rc_METHOD register_range fully_qualified_method)
|
||||
| //e.g. filled-new-array/jumbo {v0..v6}, I
|
||||
INSTRUCTION_FORMAT5rc_TYPE OPEN_BRACE register_range CLOSE_BRACE COMMA nonvoid_type_descriptor {$size = Format.Format5rc.size;}
|
||||
-> ^(I_STATEMENT_FORMAT5rc_TYPE[$start, "I_STATEMENT_FORMAT5rc_TYPE"] INSTRUCTION_FORMAT5rc_TYPE register_range nonvoid_type_descriptor)
|
||||
|
|
||||
ARRAY_DATA_DIRECTIVE
|
||||
{
|
||||
|
@ -1303,6 +1303,34 @@ instruction[int totalMethodRegisters, int methodParameterRegisters, List<Instruc
|
||||
|
||||
$instructions.add(new Instruction52c(opcode, regA, regB, fieldIdItem));
|
||||
}
|
||||
| //e.g. invoke-virtual/jumbo {v25..v26} java/lang/StringBuilder/append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
||||
^(I_STATEMENT_FORMAT5rc_METHOD INSTRUCTION_FORMAT5rc_METHOD register_range[$totalMethodRegisters, $methodParameterRegisters] fully_qualified_method)
|
||||
{
|
||||
Opcode opcode = Opcode.getOpcodeByName($INSTRUCTION_FORMAT5rc_METHOD.text);
|
||||
int startRegister = $register_range.startRegister;
|
||||
int endRegister = $register_range.endRegister;
|
||||
|
||||
int registerCount = endRegister-startRegister+1;
|
||||
$outRegisters = registerCount;
|
||||
|
||||
MethodIdItem methodIdItem = $fully_qualified_method.methodIdItem;
|
||||
|
||||
$instructions.add(new Instruction5rc(opcode, registerCount, startRegister, methodIdItem));
|
||||
}
|
||||
| //e.g. filled-new-array/jumbo {v0..v6} I
|
||||
^(I_STATEMENT_FORMAT5rc_TYPE INSTRUCTION_FORMAT5rc_TYPE register_range[$totalMethodRegisters, $methodParameterRegisters] nonvoid_type_descriptor)
|
||||
{
|
||||
Opcode opcode = Opcode.getOpcodeByName($INSTRUCTION_FORMAT5rc_TYPE.text);
|
||||
int startRegister = $register_range.startRegister;
|
||||
int endRegister = $register_range.endRegister;
|
||||
|
||||
int registerCount = endRegister-startRegister+1;
|
||||
$outRegisters = registerCount;
|
||||
|
||||
TypeIdItem typeIdItem = $nonvoid_type_descriptor.type;
|
||||
|
||||
$instructions.add(new Instruction5rc(opcode, registerCount, startRegister, typeIdItem));
|
||||
}
|
||||
| //e.g. .array-data 4 1000000 .end array-data
|
||||
^(I_STATEMENT_ARRAY_DATA ^(I_ARRAY_ELEMENT_SIZE short_integral_literal) array_elements)
|
||||
{
|
||||
|
@ -585,6 +585,15 @@ Type = {PrimitiveType} | {ClassDescriptor} | {ArrayDescriptor}
|
||||
"iput-boolean/jumbo" | "iput-byte/jumbo" | "iput-char/jumbo" | "iput-short/jumbo" {
|
||||
return newToken(INSTRUCTION_FORMAT52c_FIELD);
|
||||
}
|
||||
|
||||
"invoke-virtual/jumbo" | "invoke-super/jumbo" | "invoke-direct/jumbo" | "invoke-static/jumbo" |
|
||||
"invoke-interface/jumbo" {
|
||||
return newToken(INSTRUCTION_FORMAT5rc_METHOD);
|
||||
}
|
||||
|
||||
"filled-new-array/jumbo" {
|
||||
return newToken(INSTRUCTION_FORMAT5rc_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
/*Types*/
|
||||
|
@ -218,6 +218,7 @@ invoke-virtual/range
|
||||
invoke-super/range
|
||||
invoke-direct/range
|
||||
invoke-static/range
|
||||
invoke-interface/range
|
||||
filled-new-array/range
|
||||
execute-inline/range
|
||||
invoke-virtual-quick/range
|
||||
@ -256,3 +257,9 @@ iput-boolean/jumbo
|
||||
iput-byte/jumbo
|
||||
iput-char/jumbo
|
||||
iput-short/jumbo
|
||||
invoke-virtual/jumbo
|
||||
invoke-super/jumbo
|
||||
invoke-direct/jumbo
|
||||
invoke-static/jumbo
|
||||
invoke-interface/jumbo
|
||||
filled-new-array/jumbo
|
@ -218,6 +218,7 @@ INSTRUCTION_FORMAT3rc_METHOD("invoke-virtual/range")
|
||||
INSTRUCTION_FORMAT3rc_METHOD("invoke-super/range")
|
||||
INSTRUCTION_FORMAT3rc_METHOD("invoke-direct/range")
|
||||
INSTRUCTION_FORMAT3rc_METHOD("invoke-static/range")
|
||||
INSTRUCTION_FORMAT3rc_METHOD("invoke-interface/range")
|
||||
INSTRUCTION_FORMAT3rc_TYPE("filled-new-array/range")
|
||||
INSTRUCTION_FORMAT3rmi_METHOD("execute-inline/range")
|
||||
INSTRUCTION_FORMAT3rms_METHOD("invoke-virtual-quick/range")
|
||||
@ -256,3 +257,9 @@ INSTRUCTION_FORMAT52c_FIELD("iput-boolean/jumbo")
|
||||
INSTRUCTION_FORMAT52c_FIELD("iput-byte/jumbo")
|
||||
INSTRUCTION_FORMAT52c_FIELD("iput-char/jumbo")
|
||||
INSTRUCTION_FORMAT52c_FIELD("iput-short/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_METHOD("invoke-virtual/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_METHOD("invoke-super/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_METHOD("invoke-direct/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_METHOD("invoke-static/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_METHOD("invoke-interface/jumbo")
|
||||
INSTRUCTION_FORMAT5rc_TYPE("filled-new-array/jumbo")
|
Loading…
x
Reference in New Issue
Block a user