org.jboss.byteman.agent.adapter
Class RuleTriggerMethodAdapter

java.lang.Object
  extended by org.objectweb.asm.MethodAdapter
      extended by org.jboss.byteman.agent.adapter.RuleMethodAdapter
          extended by org.jboss.byteman.agent.adapter.RuleGeneratorAdapter
              extended by org.jboss.byteman.agent.adapter.RuleTriggerMethodAdapter
All Implemented Interfaces:
org.objectweb.asm.MethodVisitor

public class RuleTriggerMethodAdapter
extends RuleGeneratorAdapter

class which provides base functionality extended by all the location-specific method trigger adapters


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.byteman.agent.adapter.RuleMethodAdapter
RuleMethodAdapter.LocalVar
 
Field Summary
protected  java.lang.String[] exceptions
           
 
Fields inherited from class org.jboss.byteman.agent.adapter.RuleGeneratorAdapter
ADD, AND, DIV, EQ, GE, GT, LE, LT, MUL, NE, NEG, OR, REM, SHL, SHR, SUB, USHR, XOR
 
Fields inherited from class org.jboss.byteman.agent.adapter.RuleMethodAdapter
access, descriptor, name, rule, transformContext
 
Fields inherited from class org.objectweb.asm.MethodAdapter
mv
 
Method Summary
 org.objectweb.asm.Type[] getInvokedTypes()
          method overridden by AT INVOKE method adapter allowing types for the invoked method owner, parameters and return value to be identified.
protected  java.lang.String getMethodName()
           
 org.objectweb.asm.Type getReturnBindingType()
          method overridden by AT INVOKE method adapter allowing the type of the $! binding to be identified.
protected  boolean inBytemanHandler()
          return true if the current block is a handler which catches a byteman exception thrown by the byteman runtime
protected  boolean inBytemanTrigger()
          return true if the current block is in a trigger block injected by Byteman
protected  void injectTriggerPoint()
          inject the rule trigger code
protected  boolean inRethrowHandler()
          return true if the current block is handler which catches a thrown exception within the scope of a monitor enter in order to be able exit the monitor and rethrow the exception
 void visitCode()
           
 void visitEnd()
           
 void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
           
 void visitIincInsn(int var, int increment)
           
 void visitInsn(int opcode)
           
 void visitIntInsn(int opcode, int operand)
           
 void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
           
 void visitLabel(org.objectweb.asm.Label label)
           
 void visitLdcInsn(java.lang.Object cst)
           
 void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
           
 void visitMaxs(int maxStack, int maxLocals)
          ensure we allow enough room for any extra locals on the stack
 void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
           
 void visitMultiANewArrayInsn(java.lang.String desc, int dims)
           
 void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label[] labels)
           
 void visitTriggerEnd(org.objectweb.asm.Label label)
           
 void visitTriggerStart(org.objectweb.asm.Label label)
           
 void visitTryCatchBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label handler, java.lang.String type)
           
 void visitTypeInsn(int opcode, java.lang.String desc)
           
 void visitVarInsn(int opcode, int var)
          override this so we can see track which local var slots are in use and avoid overwriting them
 
Methods inherited from class org.jboss.byteman.agent.adapter.RuleGeneratorAdapter
arrayLength, arrayLoad, arrayStore, box, cast, catchException, checkCast, dup, dup2, dup2X1, dup2X2, dupX1, dupX2, endMethod, getField, getLocalType, getStatic, goTo, ifCmp, ifICmp, ifNonNull, ifNull, ifZCmp, iinc, instanceOf, invokeConstructor, invokeInterface, invokeStatic, invokeVirtual, loadArg, loadArgArray, loadArgs, loadArgs, loadLocal, loadThis, mark, mark, math, monitorEnter, monitorExit, newArray, newInstance, newLabel, newLocal, not, pop, pop2, popLocal, push, push, push, push, push, push, push, putField, putStatic, ret, returnValue, storeArg, storeLocal, swap, swap, tableSwitch, tableSwitch, throwException, throwException, unbox, visitFrame
 
Methods inherited from class org.jboss.byteman.agent.adapter.RuleMethodAdapter
getTriggerClassName, lookup, visitLocalVariable
 
Methods inherited from class org.objectweb.asm.MethodAdapter
visitAnnotation, visitAnnotationDefault, visitAttribute, visitLineNumber, visitParameterAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exceptions

protected java.lang.String[] exceptions
Method Detail

getInvokedTypes

public org.objectweb.asm.Type[] getInvokedTypes()
method overridden by AT INVOKE method adapter allowing types for the invoked method owner, parameters and return value to be identified. this default version should never get invoked

Returns:
an array containing the types of the invoked method owner, parameters and return value

getReturnBindingType

public org.objectweb.asm.Type getReturnBindingType()
method overridden by AT INVOKE method adapter allowing the type of the $! binding to be identified. this default version should only get invoked for an AT EXIT rule where it returns the trigger method return type. the overridden version should only get invoked for an AFTER INVOKE rule where it returns the invoked method return type

