- ts.setTarget(a(InstructionConstants.POP)); // default case
- a(fac.createNew("org.ibex.nestedvm.Runtime$ExecutionException"));
- a(InstructionConstants.DUP);
- a(fac.createNew("java.lang.StringBuffer"));
- a(InstructionConstants.DUP);
- a(new PUSH(cp,"Jumped to invalid address in trampoline (r2: "));
- a(fac.createInvoke("java.lang.StringBuffer","<init>",Type.VOID,new Type[]{Type.STRING},INVOKESPECIAL));
- a(InstructionConstants.ALOAD_0);
- a(fac.createFieldAccess(fullClassName,"r2",Type.INT, GETFIELD));
- a(fac.createInvoke("java.lang.StringBuffer","append",Type.STRINGBUFFER,new Type[]{Type.INT},INVOKEVIRTUAL));
- a(new PUSH(cp," pc:"));
- a(fac.createInvoke("java.lang.StringBuffer","append",Type.STRINGBUFFER,new Type[]{Type.STRING},INVOKEVIRTUAL));
- a(InstructionConstants.ALOAD_0);
- a(fac.createFieldAccess(fullClassName,"pc",Type.INT, GETFIELD));
- a(fac.createInvoke("java.lang.StringBuffer","append",Type.STRINGBUFFER,new Type[]{Type.INT},INVOKEVIRTUAL));
- a(new PUSH(cp,')'));
- a(fac.createInvoke("java.lang.StringBuffer","append",Type.STRINGBUFFER,new Type[]{Type.CHAR},INVOKEVIRTUAL));
- a(fac.createInvoke("java.lang.StringBuffer","toString",Type.STRING,Type.NO_ARGS,INVOKEVIRTUAL));
- a(fac.createInvoke("org.ibex.nestedvm.Runtime$ExecutionException","<init>",Type.VOID,new Type[]{Type.STRING},INVOKESPECIAL));
- a(InstructionConstants.ATHROW);
-
- stateCheck.setTarget(a(InstructionConstants.RETURN));
-
- tramp.setMaxStack();
- tramp.setMaxLocals();
- try {
- cl.addMethod(tramp.getMethod());
- } catch(ClassGenException e) {
- e.printStackTrace(warn);
- throw new Exn("Generation of the trampoline method failed. Try increasing maxInsnPerMethod");
- }
-
- MethodGen init = newMethod(ACC_PUBLIC,Type.VOID, Type.NO_ARGS, "<init>");
- selectMethod(init);
- // Constructor
- a(InstructionConstants.ALOAD_0);
- pushConst(pageSize);
- pushConst(totalPages);
- pushConst(fastMem ? 0 : 1);
- a(fac.createInvoke(runtimeClass,"<init>",Type.VOID,new Type[]{Type.INT,Type.INT,Type.BOOLEAN},INVOKESPECIAL));
- a(InstructionConstants.ALOAD_0);
- pushConst(gp.addr);
- a(fac.createFieldAccess(fullClassName,"gp",Type.INT, PUTFIELD));
-
- a(InstructionConstants.ALOAD_0);
- pushConst(elf.header.entry);
- a(fac.createFieldAccess(fullClassName,"entryPoint",Type.INT, PUTFIELD));
-
- a(InstructionConstants.ALOAD_0);
- pushConst(onePage ? ((highestAddr+4095)&~4095) : ((highestAddr+pageSize-1)&~(pageSize-1)));
- a(fac.createFieldAccess(fullClassName,"brkAddr",Type.INT, PUTFIELD));
+ tramp.add(POP);
+ tramp.add(NEW,Type.Class.instance("org.ibex.nestedvm.Runtime$ExecutionException"));
+ tramp.add(DUP);
+ tramp.add(NEW, Type.STRINGBUFFER);
+ tramp.add(DUP);
+ tramp.add(LDC,"Jumped to invalid address in trampoline (r2: ");
+ tramp.add(INVOKESPECIAL,Type.STRINGBUFFER.method("<init>",Type.VOID,new Type[]{Type.STRING}));
+ tramp.add(ALOAD_0);
+ tramp.add(GETFIELD, me.field("r2",Type.INT));
+ tramp.add(INVOKEVIRTUAL,Type.STRINGBUFFER.method("append",Type.STRINGBUFFER,new Type[]{Type.INT}));
+ tramp.add(LDC," pc: ");
+ tramp.add(INVOKEVIRTUAL,Type.STRINGBUFFER.method("append",Type.STRINGBUFFER,new Type[]{Type.STRING}));
+ tramp.add(ALOAD_0);
+ tramp.add(GETFIELD, me.field("pc",Type.INT));
+ tramp.add(INVOKEVIRTUAL,Type.STRINGBUFFER.method("append",Type.STRINGBUFFER,new Type[]{Type.INT}));
+ tramp.add(LDC,")");
+ tramp.add(INVOKEVIRTUAL,Type.STRINGBUFFER.method("append",Type.STRINGBUFFER,new Type[]{Type.STRING}));
+ tramp.add(INVOKEVIRTUAL,Type.STRINGBUFFER.method("toString",Type.STRING,Type.NO_ARGS));
+ // GCCLASS_HINT: org.ibex.nestedvm.RuntimeCompiler.compile org.ibex.nestedvm.Runtime$ExecutionException.<init>
+ tramp.add(INVOKESPECIAL,Type.Class.instance("org.ibex.nestedvm.Runtime$ExecutionException").method("<init>",Type.VOID,new Type[]{Type.STRING}));
+ tramp.add(ATHROW);