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

Add NoThreadCurrentMark to simulate non-attached threads

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 20
    • hotspot

      When working on JDK-8293344, I needed a way to verify that the fix actually worked and that I had removed all usages of ResourceArea memory inside an extend.

      For that, a NoThreadCurrentMark was useful. It temporarily sets the current Thread* to NULL for the extend. Any use of Thread::current below that mark will now crash or assert.

      This can be used for two things:
      - guard code that is supposed to be safe for non-attached threads (os::malloc, stack printing, UL etc) against accidental usage of Thread::current() (e.g. resource area allocation)
      - in gtests, simulate a non-attached thread to cover code that behaves differently with Thread::current()==NULL.

            stuefe Thomas Stuefe
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: