Package railo.transformer.bytecode.visitor

Examples of railo.transformer.bytecode.visitor.DecisionIntVisitor


          adapter.visitInsn(Opcodes.ACONST_NULL);
        dv.visitEnd(bc);
       
      whileVisitor.visitAfterExpressionBeforeBody(bc);
        //if(++count < startLine) continue;
        DecisionIntVisitor dv2=new DecisionIntVisitor();
        dv2.visitBegin();
          adapter.iinc(count, 1);
          adapter.loadLocal(count);
        dv2.visitLT();
          adapter.loadLocal(startline);
        dv2.visitEnd(bc);
        Label end=new Label();
        adapter.ifZCmp(Opcodes.IFEQ, end);
          whileVisitor.visitContinue(bc);
        adapter.visitLabel(end);
       
        // if(endLine!=-1 && count > endLine) break;
        DecisionIntVisitor div=new DecisionIntVisitor();
        div.visitBegin();
          adapter.loadLocal(endline);
        div.visitNEQ();
          adapter.push(-1);
        div.visitEnd(bc);
        Label end2=new Label();
        adapter.ifZCmp(Opcodes.IFEQ, end2);
       
          DecisionIntVisitor div2 = new DecisionIntVisitor();
          div2.visitBegin();
            adapter.loadLocal(count);
          div2.visitGT();
            adapter.loadLocal(endline);
          div2.visitEnd(bc);
          Label end3=new Label();
          adapter.ifZCmp(Opcodes.IFEQ, end3);
            whileVisitor.visitBreak(bc);
          adapter.visitLabel(end3);
        adapter.visitLabel(end2);
View Full Code Here


    adapter.storeLocal(startAt);
   
   
   
    // if(query.getRecordcount()>0) {
    DecisionIntVisitor div=new DecisionIntVisitor();
    div.visitBegin();
      adapter.loadLocal(tag.getQuery());
      adapter.invokeInterface(Types.QUERY, GET_RECORDCOUNT);
    div.visitGT();
      adapter.push(0);
    div.visitEnd(bc);
    Label ifRecCount=new Label();
    adapter.ifZCmp(Opcodes.IFEQ, ifRecCount);
     
      // startrow
      int from = adapter.newLocal(Types.INT_VALUE);
View Full Code Here

        }
       
