chord.runtime
Class BasicEventHandler

java.lang.Object
  extended by chord.runtime.BasicEventHandler
Direct Known Subclasses:
TraceEventHandler

public class BasicEventHandler
extends java.lang.Object

Basic handler of events generated during an instrumented program's execution for use by single-JVM dynamic analyses. Methods init(String) and done() are called when event handling starts and ends, respectively, at runtime. Who calls these methods depends upon whether or not the dynamic analysis using this event handler uses JVMTI (see BasicDynamicAnalysis.useJvmti()): - If it uses JVMTI, then these methods are called from the JVMTI agent implemented in main/agent/; see that directory for more details. - If it does not use JVMTI, then calls to these methods are injected by the instrumentor at the entry and exit of the bytecode of the main method of the analyzed program; see the constructor of class BasicInstrumentor for more details.

Author:
Mayur Naik (mhn@cs.stanford.edu)

Field Summary
protected static int currentId
          Unique ID given to each object created at runtime.
protected static WeakIdentityHashMap objmap
           
protected static boolean trace
          Flag determining when it is safe to start handling events at runtime.
 
Constructor Summary
BasicEventHandler()
           
 
Method Summary
static void done()
          Method signaling the end of event handling by a dynamic analysis.
static int getObjectId(java.lang.Object o)
           
static long getPrimitiveId(int oId, int fId)
           
static void init(java.lang.String args)
          Method signaling the start of event handling by a dynamic analysis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trace

protected static boolean trace
Flag determining when it is safe to start handling events at runtime. It is false when the JVM starts. It is set to true in the init(String) method which is called by the handler for the JVMTI event "VMInit" (see file main/src/agent/chord_instr_agent.cpp for the definition of this handler).


currentId

protected static int currentId
Unique ID given to each object created at runtime. ID 0 is reserved for null and ID 1 is reserved for the hypothetical lone object of a hypothetical class all of whose instance fields are static fields in other real classes.


objmap

protected static WeakIdentityHashMap objmap
Constructor Detail

BasicEventHandler

public BasicEventHandler()
Method Detail

getObjectId

public static int getObjectId(java.lang.Object o)

getPrimitiveId

public static long getPrimitiveId(int oId,
                                  int fId)

init

public static void init(java.lang.String args)
Method signaling the start of event handling by a dynamic analysis. See the documentation of this class for more details.


done

public static void done()
Method signaling the end of event handling by a dynamic analysis. See the documentation of this class for more details.