Uh oh!
There was an error while loading. Please reload this page.
gh-129552: Make condition inside codegen_addop_load_const a macro - #129553
gh-129552: Make condition inside codegen_addop_load_const a macro#129553WolframAlph wants to merge 5 commits into
codegen_addop_load_const a macro#129553Conversation
f73717d to
e878644Compare
ZeroIntensity
left a comment
There was a problem hiding this comment.
I'd prefer this become an assertion.
picnixz
commented
Feb 1, 2025
I'd prefer removing the < 256 and keep the macro constant as this could be changed in the future. Currently this is 257 so it is indeed redundant but if we remove the < 256, we might want to rather decide whether to use LOAD_SMALL_INT opcode depending on the value of that macro rather than the hardcoded 256. |
picnixz
commented
Feb 1, 2025
Note: I remember I asked Mark about it at some point but forgot where I asked. I think we had assertions indeed but I don't remember whether we used the macro or a hardcoded constant. |
iritkatriel
commented
Feb 1, 2025
But aren't we also restricted by magnitude of oparg here? We probably don't want to use extended args for this. |
picnixz
commented
Feb 1, 2025
Ah yes.. the oparg. Right. Thanks Irit. That was the reason why we had the hardcoded 256. Nevermind my suggestion then, but we can keep an assertion as Peter suggested. |
WolframAlph
commented
Feb 1, 2025
Yes, at first I tried to remove 256 check but then realized that extended arg is generated in that case which I suppose is not desired behavior. What assertion and where? I don't quite get. |
picnixz
commented
Feb 1, 2025
In the if-block, just assert that it's also smaller than the |
It is already guarded by |
Assertions are cost-free but if the value of that macro (small ints) changes, we might have some surprises (as we would have an array OOB at some point I think, but only if we make it smaller than 256) Ideally I would prefer to have 256 as a macro to stress that it's for a non-extended oparg, as it could be confused with the max small posint but I think that this limit (256) is generally hardcoded. |
codegen_addop_load_constcodegen_addop_load_const a macroWolframAlph
commented
Feb 3, 2025
So based on #129568 (comment), I am leaving this condition as it is and converting it to a macro to be reused in CFG. cc @iritkatriel |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Closing this one as it will be done as part of another issue. |
codegen_addop_load_consta macro #129552