Store and provide information about boolean expressions

Ivan Krylov at
Thu Aug 25 10:56:21 UTC 2016

Hi Stefan,

First, regarding the example: what do you want to compare, strings or 
references? Here it is sort of special, since this string literal is in 
a constant pool and both references are pointing to it.
I guess you might want to start with comparing either integers or 
references. String comparison in java 9 got a much more complicated with 
compact strings, compact strings, etc. So 1 step at a time, if you want 
to store a result of a boolean evaluation, start with primitives or 

Second, the template interpreter is not an easy thing to trace. Each 
bytecode like if_acmpeq is portion in a large template code blob. If you 
are comfortable with reading x86 assembly, use the -XX:+PrintInterpreter 
to learn how the interpreter does the the comparisons. is a good 
reference. Hacking on the template interpreter is even more... fun 
because it mixes the java and the native stacks in a frame. But the next 
thing for you would be to find the hotspot code that contains templates 
and uses that code to generate the actual interpreter.

You can look up some videos that talk about the Runtime mechanics, 
including the template interpreter, and how to monitor/debug hotspot. 
Look for videos from Volker Simonis or Chris Newland. If by chance you 
are at JavaZone in two weeks - I will have a couple of slides on the 
template interpreter in my talk.



On 25/08/16 11: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