mirror of
https://github.com/revanced/smali.git
synced 2025-05-20 16:07:05 +02:00
Implement instructions for the method builder
This commit is contained in:
parent
688611814d
commit
e80efa670f
@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.jf.dexlib2.Format;
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.iface.instruction.Instruction;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public abstract class BuilderInstruction implements Instruction {
|
||||||
|
@Nonnull protected final Opcode opcode;
|
||||||
|
|
||||||
|
@Nullable MethodLocation location;
|
||||||
|
|
||||||
|
protected BuilderInstruction(@Nonnull Opcode opcode) {
|
||||||
|
Preconditions.checkFormat(opcode, getFormat());
|
||||||
|
this.opcode = opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull public Opcode getOpcode() {
|
||||||
|
return opcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Format getFormat();
|
||||||
|
|
||||||
|
public int getCodeUnits() {
|
||||||
|
return getFormat().size / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MethodLocation getLocation() {
|
||||||
|
if (location == null) {
|
||||||
|
throw new IllegalStateException("Cannot get the location of an instruction that hasn't been added to a " +
|
||||||
|
"method.");
|
||||||
|
}
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.jf.dexlib2.builder;
|
||||||
|
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.iface.instruction.SwitchPayload;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public abstract class BuilderSwitchPayload extends BuilderInstruction implements SwitchPayload {
|
||||||
|
@Nullable
|
||||||
|
MethodLocation referrer;
|
||||||
|
|
||||||
|
protected BuilderSwitchPayload(@Nonnull Opcode opcode) {
|
||||||
|
super(opcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
public MethodLocation getReferrer() {
|
||||||
|
if (referrer == null) {
|
||||||
|
throw new IllegalStateException("The referrer has not been set yet");
|
||||||
|
}
|
||||||
|
return referrer;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
package org.jf.dexlib2.builder;
|
package org.jf.dexlib2.builder;
|
||||||
|
|
||||||
import org.jf.dexlib2.Opcode;
|
import org.jf.dexlib2.iface.MethodImplementation;
|
||||||
import org.jf.dexlib2.iface.reference.Reference;
|
|
||||||
import org.jf.dexlib2.iface.reference.StringReference;
|
import org.jf.dexlib2.iface.reference.StringReference;
|
||||||
import org.jf.dexlib2.iface.reference.TypeReference;
|
import org.jf.dexlib2.iface.reference.TypeReference;
|
||||||
import org.jf.dexlib2.writer.builder.BuilderStringReference;
|
import org.jf.dexlib2.writer.builder.BuilderStringReference;
|
||||||
@ -9,22 +8,25 @@ import org.jf.dexlib2.writer.builder.BuilderStringReference;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MethodImplementationBuilder<ReferenceType extends Reference> {
|
public class MethodImplementationBuilder {
|
||||||
// Contains all named labels - both placed and unplaced
|
// Contains all named labels - both placed and unplaced
|
||||||
private final HashMap<String, Label> labels = new HashMap<String, Label>();
|
private final HashMap<String, Label> labels = new HashMap<String, Label>();
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final MutableMethodImplementation<ReferenceType> impl;
|
private final MutableMethodImplementation impl;
|
||||||
|
|
||||||
private MethodLocation currentLocation;
|
private MethodLocation currentLocation;
|
||||||
|
|
||||||
public MethodImplementationBuilder() {
|
public MethodImplementationBuilder() {
|
||||||
this.impl = new MutableMethodImplementation<ReferenceType>();
|
this.impl = new MutableMethodImplementation();
|
||||||
this.currentLocation = impl.instructionList.get(0);
|
this.currentLocation = impl.instructionList.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MethodImplementation buildMethodImplementation() {
|
||||||
|
return impl.buildMethodImplementation();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new named label at the current location.
|
* Adds a new named label at the current location.
|
||||||
*
|
*
|
||||||
@ -114,147 +116,8 @@ public class MethodImplementationBuilder<ReferenceType extends Reference> {
|
|||||||
currentLocation.addSetSourceFile(sourceFile);
|
currentLocation.addSetSourceFile(sourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInstruction10t(@Nonnull Opcode opcode,
|
public void addInstruction(@Nullable BuilderInstruction instruction) {
|
||||||
@Nonnull Label label) {
|
impl.addInstruction(instruction);
|
||||||
}
|
currentLocation = impl.instructionList.get(impl.instructionList.size()-1);
|
||||||
|
|
||||||
public void addInstruction10x(@Nonnull Opcode opcode) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction11n(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction11x(@Nonnull Opcode opcode,
|
|
||||||
int registerA) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction12x(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction20bc(@Nonnull Opcode opcode,
|
|
||||||
int verificationError,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction20t(@Nonnull Opcode opcode,
|
|
||||||
@Nonnull Label label) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction21c(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction21ih(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction21lh(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
long literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction21s(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction21t(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
@Nonnull Label label) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction22b(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction22c(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction22s(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction22t(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB,
|
|
||||||
@Nonnull Label labelMethodItem) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction22x(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction23x(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB,
|
|
||||||
int registerC) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction30t(@Nonnull Opcode opcode,
|
|
||||||
@Nonnull Label label) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction31c(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction31i(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction31t(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
@Nonnull Label label) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction32x(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
int registerB) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction35c(@Nonnull Opcode opcode,
|
|
||||||
int registerCount,
|
|
||||||
int registerC,
|
|
||||||
int registerD,
|
|
||||||
int registerE,
|
|
||||||
int registerF,
|
|
||||||
int registerG,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction3rc(@Nonnull Opcode opcode,
|
|
||||||
int startRegister,
|
|
||||||
int registerCount,
|
|
||||||
@Nonnull ReferenceType reference) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addInstruction51l(@Nonnull Opcode opcode,
|
|
||||||
int registerA,
|
|
||||||
long literal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPackedSwitchPayload(int startKey, @Nullable List<? extends Label> switchElements) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSparseSwitchPayload(@Nullable List<? extends SwitchLabelElement> switchElements) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addArrayPayload(int elementWidth, @Nullable List<Number> arrayElements) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,17 +9,20 @@ import org.jf.dexlib2.writer.builder.BuilderStringReference;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.AbstractSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class MethodLocation {
|
public class MethodLocation {
|
||||||
@Nullable Instruction instruction;
|
@Nullable BuilderInstruction instruction;
|
||||||
int codeAddress;
|
int codeAddress;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
private List<Label> labels = Lists.newArrayList();
|
private List<Label> labels = Lists.newArrayList();
|
||||||
List<BuilderDebugItem> debugItems = Lists.newArrayList();
|
List<BuilderDebugItem> debugItems = Lists.newArrayList();
|
||||||
|
|
||||||
MethodLocation(@Nullable Instruction instruction,
|
MethodLocation(@Nullable BuilderInstruction instruction,
|
||||||
int codeAddress, int index) {
|
int codeAddress, int index) {
|
||||||
this.instruction = instruction;
|
this.instruction = instruction;
|
||||||
this.codeAddress = codeAddress;
|
this.codeAddress = codeAddress;
|
||||||
@ -39,6 +42,31 @@ public class MethodLocation {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mergeInto(@Nonnull MethodLocation other) {
|
||||||
|
for (Label label: labels) {
|
||||||
|
label.location = other;
|
||||||
|
other.labels.add(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to keep the debug items in the same order. We add the other debug items to this list, then reassign
|
||||||
|
// the list.
|
||||||
|
for (BuilderDebugItem debugItem: debugItems) {
|
||||||
|
debugItem.location = other;
|
||||||
|
}
|
||||||
|
debugItems.addAll(other.debugItems);
|
||||||
|
other.debugItems = debugItems;
|
||||||
|
|
||||||
|
for (int i=debugItems.size()-1; i>=0; i--) {
|
||||||
|
BuilderDebugItem debugItem = debugItems.get(i);
|
||||||
|
debugItem.location = other;
|
||||||
|
other.debugItems.add(0, debugItem);
|
||||||
|
}
|
||||||
|
for (BuilderDebugItem debugItem: debugItems) {
|
||||||
|
debugItem.location = other;
|
||||||
|
other.debugItems.add(0, debugItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Set<Label> getLabels() {
|
public Set<Label> getLabels() {
|
||||||
return new AbstractSet<Label>() {
|
return new AbstractSet<Label>() {
|
||||||
|
@ -2,7 +2,7 @@ package org.jf.dexlib2.builder;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.jf.dexlib2.iface.MethodImplementation;
|
import org.jf.dexlib2.iface.MethodImplementation;
|
||||||
import org.jf.dexlib2.iface.reference.Reference;
|
import org.jf.dexlib2.iface.instruction.Instruction;
|
||||||
import org.jf.dexlib2.iface.reference.TypeReference;
|
import org.jf.dexlib2.iface.reference.TypeReference;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MutableMethodImplementation<ReferenceType extends Reference> {
|
public class MutableMethodImplementation {
|
||||||
final ArrayList<MethodLocation> instructionList = Lists.newArrayList(new MethodLocation(null, 0, 0));
|
final ArrayList<MethodLocation> instructionList = Lists.newArrayList(new MethodLocation(null, 0, 0));
|
||||||
private final ArrayList<BuilderTryBlock> tryBlocks = Lists.newArrayList();
|
private final ArrayList<BuilderTryBlock> tryBlocks = Lists.newArrayList();
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public class MutableMethodImplementation<ReferenceType extends Reference> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MethodLocation> getInstruction() {
|
public List<MethodLocation> getInstructions() {
|
||||||
return Collections.unmodifiableList(instructionList);
|
return Collections.unmodifiableList(instructionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,4 +39,105 @@ public class MutableMethodImplementation<ReferenceType extends Reference> {
|
|||||||
public void addCatch(@Nonnull Label from, @Nonnull Label to, @Nonnull Label handler) {
|
public void addCatch(@Nonnull Label from, @Nonnull Label to, @Nonnull Label handler) {
|
||||||
tryBlocks.add(new BuilderTryBlock(from, to, handler));
|
tryBlocks.add(new BuilderTryBlock(from, to, handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addInstruction(int index, BuilderInstruction instruction) {
|
||||||
|
// the end check here is intentially >= rather than >, because the list always includes an "empty"
|
||||||
|
// (null instruction) MethodLocation at the end. To add an instruction to the end of the list, the user would
|
||||||
|
// provide the index of this empty item, which would be size() - 1.
|
||||||
|
if (index >= instructionList.size()) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == instructionList.size() - 1) {
|
||||||
|
addInstruction(instruction);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int codeAddress = instructionList.get(index).getCodeAddress();
|
||||||
|
|
||||||
|
instructionList.add(index, new MethodLocation(instruction, codeAddress, index));
|
||||||
|
codeAddress += instruction.getCodeUnits();
|
||||||
|
|
||||||
|
for (int i=index+1; i<instructionList.size(); i++) {
|
||||||
|
MethodLocation location = instructionList.get(i);
|
||||||
|
location.index++;
|
||||||
|
location.codeAddress = codeAddress;
|
||||||
|
if (location.instruction != null) {
|
||||||
|
codeAddress += location.instruction.getCodeUnits();
|
||||||
|
} else {
|
||||||
|
// only the last MethodLocation should have a null instruction
|
||||||
|
assert index == instructionList.size()-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addInstruction(BuilderInstruction instruction) {
|
||||||
|
MethodLocation last = instructionList.get(instructionList.size()-1);
|
||||||
|
last.instruction = instruction;
|
||||||
|
|
||||||
|
int nextCodeAddress = last.codeAddress + instruction.getCodeUnits();
|
||||||
|
instructionList.add(new MethodLocation(null, nextCodeAddress, instructionList.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeInstruction(int index) {
|
||||||
|
if (index >= instructionList.size() - 1) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
|
}
|
||||||
|
|
||||||
|
MethodLocation toRemove = instructionList.get(index);
|
||||||
|
toRemove.instruction = null;
|
||||||
|
MethodLocation next = instructionList.get(index+1);
|
||||||
|
toRemove.mergeInto(next);
|
||||||
|
|
||||||
|
instructionList.remove(index);
|
||||||
|
int codeAddress = toRemove.codeAddress;
|
||||||
|
for (int i=index; i<instructionList.size(); i++) {
|
||||||
|
MethodLocation location = instructionList.get(index);
|
||||||
|
location.index = i;
|
||||||
|
location.codeAddress = codeAddress;
|
||||||
|
|
||||||
|
Instruction instruction = location.getInstruction();
|
||||||
|
if (instruction != null) {
|
||||||
|
codeAddress += instruction.getCodeUnits();
|
||||||
|
} else {
|
||||||
|
assert i == instructionList.size() - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void swapInstructions(int index1, int index2) {
|
||||||
|
if (index1 >= instructionList.size() - 1 || index2 >= instructionList.size() - 1) {
|
||||||
|
throw new IndexOutOfBoundsException();
|
||||||
|
}
|
||||||
|
MethodLocation first = instructionList.get(index1);
|
||||||
|
MethodLocation second = instructionList.get(index2);
|
||||||
|
|
||||||
|
// only the last MethodLocation may have a null instruction
|
||||||
|
assert first.instruction != null;
|
||||||
|
assert second.instruction != null;
|
||||||
|
|
||||||
|
first.instruction.location = second;
|
||||||
|
second.instruction.location = first;
|
||||||
|
|
||||||
|
{
|
||||||
|
BuilderInstruction tmp = second.instruction;
|
||||||
|
second.instruction = first.instruction;
|
||||||
|
first.instruction = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index2 < index1) {
|
||||||
|
int tmp = index2;
|
||||||
|
index2 = index1;
|
||||||
|
index1 = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
int codeAddress = first.codeAddress + first.instruction.getCodeUnits();
|
||||||
|
for (int i=index1+1; i<=index2; i++) {
|
||||||
|
MethodLocation location = instructionList.get(i);
|
||||||
|
location.codeAddress = codeAddress;
|
||||||
|
|
||||||
|
Instruction instruction = location.instruction;
|
||||||
|
assert instruction != null;
|
||||||
|
codeAddress += location.instruction.getCodeUnits();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,11 @@ package org.jf.dexlib2.builder;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class SwitchLabelElement {
|
public class SwitchLabelElement {
|
||||||
public SwitchLabelElement(int key, @Nonnull Label dest) {
|
public final int key;
|
||||||
|
@Nonnull public final Label target;
|
||||||
|
|
||||||
|
public SwitchLabelElement(int key, @Nonnull Label target) {
|
||||||
|
this.key = key;
|
||||||
|
this.target = target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.google.common.collect.ImmutableList;
|
||||||
|
import org.jf.dexlib2.Format;
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.builder.BuilderInstruction;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.ArrayPayload;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BuilderArrayPayload extends BuilderInstruction implements ArrayPayload {
|
||||||
|
public static final Opcode OPCODE = Opcode.ARRAY_PAYLOAD;
|
||||||
|
|
||||||
|
protected final int elementWidth;
|
||||||
|
@Nonnull protected final List<Number> arrayElements;
|
||||||
|
|
||||||
|
public BuilderArrayPayload(int elementWidth,
|
||||||
|
@Nullable List<Number> arrayElements) {
|
||||||
|
super(OPCODE);
|
||||||
|
this.elementWidth = elementWidth;
|
||||||
|
this.arrayElements = arrayElements==null?ImmutableList.<Number>of():arrayElements;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getElementWidth() { return elementWidth; }
|
||||||
|
@Nonnull @Override public List<Number> getArrayElements() { return arrayElements; }
|
||||||
|
|
||||||
|
@Override public int getCodeUnits() { return 4 + (elementWidth * arrayElements.size() + 1) / 2; }
|
||||||
|
@Override public Format getFormat() { return OPCODE.format; }
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction10t;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction10t extends BuilderOffsetInstruction implements Instruction10t {
|
||||||
|
public static final Format FORMAT = Format.Format10t;
|
||||||
|
|
||||||
|
public BuilderInstruction10t(@Nonnull Opcode opcode,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction10x;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction10x extends BuilderInstruction implements Instruction10x {
|
||||||
|
public static final Format FORMAT = Format.Format10x;
|
||||||
|
|
||||||
|
public BuilderInstruction10x(@Nonnull Opcode opcode) {
|
||||||
|
super(opcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction11n;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction11n extends BuilderInstruction implements Instruction11n {
|
||||||
|
public static final Format FORMAT = Format.Format11n;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction11n(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkNibbleRegister(registerA);
|
||||||
|
this.literal = Preconditions.checkNibbleLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction11x;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction11x extends BuilderInstruction implements Instruction11x {
|
||||||
|
public static final Format FORMAT = Format.Format11x;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
|
||||||
|
public BuilderInstruction11x(@Nonnull Opcode opcode,
|
||||||
|
int registerA) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction12x;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction12x extends BuilderInstruction implements Instruction12x {
|
||||||
|
public static final Format FORMAT = Format.Format12x;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
|
||||||
|
public BuilderInstruction12x(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkNibbleRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkNibbleRegister(registerB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, 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.Instruction20bc;
|
||||||
|
import org.jf.dexlib2.iface.reference.Reference;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction20bc extends BuilderInstruction implements Instruction20bc {
|
||||||
|
public static final Format FORMAT = Format.Format20bc;
|
||||||
|
|
||||||
|
protected final int verificationError;
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction20bc(@Nonnull Opcode opcode,
|
||||||
|
int verificationError,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.verificationError = Preconditions.checkVerificationError(verificationError);
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getVerificationError() { return verificationError; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction20t;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction20t extends BuilderOffsetInstruction implements Instruction20t {
|
||||||
|
public static final Format FORMAT = Format.Format20t;
|
||||||
|
|
||||||
|
public BuilderInstruction20t(@Nonnull Opcode opcode,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction21c;
|
||||||
|
import org.jf.dexlib2.iface.reference.Reference;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction21c extends BuilderInstruction implements Instruction21c {
|
||||||
|
public static final Format FORMAT = Format.Format21c;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction21c(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction21ih;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction21ih extends BuilderInstruction implements Instruction21ih {
|
||||||
|
public static final Format FORMAT = Format.Format21ih;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction21ih(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.literal = Preconditions.checkIntegerHatLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
@Override public short getHatLiteral() { return (short)(literal >>> 16); }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction21lh;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction21lh extends BuilderInstruction implements Instruction21lh {
|
||||||
|
public static final Format FORMAT = Format.Format21lh;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final long literal;
|
||||||
|
|
||||||
|
public BuilderInstruction21lh(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
long literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.literal = Preconditions.checkLongHatLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
@Override public short getHatLiteral() { return (short)(literal >>> 48); }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction21s;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction21s extends BuilderInstruction implements Instruction21s {
|
||||||
|
public static final Format FORMAT = Format.Format21s;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction21s(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.literal = Preconditions.checkShortLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction21t;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction21t extends BuilderOffsetInstruction implements Instruction21t {
|
||||||
|
public static final Format FORMAT = Format.Format21t;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
|
||||||
|
public BuilderInstruction21t(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -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.Instruction22b;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction22b extends BuilderInstruction implements Instruction22b {
|
||||||
|
public static final Format FORMAT = Format.Format22b;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction22b(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkByteRegister(registerB);
|
||||||
|
this.literal = Preconditions.checkByteLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -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.reference.Reference;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction22c extends BuilderInstruction implements Instruction22c {
|
||||||
|
public static final Format FORMAT = Format.Format22c;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction22c(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkNibbleRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkNibbleRegister(registerB);
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -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.Instruction22s;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction22s extends BuilderInstruction implements Instruction22s {
|
||||||
|
public static final Format FORMAT = Format.Format22s;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction22s(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkNibbleRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkNibbleRegister(registerB);
|
||||||
|
this.literal = Preconditions.checkShortLiteral(literal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction22t;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction22t extends BuilderOffsetInstruction implements Instruction22t {
|
||||||
|
public static final Format FORMAT = Format.Format22t;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
|
||||||
|
public BuilderInstruction22t(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
this.registerA = Preconditions.checkNibbleRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkNibbleRegister(registerB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction22x;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction22x extends BuilderInstruction implements Instruction22x {
|
||||||
|
public static final Format FORMAT = Format.Format22x;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
|
||||||
|
public BuilderInstruction22x(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkShortRegister(registerB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction23x;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction23x extends BuilderInstruction implements Instruction23x {
|
||||||
|
public static final Format FORMAT = Format.Format23x;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
protected final int registerC;
|
||||||
|
|
||||||
|
public BuilderInstruction23x(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB,
|
||||||
|
int registerC) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkByteRegister(registerB);
|
||||||
|
this.registerC = Preconditions.checkByteRegister(registerC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
@Override public int getRegisterC() { return registerC; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction30t;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction30t extends BuilderOffsetInstruction implements Instruction30t {
|
||||||
|
public static final Format FORMAT = Format.Format30t;
|
||||||
|
|
||||||
|
public BuilderInstruction30t(@Nonnull Opcode opcode,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction31c;
|
||||||
|
import org.jf.dexlib2.iface.reference.Reference;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction31c extends BuilderInstruction implements Instruction31c {
|
||||||
|
public static final Format FORMAT = Format.Format31c;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction31c(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction31i;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction31i extends BuilderInstruction implements Instruction31i {
|
||||||
|
public static final Format FORMAT = Format.Format31i;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int literal;
|
||||||
|
|
||||||
|
public BuilderInstruction31i(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.literal = literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getNarrowLiteral() { return literal; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.Instruction31t;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction31t extends BuilderOffsetInstruction implements Instruction31t {
|
||||||
|
public static final Format FORMAT = Format.Format31t;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
|
||||||
|
public BuilderInstruction31t(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode, target);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction32x;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction32x extends BuilderInstruction implements Instruction32x {
|
||||||
|
public static final Format FORMAT = Format.Format32x;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final int registerB;
|
||||||
|
|
||||||
|
public BuilderInstruction32x(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
int registerB) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkShortRegister(registerA);
|
||||||
|
this.registerB = Preconditions.checkShortRegister(registerB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public int getRegisterB() { return registerB; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction35c;
|
||||||
|
import org.jf.dexlib2.iface.reference.Reference;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction35c extends BuilderInstruction implements Instruction35c {
|
||||||
|
public static final Format FORMAT = Format.Format35c;
|
||||||
|
|
||||||
|
protected final int registerCount;
|
||||||
|
protected final int registerC;
|
||||||
|
protected final int registerD;
|
||||||
|
protected final int registerE;
|
||||||
|
protected final int registerF;
|
||||||
|
protected final int registerG;
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction35c(@Nonnull Opcode opcode,
|
||||||
|
int registerCount,
|
||||||
|
int registerC,
|
||||||
|
int registerD,
|
||||||
|
int registerE,
|
||||||
|
int registerF,
|
||||||
|
int registerG,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerCount = Preconditions.check35cRegisterCount(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.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* 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.reference.Reference;
|
||||||
|
import org.jf.dexlib2.immutable.reference.ImmutableReferenceFactory;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction3rc extends BuilderInstruction implements Instruction3rc {
|
||||||
|
public static final Format FORMAT = Format.Format3rc;
|
||||||
|
|
||||||
|
protected final int startRegister;
|
||||||
|
protected final int registerCount;
|
||||||
|
|
||||||
|
@Nonnull protected final Reference reference;
|
||||||
|
|
||||||
|
public BuilderInstruction3rc(@Nonnull Opcode opcode,
|
||||||
|
int startRegister,
|
||||||
|
int registerCount,
|
||||||
|
@Nonnull Reference reference) {
|
||||||
|
super(opcode);
|
||||||
|
this.startRegister = Preconditions.checkShortRegister(startRegister);
|
||||||
|
this.registerCount = Preconditions.checkRegisterRangeCount(registerCount);
|
||||||
|
this.reference = ImmutableReferenceFactory.of(opcode.referenceType, reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getStartRegister() { return startRegister; }
|
||||||
|
@Override public int getRegisterCount() { return registerCount; }
|
||||||
|
@Nonnull @Override public Reference getReference() { return reference; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* 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.Instruction51l;
|
||||||
|
import org.jf.dexlib2.util.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderInstruction51l extends BuilderInstruction implements Instruction51l {
|
||||||
|
public static final Format FORMAT = Format.Format51l;
|
||||||
|
|
||||||
|
protected final int registerA;
|
||||||
|
protected final long literal;
|
||||||
|
|
||||||
|
public BuilderInstruction51l(@Nonnull Opcode opcode,
|
||||||
|
int registerA,
|
||||||
|
long literal) {
|
||||||
|
super(opcode);
|
||||||
|
this.registerA = Preconditions.checkByteRegister(registerA);
|
||||||
|
this.literal = literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getRegisterA() { return registerA; }
|
||||||
|
@Override public long getWideLiteral() { return literal; }
|
||||||
|
|
||||||
|
@Override public Format getFormat() { return FORMAT; }
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.jf.dexlib2.builder.instruction;
|
||||||
|
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.builder.BuilderInstruction;
|
||||||
|
import org.jf.dexlib2.builder.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.OffsetInstruction;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public abstract class BuilderOffsetInstruction extends BuilderInstruction implements OffsetInstruction {
|
||||||
|
@Nonnull
|
||||||
|
protected final Label target;
|
||||||
|
|
||||||
|
public BuilderOffsetInstruction(@Nonnull Opcode opcode,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
super(opcode);
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getCodeOffset() {
|
||||||
|
return target.getCodeAddress() - this.getLocation().getCodeAddress();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.jf.dexlib2.Format;
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.builder.BuilderSwitchPayload;
|
||||||
|
import org.jf.dexlib2.builder.Label;
|
||||||
|
import org.jf.dexlib2.builder.MethodLocation;
|
||||||
|
import org.jf.dexlib2.iface.instruction.SwitchElement;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.PackedSwitchPayload;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BuilderPackedSwitchPayload extends BuilderSwitchPayload implements PackedSwitchPayload {
|
||||||
|
public static final Opcode OPCODE = Opcode.PACKED_SWITCH_PAYLOAD;
|
||||||
|
|
||||||
|
@Nonnull protected final List<? extends BuilderSwitchElement> switchElements;
|
||||||
|
|
||||||
|
public BuilderPackedSwitchPayload(final int startKey,
|
||||||
|
@Nullable List<? extends Label> switchElements) {
|
||||||
|
super(OPCODE);
|
||||||
|
if (switchElements == null) {
|
||||||
|
this.switchElements = ImmutableList.of();
|
||||||
|
} else {
|
||||||
|
this.switchElements = Lists.transform(switchElements, new Function<Label, BuilderSwitchElement>() {
|
||||||
|
int key = startKey;
|
||||||
|
@Nullable @Override public BuilderSwitchElement apply(@Nullable Label target) {
|
||||||
|
assert target != null;
|
||||||
|
return new BuilderSwitchElement(BuilderPackedSwitchPayload.this, key++, target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull @Override public List<? extends SwitchElement> getSwitchElements() { return switchElements; }
|
||||||
|
|
||||||
|
@Override public int getCodeUnits() { return 4 + switchElements.size() * 2; }
|
||||||
|
@Override public Format getFormat() { return OPCODE.format; }
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* 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 com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.jf.dexlib2.Format;
|
||||||
|
import org.jf.dexlib2.Opcode;
|
||||||
|
import org.jf.dexlib2.builder.BuilderSwitchPayload;
|
||||||
|
import org.jf.dexlib2.builder.SwitchLabelElement;
|
||||||
|
import org.jf.dexlib2.iface.instruction.SwitchElement;
|
||||||
|
import org.jf.dexlib2.iface.instruction.formats.SparseSwitchPayload;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BuilderSparseSwitchPayload extends BuilderSwitchPayload implements SparseSwitchPayload {
|
||||||
|
public static final Opcode OPCODE = Opcode.SPARSE_SWITCH_PAYLOAD;
|
||||||
|
|
||||||
|
@Nonnull protected final List<? extends BuilderSwitchElement> switchElements;
|
||||||
|
|
||||||
|
public BuilderSparseSwitchPayload(@Nullable List<? extends SwitchLabelElement> switchElements) {
|
||||||
|
super(OPCODE);
|
||||||
|
if (switchElements == null) {
|
||||||
|
this.switchElements = ImmutableList.of();
|
||||||
|
} else {
|
||||||
|
this.switchElements = Lists.transform(switchElements, new Function<SwitchLabelElement, BuilderSwitchElement>() {
|
||||||
|
@Nullable @Override public BuilderSwitchElement apply(@Nullable SwitchLabelElement element) {
|
||||||
|
assert element != null;
|
||||||
|
return new BuilderSwitchElement(BuilderSparseSwitchPayload.this, element.key, element.target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull @Override public List<? extends SwitchElement> getSwitchElements() { return switchElements; }
|
||||||
|
|
||||||
|
@Override public int getCodeUnits() { return 2 + switchElements.size() * 4; }
|
||||||
|
@Override public Format getFormat() { return OPCODE.format; }
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package org.jf.dexlib2.builder.instruction;
|
||||||
|
|
||||||
|
import org.jf.dexlib2.builder.BuilderSwitchPayload;
|
||||||
|
import org.jf.dexlib2.builder.Label;
|
||||||
|
import org.jf.dexlib2.iface.instruction.SwitchElement;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class BuilderSwitchElement implements SwitchElement {
|
||||||
|
@Nonnull BuilderSwitchPayload parent;
|
||||||
|
private final int key;
|
||||||
|
@Nonnull private final Label target;
|
||||||
|
|
||||||
|
public BuilderSwitchElement(@Nonnull BuilderSwitchPayload parent,
|
||||||
|
int key,
|
||||||
|
@Nonnull Label target) {
|
||||||
|
this.parent = parent;
|
||||||
|
this.key = key;
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public int getOffset() {
|
||||||
|
return parent.getReferrer().getCodeAddress() - target.getCodeAddress();
|
||||||
|
}
|
||||||
|
}
|
@ -46,9 +46,10 @@ import org.antlr.runtime.tree.TreeNodeStream;
|
|||||||
import org.antlr.runtime.tree.TreeParser;
|
import org.antlr.runtime.tree.TreeParser;
|
||||||
import org.antlr.runtime.tree.TreeRuleReturnScope;
|
import org.antlr.runtime.tree.TreeRuleReturnScope;
|
||||||
import org.jf.dexlib2.*;
|
import org.jf.dexlib2.*;
|
||||||
import org.jf.dexlib2.builder.LabelRef;
|
import org.jf.dexlib2.builder.Label;
|
||||||
import org.jf.dexlib2.builder.MethodImplementationBuilder;
|
import org.jf.dexlib2.builder.MethodImplementationBuilder;
|
||||||
import org.jf.dexlib2.builder.SwitchLabelElement;
|
import org.jf.dexlib2.builder.SwitchLabelElement;
|
||||||
|
import org.jf.dexlib2.builder.instruction.*;
|
||||||
import org.jf.dexlib2.iface.Annotation;
|
import org.jf.dexlib2.iface.Annotation;
|
||||||
import org.jf.dexlib2.iface.AnnotationElement;
|
import org.jf.dexlib2.iface.AnnotationElement;
|
||||||
import org.jf.dexlib2.iface.ClassDef;
|
import org.jf.dexlib2.iface.ClassDef;
|
||||||
@ -326,7 +327,7 @@ array_elements returns[List<Number> elements]
|
|||||||
$elements.add($fixed_64bit_literal_number.value);
|
$elements.add($fixed_64bit_literal_number.value);
|
||||||
})*);
|
})*);
|
||||||
|
|
||||||
packed_switch_elements returns[List<LabelRef> elements]
|
packed_switch_elements returns[List<Label> elements]
|
||||||
@init {$elements = Lists.newArrayList();}
|
@init {$elements = Lists.newArrayList();}
|
||||||
:
|
:
|
||||||
^(I_PACKED_SWITCH_ELEMENTS
|
^(I_PACKED_SWITCH_ELEMENTS
|
||||||
@ -536,7 +537,7 @@ catch_directive
|
|||||||
catchall_directive
|
catchall_directive
|
||||||
: ^(I_CATCHALL from=label_ref to=label_ref using=label_ref)
|
: ^(I_CATCHALL from=label_ref to=label_ref using=label_ref)
|
||||||
{
|
{
|
||||||
$method::methodBuilder.addCatch(null, $from.label, $to.label, $using.label);
|
$method::methodBuilder.addCatch($from.label, $to.label, $using.label);
|
||||||
};
|
};
|
||||||
|
|
||||||
parameters[List<SmaliMethodParameter> parameters]
|
parameters[List<SmaliMethodParameter> parameters]
|
||||||
@ -636,7 +637,7 @@ source
|
|||||||
ordered_method_items
|
ordered_method_items
|
||||||
: ^(I_ORDERED_METHOD_ITEMS (label_def | instruction | debug_directive)*);
|
: ^(I_ORDERED_METHOD_ITEMS (label_def | instruction | debug_directive)*);
|
||||||
|
|
||||||
label_ref returns[LabelRef label]
|
label_ref returns[Label label]
|
||||||
: SIMPLE_NAME { $label = $method::methodBuilder.getLabel($SIMPLE_NAME.text); };
|
: SIMPLE_NAME { $label = $method::methodBuilder.getLabel($SIMPLE_NAME.text); };
|
||||||
|
|
||||||
register_list returns[byte[\] registers, byte registerCount]
|
register_list returns[byte[\] registers, byte registerCount]
|
||||||
@ -741,7 +742,7 @@ insn_format10t
|
|||||||
^(I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref)
|
^(I_STATEMENT_FORMAT10t INSTRUCTION_FORMAT10t label_ref)
|
||||||
{
|
{
|
||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT10t.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT10t.text);
|
||||||
$method::methodBuilder.addInstruction10t(opcode, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction10t(opcode, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format10x
|
insn_format10x
|
||||||
@ -749,7 +750,7 @@ insn_format10x
|
|||||||
^(I_STATEMENT_FORMAT10x INSTRUCTION_FORMAT10x)
|
^(I_STATEMENT_FORMAT10x INSTRUCTION_FORMAT10x)
|
||||||
{
|
{
|
||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT10x.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT10x.text);
|
||||||
$method::methodBuilder.addInstruction10x(opcode);
|
$method::methodBuilder.addInstruction(new BuilderInstruction10x(opcode));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format11n
|
insn_format11n
|
||||||
@ -762,7 +763,7 @@ insn_format11n
|
|||||||
short litB = $short_integral_literal.value;
|
short litB = $short_integral_literal.value;
|
||||||
LiteralTools.checkNibble(litB);
|
LiteralTools.checkNibble(litB);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction11n(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction11n(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format11x
|
insn_format11x
|
||||||
@ -772,7 +773,7 @@ insn_format11x
|
|||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT11x.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT11x.text);
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction11x(opcode, regA);
|
$method::methodBuilder.addInstruction(new BuilderInstruction11x(opcode, regA));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format12x
|
insn_format12x
|
||||||
@ -783,7 +784,7 @@ insn_format12x
|
|||||||
byte regA = parseRegister_nibble($registerA.text);
|
byte regA = parseRegister_nibble($registerA.text);
|
||||||
byte regB = parseRegister_nibble($registerB.text);
|
byte regB = parseRegister_nibble($registerB.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction12x(opcode, regA, regB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction12x(opcode, regA, regB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format20bc
|
insn_format20bc
|
||||||
@ -795,8 +796,8 @@ insn_format20bc
|
|||||||
int verificationError = $verification_error_type.verificationError;
|
int verificationError = $verification_error_type.verificationError;
|
||||||
ImmutableReference referencedItem = $verification_error_reference.reference;
|
ImmutableReference referencedItem = $verification_error_reference.reference;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction20bc(opcode, verificationError,
|
$method::methodBuilder.addInstruction(new BuilderInstruction20bc(opcode, verificationError,
|
||||||
dexBuilder.internReference(referencedItem));
|
dexBuilder.internReference(referencedItem)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format20t
|
insn_format20t
|
||||||
@ -804,7 +805,7 @@ insn_format20t
|
|||||||
^(I_STATEMENT_FORMAT20t INSTRUCTION_FORMAT20t label_ref)
|
^(I_STATEMENT_FORMAT20t INSTRUCTION_FORMAT20t label_ref)
|
||||||
{
|
{
|
||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT20t.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT20t.text);
|
||||||
$method::methodBuilder.addInstruction20t(opcode, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction20t(opcode, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21c_field
|
insn_format21c_field
|
||||||
@ -816,8 +817,8 @@ insn_format21c_field
|
|||||||
|
|
||||||
ImmutableFieldReference fieldReference = $fully_qualified_field.fieldReference;
|
ImmutableFieldReference fieldReference = $fully_qualified_field.fieldReference;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21c(opcode, regA,
|
$method::methodBuilder.addInstruction(new BuilderInstruction21c(opcode, regA,
|
||||||
dexBuilder.internFieldReference(fieldReference));
|
dexBuilder.internFieldReference(fieldReference)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21c_string
|
insn_format21c_string
|
||||||
@ -827,8 +828,8 @@ insn_format21c_string
|
|||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21c_STRING.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21c_STRING.text);
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21c(opcode, regA,
|
$method::methodBuilder.addInstruction(new BuilderInstruction21c(opcode, regA,
|
||||||
dexBuilder.internStringReference($string_literal.value));
|
dexBuilder.internStringReference($string_literal.value)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21c_type
|
insn_format21c_type
|
||||||
@ -838,8 +839,8 @@ insn_format21c_type
|
|||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21c_TYPE.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21c_TYPE.text);
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21c(opcode, regA,
|
$method::methodBuilder.addInstruction(new BuilderInstruction21c(opcode, regA,
|
||||||
dexBuilder.internTypeReference($reference_type_descriptor.type));
|
dexBuilder.internTypeReference($reference_type_descriptor.type)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21ih
|
insn_format21ih
|
||||||
@ -851,7 +852,7 @@ insn_format21ih
|
|||||||
|
|
||||||
int litB = $fixed_32bit_literal.value;
|
int litB = $fixed_32bit_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21ih(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction21ih(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21lh
|
insn_format21lh
|
||||||
@ -863,7 +864,7 @@ insn_format21lh
|
|||||||
|
|
||||||
long litB = $fixed_64bit_literal.value;
|
long litB = $fixed_64bit_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21lh(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction21lh(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21s
|
insn_format21s
|
||||||
@ -875,7 +876,7 @@ insn_format21s
|
|||||||
|
|
||||||
short litB = $short_integral_literal.value;
|
short litB = $short_integral_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21s(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction21s(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format21t
|
insn_format21t
|
||||||
@ -885,7 +886,7 @@ insn_format21t
|
|||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21t.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT21t.text);
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction21t(opcode, regA, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction21t(opcode, regA, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22b
|
insn_format22b
|
||||||
@ -899,7 +900,7 @@ insn_format22b
|
|||||||
short litC = $short_integral_literal.value;
|
short litC = $short_integral_literal.value;
|
||||||
LiteralTools.checkByte(litC);
|
LiteralTools.checkByte(litC);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22b(opcode, regA, regB, litC);
|
$method::methodBuilder.addInstruction(new BuilderInstruction22b(opcode, regA, regB, litC));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22c_field
|
insn_format22c_field
|
||||||
@ -912,8 +913,8 @@ insn_format22c_field
|
|||||||
|
|
||||||
ImmutableFieldReference fieldReference = $fully_qualified_field.fieldReference;
|
ImmutableFieldReference fieldReference = $fully_qualified_field.fieldReference;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22c(opcode, regA, regB,
|
$method::methodBuilder.addInstruction(new BuilderInstruction22c(opcode, regA, regB,
|
||||||
dexBuilder.internFieldReference(fieldReference));
|
dexBuilder.internFieldReference(fieldReference)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22c_type
|
insn_format22c_type
|
||||||
@ -924,8 +925,8 @@ insn_format22c_type
|
|||||||
byte regA = parseRegister_nibble($registerA.text);
|
byte regA = parseRegister_nibble($registerA.text);
|
||||||
byte regB = parseRegister_nibble($registerB.text);
|
byte regB = parseRegister_nibble($registerB.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22c(opcode, regA, regB,
|
$method::methodBuilder.addInstruction(new BuilderInstruction22c(opcode, regA, regB,
|
||||||
dexBuilder.internTypeReference($nonvoid_type_descriptor.type));
|
dexBuilder.internTypeReference($nonvoid_type_descriptor.type)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22s
|
insn_format22s
|
||||||
@ -938,7 +939,7 @@ insn_format22s
|
|||||||
|
|
||||||
short litC = $short_integral_literal.value;
|
short litC = $short_integral_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22s(opcode, regA, regB, litC);
|
$method::methodBuilder.addInstruction(new BuilderInstruction22s(opcode, regA, regB, litC));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22t
|
insn_format22t
|
||||||
@ -949,7 +950,7 @@ insn_format22t
|
|||||||
byte regA = parseRegister_nibble($registerA.text);
|
byte regA = parseRegister_nibble($registerA.text);
|
||||||
byte regB = parseRegister_nibble($registerB.text);
|
byte regB = parseRegister_nibble($registerB.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22t(opcode, regA, regB, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction22t(opcode, regA, regB, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format22x
|
insn_format22x
|
||||||
@ -960,7 +961,7 @@ insn_format22x
|
|||||||
short regA = parseRegister_byte($registerA.text);
|
short regA = parseRegister_byte($registerA.text);
|
||||||
int regB = parseRegister_short($registerB.text);
|
int regB = parseRegister_short($registerB.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction22x(opcode, regA, regB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction22x(opcode, regA, regB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format23x
|
insn_format23x
|
||||||
@ -972,7 +973,7 @@ insn_format23x
|
|||||||
short regB = parseRegister_byte($registerB.text);
|
short regB = parseRegister_byte($registerB.text);
|
||||||
short regC = parseRegister_byte($registerC.text);
|
short regC = parseRegister_byte($registerC.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction23x(opcode, regA, regB, regC);
|
$method::methodBuilder.addInstruction(new BuilderInstruction23x(opcode, regA, regB, regC));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format30t
|
insn_format30t
|
||||||
@ -981,7 +982,7 @@ insn_format30t
|
|||||||
{
|
{
|
||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT30t.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT30t.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction30t(opcode, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction30t(opcode, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format31c
|
insn_format31c
|
||||||
@ -991,8 +992,8 @@ insn_format31c
|
|||||||
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT31c.text);
|
Opcode opcode = opcodes.getOpcodeByName($INSTRUCTION_FORMAT31c.text);
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction31c(opcode, regA,
|
$method::methodBuilder.addInstruction(new BuilderInstruction31c(opcode, regA,
|
||||||
dexBuilder.internStringReference($string_literal.value));
|
dexBuilder.internStringReference($string_literal.value)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format31i
|
insn_format31i
|
||||||
@ -1004,7 +1005,7 @@ insn_format31i
|
|||||||
|
|
||||||
int litB = $fixed_32bit_literal.value;
|
int litB = $fixed_32bit_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction31i(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction31i(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format31t
|
insn_format31t
|
||||||
@ -1015,7 +1016,7 @@ insn_format31t
|
|||||||
|
|
||||||
short regA = parseRegister_byte($REGISTER.text);
|
short regA = parseRegister_byte($REGISTER.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction31t(opcode, regA, $label_ref.label);
|
$method::methodBuilder.addInstruction(new BuilderInstruction31t(opcode, regA, $label_ref.label));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format32x
|
insn_format32x
|
||||||
@ -1026,7 +1027,7 @@ insn_format32x
|
|||||||
int regA = parseRegister_short($registerA.text);
|
int regA = parseRegister_short($registerA.text);
|
||||||
int regB = parseRegister_short($registerB.text);
|
int regB = parseRegister_short($registerB.text);
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction32x(opcode, regA, regB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction32x(opcode, regA, regB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format35c_method
|
insn_format35c_method
|
||||||
@ -1041,8 +1042,8 @@ insn_format35c_method
|
|||||||
|
|
||||||
ImmutableMethodReference methodReference = $fully_qualified_method.methodReference;
|
ImmutableMethodReference methodReference = $fully_qualified_method.methodReference;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction35c(opcode, registerCount, registers[0], registers[1],
|
$method::methodBuilder.addInstruction(new BuilderInstruction35c(opcode, registerCount, registers[0], registers[1],
|
||||||
registers[2], registers[3], registers[4], dexBuilder.internMethodReference(methodReference));
|
registers[2], registers[3], registers[4], dexBuilder.internMethodReference(methodReference)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format35c_type
|
insn_format35c_type
|
||||||
@ -1055,8 +1056,8 @@ insn_format35c_type
|
|||||||
byte[] registers = $register_list.registers;
|
byte[] registers = $register_list.registers;
|
||||||
byte registerCount = $register_list.registerCount;
|
byte registerCount = $register_list.registerCount;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction35c(opcode, registerCount, registers[0], registers[1],
|
$method::methodBuilder.addInstruction(new BuilderInstruction35c(opcode, registerCount, registers[0], registers[1],
|
||||||
registers[2], registers[3], registers[4], dexBuilder.internTypeReference($nonvoid_type_descriptor.type));
|
registers[2], registers[3], registers[4], dexBuilder.internTypeReference($nonvoid_type_descriptor.type)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format3rc_method
|
insn_format3rc_method
|
||||||
@ -1071,8 +1072,8 @@ insn_format3rc_method
|
|||||||
|
|
||||||
ImmutableMethodReference methodReference = $fully_qualified_method.methodReference;
|
ImmutableMethodReference methodReference = $fully_qualified_method.methodReference;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction3rc(opcode, startRegister, registerCount,
|
$method::methodBuilder.addInstruction(new BuilderInstruction3rc(opcode, startRegister, registerCount,
|
||||||
dexBuilder.internMethodReference(methodReference));
|
dexBuilder.internMethodReference(methodReference)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format3rc_type
|
insn_format3rc_type
|
||||||
@ -1085,8 +1086,8 @@ insn_format3rc_type
|
|||||||
|
|
||||||
int registerCount = endRegister-startRegister+1;
|
int registerCount = endRegister-startRegister+1;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction3rc(opcode, startRegister, registerCount,
|
$method::methodBuilder.addInstruction(new BuilderInstruction3rc(opcode, startRegister, registerCount,
|
||||||
dexBuilder.internTypeReference($nonvoid_type_descriptor.type));
|
dexBuilder.internTypeReference($nonvoid_type_descriptor.type)));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_format51l_type
|
insn_format51l_type
|
||||||
@ -1098,7 +1099,7 @@ insn_format51l_type
|
|||||||
|
|
||||||
long litB = $fixed_64bit_literal.value;
|
long litB = $fixed_64bit_literal.value;
|
||||||
|
|
||||||
$method::methodBuilder.addInstruction51l(opcode, regA, litB);
|
$method::methodBuilder.addInstruction(new BuilderInstruction51l(opcode, regA, litB));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_array_data_directive
|
insn_array_data_directive
|
||||||
@ -1108,7 +1109,7 @@ insn_array_data_directive
|
|||||||
int elementWidth = $short_integral_literal.value;
|
int elementWidth = $short_integral_literal.value;
|
||||||
List<Number> elements = $array_elements.elements;
|
List<Number> elements = $array_elements.elements;
|
||||||
|
|
||||||
$method::methodBuilder.addArrayPayload(elementWidth, $array_elements.elements);
|
$method::methodBuilder.addInstruction(new BuilderArrayPayload(elementWidth, $array_elements.elements));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_packed_switch_directive
|
insn_packed_switch_directive
|
||||||
@ -1116,14 +1117,15 @@ insn_packed_switch_directive
|
|||||||
^(I_STATEMENT_PACKED_SWITCH ^(I_PACKED_SWITCH_START_KEY fixed_32bit_literal) packed_switch_elements)
|
^(I_STATEMENT_PACKED_SWITCH ^(I_PACKED_SWITCH_START_KEY fixed_32bit_literal) packed_switch_elements)
|
||||||
{
|
{
|
||||||
int startKey = $fixed_32bit_literal.value;
|
int startKey = $fixed_32bit_literal.value;
|
||||||
$method::methodBuilder.addPackedSwitchPayload(startKey, $packed_switch_elements.elements);
|
$method::methodBuilder.addInstruction(new BuilderPackedSwitchPayload(startKey,
|
||||||
|
$packed_switch_elements.elements));
|
||||||
};
|
};
|
||||||
|
|
||||||
insn_sparse_switch_directive
|
insn_sparse_switch_directive
|
||||||
:
|
:
|
||||||
^(I_STATEMENT_SPARSE_SWITCH sparse_switch_elements)
|
^(I_STATEMENT_SPARSE_SWITCH sparse_switch_elements)
|
||||||
{
|
{
|
||||||
$method::methodBuilder.addSparseSwitchPayload($sparse_switch_elements.elements);
|
$method::methodBuilder.addInstruction(new BuilderSparseSwitchPayload($sparse_switch_elements.elements));
|
||||||
};
|
};
|
||||||
|
|
||||||
nonvoid_type_descriptor returns [String type]
|
nonvoid_type_descriptor returns [String type]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user