From a5285306c11a48bdee1eee52c769205d0493e928 Mon Sep 17 00:00:00 2001 From: Graham Date: Fri, 10 Apr 2020 09:08:12 +0100 Subject: [PATCH] Simplify queueEntryPoints() with isMethodRenamable() Signed-off-by: Graham --- .../deob/transform/ConstantArgTransformer.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt b/deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt index 065b2ea2..2d08d3cf 100644 --- a/deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt +++ b/deob/src/main/java/dev/openrs2/deob/transform/ConstantArgTransformer.kt @@ -70,17 +70,23 @@ class ConstantArgTransformer : Transformer() { private fun queueEntryPoints(classPath: ClassPath) { for (partition in inheritedMethodSets) { /* - * The EXCLUDED_METHODS set roughly matches up with the methods we - * want to consider as entry points. It isn't perfect - it counts - * every method as an entry point, but strictly speaking we - * only need to count methods invoked with reflection as - * entry points (like VisibilityTransformer). However, it makes no - * difference in this case, as the deobfuscator does not add dummy - * constant arguments to constructors. + * The set of non-renamable methods roughly matches up with the + * methods we want to consider as entry points. It includes methods + * which we override, which may be called by the standard library), + * the main() method (called by the JVM), providesignlink() (called + * with reflection) and (called by the JVM). + * + * It isn't perfect - it counts every method as an entry + * point, but strictly speaking we only need to count + * methods invoked with reflection as entry points (like + * VisibilityTransformer). However, it makes no difference in this + * case, as the deobfuscator does not add dummy constant arguments + * to constructors. + * + * It also counts native methods as an entry point. This isn't + * problematic as they don't have an InsnList, so we skip them. */ - val excluded = partition.first().name in TypedRemapper.EXCLUDED_METHODS - val overridesDependency = partition.any { classPath[it.owner]!!.dependency } - if (excluded || overridesDependency) { + if (!TypedRemapper.isMethodRenamable(classPath, partition)) { pendingMethods.addAll(partition) } }