// udfCall    
        Function[] functions=getFunctions();
        ConditionVisitor cv;
        DecisionIntVisitor div;
    // less/equal than 10 functions
        if(isInterface()){}
        else if(functions.length<=10) {
          adapter = new GeneratorAdapter(Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL , UDF_CALL, null, new Type[]{Types.THROWABLE}, cw);
            BytecodeContext bc = new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,UDF_CALL,writeLog(),supressWSbeforeArg);
            if(functions.length==0){}
            else if(functions.length==1){
            ExpressionUtil.visitLine(bc,functions[0].getStart());
            functions[0].getBody().writeOut(bc);
            ExpressionUtil.visitLine(bc,functions[0].getEnd());
          }
          else writeOutUdfCallInner(bc,functions,0,functions.length);
            adapter.visitInsn(Opcodes.ACONST_NULL);
            adapter.returnValue();
            adapter.endMethod();
        }
   // more than 10 functions
        else {
          adapter = new GeneratorAdapter(Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL , UDF_CALL, null, new Type[]{Types.THROWABLE}, cw);
          BytecodeContext bc = new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,UDF_CALL,writeLog(),supressWSbeforeArg);
            cv = new ConditionVisitor();
            cv.visitBefore();
            int count=0;
            for(int i=0;i<functions.length;i+=10) {
              cv.visitWhenBeforeExpr();
                div=new DecisionIntVisitor();
            div.visitBegin();
              adapter.loadArg(2);
            div.visitLT();
              adapter.push(i+10);
            div.visitEnd(bc);
              cv.visitWhenAfterExprBeforeBody(bc);
               
                adapter.visitVarInsn(Opcodes.ALOAD, 0);
                adapter.visitVarInsn(Opcodes.ALOAD, 1);
                adapter.visitVarInsn(Opcodes.ALOAD, 2);
                adapter.visitVarInsn(Opcodes.ILOAD, 3);
                adapter.visitMethodInsn(Opcodes.INVOKEVIRTUAL, name, createFunctionName(++count), "(Lrailo/runtime/PageContext;Lrailo/runtime/type/UDF;I)Ljava/lang/Object;");
                adapter.visitInsn(Opcodes.ARETURN);//adapter.returnValue();
              cv.visitWhenAfterBody(bc);
            }
            cv.visitAfter(bc);
         
          adapter.visitInsn(Opcodes.ACONST_NULL);
          adapter.returnValue();
          adapter.endMethod();
         
          count=0;
          Method innerCall;
          for(int i=0;i<functions.length;i+=10) {
            innerCall = new Method(createFunctionName(++count),Types.OBJECT,new Type[]{Types.PAGE_CONTEXT, USER_DEFINED_FUNCTION, Types.INT_VALUE});
           
            adapter = new GeneratorAdapter(Opcodes.ACC_PRIVATE+Opcodes.ACC_FINAL , innerCall, null, new Type[]{Types.THROWABLE}, cw);
            writeOutUdfCallInner(new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,innerCall,writeLog(),supressWSbeforeArg), functions, i, i+10>functions.length?functions.length:i+10);
           
            adapter.visitInsn(Opcodes.ACONST_NULL);
            adapter.returnValue();
            adapter.endMethod();
          }
        }
       

     // threadCall
         TagThread[] threads=getThreads();
         if(true) {
           adapter = new GeneratorAdapter(Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL , THREAD_CALL, null, new Type[]{Types.THROWABLE}, cw);
           if(threads.length>0) writeOutThreadCallInner(new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,THREAD_CALL,writeLog(),supressWSbeforeArg),threads,0,threads.length);
         //adapter.visitInsn(Opcodes.ACONST_NULL);
         adapter.returnValue();
         adapter.endMethod();
         }
       

       
               
