Package org.allspice.bytecode

Examples of org.allspice.bytecode.Mark


   * @param type
   * @param T
   * @param F
   */
  public static void createMappedBoolean(InstructionListContext ilc, TypeCode type, Object T,Object F) {
    Mark one = new Mark() ;
    Mark end = new Mark() ;
    createIFNE0(ilc,type,one) ;
    ilc.add(ilc.getInstructionFactory().createConstant(F)) ;
    ilc.addBranch(new GOTO(null), end) ;
    ilc.addMark(one,-1) ;
    ilc.add(ilc.getInstructionFactory().createConstant(T)) ;
View Full Code Here


   * @param caselabels
   */
  public static void createLookupSwitch(InstructionListContext ilc,
      final Collection<? extends CaseLabel> caselabels) {
    final TreeMap<Integer, Mark> cswitches = new TreeMap<Integer,Mark>() ;
    Mark defaultSwitch = null ;
    for(CaseLabel e: caselabels) {
      Integer val = e.label ;
      Mark mark = e.mark ;
      if (val != null) {
        cswitches.put(val,mark) ;
      }
      else {
        defaultSwitch = mark ;
      }
    }
    final Mark def = defaultSwitch ;
    final int[] matches = new int[cswitches.size()] ;
    final InstructionHandle[] targets = new InstructionHandle[matches.length] ;
    int i = 0 ;
    for(Integer match: cswitches.keySet()) {
      matches[i++] = match.intValue() ;
View Full Code Here

   * @param caselabels
   */
  public static void createTableSwitch(InstructionListContext ilc,
      final Collection<? extends CaseLabel> caselabels) {
    final TreeMap<Integer, Mark> cswitches = new TreeMap<Integer,Mark>() ;
    Mark defaultSwitch = null ;
    for(CaseLabel e: caselabels) {
      Integer val = e.label ;
      Mark mark = e.mark ;
      if (val != null) {
        cswitches.put(val,mark) ;
      }
      else {
        defaultSwitch = mark ;
      }
    }
    final Mark def = defaultSwitch ;
    final int[] matches = new int[cswitches.size()] ;
    final InstructionHandle[] targets = new InstructionHandle[matches.length] ;
    int i = 0 ;
    for(Integer match: cswitches.keySet()) {
      matches[i++] = match.intValue() ;
View Full Code Here

    public abstract TypeCode getComparisonType(EvaluationContext context,Expr lhs,Expr rhs) throws CompilerException ;
  public void compile(TypeName forwardType, T t, EvaluationContext context, InstList result) throws CompilerException {
    final Expr lhs = t.lhs;
    final Expr rhs = t.rhs;
    TypeCode type = getComparisonType(context,lhs, rhs) ;
    Mark isTrue = new Mark() ;
    StdJavaExpressions.createBinopComparison(context, lhs, rhs,TypeName.valueOf(type),isTrue,createOp(type,isTrue),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
View Full Code Here

  public ClassDef defadd(String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x,y) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new IfLessThan(TypeCode.getType(type),one),
        new Const(false),
View Full Code Here

public class TestIFNE0 extends MyTestCase {
  public ClassDef defadd(String type,int i1) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new IfNotEquals0(TypeCode.getType(type),one),
        new Const(false),
        new Return(TypeCode.BOOLEAN),
View Full Code Here

  public ClassDef defadd(String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x,y) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new IfGreaterThan(TypeCode.getType(type),one),
        new Const(false),
View Full Code Here

public class TestLookupSwitch extends MyTestCase {
  public ClassDef defadd() {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,TypeName.INT) ;
    MethodDef md = new MethodDef(TypeName.DOUBLE,"meth",x) ;
    Mark one = new Mark() ;
    Mark two = new Mark() ;
    Mark three = new Mark() ;
    Mark others = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new LookupSwitch(new FIFO<CaseLabel>(new CaseLabel(3,three),new CaseLabel(1,one),new CaseLabel(2,two),new CaseLabel(null,others))),
        new Nop(one),new Const(1.0),new Return(TypeCode.DOUBLE),
        new Nop(two),new Const(2.0),new Return(TypeCode.DOUBLE),
View Full Code Here

  public ClassDef defadd(String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.BOOLEAN,"meth",x,y) ;
    Mark one = new Mark() ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new IfLessThanEq(TypeCode.getType(type),one),
        new Const(false),
View Full Code Here

  public ClassDef defadd() {
    ClassDef cd = makeClass() ;
    Var x = new Var(1,new TypeName("java.lang.Exception")) ;
    Var ex = new Var(2,new TypeName("java.lang.Exception")) ;
    MethodDef md = new MethodDef(TypeName.INT,"meth",x) ;
    Mark start_pc = new Mark() ;
    Mark end_pc = new Mark() ;
    Mark the_end = new Mark() ;
    Mark handler = new Mark() ;
    md = md.addInstructions(
        new Nop(start_pc),
        new Load(x),
        new Throw(),
        new Nop(end_pc),
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.Mark

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.