From 12b10e48ae86a8fe82840247428254aea62e370b Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 23 Feb 2004 12:45:44 +0000 Subject: [PATCH] totally working again darcs-hash:20040223124544-5007d-9ba772cfadc63c6ddf5cae3e5782d251ad6dbaaa.gz --- Makefile | 2 +- src/org/ibex/util/BytecodePruner.java | 164 ++++++++++++++++++++++----------- 2 files changed, 110 insertions(+), 56 deletions(-) diff --git a/Makefile b/Makefile index f64d42f..e8781fe 100644 --- a/Makefile +++ b/Makefile @@ -240,7 +240,7 @@ build/$(platform)/$(target_bin): .compile build/$(platform)/builtin.o build/$(pl java -cp lib/bcel-5.1.jar:build/class org.ibex.util.BytecodePruner \ build/$(platform)/ibex.jar:upstream/install/share/java/libgcj-3.3.jar \ -o build/pruned \ - `cat .natcalls | grep -v ^gcj` org.ibex.plat.Linux.main + `cat .natcalls` # rm -rf build/pruned/org/ibex/js/*; cp build/java/org/ibex/js/* build/pruned/org/ibex/js/ diff --git a/src/org/ibex/util/BytecodePruner.java b/src/org/ibex/util/BytecodePruner.java index 9dbae75..4514cb4 100644 --- a/src/org/ibex/util/BytecodePruner.java +++ b/src/org/ibex/util/BytecodePruner.java @@ -7,13 +7,6 @@ import org.apache.bcel.generic.*; import org.apache.bcel.classfile.*; import org.apache.bcel.util.*; - // SecurityManager hacks to avoid java.security? - // URL and all descendents? Probably impossible. - // ObjectInput/ObjectOutput? Serialization? - - // superprune: URLClassLoader, convert.In/Output other than needed, unneeded locales - // reflective metadata is killing us... - // Reachability rules: // - a constructor is reachable iff it is called @@ -35,8 +28,12 @@ import org.apache.bcel.util.*; public class BytecodePruner { public static final boolean deleteMethods = false; + + // FIXME public static SyntheticRepository repo = null; + public static HashSet dest = new HashSet(); + public static String outdir = "."; public void loadAllMethods(String classname) throws Exception { @@ -44,39 +41,106 @@ public class BytecodePruner { Method[] meths = getMethods(repo.loadClass(classname)); for(int i=0; i= 3 && s[1].equals("-o")) { outdir = s[2]; start += 2; } repo = SyntheticRepository.getInstance(new ClassPath(s[0])); - for(int i=start; i")) good = true; @@ -235,8 +304,7 @@ public class BytecodePruner { dest.add(method); level += 2; for(int i=0; i