Store and provide information about boolean expressions

Stefan Schulz schulzs at Mathematik.Uni-Marburg.de
Thu Aug 25 08:36:09 UTC 2016


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