Package org.allspice.bytecode.instructions

Examples of org.allspice.bytecode.instructions.Store


      Var x = new Var(1,new TypeName(type)) ;
      MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new Load(x),
          new Store(new FieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
    {
View Full Code Here


    md = md.addInstructions(
        new JumpSub(sub),
        new Load(z),
        new Return(TypeCode.INT),
        new Nop(sub),
        new Store(vret),
        new Load(x),
        new Load(y),
        new Add(TypeCode.INT),
        new Store(z),
        new ReturnVar(vret.index)
        ) ;
    cd = cd.addMethod(md)
    return cd ;
  }
View Full Code Here

      Var x = new Var(0,new TypeName(type)) ;
      MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
      md = md.setStatic(true) ;
      md = md.addInstructions(
          new Load(x),
          new Store(new StaticFieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
    {
View Full Code Here

    l.add(new JumpSub(finallyMark)) ;
    l.add(new Goto(the_end)) ;
    {
      l.add(new ExceptionHandler(start_pc,end_pc,handler,TypeName.THROWABLE)) ;
      l.add(new Nop(handler)) ;
      l.add(new Store(ex)) ;
      l.add(new JumpSub(finallyMark)) ;
      l.add(new Load(ex)) ;
      l.add(new Throw()) ;
    }
    l.add(new Nop(finallyMark)) ;
    l.add(new Store(vret)) ;
    for(Statement s: finallyStatements) {
      newContext.compile(s,l) ;
    }
    l.add(new ReturnVar(vret.index)) ;
    l.add(new Nop(the_end))
View Full Code Here

      Var v = (Var)newContext.getVar(cb.ex.name);
      final String extype = cb.ex.type;
      Mark handler = new Mark() ;
      l.add(new ExceptionHandler(start_pc,end_pc,handler,context.fullyQualified(extype))) ;
      l.add(new Nop(handler)) ;
      l.add(new Store(v)) ;
      for(Statement s1: cb.statements) {
        newContext.compile(s1,l) ;
      }
      l.add(new Goto(the_end)) ;
    }
View Full Code Here

    LValue v = newContext.getVar("$$mon$$") ;
    Var ex = (Var)newContext.getVar("$$ex$$") ;
    Var vret = (Var)newContext.getVar("$$ra$$") ;
    makeInit(newContext,varDecl.init,v.getType(),l) ;
    l.add(new Dup(TypeCode.VOID,TypeCode.OBJECT)) ;
    l.add(new Store(v)) ;
    l.add(new MonitorEnter()) ;
    Mark the_end = new Mark() ;
    Mark start_pc = new Mark() ;
    Mark end_pc = new Mark() ;
    Mark handler = new Mark() ;
    l.add(new Nop(start_pc)) ;
    for(Statement s: statements) {
      newContext.compile(s,l) ;
    }
    l.add(new Nop(end_pc)) ;
    l.add(new JumpSub(finallyMark)) ;
    l.add(new Goto(the_end)) ;
    {
      l.add(new ExceptionHandler(start_pc,end_pc,handler,TypeName.THROWABLE)) ;
      l.add(new Nop(handler)) ;
      l.add(new Store(ex)) ;
      l.add(new JumpSub(finallyMark)) ;
      l.add(new Load(ex)) ;
      l.add(new Throw()) ;
    }
    l.add(new Nop(finallyMark)) ;
    l.add(new Store(vret)) ;
    l.add(new Load(v)) ;
    l.add(new MonitorExit()) ;
    l.add(new ReturnVar(vret.index)) ;
    l.add(new Nop(the_end))
  }
View Full Code Here

      final VarDecl varDecl = new VarDecl(context.methodDef.returnType,"$$ret$$",e);
      final VarStack vars = context.decls.addLocalVar(context.getFileUnitInfo(),new FIFO<VarDecl>(varDecl));
      EvaluationContext newContext = context.setVars(vars) ;
      LValue v = newContext.getVar("$$ret$$") ;
      makeInit(newContext,varDecl.init,v.getType(),l) ;
      l.add(new Store(v)) ;
      l.add(context.returnInst) ;
      l.add(new Load(v)) ;
      l.add(new Return(TypeCode.getType(context.methodDef.returnType))) ;
    }
  }
View Full Code Here

 
  public static LValue createSetValueExpr(EvaluationContext context,Expr lhs,Expr e,InstList l) throws CompilerException {
    LValue v = context.compileLValue(lhs, l);
    l.add(new Dup(TypeCode.VOID,v.getRefType())) ;
    makeInit(context,e,v.getType(),l) ;
    l.add(new Store(v)) ;
    return v ;
  }
View Full Code Here

    return v ;
  }
  public static void createSetValueExprNoReturn(EvaluationContext context,Expr lhs,Expr e,InstList l) throws CompilerException {
    LValue v = context.compileLValue(lhs, l);
    makeInit(context,e,v.getType(),l) ;
    l.add(new Store(v)) ;
  }
View Full Code Here

      final Collection<VarDecl> varList, final Collection<Statement> statements, InstList l) throws CompilerException {
    EvaluationContext newContext = context.setVars(context.decls.addLocalVar(context.getFileUnitInfo(),varList)) ;
    for(VarDecl vd: varList) {
      LValue v = newContext.getVar(vd.name) ;
      makeInit(newContext,vd.init,v.getType(),l) ;
      l.add(new Store(v)) ;
    }
    for(Statement s: statements) {
      newContext.compile(s,l) ;
    }
  }
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.instructions.Store

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.