cn.wensiqun.asmsupport.operators
类 AbstractOperator

java.lang.Object
  继承者 cn.wensiqun.asmsupport.definition.AbstractExecuteable
      继承者 cn.wensiqun.asmsupport.operators.AbstractOperator
所有已实现的接口:
Executeable
直接已知子类:
AbstractArrayOperator, AbstractLogical, AbstractNumerical, AbstractRelational, ArrayValue, ASMDirect, Assigner, BlockEndFlag, BreakStack, CheckCast, InstanceofOperator, LocalVariableCreator, MethodInvoker, NoneOperator, StringAppender, TernaryOperator, VisitFieldInsn, VisitIincInsn, VisitInsn, VisitIntInsn, VisitLdcInsn, VisitMethodInsn, VisitMultiANewArrayInsn, VisitTypeInsn, VisitVarInsn

public abstract class AbstractOperator
extends AbstractExecuteable

作者:
温斯群(Joe Wen)

字段摘要
protected  List<AbstractCrement> allCrement
           
protected  ProgramBlock block
           
protected  InstructionHelper insnHelper
           
 
构造方法摘要
protected AbstractOperator(ProgramBlock block)
           
 
方法摘要
protected  void afterInitProperties()
           
protected  void autoCast(AClass from, AClass to)
           
protected  void beforeInitProperties()
           
protected  void checkAsArgument()
          invoke by OperatorFactory
protected  void checkOutCrement()
           
 void checkUnreachableCode()
           
 void execute()
          执行
protected abstract  void executing()
           
protected  void firstPrepareProcess()
           
 ProgramBlock getBlock()
           
 int getCompileOrder()
           
protected  void lastPrepareProcess()
           
 void prepare()
          执行execute的预先操作 在此方法中如果要对执行队列操作 那么不能对执行队列做删除和添加操作 只能做替操作 除了MethodBody类型的Block是通过直接调用的方式执行Prepare方法之外, 其他Block 均在调用创建该Block的时候触发Prepare方法, 所有创建非MethodBody类型Block都在 jw.asmsupport.block.operator.CreateBlockOperator接口中 对于一般的Block,比如if...else...
protected  void verifyArgument()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

block

protected ProgramBlock block

insnHelper

protected InstructionHelper insnHelper

allCrement

protected List<AbstractCrement> allCrement
构造方法详细信息

AbstractOperator

protected AbstractOperator(ProgramBlock block)
方法详细信息

getBlock

public ProgramBlock getBlock()

checkUnreachableCode

public void checkUnreachableCode()

prepare

public final void prepare()
从接口 Executeable 复制的描述

执行execute的预先操作 在此方法中如果要对执行队列操作 那么不能对执行队列做删除和添加操作 只能做替操作

除了MethodBody类型的Block是通过直接调用的方式执行Prepare方法之外, 其他Block 均在调用创建该Block的时候触发Prepare方法, 所有创建非MethodBody类型Block都在 jw.asmsupport.block.operator.CreateBlockOperator接口中

对于一般的Block,比如if...else... 比如如下代码:

 public void method(){
     if(...){
        while(....){
           ...
        }
     }else{
        for(...){
           ...
        }
     }
 }
 

通常执行prepare的顺序如下:

 $ 表示调用 CreateBlockOperator.xxx方法
 _\ 表示触发prepare方法
 
    MethodBody
         |
         |$
         |____\ IF Block
         |          |
         |          |$
         |          |____\ While Block
         |                       |
         |                       |
         |/______________________|
         |           
         |$
         |____\ Else Block 
                    |
                    |$
                    |____\ For Block
                                 |
                                 |
   Method Body End /_____________|
   
 

但是对于每个连续的Try...Catch...Finally...块, asmsupport会先将这一连续的 块逐一创建完成,再执行各自的Prepare方法。 如下图所示

 $ 表示调用 createBlockOperator.xxx方法
 _\ 表示出发prepare方法
 
    MethodBody
         |
         |$
         |____\ Try Block 1
         |          | 
         |          |
         |                         |
         |$                        |
         |____\ Catch Block 1      |
         |                         |
         |$                        |
         |____\ Finally Block 1    |
         |                         |
         |                         |
         |_________________________|
         
                                 |
   Method Body End /_____________|
   
 


firstPrepareProcess

protected void firstPrepareProcess()

beforeInitProperties

protected void beforeInitProperties()

verifyArgument

protected void verifyArgument()

checkOutCrement

protected void checkOutCrement()

checkAsArgument

protected void checkAsArgument()
invoke by OperatorFactory


afterInitProperties

protected void afterInitProperties()

lastPrepareProcess

protected void lastPrepareProcess()

execute

public void execute()
从接口 Executeable 复制的描述
执行


executing

protected abstract void executing()

autoCast

protected void autoCast(AClass from,
                        AClass to)
参数:
from -
to -

getCompileOrder

public final int getCompileOrder()


Copyright © 2013. All Rights Reserved.