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

Cleanup Thread state transitions

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 17
    • Fix Version/s: 19
    • Component/s: hotspot
    • Labels:

      Description

      There are a couple of simplifications that can be done to the transition/transition wrapper code:

      - Consolidate ThreadBlockInVM and ThreadBlockInVMWithDeadlockCheck
      - Consolidate ThreadInVMfromJava and ThreadInVMfromJavaNoAsyncException
      - With little effort maybe we can also get rid of the transitional states (_thread_in_vm_trans, _thread_blocked_trans, etc) since we either are already in a safepoint unsafe state before checking for safepoints/handshakes or we can transition first to the desired safepoint unsafe state and then check for safepoint/handshakes.
      - Make clear which operations we need to check for when transitioning from one state to another(safepoint/handshake, suspend, async exceptions etc) and adjust wrappers if needed.
      - We call make_walkable() before transitioning to a safe state, but stack should always be walkable if we are in the vm and there is a last Java frame (_last_Java_sp != NULL). It seems the only issue could come from the compiler, since it can set _last_Java_sp but not _last_Java_pc, expecting it will be retrieved later from _last_Java_sp if we do need to walk the stack. For x86 and aarch64, _last_Java_pc is retrieved by doing _last_Java_pc = _last_Java_sp[-1]).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pchilanomate Patricio Chilano Mateo
              Reporter:
              pchilanomate Patricio Chilano Mateo
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: