Skip to content

Commit

Permalink
fix(js): reenable peephole
Browse files Browse the repository at this point in the history
  • Loading branch information
zlataovce committed Aug 20, 2024
1 parent fc29843 commit b40e3a2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = "run.slicer"
version = "1.0.3"
version = "1.0.4"
description = "A Java library for performing bytecode normalization and generic deobfuscation."

repositories {
Expand Down
24 changes: 1 addition & 23 deletions core/src/main/java/run/slicer/poke/AnalyzerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ private void optimize(AppView view) {
}

static final class Builder implements Analyzer.Builder {
private static final boolean PEEPHOLE = Boolean.parseBoolean(
System.getProperty("run.slicer.poke.peephole", "true")
);
private static final boolean EVALUATION = Boolean.parseBoolean(
System.getProperty("run.slicer.poke.evaluation", "true")
);

private int passes = 1;
private boolean verify = false;
private boolean optimize = false;
Expand Down Expand Up @@ -136,27 +129,12 @@ public Analyzer build() {
"method/generalization/*",
"method/specialization/*",
"method/propagation/*",
"code/merging",
"code/removal/*",
"code/allocation/*"
"code/*"
));

if (this.inline) {
optimizations.add("method/inlining/*");
}
if (PEEPHOLE) {
optimizations.add("code/simplification/variable");
optimizations.add("code/simplification/arithmetic");
optimizations.add("code/simplification/cast");
optimizations.add("code/simplification/field");
optimizations.add("code/simplification/branch");
optimizations.add("code/simplification/object");
optimizations.add("code/simplification/string");
optimizations.add("code/simplification/math");
}
if (EVALUATION) {
optimizations.add("code/simplification/advanced");
}
config.optimizations = optimizations;

return new AnalyzerImpl(config);
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ teavm = "0.10.0"
jspecify = { group = "org.jspecify", name = "jspecify", version = "0.3.0" }
picocli = { group = "info.picocli", name = "picocli", version.ref = "picocli" }
picocli-codegen = { group = "info.picocli", name = "picocli-codegen", version.ref = "picocli" }
proguard = { group = "com.github.run-slicer", name = "proguard", version = "1d630e03ef" }
proguard = { group = "com.github.run-slicer", name = "proguard", version = "332d4679b5" }
teavm-core = { group = "org.teavm", name = "teavm-core", version.ref = "teavm" }

[plugins]
Expand Down
3 changes: 0 additions & 3 deletions js/src/main/java/run/slicer/poke/js/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ public class Main {
// the proper fix would be to stop proguard-core from casting threads to its own objects,
// but I really can't be bothered to stub that all out
System.setProperty("parallel.threads", "1");

// FIXME: InstructionSequencesReplacer breaks TeaVM
System.setProperty("run.slicer.poke.peephole", "false");
}

@JSExport
Expand Down

0 comments on commit b40e3a2

Please sign in to comment.