Add newParameterValue() implementation to IntInterpreter

bzip2
Graham 5 years ago
parent fc95d5086c
commit 55646c8384
  1. 32
      deob/src/main/java/dev/openrs2/deob/analysis/IntInterpreter.java

@ -16,8 +16,11 @@ import org.objectweb.asm.tree.analysis.Interpreter;
public final class IntInterpreter extends Interpreter<IntValue> {
private final Interpreter<BasicValue> basicInterpreter = new BasicInterpreter();
public IntInterpreter() {
private final Integer[] parameters;
public IntInterpreter(Integer[] parameters) {
super(Opcodes.ASM7);
this.parameters = parameters;
}
@Override
@ -30,6 +33,33 @@ public final class IntInterpreter extends Interpreter<IntValue> {
return IntValue.newUnknown(basicValue);
}
@Override
public IntValue newParameterValue(boolean isInstanceMethod, int local, Type type) {
var basicValue = basicInterpreter.newParameterValue(isInstanceMethod, local, type);
if (basicValue == null) {
return null;
}
if (parameters != null) {
int parameterIndex;
if (isInstanceMethod) {
if (local == 0) {
return IntValue.newUnknown(basicValue);
}
parameterIndex = local - 1;
} else {
parameterIndex = local;
}
var parameter = parameters[parameterIndex];
if (parameter != null) {
return IntValue.newConstant(basicValue, parameter);
}
}
return IntValue.newUnknown(basicValue);
}
@Override
public IntValue newOperation(AbstractInsnNode insn) throws AnalyzerException {
var basicValue = basicInterpreter.newOperation(insn);

Loading…
Cancel
Save