alt.jiapi.util
Class HotSpotAdvisor

java.lang.Object
  extended by alt.jiapi.util.HotSpotAdvisor

public class HotSpotAdvisor
extends java.lang.Object

HotSpotAdvisor is used to copy instructions from HotSpotAdvice to class being instrumented. This makes it possible to instrument target classes without any knowledge about Java bytecodes or instruction set.

Conseptually, this class, with the aid of HotSpotAdvise, provides the same thing as AspectJs' join-point, before advice, after advice and around advice.

At some point in time, we might add point-cut semantics here. At the moment, point-cut semantics can be simulated to some extent with the aid of InstrumentationDescriptor

At the moment there is not such thing as HotSpotContext. For example, HotSpotAdvice knows, that an invocation is being made, but it does not know what are the call parameters of the invocation, and it does not know what the invocation returned.

Future versions of HotSpotAdvice might have this knowledge.

See Also:
HotSpotAdvice, for the definition of hotspot

Field Summary
static byte[] FIELD_ACCESSES
          This field can be used in constructor to search for hotspots, that do some sort of field access.
static byte[] INVOCATIONS
          This field can be used in constructor to search for any invocations being made.
static byte[] RETURNS
          This field can be used in constructor to search for hotspots, that makes a method return normally.
 
Constructor Summary
HotSpotAdvisor(InstrumentationDescriptor id, HotSpotAdvice advice, byte hotSpot)
          Creates new HotSpotAdvisor.
HotSpotAdvisor(InstrumentationDescriptor id, HotSpotAdvice advice, byte[] hotSpots)
          Creates new HotSpotAdvisor.
HotSpotAdvisor(InstrumentationDescriptor id, HotSpotAdvice advice, byte[] hotSpots, java.lang.String resolution)
          Creates new HotSpotAdvisor.
 
Method Summary
 void checkForBranchTarget(Instruction firstHotSpotInstruction, InstructionList methodList, Instruction firstBeforeInstruction)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_ACCESSES

public static final byte[] FIELD_ACCESSES
This field can be used in constructor to search for hotspots, that do some sort of field access. Like get or set field.


INVOCATIONS

public static final byte[] INVOCATIONS
This field can be used in constructor to search for any invocations being made. Note, that a call to super classes' constructor, is technically just an invocation. If you like to exclude calls to super class constructor, define your own byte array like this:
    byte[] invocations = new byte[] {
        Opcodes.INVOKESTATIC,
        Opcodes.INVOKEVIRTUAL,
        Opcodes.INVOKEINTERFACE
    };
 


RETURNS

public static final byte[] RETURNS
This field can be used in constructor to search for hotspots, that makes a method return normally.

Constructor Detail

HotSpotAdvisor

public HotSpotAdvisor(InstrumentationDescriptor id,
                      HotSpotAdvice advice,
                      byte hotSpot)
Creates new HotSpotAdvisor.

Parameters:
id - InstrumentationDescriptor to use. A Special instruction copy Instrumentor is added to this descriptor, so users should only add inclusion/exclusion rules to descriptor.
advice - A HotSpotAdvice where instructions to be copied are taken.
hotSpot - this byte represents an opcode of the hotspot.
See Also:
Opcodes

HotSpotAdvisor

public HotSpotAdvisor(InstrumentationDescriptor id,
                      HotSpotAdvice advice,
                      byte[] hotSpots)
Creates new HotSpotAdvisor.

Parameters:
id - InstrumentationDescriptor to use. A Special instruction copy Instrumentor is added to this descriptor, so users should only add inclusion/exclusion rules to descriptor.
advice - A HotSpotAdvice where instructions to be copied are taken.
hotSpots - an array of bytes. Each byte represents an opcode of the hotspot. So, multiple opcodes may be used.
See Also:
INVOCATIONS, RETURNS, FIELD_ACCESSES, Opcodes, OpcodeGroups

HotSpotAdvisor

public HotSpotAdvisor(InstrumentationDescriptor id,
                      HotSpotAdvice advice,
                      byte[] hotSpots,
                      java.lang.String resolution)
Creates new HotSpotAdvisor.

Parameters:
id - InstrumentationDescriptor to use. A Special instruction copy Instrumentor is added to this descriptor, so users should only add inclusion/exclusion rules to descriptor.
advice - A HotSpotAdvice where instructions to be copied are taken.
hotSpots - an array of bytes. Each byte represents an opcode of the hotspot. So, multiple opcodes may be used.
See Also:
INVOCATIONS, RETURNS, FIELD_ACCESSES, Opcodes, OpcodeGroups
Method Detail

checkForBranchTarget

public void checkForBranchTarget(Instruction firstHotSpotInstruction,
                                 InstructionList methodList,
                                 Instruction firstBeforeInstruction)


Copyright © 2001. Documenation generated August 26 2011.