// udfDefaultValue
    // less/equal than 10 functions
        if(isInterface()) {}
        else if(functions.length<=10) {
          adapter = new GeneratorAdapter(Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL , UDF_DEFAULT_VALUE, null, new Type[]{Types.PAGE_EXCEPTION}, cw);
          if(functions.length>0)
            writeUdfDefaultValueInner(new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,UDF_DEFAULT_VALUE,writeLog(),supressWSbeforeArg),functions,0,functions.length);
           
            adapter.loadArg(DEFAULT_VALUE);
          adapter.returnValue();
            adapter.endMethod();
        }
        else {
          adapter = new GeneratorAdapter(Opcodes.ACC_PUBLIC+Opcodes.ACC_FINAL , UDF_DEFAULT_VALUE, null, new Type[]{Types.PAGE_EXCEPTION}, cw);
            BytecodeContext bc = new BytecodeContext(source,statConstr,constr,this,keys,cw,name,adapter,UDF_DEFAULT_VALUE,writeLog(),supressWSbeforeArg);
          cv = new ConditionVisitor();
          cv.visitBefore();
          int count=0;
          for(int i=0;i<functions.length;i+=10) {
            cv.visitWhenBeforeExpr();
              div=new DecisionIntVisitor();
          div.visitBegin();
            adapter.loadArg(1);
          div.visitLT();
            adapter.push(i+10);
          div.visitEnd(bc);
            cv.visitWhenAfterExprBeforeBody(bc);
             
              adapter.visitVarInsn(Opcodes.ALOAD, 0);
              adapter.visitVarInsn(Opcodes.ALOAD, 1);
              adapter.visitVarInsn(Opcodes.ILOAD, 2);
View Full Code Here

  }

  private void writeUdfDefaultValueInner(BytecodeContext bc, Function[] functions, int offset, int length) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
    ConditionVisitor cv = new ConditionVisitor();
    DecisionIntVisitor div;
        cv.visitBefore();
        for(int i=offset;i<length;i++) {
          cv.visitWhenBeforeExpr();
            div = new DecisionIntVisitor();
        div.visitBegin();
          adapter.loadArg(1);
        div.visitEQ();
          adapter.push(i);
        div.visitEnd(bc);
          cv.visitWhenAfterExprBeforeBody(bc);
            writeOutFunctionDefaultValueInnerInner(bc, functions[i]);
          cv.visitWhenAfterBody(bc);
        }
        cv.visitAfter(bc);
View Full Code Here


  private void writeOutUdfCallInnerIf(BytecodeContext bc,Function[] functions, int offset, int length) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
    ConditionVisitor cv=new ConditionVisitor();
        DecisionIntVisitor div;
        cv.visitBefore();
        for(int i=offset;i<length;i++) {
          cv.visitWhenBeforeExpr();
            div=new DecisionIntVisitor();
        div.visitBegin();
          adapter.loadArg(2);
        div.visitEQ();
          adapter.push(i);
        div.visitEnd(bc);
          cv.visitWhenAfterExprBeforeBody(bc);
            ExpressionUtil.visitLine(bc, functions[i].getStart());
            functions[i].getBody().writeOut(bc);
            ExpressionUtil.visitLine(bc, functions[i].getEnd());
          cv.visitWhenAfterBody(bc);
View Full Code Here

 

  private void writeOutThreadCallInner(BytecodeContext bc,TagThread[] threads, int offset, int length) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
    ConditionVisitor cv=new ConditionVisitor();
        DecisionIntVisitor div;
        cv.visitBefore();
        //print.ln("functions:"+functions.length);
          for(int i=offset;i<length;i++) {
            cv.visitWhenBeforeExpr();
              div=new DecisionIntVisitor();
          div.visitBegin();
            adapter.loadArg(1);
          div.visitEQ();
            adapter.push(i);
          div.visitEnd(bc);
            cv.visitWhenAfterExprBeforeBody(bc);
              Body body = threads[i].getRealBody();
              if(body!=null)body.writeOut(bc);
            cv.visitWhenAfterBody(bc);
          }
View Full Code Here

    }
     
    Iterator<Argument> it = args.iterator();
    Argument arg;
    ConditionVisitor cv=new ConditionVisitor();
    DecisionIntVisitor div;
    cv.visitBefore();
    int count=0;
    while(it.hasNext()) {
      arg=it.next();
      cv.visitWhenBeforeExpr();
        div=new DecisionIntVisitor();
        div.visitBegin();
          adapter.loadArg(2);
        div.visitEQ();
          adapter.push(count++);
        div.visitEnd(bc);
      cv.visitWhenAfterExprBeforeBody(bc);
        Expression defaultValue = arg.getDefaultValue();
        if(defaultValue!=null) {
          /*if(defaultValue instanceof Null) {
            adapter.invokeStatic(NULL, GET_INSTANCE);
View Full Code Here

  private void addCase(BytecodeContext bc, ConditionVisitor cv, Tag tag, int expression) throws BytecodeException {
    GeneratorAdapter adapter = bc.getAdapter();
   
    cv.visitWhenBeforeExpr();
      DecisionIntVisitor div=new DecisionIntVisitor();
      div.visitBegin();
        // List.listFindNoCase(case.value,expression,del);
        tag.getAttribute("value").getValue().writeOut(bc,Expression.MODE_REF);
        adapter.loadLocal(expression);
        Attribute attr = tag.getAttribute("delimiters");
        if(attr!=null)attr.getValue().writeOut(bc,Expression.MODE_REF);
        else adapter.push(",");
        adapter.invokeStatic(Types.LIST_UTIL, LIST_FIND_NO_CASE);
      div.visitNEQ();
        adapter.push(-1);
      div.visitEnd(bc);
    cv.visitWhenAfterExprBeforeBody(bc);
      tag.getBody().writeOut(bc);
    cv.visitWhenAfterBody(bc);
   
   
View Full Code Here

TOP

Related Classes of railo.transformer.bytecode.visitor.DecisionIntVisitor

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.