[exp] RFR: Value bytecode trace events

David Simms david.simms at oracle.com
Mon Mar 12 10:58:22 UTC 2018


For the"experimental" branch (exp) of the Valhalla repository, to aid 
with discovering what code does with value based classes at runtime. A 
patch that generates events for certain value use cases we are concerned 
over for "lworld" prototyping:

http://cr.openjdk.java.net/~dsimms/valhalla/valueevents/webrev0/

Using trace framework is more powerful than logging (minimal overhead, 
built in stack traces, tools for viewing). Unfortunately, flight 
recorder is not open just yet, but soon(TM) - sorry about that.

For classes defined as "value based" by "-XX:ValueBasedClasses=" ("exp" 
branch defaults to all current javadoc "value-based"), the following 
events are produced (see traceevents.xml):

  * ValueDefined: the JVM defines a "value based" class
  * ValueAcmp: ifacmp_eq/ne compares an instance of "value based" class
    in bytecode
  * ValueHashCode: "System.identityHashCode()" or JVM Object.hashCode()
    is called on an instance of "value based" class (not user defined,
    was too lazy)
  * ValueMonitorEnter: when "monitorenter" bytecode or synchronized
    method locks an instance of a "value based" class.
  * ValueMonitorWait/Notify: when wait/notify are used on an instance of
    a "value based" class.

Since some of the bytecode implementation is a little sensitive, there 
is a further flag " -XX:+ValueBytecodeEvents" to enable event code gen. 
All events are instant and generate stack trace, so one may later 
inspect code for suspect behavior.

For the most part these events are generated from the interpreter only. 
The are for discovery of code patterns, and extra work for the JIT won't 
reveal so much more information.

Just putting this patch out there for comment, otherwise will be using 
to aid further investigation.

/D





More information about the valhalla-dev mailing list