Skip to content

Commit

Permalink
Fixed ASM frame calculations; fixing forEach removal
Browse files Browse the repository at this point in the history
  • Loading branch information
gudenau committed Aug 21, 2020
1 parent 0c6b7d4 commit e0c7aac
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.9.1+build.205

# Mod Properties
mod_version = 0.0.2
mod_version = 0.0.3
maven_group = net.gudenau.minecraft
archives_base_name = gud_fps

Expand Down
Empty file added logs/latest.log
Empty file.
3 changes: 2 additions & 1 deletion src/main/java/net/gudenau/minecraft/fps/GudFPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void onInitialize(){
}catch(IOException | URISyntaxException ignored){
System.err.println("Failed to force load classes");
}
System.exit(0);
}
}

Expand Down Expand Up @@ -135,7 +136,7 @@ private static Config loadConfig(){
}

public static final class Config{
public final Option<Boolean> removeForEach = new BooleanOption("removeForEach", false);
public final Option<Boolean> removeForEach = new BooleanOption("removeForEach", true);
public final Option<Boolean> removeBlockPos = new BooleanOption("removeBlockPos", true);
public final Option<Boolean> precomputeConstants = new BooleanOption("precomputeConstants", true);
public final Option<Boolean> optimizeMath = new BooleanOption("optimizeMath", true);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/gudenau/minecraft/fps/mixin/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class Plugin implements IMixinConfigPlugin{
}

ClassLoader classLoader = Plugin.class.getClassLoader();
Transformers.setClassLoader(classLoader);

try{
// Get all of the non-public classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.gudenau.minecraft.fps.transformer;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class Transformers{
private static final boolean verifyClasses = GudFPS.CONFIG.verify.get();
private static final Stats transformerStats = Stats.getStats("Transformer");
private static final Stats dumperStats = Stats.getStats("Dump");
private static ClassLoader classLoader;

static {
GudFPS.Config config = GudFPS.CONFIG;
Expand Down Expand Up @@ -100,7 +101,12 @@ private static byte[] doTransform(String name, String transformedName, byte[] ba
transformerStats.incrementStat(transformer.getClass().getSimpleName());
}

ClassWriter classWriter = new ClassWriter(flags.getFlags());
ClassWriter classWriter = new ClassWriter(flags.getFlags()){
@Override
protected ClassLoader getClassLoader(){
return classLoader;
}
};
classNode.accept(classWriter);
byte[] newClass = classWriter.toByteArray();
if(dumpClasses){
Expand Down Expand Up @@ -160,4 +166,8 @@ private static void dumpClass(ClassNode node, byte[] bytecode){
}
});
}

public static void setClassLoader(ClassLoader classLoader){
Transformers.classLoader = classLoader;
}
}

0 comments on commit e0c7aac

Please sign in to comment.