mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Fix support of SWAP instruction
This commit is contained in:
parent
88a1a39301
commit
062f30634c
|
@ -28,10 +28,10 @@ import org.teavm.model.util.ProgramUtils;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public class ProgramParser implements VariableDebugInformation {
|
||||
static final byte ROOT = 0;
|
||||
static final byte SINGLE = 1;
|
||||
static final byte DOUBLE_FIRST_HALF = 2;
|
||||
static final byte DOUBLE_SECOND_HALF = 3;
|
||||
private static final byte ROOT = 0;
|
||||
private static final byte SINGLE = 1;
|
||||
private static final byte DOUBLE_FIRST_HALF = 2;
|
||||
private static final byte DOUBLE_SECOND_HALF = 3;
|
||||
private String fileName;
|
||||
private StackFrame[] stackBefore;
|
||||
private StackFrame[] stackAfter;
|
||||
|
@ -60,17 +60,17 @@ public class ProgramParser implements VariableDebugInformation {
|
|||
}
|
||||
|
||||
private static class StackFrame {
|
||||
public final StackFrame next;
|
||||
public final byte type;
|
||||
public final int depth;
|
||||
final StackFrame next;
|
||||
final byte type;
|
||||
final int depth;
|
||||
|
||||
public StackFrame(int depth) {
|
||||
StackFrame(int depth) {
|
||||
this.next = null;
|
||||
this.type = ROOT;
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
public StackFrame(StackFrame next, byte type) {
|
||||
StackFrame(StackFrame next, byte type) {
|
||||
this.next = next;
|
||||
this.type = type;
|
||||
this.depth = next != null ? next.depth + 1 : 0;
|
||||
|
@ -162,7 +162,7 @@ public class ProgramParser implements VariableDebugInformation {
|
|||
@Override
|
||||
public Map<Integer, String> getDebugNames(Instruction insn) {
|
||||
Map<Integer, String> map = variableDebugNames.get(insn);
|
||||
return map != null ? Collections.unmodifiableMap(map) : Collections.<Integer, String>emptyMap();
|
||||
return map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap();
|
||||
}
|
||||
|
||||
private void prepare(MethodNode method) {
|
||||
|
@ -513,8 +513,8 @@ public class ProgramParser implements VariableDebugInformation {
|
|||
}
|
||||
|
||||
insn.setMethod(new MethodDescriptor(name, MethodDescriptor.parseSignature(desc)));
|
||||
for (int i = 0; i < bsmArgs.length; ++i) {
|
||||
insn.getBootstrapArguments().add(convertConstant(bsmArgs[i]));
|
||||
for (Object bsmArg : bsmArgs) {
|
||||
insn.getBootstrapArguments().add(convertConstant(bsmArg));
|
||||
}
|
||||
|
||||
addInstruction(insn);
|
||||
|
@ -1200,8 +1200,9 @@ public class ProgramParser implements VariableDebugInformation {
|
|||
case Opcodes.SWAP: {
|
||||
int b = popSingle();
|
||||
int a = popSingle();
|
||||
int tmp = pushSingle();
|
||||
pushSingle();
|
||||
pushSingle();
|
||||
int tmp = b + 1;
|
||||
emitAssignInsn(a, tmp);
|
||||
emitAssignInsn(b, a);
|
||||
emitAssignInsn(tmp, b);
|
||||
|
@ -1726,7 +1727,7 @@ public class ProgramParser implements VariableDebugInformation {
|
|||
}
|
||||
};
|
||||
|
||||
static MethodHandle parseHandle(Handle handle) {
|
||||
private static MethodHandle parseHandle(Handle handle) {
|
||||
switch (handle.getTag()) {
|
||||
case Opcodes.H_GETFIELD:
|
||||
return MethodHandle.fieldGetter(handle.getOwner().replace('/', '.'), handle.getName(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user