Add support for overriding inSets of entry nodes to DataFlowAnalyzer

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 38f731f986
commit 37c672a9bf
  1. 4
      deob/src/main/java/dev/openrs2/deob/analysis/DataFlowAnalyzer.kt

@ -21,6 +21,7 @@ abstract class DataFlowAnalyzer<T>(owner: String, private val method: MethodNode
} }
} }
protected open fun createEntrySet(): T = createInitialSet()
protected abstract fun createInitialSet(): T protected abstract fun createInitialSet(): T
protected abstract fun join(set1: T, set2: T): T protected abstract fun join(set1: T, set2: T): T
protected abstract fun transfer(set: T, insn: AbstractInsnNode): T protected abstract fun transfer(set: T, insn: AbstractInsnNode): T
@ -42,6 +43,7 @@ abstract class DataFlowAnalyzer<T>(owner: String, private val method: MethodNode
} }
fun analyze() { fun analyze() {
val entrySet = createEntrySet()
val initialSet = createInitialSet() val initialSet = createInitialSet()
val workList = LinkedHashSet<Int>() val workList = LinkedHashSet<Int>()
@ -55,7 +57,7 @@ abstract class DataFlowAnalyzer<T>(owner: String, private val method: MethodNode
} }
val inSet = if (predecessors.isEmpty()) { val inSet = if (predecessors.isEmpty()) {
initialSet entrySet
} else { } else {
predecessors.reduce(this::join) predecessors.reduce(this::join)
} }

Loading…
Cancel
Save