use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class ANewArray method lookup.
@Override
public void lookup() {
ClassGroup group = this.getInstructions().getCode().getMethod().getClassFile().getGroup();
myClass = group.findClass(type.getInternalName());
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class MappingExecutorUtil method map.
public static ParallelExecutorMapping map(Method m1, Method m2) {
ClassGroup group1 = m1.getClassFile().getGroup();
ClassGroup group2 = m2.getClassFile().getGroup();
Execution e = new Execution(group1);
e.step = true;
Frame frame = new Frame(e, m1);
frame.initialize();
e.frames.add(frame);
Execution e2 = new Execution(group2);
e2.step = true;
Frame frame2 = new Frame(e2, m2);
frame2.initialize();
e2.frames.add(frame2);
frame.other = frame2;
frame2.other = frame;
ParallellMappingExecutor parallel = new ParallellMappingExecutor(e, e2);
ParallelExecutorMapping mappings = new ParallelExecutorMapping(m1.getClassFile().getGroup(), m2.getClassFile().getGroup());
mappings.m1 = m1;
mappings.m2 = m2;
parallel.mappings = mappings;
int same = 0;
while (parallel.step()) {
// get what each frame is paused/exited on
InstructionContext p1 = parallel.getP1(), p2 = parallel.getP2();
assert p1.getInstruction() instanceof MappableInstruction;
assert p2.getInstruction() instanceof MappableInstruction;
MappableInstruction mi1 = (MappableInstruction) p1.getInstruction(), mi2 = (MappableInstruction) p2.getInstruction();
boolean isSame = mi1.isSame(p1, p2);
assert isSame == mi2.isSame(p2, p1) : "isSame fail " + p1.getInstruction() + " <> " + p2.getInstruction();
if (!isSame) {
mappings.crashed = true;
p1.getFrame().stop();
p2.getFrame().stop();
continue;
}
++same;
mi1.map(mappings, p1, p2);
}
mappings.same = same;
return mappings;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class MappingExecutorUtil method isInlineable.
public static boolean isInlineable(Instruction i) {
if (!(i instanceof InvokeStatic))
return false;
ClassGroup group = i.getInstructions().getCode().getMethod().getClassFile().getGroup();
InvokeStatic is = (InvokeStatic) i;
net.runelite.asm.pool.Method m = is.getMethod();
return group.findClass(m.getClazz().getName()) != null;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class JarUtil method loadJar.
public static ClassGroup loadJar(File jarfile) throws IOException {
ClassGroup group = new ClassGroup();
try (JarFile jar = new JarFile(jarfile)) {
for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements(); ) {
JarEntry entry = it.nextElement();
if (!entry.getName().endsWith(".class")) {
continue;
}
InputStream is = jar.getInputStream(entry);
ClassReader reader = new ClassReader(is);
ClassFileVisitor cv = new ClassFileVisitor();
reader.accept(cv, ClassReader.SKIP_FRAMES);
group.addClass(cv.getClassFile());
}
}
group.initialize();
return group;
}
use of net.runelite.asm.ClassGroup in project runelite by runelite.
the class ExecutionTest method test.
@Test
public void test() throws Exception {
ClassGroup group1 = JarUtil.loadJar(new File(properties.getVanillaClient()));
Execution e = new Execution(group1);
e.populateInitialMethods();
e.run();
}
Aggregations