gcclass hints (YOU NEED TO UPDATE upstream/build/gcclass)
authorbrian <brian@brianweb.net>
Thu, 1 Jul 2004 08:53:22 +0000 (01:53 -0700)
committerbrian <brian@brianweb.net>
Thu, 1 Jul 2004 08:53:22 +0000 (01:53 -0700)
darcs-hash:20040701085322-24bed-801fc66615d086ab0db61763d35382affdc3e8f4.gz

Makefile
src/org/ibex/nestedvm/ClassFileCompiler.java
src/org/ibex/nestedvm/util/Platform.java
upstream/Makefile

index d0b20c4..3cdb291 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -221,18 +221,16 @@ nestedvm.jar: $(java_classes) .manifest
        cd build && jar cfm ../$@ ../.manifest $(java_classes:build/%.class=%*.class)
        cd $(CLASSGEN_PATH) && jar uf $(mips2java_root)/$@ .
 
-compact_runtime_compiler.jar: $(java_classes) .manifest $(tasks)/build_darcs_gcclass
+.gcclass_hints: $(java_sources)
+       sed -n 's/.*GCCLASS_HINT: \([^ ]*\) \([^ ]*\).*/hint:\1:\2/p' $(java_sources) > $@
+
+compact_runtime_compiler.jar: $(java_classes) .manifest $(tasks)/build_darcs_gcclass .gcclass_hints
        mkdir -p tmp/pruned
        rm -rf tmp/pruned/*
        java -cp \
                upstream/build/gcclass/build:upstream/build/gcclass/upstream/bcel-5.1/bcel-5.1.jar \
        com.brian_web.gcclass.GCClass \
-               "$(classpath)" tmp/pruned \
-               org.ibex.nestedvm.RuntimeCompiler.main 'org.ibex.nestedvm.Runtime.decodeData' \
-               'org.ibex.nestedvm.UnixRuntime.<init>' 'org.ibex.nestedvm.Runtime.initPages' \
-               'org.ibex.nestedvm.Runtime.clearPages' 'org.ibex.nestedvm.Runtime.syscall' \
-               'org.ibex.nestedvm.Runtime$$CPUState.dup' \
-               org.ibex.nestedvm.util.Platform\$$Jdk{11,12,13,14}.'<init>'
+               "$(classpath)" tmp/pruned org.ibex.nestedvm.RuntimeCompiler.main `cat .gcclass_hints`
        cd tmp/pruned && jar cfm ../../$@ ../../.manifest .
 
 sizecheck: compact_runtime_compiler.jar
@@ -399,15 +397,12 @@ ntlmtest: build/tests/NtlmAuth.class
        @test -e smb.conf || cp upstream/build/samba/examples/smb.conf.default smb.conf
        $(JAVA) -cp "$(classpath)" tests.NtlmAuth --username=brian --password=test --diagnostics -d 5
 
-ntlmauth.jar: build/tests/NtlmAuth.class $(tasks)/build_darcs_gcclass
+ntlmauth.jar: build/tests/NtlmAuth.class $(tasks)/build_darcs_gcclass .gcclass_hints
        mkdir -p tmp/pruned
        rm -rf tmp/pruned/*
        java -cp \
                upstream/build/gcclass/build:upstream/build/gcclass/upstream/bcel-5.1/bcel-5.1.jar \
-       com.brian_web.gcclass.GCClass \
-               "$(classpath)" tmp/pruned \
-               tests.NtlmAuth.main \
-               $(patsubst %,org.ibex.nestedvm.util.Platform\$$Jdk%.'<init>', 11 12 13 14)
+               com.brian_web.gcclass.GCClass "$(classpath)" tmp/pruned tests.NtlmAuth.main `cat .gcclass_hints`
        printf "Manifest-Version: 1.0\nMain-Class: tests.NtlmAuth\n" > .manifest.ntlm
        cd tmp/pruned && jar cfm ../../$@ ../../.manifest.ntlm .
        rm -f  .manifest.ntlm
index 20652b6..47f7bed 100644 (file)
@@ -90,7 +90,9 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
 
         // <clinit>
         clinit = cg.addMethod("<clinit>",Type.VOID,Type.NO_ARGS,ACC_PRIVATE|ACC_STATIC);
-        
+
+        // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.UnixRuntime.<init>
+
         // <init>
         init = cg.addMethod("<init>",Type.VOID,Type.NO_ARGS,ACC_PUBLIC);        
         init.add(ALOAD_0);
@@ -235,6 +237,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         tramp.add(LDC,")");
         tramp.add(INVOKEVIRTUAL,new MethodRef(Type.STRINGBUFFER,"append",Type.STRINGBUFFER,new Type[]{Type.STRING}));
         tramp.add(INVOKEVIRTUAL,new MethodRef(Type.STRINGBUFFER,"toString",Type.STRING,Type.NO_ARGS));
+        // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime$ExecutionException.<init>
         tramp.add(INVOKESPECIAL,new MethodRef(new Type.Object("org.ibex.nestedvm.Runtime$ExecutionException"),"<init>",Type.VOID,new Type[]{Type.STRING}));
         tramp.add(ATHROW);
                 
@@ -274,6 +277,8 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
             ls.add(IRETURN);
         }
         
+        // Kind of a hack, referencing dup() gets us all the fields for free
+        // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime$CPUState.dup
         Type.Object cpuStateType = new Type.Object("org.ibex.nestedvm.Runtime$CPUState");
         MethodGen setCPUState = cg.addMethod("setCPUState",Type.VOID,new Type[]{cpuStateType},ACC_PROTECTED);
         MethodGen getCPUState = cg.addMethod("getCPUState",Type.VOID,new Type[]{cpuStateType},ACC_PROTECTED);
@@ -350,6 +355,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         execute.add(NEW, new Type.Object("org.ibex.nestedvm.Runtime$FaultException"));
         execute.add(DUP);
         execute.add(ALOAD_1);
+        // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime$FaultException.<init>
         execute.add(INVOKESPECIAL,new MethodRef("org.ibex.nestedvm.Runtime$FaultException","<init>",Type.VOID,new Type[]{new Type.Object("java.lang.RuntimeException")}));
         execute.add(ATHROW);
         
@@ -364,8 +370,10 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         main.add(ALOAD_0);
         if(unixRuntime) {
             Type.Object ur = new Type.Object("org.ibex.nestedvm.UnixRuntime");
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.runAndExec
             main.add(INVOKESTATIC,new MethodRef(ur,"runAndExec",Type.INT,new Type[]{ur,Type.STRING,Type.arrayType(Type.STRING)}));
         } else {
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.run
             main.add(INVOKEVIRTUAL,new MethodRef(me,"run",Type.INT,new Type[]{Type.STRING,Type.arrayType(Type.STRING)}));
         }
         main.add(INVOKESTATIC,new MethodRef(new Type.Object("java.lang.System"),"exit",Type.VOID,new Type[]{Type.INT}));
@@ -407,13 +415,14 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
             
             clinit.add(LDC,sb.toString());
             clinit.add(LDC,segSize/4);
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.decodeData
             clinit.add(INVOKESTATIC,new MethodRef(new Type.Object("org.ibex.nestedvm.Runtime"),"decodeData",Type.arrayType(Type.INT),new Type[]{Type.STRING,Type.INT}));
             clinit.add(PUTSTATIC,new FieldRef(me,fieldname,Type.arrayType(Type.INT)));
-
             init.add(ALOAD_0);
             init.add(GETSTATIC,new FieldRef(me,fieldname,Type.arrayType(Type.INT)));
             init.add(LDC,addr);
             init.add(LDC,readOnly ? 1 : 0);
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.initPages
             init.add(INVOKEVIRTUAL,new MethodRef(me,"initPages",Type.VOID,new Type[]{Type.arrayType(Type.INT),Type.INT,Type.BOOLEAN}));
             
             addr += segSize;
@@ -430,6 +439,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         init.add(ALOAD_0);
         init.add(LDC,addr);
         init.add(LDC,count);
+        // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.clearPages
         init.add(INVOKEVIRTUAL,new MethodRef(me,"clearPages",Type.VOID,new Type[]{Type.INT,Type.INT}));
     }
     
@@ -751,6 +761,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
                 pushRegZ(R+A3);
                 pushRegZ(R+T0);
                 pushRegZ(R+T1);
+                // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.syscall
                 mg.add(INVOKEVIRTUAL,new MethodRef(me,"syscall",Type.INT,new Type[]{Type.INT,Type.INT,Type.INT,Type.INT,Type.INT,Type.INT,Type.INT}));
                 setReg();
                 
@@ -1962,6 +1973,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
             mg.add(DUP);
             mg.add(ALOAD_0);
             mg.add(SWAP);
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.nullPointerCheck
             mg.add(INVOKEVIRTUAL,new MethodRef(me,"nullPointerCheck",Type.VOID,new Type[]{Type.INT}));
         }
         
@@ -1995,6 +2007,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         } else if(fastMem) {
             mg.add(IASTORE);
         } else {
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.unsafeMemWrite
             mg.add(INVOKEVIRTUAL,new MethodRef(me,"unsafeMemWrite",Type.VOID,new Type[]{Type.INT,Type.INT}));
         }
         
@@ -2066,6 +2079,7 @@ public class ClassFileCompiler extends Compiler implements CGConst  {
         } else {
             if(preMemReadDoPreWrite)
                 mg.add(DUP2);
+            // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime.unsafeMemRead
             mg.add(INVOKEVIRTUAL,new MethodRef(me,"unsafeMemRead",Type.INT,new Type[]{Type.INT}));
         }
     }
index 9277b16..f7eea1e 100644 (file)
@@ -6,6 +6,13 @@ import java.util.*;
 
 import java.text.DateFormatSymbols;
 
+/*
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk11.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk12.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk13.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk14.<init>
+*/
+
 public abstract class Platform {
     Platform() { }
     private static final Platform p;
index fa28cc0..5885009 100644 (file)
@@ -85,7 +85,7 @@ update_darcs_%: tasks/extract_darcs_%
        else \
                cd "build/$*" && wget -np -nH --cut-dirs=1 -rl 16 -N -X _darcs $(darcs_$*); \
        fi
-       rm "tasks/build_darcs_$*" # to force a rebuild
+       rm -f "tasks/build_darcs_$*" # to force a rebuild
 
 tasks/build_darcs_%: tasks/extract_darcs_%
        cd "build/$*" && $(MAKE)