On Wed, 5 May 2021 20:59:01 GMT, Leonid Mesnik <[email protected]> wrote:
>> Class loading can happen on different threads, but HotSwap agent is not >> ready to this - classCount variable is used without any synchronization. >> The fix adds synchronization for ClassFileLoadHook. > > test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp line 71: > >> 69: static int classCount = 0; >> 70: /* lock to access classCount */ >> 71: static jrawMonitorID classLoadLock = NULL; > > I think it would simpler to use an atomic counter rather than monitors for > this fix. Do you mean use <atomic> from STL? I'm not sure it would be simpler as we need logic like "get the value, if the value is less than max_classes, increment it" ------------- PR: https://git.openjdk.java.net/jdk/pull/3889
