Added decoding for static references#1091
Conversation
mariaKt
left a comment
There was a problem hiding this comment.
Because statics have a symbol name, due to reduce_to now maintaining statics, they end up into the functions map as well.
Here is the path:
reduce_tokeeps the static item, so it appears inSMIRInfo.items(smir.py:94, indexed bysymbol_name).function_symbols(smir.py:128) buildsmissingfrom ALLitems.keys()not already in the functions table. The static's symbol isn't in that table, so it gets added and assigned a fake negativeTy(fake_ty = -2, -3, …).
Now, every step that is followed for the functions (function_symbols_reverse,_functions), is similarly followed for the statics because they have a symbol, so they end up in the function map.
This is probably OK for correctness, because the negative Tys are never used as a call target, so the keys associated with statics are never looked up that way. But:
- the function map is already large; there's no need to bloat it further with entries that are never used.
- it's conceptually wrong: a static is not a function and shouldn't be in the functions map. While I see that they are both global objects and a common data structure with both can be useful (e.g., for addressing), I don't think that that data structure should be the functions map.
This can be addressed by restricting the missing computation to function items only, so only genuine functions get synthesized Tys, or another way if you prefer. Either in this PR or a quick follow-up, whichever is easier, no need to block this. It shouldn't affect the static decoding added by this PR, since it reads from the separate new statics property, not from the function map.
|
@mariaKt good catch with the function symbols and statics mix up, thank you. |
40 new passing tests (this PR and PR #1091: static refs)
40 new passing tests (this PR and PR #1091: static refs)
Added decoding for static references:
reduce_toto keep the static itemsdecoding.py