Package cn.wensiqun.asmsupport.asm

Examples of cn.wensiqun.asmsupport.asm.InstructionHelper


    }
   
  }

  protected void getValue(){
        InstructionHelper ih = block.getInsnHelper();
        AClass cls = arrayReference.getParamterizedType();
        if(log.isDebugEnabled()){
            log.debug("load the array reference to stack");
        }
        arrayReference.loadToStack(block);
       
        for(int i=0; i<parDims.length; i++){
            cls = ((ArrayClass) cls).getNextDimType();
            parDims[i].loadToStack(block);
            autoCast(parDims[i].getParamterizedType(), AClass.INT_ACLASS);
            ih.arrayLoad(cls.getType());
        }
       
    }
View Full Code Here


  @Override
    public void executing() {
        log.debug("start get value for store array");
        getValue();
        InstructionHelper ih = block.getInsnHelper();
        log.debug("push the last dim index to stack");
        lastDim.loadToStack(block);
        autoCast(lastDim.getParamterizedType(), AClass.INT_ACLASS);
       
        value.loadToStack(block);
        autoCast(value.getParamterizedType(), storeClass);
        log.debug("store value to corresponse to index of the array");
        ih.arrayStore(storeClass.getType());
    }
View Full Code Here

    @Override
    public void executing() {
    if(!useByOther){
            throw new RuntimeException(this.toString() + " not use by other operator");
        }
        InstructionHelper ih = block.getInsnHelper();
        if(log.isDebugEnabled()) log.debug("start get length of array");
        getValue();
        if(log.isDebugEnabled()) log.debug("got length and push to stack");
        ih.arrayLength();
    }
View Full Code Here

    @Override
    protected void lastPrepareProcess() {
    }
   
    private void loopArray(AClass acls, Object arrayOrElement){
        InstructionHelper ih = block.getInsnHelper();
        if(arrayOrElement.getClass().isArray()){
            int len = Array.getLength(arrayOrElement);
            ih.push(len);
            AClass nextDimType = ((ArrayClass)acls).getNextDimType();
            ih.newArray(nextDimType.getType());
            if(len > 0){
                ih.dup()
            }
            for(int i=0; i<len ;i++){
                ih.push(i);
                loopArray(nextDimType, Array.get(arrayOrElement, i));
                ih.arrayStore(acls.getType());
                if(i < len - 1){
                    ih.dup();
                }
            }
        }else{
            ((Parameterized) arrayOrElement).loadToStack(block);
            //auto cast each value for array
View Full Code Here

            throw new RuntimeException("this array value not use by other operator");
        }
       
        if(allocateDims != null){
            log.debug("start new a array!");
            InstructionHelper ih = block.getInsnHelper();
            if(allocateDims == null || allocateDims.length == 0){
                ih.push(arrayCls.getType());
                ih.checkCast(arrayCls.getType());
                return;
            }
           
            if(allocateDims.length == 1){
                allocateDims[0].loadToStack(block);
                ih.unbox(allocateDims[0].getParamterizedType().getType());
                ih.newArray(arrayCls.getNextDimType().getType());
            }else{
                for(Parameterized allocate : allocateDims){
                    allocate.loadToStack(block);
                    ih.unbox(allocate.getParamterizedType().getType());
                }
                ih.multiANewArrayInsn(arrayCls.getType(), allocateDims.length);
            }
        }else{
            loopArray(arrayCls, values);
        }
    }
View Full Code Here

TOP

Related Classes of cn.wensiqun.asmsupport.asm.InstructionHelper

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.