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

Update comment on java_suspend_self_with_safepoint_check()

XMLWordPrintable

    • b17

      The comment on JavaThread::java_suspend_self_with_safepoint_check() should be updated [1]

      The comment states "Because this thread is external suspended the safepoint code will count it as at a safepoint, regardless of what its actual current thread-state is"

      After JDK-8252414 this is not the case anymore. Suspend flags are not regarded when deciding if a thread is safepoint/handshake safe.

      The statement "However, not all initial-states are allowed when performing a safepoint check, as we should never be blocking at a safepoint whilst in those states. Of these 'bad' states only _thread_in_native is possible when executing this code (based on our two callers)" does not name all of the problematic states. This can cause uncertainty with the reader. The comment should point to SafepointSynchronize::block() where the 'good' states are enumerated in the switch statement [2].

      [1] https://github.com/openjdk/jdk/blob/1c84cfa2364fa18fc028df89bdc4de207365784f/src/hotspot/share/runtime/thread.cpp#L2593

      [2] States that are allowed when performing a safepoint check
           https://github.com/openjdk/jdk/blob/a9993f9464a724637b3d38bd2f6caedf884d3e0b/src/hotspot/share/runtime/safepoint.cpp#L715

            rrich Richard Reingruber
            rrich Richard Reingruber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: