openj9
openj9 copied to clipboard
Update jvmtiGetThreadGroupChildren for java 19
The ThreadGroup class does not store its threads anymore and child groups are separated into "groups" and "weaks" ThreadGroup arrays.
The child ThreadGroups array is populated from the ThreadGroup's "groups" and "weaks" arrays, which are the child ThreadGroups that are strongly and weakly reachable from the parent.
The threads array is constructed by iterating over all J9VMThreads and adding the threads that belong in the given ThreadGroup.
The returned arrays are constructed while locking on the ThreadGroup object.
Fixes: #15244 Issue: #15183 Signed-off-by: Eric Yang [email protected]
Test in linked issue passes with these changes
@EricYangIBM The commits can be squashed.
@tajila These changes should work fine. But, still doubtful about the memory allocated for threads
and groups
arrays which are returned from this method (see comments inlined in code). Should we create new arrays with smaller/required size and copy the elements from the bigger array and free the bigger array?
But, still doubtful about the memory allocated for threads and groups arrays which are returned from this method (see comments inlined in code). Should we create new arrays with smaller/required size and copy the elements from the bigger array and free the bigger array?
This is not going to return vthreads correct? If so, then I dont think returning a potentially larger buffer is a big deal as platform threads arent created as frequently
It could be an optimization that is added later
This is not going to return vthreads correct?
Vthreads will not be returned. See ref below. @EricYangIBM Can you add a comment in code and open an issue regarding this optimization for tracking purposes?
Ref: https://download.java.net/java/early_access/jdk19/docs/specs/jvmti.html#GetThreadGroupChildren
I will open the issue after this PR is merged (to link to the comment)
LGTM. The commits need to be squashed before the PR builds are launched.
Squashed
jenkins compile win jdk19,jdk17
Does not work for me yet. Need to wait for @AdamBrousseau to add me.
jenkins compile win jdk19,jdk17
jenkins test sanity amac jdk19,jdk17
These JVMTI changes should only impact the gtgc001
test, which has been enabled and passes for JDK17 and JDK19.
https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.functional_aarch64_mac_Personal/75/
jit_vich_0_FAILED
is unrelated to this PR. All tests in this suite pass but there is an error at the end (Invalid JIT return address
).
===============================================
JIT_Test suite
Total tests run: 18, Failures: 0, Skips: 0
===============================================
*** Invalid JIT return address 000000037A4175E0 in 000000016FBDFD98
jit_vich_0_FAILED
Still can't merge the PR. Need to wait for @AdamBrousseau to give the required permissions.
Still can't merge the PR
This is an Eclipse Github team thing. It should be automatic. If it's not working then I would open an Eclipse ticket. https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues?sort=created_date&state=opened