Returns:
the appropriate return type

inBytemanHandler

protected boolean inBytemanHandler()
return true if the current block is a handler which catches a byteman exception thrown by the byteman runtime

Returns:

inBytemanTrigger

protected boolean inBytemanTrigger()
return true if the current block is in a trigger block injected by Byteman

Returns:

inRethrowHandler

protected boolean inRethrowHandler()
return true if the current block is handler which catches a thrown exception within the scope of a monitor enter in order to be able exit the monitor and rethrow the exception

Returns:

getMethodName

protected java.lang.String getMethodName()

visitCode

public void visitCode()
Specified by:
visitCode in interface org.objectweb.asm.MethodVisitor
Overrides:
visitCode in class org.objectweb.asm.MethodAdapter

visitInsn

public void visitInsn(int opcode)
Specified by:
visitInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitInsn in class org.objectweb.asm.MethodAdapter

visitIincInsn

public void visitIincInsn(int var,
                          int increment)
Specified by:
visitIincInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitIincInsn in class org.objectweb.asm.MethodAdapter

visitIntInsn

public void visitIntInsn(int opcode,
                         int operand)
Specified by:
visitIntInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitIntInsn in class org.objectweb.asm.MethodAdapter

visitLdcInsn

public void visitLdcInsn(java.lang.Object cst)
Specified by:
visitLdcInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitLdcInsn in class org.objectweb.asm.MethodAdapter

visitVarInsn

public void visitVarInsn(int opcode,
                         int var)
Description copied from class: RuleGeneratorAdapter
override this so we can see track which local var slots are in use and avoid overwriting them

Specified by:
visitVarInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitVarInsn in class RuleGeneratorAdapter

visitTypeInsn

public void visitTypeInsn(int opcode,
                          java.lang.String desc)
Specified by:
visitTypeInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitTypeInsn in class org.objectweb.asm.MethodAdapter

visitFieldInsn

public void visitFieldInsn(int opcode,
                           java.lang.String owner,
                           java.lang.String name,
                           java.lang.String desc)
Specified by:
visitFieldInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitFieldInsn in class org.objectweb.asm.MethodAdapter

visitMethodInsn

public void visitMethodInsn(int opcode,
                            java.lang.String owner,
                            java.lang.String name,
                            java.lang.String desc)
Specified by:
visitMethodInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitMethodInsn in class org.objectweb.asm.MethodAdapter

visitJumpInsn

public void visitJumpInsn(int opcode,
                          org.objectweb.asm.Label label)
Specified by:
visitJumpInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitJumpInsn in class org.objectweb.asm.MethodAdapter

visitLabel

public void visitLabel(org.objectweb.asm.Label label)
Specified by:
visitLabel in interface org.objectweb.asm.MethodVisitor
Overrides:
visitLabel in class org.objectweb.asm.MethodAdapter

visitTriggerStart

public void visitTriggerStart(org.objectweb.asm.Label label)

visitTriggerEnd

public void visitTriggerEnd(org.objectweb.asm.Label label)

visitTableSwitchInsn

public void visitTableSwitchInsn(int min,
                                 int max,
                                 org.objectweb.asm.Label dflt,
                                 org.objectweb.asm.Label[] labels)
Specified by:
visitTableSwitchInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitTableSwitchInsn in class org.objectweb.asm.MethodAdapter

visitLookupSwitchInsn

public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
                                  int[] keys,
                                  org.objectweb.asm.Label[] labels)
Specified by:
visitLookupSwitchInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitLookupSwitchInsn in class org.objectweb.asm.MethodAdapter

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(java.lang.String desc,
                                    int dims)
Specified by:
visitMultiANewArrayInsn in interface org.objectweb.asm.MethodVisitor
Overrides:
visitMultiANewArrayInsn in class org.objectweb.asm.MethodAdapter

visitTryCatchBlock

public void visitTryCatchBlock(org.objectweb.asm.Label start,
                               org.objectweb.asm.Label end,
                               org.objectweb.asm.Label handler,
                               java.lang.String type)
Specified by:
visitTryCatchBlock in interface org.objectweb.asm.MethodVisitor
Overrides:
visitTryCatchBlock in class org.objectweb.asm.MethodAdapter

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Description copied from class: RuleGeneratorAdapter
ensure we allow enough room for any extra locals on the stack

Specified by:
visitMaxs in interface org.objectweb.asm.MethodVisitor
Overrides:
visitMaxs in class RuleGeneratorAdapter

visitEnd

public void visitEnd()
Specified by:
visitEnd in interface org.objectweb.asm.MethodVisitor
Overrides:
visitEnd in class org.objectweb.asm.MethodAdapter

injectTriggerPoint

protected void injectTriggerPoint()
inject the rule trigger code



Copyright © 2012. All Rights Reserved.