X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FClassFileCompiler.java;h=6e67c80cd64b0739a49405410b11f4fd39fd7037;hb=b5282b0a1a8ca5212c75623610be6d0483fd35bd;hp=20652b6bda5fcbdad9536fd9fa47c8977bb8aa98;hpb=7a9bc0ba0fd215bd5b9a2e370937d81870aadba5;p=nestedvm.git diff --git a/src/org/ibex/nestedvm/ClassFileCompiler.java b/src/org/ibex/nestedvm/ClassFileCompiler.java index 20652b6..6e67c80 100644 --- a/src/org/ibex/nestedvm/ClassFileCompiler.java +++ b/src/org/ibex/nestedvm/ClassFileCompiler.java @@ -1,3 +1,7 @@ +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. + package org.ibex.nestedvm; import java.io.*; @@ -90,7 +94,9 @@ public class ClassFileCompiler extends Compiler implements CGConst { // clinit = cg.addMethod("",Type.VOID,Type.NO_ARGS,ACC_PRIVATE|ACC_STATIC); - + + // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.UnixRuntime. + // init = cg.addMethod("",Type.VOID,Type.NO_ARGS,ACC_PUBLIC); init.add(ALOAD_0); @@ -235,6 +241,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. tramp.add(INVOKESPECIAL,new MethodRef(new Type.Object("org.ibex.nestedvm.Runtime$ExecutionException"),"",Type.VOID,new Type[]{Type.STRING})); tramp.add(ATHROW); @@ -274,6 +281,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 +359,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. execute.add(INVOKESPECIAL,new MethodRef("org.ibex.nestedvm.Runtime$FaultException","",Type.VOID,new Type[]{new Type.Object("java.lang.RuntimeException")})); execute.add(ATHROW); @@ -364,8 +374,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 +419,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 +443,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 +765,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 +1977,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 +2011,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 +2083,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})); } }