Use IdentityHashMap to store original instruction indexes

I think it is better to be explicit here, instead of relying on ASM's
current lack of equals()/hashCode() methods in the AbstractInsnNode
class.

Signed-off-by: Graham <gpe@openrs2.dev>
bzip2
Graham 4 years ago
parent c57f0927ba
commit 7811bc70f4
  1. 3
      asm/src/main/java/dev/openrs2/asm/classpath/ClassPath.kt

@ -8,6 +8,7 @@ import dev.openrs2.util.collect.ForestDisjointSet
import org.objectweb.asm.Opcodes import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.AbstractInsnNode import org.objectweb.asm.tree.AbstractInsnNode
import org.objectweb.asm.tree.ClassNode import org.objectweb.asm.tree.ClassNode
import java.util.IdentityHashMap
class ClassPath( class ClassPath(
private val runtime: ClassLoader, private val runtime: ClassLoader,
@ -25,7 +26,7 @@ class ClassPath(
* Transformers to avoid adding extraneous labels until the last possible * Transformers to avoid adding extraneous labels until the last possible
* moment, which would confuse some of our analyses if added earlier. * moment, which would confuse some of our analyses if added earlier.
*/ */
val originalPcs = mutableMapOf<AbstractInsnNode, Int>() val originalPcs = IdentityHashMap<AbstractInsnNode, Int>()
val libraryClasses: Sequence<ClassMetadata> val libraryClasses: Sequence<ClassMetadata>
get() = libraries.asSequence().flatten().map { get(it.name)!! } get() = libraries.asSequence().flatten().map { get(it.name)!! }

Loading…
Cancel
Save