-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[cling] The LookupHelper routines need the ROOT lock. #18522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Those routines are at the very least looking up information into Clang and thus need to prevent concurrent updates. Some of the routines can also sometimes induces changes in Clang (eg. template instantiation).
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit d70a2f4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks fine to me, thanks, provided that I understood correctly what was the role of the RAII (the header cannot be found)
Why not locking the underlying interface in the LookupHelper? |
Because one need to lock both the (potential) write access and the read accesses. For example in
The lock needs to be held during both the 1st (because of potential modification by this thread) and the last line (because of potential modification by another thread) We could improve the scaling further by leveraging the fact that the ROOT lock is a read-write lock but that level of granularity is not available from Cling yet. |
The header is |
Why the read access? Do you mean because read access sometimes mutates the AST? |
No. Because another thread might mutate the area you are reading for example:
and
Then during As long as there is 'destructive' or The general rule we have been trying (and only incompletely succeeding) to always hold the ROOT lock when accessing Clang/Cling information. |
Those routines are at the very least looking up information into Clang and thus need to prevent concurrent updates. Some of the routines can also sometimes induces changes in Clang (eg. template instantiation).
This fixes #18520 and #18519