Store and provide information about boolean expressions

Chris Newland cnewland at
Thu Aug 25 20:29:03 UTC 2016

Hi Stefan,

Sounds like an interesting project!

Is there a requirement to track this using HotSpot modifications? You
might be able to get what you need with bytecode instrumentation or by
modifying the javac compiler.

fyi: You might find the branch taken information output by the HotSpot C2
compiler useful while you're getting started.

Use the -XX:+UnlockDiagnosticVMOptions and -XX:+LogCompilation switches
and load the hotspot log file into JITWatch
( to get a visualisation like



On Thu, August 25, 2016 09:36, Stefan Schulz wrote:
> Hello,
> currently I'm working on my Master’s Thesis and I’m kind of lost. I’m new
> to OpenJDK development so please bear with me.
> The idea is so store detailed information about evaluated boolean
> expressions and provide it through JDI. Consider this example of a typical
> newcomer error:
> String a1 = “a“;
> String a2 = “a“;
> if (a1 == a2) { //Do something
> }
> I want so store the following information about the expression:
> - Value the expression evaluated to (false)
> - Kind of evaluation used (by object reference)
> - Compared values (object refences)
> This is my setup:
> - Ubuntu 16.04.1
> - x86_64 architecture
> - OpenJDK 9 with Jigsaw bootstrapped by OpenJDK 8 from the Ubuntu software
> repos - Netbeans 8.1
> - JVM is running in interpreter mode using the XInt-flag for simplicity’s
> sake
> My first approach was to look for occurrences of the bytecodes if_acmpne
> and if_acmpeq in the code, and just print the results when the instruction
> is resolved. I’m having a hard time to find the exact point where they are
> interpreted. Since the example application initializes the String values
> right before they are compared, I know that the bytecode invokespecial
> (where the String constructor is called) needs to be run twice
> beforehand.
> I’ve been able to track those invocations down to calls of
> hotspot/src/share/vm/runtime/javaCalls::call_special,
> but I don’t understand how the comparison is executed afterwards. I’ve
> attached the example code I’m analyzing.
> Could you point me to a direction or explain to me how this is
> implemented?
> Best regards,
> Stefan

More information about the hotspot-runtime-dev mailing list