-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Consistently DCHECK the index >= 0 in value store getters #6310
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: trunk
Are you sure you want to change the base?
Conversation
|
|
It looks like, before this change, Am I misunderstanding something? @dwblaikie do you have thoughts on this change? |
yes but it took me extra work to understand what had gone wrong every time I ended up in a failure in GetRawIndex() instead of in Add/Get, so I would really prefer to keep them up at the higher level in the stack. |
|
On #6308, you say:
I assume you're referring to:
It looks like the main difference is you're printing |
I think it would help definitely. But it still feels misleading, I keep reading it as being a problem related to tagging somehow, as it's in the tagging helper functions, rather than being at the entry point where I passed in the bad ID. |
|
I'd tend to prefer to keep the check as low as it can go, to reduce the chance it gets missed in some callers in the future. Would rephrasing/adding some more words to the check help with the contextual confusion? |
Instead of DCHECKing inside GetRawIndex sometimes and in the Get/Add methods other times, consistently DCHECK as far up the call stack as possible by deferring the DCHECK to the Get/Add methods, through a new TryGetRawIndex that passes through untagged id indices such as None.
Keep the GetRawIndex method around with the DCHECK for other callers, as we often call that and then index into some other array with it, and the DCHECK makes good sense there for those callers.
Make the IdTag relationship between RelationalValueStore and ValueStore more clear. They have the same ID values, as they have the same indices and the same IdTag.