chord.instr
Class TraceTransformer

java.lang.Object
  extended by chord.instr.TraceTransformer

public class TraceTransformer
extends java.lang.Object

Functionality for transforming a trace of events containing BEF_NEW and AFT_NEW events, generated by an instrumented program's execution, into a trace containing NEW events.

In the original trace, it is not possible to get the address of the object allocated by a NEW bytecode instruction immediately after that instruction has executed. JVMs typically forbid accessing the just allocated object until its constructor has finished executing. Thus, the earliest legal point at which the object's address may be obtained is typically after several other bytecode instructions have been executed.

To remedy this problem, the original trace generates the "BEF_NEW h t" event just before the NEW instruction uniquely identified by h is executed by thread t, and the "AFT_NEW h t o" event just after the constructor of the object allocated by that NEW instruction has finished executing. The h and t fields in the AFT_NEW event are used by this trace transformer to find the matching BEF_NEW event. It then replaces that BEF_NEW event with a "NEW h t o" event and removes the AFT_NEW event. Thus, the resulting trace contains only NEW events, no BEF_NEW or AFT_NEW events.

Recognized system properties:

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

Constructor Summary
TraceTransformer(java.lang.String rdFileName, java.lang.String wrFileName, InstrScheme scheme)
          Initializes a trace transformer.
 
Method Summary
 void run()
          Runs the trace transformer which creates a new trace that eliminates each "AFT_NEW h t o" event from the original trace and replaces the matching "BEF_NEW h t" event in the original trace by a new event "NEW h t o" in the transformed trace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceTransformer

public TraceTransformer(java.lang.String rdFileName,
                        java.lang.String wrFileName,
                        InstrScheme scheme)
Initializes a trace transformer.

Parameters:
rdFileName - The location of the file from which the original trace must be read.
wrFileName - The locaiton of the file to which the transformed trace must be written.
scheme - The instrumentation scheme specifying the format of the original trace.
Method Detail

run

public void run()
Runs the trace transformer which creates a new trace that eliminates each "AFT_NEW h t o" event from the original trace and replaces the matching "BEF_NEW h t" event in the original trace by a new event "NEW h t o" in the transformed trace.