Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8318528

Rename TestUnstructuredLocking test

    XMLWordPrintable

Details

    • b21

    Backports

      Description

        JVMS has a very specific meaning to structured locking:
        https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-2.html#jvms-2.11.10

        It reads as, "anywhere in the method, do not unlock the monitors the method have not locked, and do not leave locked monitors that method does not unlock". (Arguably, a better name that is sometimes mentioned in OpenJDK is "block-structured locking": https://github.com/openjdk/jdk/blob/9cf334fb6488188ea4236e5d156b11245bace88f/src/hotspot/cpu/x86/interp_masm_x86.cpp#L1070-L1072)

        It does not actually say anything about the case where two monitors are locked and unlocked in non-stack fashion within the method, which is what test simulates. Compiler code calls this situation "(un) balanced monitors":
        https://github.com/openjdk/jdk/blob/9cf334fb6488188ea4236e5d156b11245bace88f/src/hotspot/share/ci/ciMethod.cpp#L284-L288

        I would not bother about this normally, but I have just spent half an hour discussing this test, structured locking, and balanced monitors with someone who was confused about the whole thing. The test name was the starting point of that confusion. I think it would be clean to name the test appropriately to avoid further confusion.

        Attachments

          Issue Links

            Activity

              People

                shade Aleksey Shipilev
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: