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
@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
// <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);
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);
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);
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);
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}));
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;
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}));
}
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();
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}));
}
} 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}));
}
} 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}));
}
}