RFR: 8333235: vmTestbase/nsk/jdb/kill/kill001/kill001.java fails with C1

Serguei Spitsyn sspitsyn at openjdk.org
Tue Jun 4 21:18:56 UTC 2024


On Tue, 4 Jun 2024 21:05:40 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java line 153:
>> 
>>> 151:         }
>>> 152:     }
>>> 153: 
>> 
>> Have you tried an empty method? I don't think it's a matter of how much time you spend in the method, but just whether or not a JVM async exception polling point is reached. I suspect the method call or return will be a polling point, but I'm unsure what happens if the method call is elided by the JIT because it does nothing.
>
> The empty method is removed. So test failing with '-Xcomp /C2' and exception happens after try block.
> 
> The log shows:
> reply[2]: main[1] 
> Sending command: cont
> reply[0]: > 
> reply[1]: Exception occurred: java.lang.NullPointerException (to be caught at: nsk.jdb.kill.kill001.MyThread.run(), line=165 bci=107)"thread=MyThread-1", nsk.jdb.kill.kill001.MyThread.run(), line=164 bci=100
> reply[2]: 164                methodForException();
> reply[3]: 
> reply[4]: MyThread-1[1] 
> Sending command: cont
> reply[0]: > 
> reply[1]: Exception occurred: nsk.jdb.kill.kill001.MyException (uncaught)
> reply[2]: Exception occurred: nsk.jdb.kill.kill001.MyException (uncaught)"thread=MyThread-4", nsk.jdb.kill.kill001.MyThread.run(), line=178 bci=187
> reply[3]: 178            kill001a.log.display(ThreadFinished);
> reply[4]: 
> reply[5]: MyThread-4[1] 
> Sending command: cont
> reply[0]: > 
> reply[1]: Exception occurred: com.sun.jdi.IncompatibleThreadStateException (uncaught)
> reply[2]: Exception occurred: com.sun.jdi.IncompatibleThreadStateException (uncaught)"thread=MyThread-3", nsk.share.Log.display(), line=327 bci=9
> reply[3]: 327                doPrint(message.toString());
> reply[4]: 
> reply[5]: MyThread-3[1] 
> Sending command: cont
> reply[0]: > Thread MyThread-1 caught expected async exception: java.lang.NullPointerException: kill001a's Exception
> reply[1]: Thread finished: MyThread-1
> reply[2]: 
> reply[3]: Exception occurred: java.lang.ThreadDeath (uncaught)
> reply[4]: Exception occurred: java.lang.ThreadDeath (uncaught)"thread=MyThread-0", nsk.share.Log.doPrint(), line=495 bci=1
> reply[5]: 495            PrintStream stream = findOutStream();
> reply[6]: 
> reply[7]: MyThread-0[1] 
> Sending command: cont
> reply[0]: > 
> reply[1]: Exception occurred: java.lang.SecurityException (uncaught)
> reply[2]: Exception occurred: java.lang.SecurityException (uncaught)"thread=MyThread-2", nsk.share.Log.doPrint(), line=495 bci=1
> reply[3]: 495            PrintStream stream = findOutStream();

Empty method could work but the JIT compiler can optimize it out with inlining.
But the loop is not needed. Something like this would work:

   static public int trash;
    void methodForException() {
        trash = 10;
    }

But I'm not sure if the static variable value needs to be used from outside of this method. I'm afraid, the Escape Analysis can spoil this. :)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19547#discussion_r1626612160


More information about the serviceability-dev mailing list