RFR: 8316958: Add test for unstructured locking

David Holmes dholmes at openjdk.org
Tue Sep 26 21:36:14 UTC 2023


On Tue, 26 Sep 2023 14:13:08 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> In my original lightweight-locking PR, I had a testcase that exercises unstructured locking, which is permitted by the JVM spec, but not generated by javac, and thus not executed anywhere. JITs don't compile unstructured-locked code, therefore any code which attempts this would be slow anyway.
> 
> Testing:
>  - [x] runtime/locking

Good ides to have a test. I think we actually have a JNI-based unstructured locking testcase but not a bytecode one. One suggestion/request below.

Thanks

test/hotspot/jtreg/runtime/locking/TestUnstructuredLocking.jasm line 29:

> 27:  * @summary Check that monitorenter A; monitorenter B; monitorexit A; monitorexit B; works
> 28:  * @compile TestUnstructuredLocking.jasm
> 29:  * @run main/othervm -Xint TestUnstructuredLocking

I would add an Xcomp case to ensure the JIT really doesn't try to compile this, and that it still works.

test/hotspot/jtreg/runtime/locking/TestUnstructuredLocking.jasm line 50:

> 48:         monitorexit;
> 49:         aload_2;
> 50:         invokevirtual Method java/lang/Object.notify:"()V";

Curious why this is needed.

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15925#pullrequestreview-1645232636
PR Review Comment: https://git.openjdk.org/jdk/pull/15925#discussion_r1337800958
PR Review Comment: https://git.openjdk.org/jdk/pull/15925#discussion_r1337802639


More information about the hotspot-runtime-dev mailing list