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

APIs that require JavaThread should take JavaThread arguments

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 16
    • Fix Version/s: 17
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b23

      Description

      For a variety of historical reasons we tend to use "Thread*" as a parameter type widely throughout the VM (in particular this is likely due to the use of TRAPS/CHECK* and the fanout therefrom). In many cases though the first thing a method does is cast the Thread* to JavaThread* as it "must be a JavaThread". We should look at changing those APIs so that they take a JavaThread* parameter to begin with.

      This will also impact the definition of JVM_ENTRY/JNI_ENTRY etc which typically declare:

      JavaThread * thread = JavaThreadCurrent();
      Thread* THREAD = thread; // Needed for CHECK macro

      and the TRAPS macro (as exceptions should only be relevant to JavaThreads in the first place).

      This may also lead into related refactoring of the Thread hierarchy as there are things in Thread that really only pertain to JavaThread (or at least Java-executing threads, which not be exactly the same thing - TBD).

      It isn't clear how far we can unravel this and clean up the APIs, but it is worth investigating.

      This will also lead into cleanups in the ObjectMonitor code to rationalise the use of Self/THREAD/jt.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dholmes David Holmes
              Reporter:
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: