Array stuff needs more thinking.
This commit is contained in:
@@ -21,6 +21,7 @@ public class ClassGroup
|
||||
|
||||
public ClassFile findClass(String name)
|
||||
{
|
||||
// XXX handle arrays
|
||||
for (ClassFile c : classes)
|
||||
if (c.getName().equals(name))
|
||||
return c;
|
||||
|
||||
@@ -48,20 +48,4 @@ public class Code extends Attribute
|
||||
{
|
||||
instructions.buildInstructionGraph();
|
||||
}
|
||||
|
||||
/*
|
||||
public void execute(Frame frame)
|
||||
{
|
||||
int pc = 0;
|
||||
|
||||
while (exeuting)
|
||||
{
|
||||
Instruction i = instructions.findInstruction(pc);
|
||||
i.execute(frame);
|
||||
}
|
||||
}
|
||||
|
||||
public void jump(int offset)
|
||||
{
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
import info.sigterm.deob.execution.Stack;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -21,5 +25,20 @@ public class MultiANewArray extends Instruction
|
||||
dimensions = is.readUnsignedByte();
|
||||
length += 3;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(Frame e)
|
||||
{
|
||||
Stack stack = e.getStack();
|
||||
|
||||
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||
Class clazz = (Class) thisClass.getPool().getEntry(index);
|
||||
|
||||
// XXX primive type/array type ? [[I [[Lmyclass; etc
|
||||
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
|
||||
|
||||
int[] dims = new int[dimensions];
|
||||
for (int i = 0; i < dimensions; ++i)
|
||||
dims[i] = (int) stack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package info.sigterm.deob.attributes.code.instructions;
|
||||
|
||||
import info.sigterm.deob.ClassFile;
|
||||
import info.sigterm.deob.attributes.code.Instruction;
|
||||
import info.sigterm.deob.attributes.code.InstructionType;
|
||||
import info.sigterm.deob.attributes.code.Instructions;
|
||||
import info.sigterm.deob.execution.ClassInstance;
|
||||
import info.sigterm.deob.execution.Frame;
|
||||
import info.sigterm.deob.execution.ObjectInstance;
|
||||
import info.sigterm.deob.pool.Class;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -20,4 +25,20 @@ public class New extends Instruction
|
||||
length += 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Frame e)
|
||||
{
|
||||
ClassFile thisClass = this.getInstructions().getCode().getAttributes().getClassFile();
|
||||
Class clazz = (Class) thisClass.getPool().getEntry(index);
|
||||
ClassFile cf = thisClass.getGroup().findClass(clazz.getName());
|
||||
if (cf == null)
|
||||
{
|
||||
e.getStack().push(null);
|
||||
return;
|
||||
}
|
||||
|
||||
ClassInstance type = e.getPath().getClassInstance(cf);
|
||||
ObjectInstance obj = e.getPath().createObject(type);
|
||||
e.getStack().push(obj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user