Review request: White box testing API for HotSpot
mikael.gerdin at oracle.com
Tue Nov 29 08:04:23 PST 2011
I've been working on a white box testing API for HotSpot in order to
allow for improved precision in vm testing.
The basic idea is to open up the possibility for tests written in Java
to call native methods which query or poke the vm in some way.
The API is accessible by using the class sun/hotspot/WhiteBox which is
not intended to be available in public builds.
In order to allow the WhiteBox class access to the VM the
registerNatives function is linked to JVM_RegisterWhiteBoxMethods. That
function then links all the implementation functions using normal JNI
The API is not meant to be used by end users for any intent or purpose
and as such it is both guarded by "-XX:+UnlockDiagnosticVMOptions
-XX:+EnableWhiteboxAPI" and the fact that the class files will not be
present in an end user build of a JDK.
If the VM crashes after this API has been accessed a note will be
written in the hs_err file to signal that the API has been used.
(thanks to stefank for hosting my webrev :)
I'll file a CR tomorrow.
Add a test target to make sure that the API is available on all
Makefile changes to build the class sun/hotspot/WhiteBox, put it in a
JAR file and copy it to the jre/lib/endorsed directory in the export
The BSD makefile changes are not tested since I don't have access to any
BSD/OSX machine to test them on.
Special-case the method sun/hotspot/WhiteBox/registerNatives and link it
The implementation of the white box API. The actual API functions are
only examples of what we want to be able to do using the API.
Add the command line flag
Print a message in hs_err files when white box API has been used.
Add a makefile test target for the white box API test
JTreg test to ensure that the API works.
More information about the hotspot-dev