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.
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.
- relates to
-
JDK-8293344 JDK-8242181 broke stack printing for non-attached threads
-
- Resolved
-
- links to
-
Review openjdk/jdk/10178