mirror of
https://github.com/revanced/smali.git
synced 2025-05-30 20:40:11 +02:00
Refactor out the getRegCount method into a seperate InvokeInstruction interface
This commit is contained in:
parent
f40b4e9a1e
commit
166fc9296e
@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
package org.jf.dexlib.Code.Analysis;
|
package org.jf.dexlib.Code.Analysis;
|
||||||
|
|
||||||
import org.jf.dexlib.Code.Format.Instruction35mi;
|
|
||||||
import org.jf.dexlib.Code.Format.Instruction3rmi;
|
|
||||||
import org.jf.dexlib.Code.OdexedInvokeInline;
|
import org.jf.dexlib.Code.OdexedInvokeInline;
|
||||||
import org.jf.dexlib.Code.OdexedInvokeVirtual;
|
import org.jf.dexlib.Code.OdexedInvokeVirtual;
|
||||||
|
|
||||||
@ -88,7 +86,7 @@ abstract class InlineMethodResolver {
|
|||||||
}
|
}
|
||||||
return inlineMethods[methodIndex];
|
return inlineMethods[methodIndex];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
private static class InlineMethodResolver_version36 extends InlineMethodResolver
|
private static class InlineMethodResolver_version36 extends InlineMethodResolver
|
||||||
{
|
{
|
||||||
@ -176,11 +174,7 @@ abstract class InlineMethodResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getParameterCount(OdexedInvokeInline instruction) {
|
private int getParameterCount(OdexedInvokeInline instruction) {
|
||||||
if (instruction instanceof Instruction35mi) {
|
return instruction.getRegCount();
|
||||||
return ((Instruction35mi)instruction).getRegCount();
|
|
||||||
} else {
|
|
||||||
return ((Instruction3rmi)instruction).getRegCount();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
package org.jf.dexlib.Code;
|
package org.jf.dexlib.Code;
|
||||||
|
|
||||||
public interface FiveRegisterInstruction {
|
public interface FiveRegisterInstruction extends InvokeInstruction {
|
||||||
byte getRegCount();
|
|
||||||
byte getRegisterA();
|
byte getRegisterA();
|
||||||
byte getRegisterD();
|
byte getRegisterD();
|
||||||
byte getRegisterE();
|
byte getRegisterE();
|
||||||
|
@ -105,7 +105,7 @@ public class Instruction35c extends InstructionWithReference implements FiveRegi
|
|||||||
return Format.Format35c;
|
return Format.Format35c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getRegCount() {
|
public short getRegCount() {
|
||||||
return regCount;
|
return regCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class Instruction35mi extends Instruction implements FiveRegisterInstruct
|
|||||||
return Format.Format35ms;
|
return Format.Format35ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getRegCount() {
|
public short getRegCount() {
|
||||||
return regCount;
|
return regCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
|||||||
return Format.Format35ms;
|
return Format.Format35ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getRegCount() {
|
public short getRegCount() {
|
||||||
return regCount;
|
return regCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class Instruction35s extends InstructionWithReference implements FiveRegi
|
|||||||
return Format.Format35s;
|
return Format.Format35s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getRegCount() {
|
public short getRegCount() {
|
||||||
return regCount;
|
return regCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* [The "BSD licence"]
|
||||||
|
* Copyright (c) 2011 Ben Gruver
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. 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.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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;
|
||||||
|
|
||||||
|
public interface InvokeInstruction {
|
||||||
|
short getRegCount();
|
||||||
|
}
|
@ -31,6 +31,6 @@
|
|||||||
|
|
||||||
package org.jf.dexlib.Code;
|
package org.jf.dexlib.Code;
|
||||||
|
|
||||||
public interface OdexedInvokeInline {
|
public interface OdexedInvokeInline extends InvokeInstruction {
|
||||||
int getInlineIndex();
|
int getInlineIndex();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
package org.jf.dexlib.Code;
|
package org.jf.dexlib.Code;
|
||||||
|
|
||||||
public interface RegisterRangeInstruction {
|
public interface RegisterRangeInstruction extends InvokeInstruction {
|
||||||
short getRegCount();
|
|
||||||
int getStartRegister();
|
int getStartRegister();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user