public class DynamicCallGraphOrganizer extends Organizer
It communicates with an edge listener through a integer array, denoted buffer. When this organizer is woken up via threshold reached, it processes the sequence of triples that are contained in buffer.
After processing the buffer and updating the dynamic call graph, it optionally notifies the AdaptiveInliningOrganizer who is responsible for analyzing the dynamic call graph for the purposes of feedback-directed inlining.
Note: Since this information is intended to drive feedback-directed inlining, the organizer drops edges that are not relevant. For example, one of the methods is a native method, or the callee is a runtime service routine and thus can't be inlined into its caller even if it is reported as hot. Thus, the call graph may not contain some hot edges since they aren't viable inlining candidates. One may argue that this is not the right design. Perhaps instead the edges should be present for profiling purposes, but not reported as inlining candidates to the
EXPECTATION: buffer is filled all the way up with triples.
Modifier and Type | Field and Description |
---|---|
private int[] |
buffer
buffer provides the communication channel between the edge listener
and the organizer.
|
private int |
bufferSize
the buffer's size, i.e. length of
buffer |
private static boolean |
DEBUG |
private int |
numberOfBufferTriples
the maximum number of triples contained in buffer
|
private int |
thresholdReachedCount
Countdown of times we have to have called thresholdReached before
we believe the call graph has enough samples that it is reasonable
to use it to guide profile-directed inlining.
|
rvmThread
Constructor and Description |
---|
DynamicCallGraphOrganizer(EdgeListener edgeListener)
Constructs a new dynamic call graph organizer that will get its data from the given edge listener.
|
Modifier and Type | Method and Description |
---|---|
void |
initialize()
Initialization: set up data structures and sampling objects.
|
boolean |
someDataAvailable()
Checks if the dynamic call graph organizer has gathered and processed enough samples to support decisions.
|
(package private) void |
thresholdReached()
Process contents of buffer:
add call graph edges and increment their weights.
|
activate, report, run
getRVMThread, start, stop
private static final boolean DEBUG
private int[] buffer
The buffer contains an array of triples <callee, caller, address>
where
the caller and callee are CompiledMethodID's, and address identifies
the call site.
The edge listener adds triples.
At some point the listener deregisters itself and notifies the organizer
by calling thresholdReached().
private int bufferSize
buffer
private int numberOfBufferTriples
private int thresholdReachedCount
public DynamicCallGraphOrganizer(EdgeListener edgeListener)
edgeListener
- the listener that provides data for this organizerpublic void initialize()
Uses either timer based sampling or counter based sampling,
depending on Controller.options
.
initialize
in class Organizer
void thresholdReached()
thresholdReached
in class Organizer
public boolean someDataAvailable()
true
if enough data is available, false
otherwise