Inline JSRs

This is required for some later analyses to work correctly.
master
Graham 5 years ago
parent d5683932c2
commit e3df684f4f
  1. 19
      asm/src/main/java/dev/openrs2/asm/classpath/JsrInliner.kt
  2. 2
      asm/src/main/java/dev/openrs2/asm/classpath/Library.kt

@ -0,0 +1,19 @@
package dev.openrs2.asm.classpath
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.commons.JSRInlinerAdapter
class JsrInliner(cv: ClassVisitor) : ClassVisitor(Opcodes.ASM7, cv) {
override fun visitMethod(
access: Int,
name: String,
descriptor: String,
signature: String?,
exceptions: Array<String>?
): MethodVisitor {
val mv = super.visitMethod(access, name, descriptor, signature, exceptions)
return JSRInlinerAdapter(mv, access, name, descriptor, signature, exceptions)
}
}

@ -159,7 +159,7 @@ class Library constructor() : Iterable<ClassNode> {
val clazz = ClassNode()
val reader = ClassReader(`in`)
reader.accept(clazz, ClassReader.SKIP_DEBUG)
reader.accept(JsrInliner(clazz), ClassReader.SKIP_DEBUG)
library.add(clazz)
}

Loading…
Cancel
Save