On Wed, 8 May 2024 22:10:29 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> In fact, I do not understand why reporting the "rank order" violation is >> important what "leaf rank order" is violated. I feel that I'm missing >> something. Let me think on it a little bit. > > If the following are all true > - you are entering is a leaf monitor > - the current thread has already entered a leaf monitor > - the rank of the monitor you are entering is lower than the rank of the > monitor already held > > Then you have both a rank order violation and a violation for entering a leaf > monitor when you have already entered a leaf monitor. My current > implementation will complain about the rank violation (although can easily be > made to instead complain about the leaf violation or complain about both). > Yours will complain about the leaf violation. To make yours instead complain > about the rank violation, the first loop needs to also check all the leaf > monitors. Since the 2nd loop also checks all the leaf monitors (but for a > different reason), this means iterating over the leaf monitors twice. > Complaining about both violations would also require iterating over the leaf > monitors twice. Okay, thanks. > Then you have both a rank order violation and a violation for entering a leaf > monitor when you have already entered a leaf monitor. I kind of disagree with the second part of this statement. My understanding is that the second loop does a little bit different check: "Violation for entering ANY monitor when you have already entered a leaf monitor." Please, note that `rank` can be any rank including those with conditions: rank < FIRST_LEAF_DEBUG_RAW_MONITOR rank >= FIRST_LEAF_DEBUG_RAW_MONITOR ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19044#discussion_r1594776344