You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private final int require;
...
private final int ret;
And a comment describes them as : in-args,out-args
But they are not what is seems.
require is really a stack lookupDepth. ret cannot be easily explained, it is basically (lookupDepth+pushCount).
I suggest removing ret and require and replace them with 3 arguments: (lookupDepth, popCount, pushCount).
While popCount won't be referenced in the code, it's useful to have it as reference and for debugging.
For most opcodes the definition won't change. For DUPx, SWAPx, DUPN, SWAPN it will change.
verifyStackOverflow() will also need to be modified.
The text was updated successfully, but these errors were encountered:
SergioDemianLerner
changed the title
Opcode.java fields (require,ret) are wrongly named, replace them with (lookupDepth, popCount, and pushCount)
Opcode.java fields (require,ret) are wrongly named, replace them with (lookupDepth, popCount, pushCount)
Aug 3, 2022
I think the original meaning was that you could implement those opcodes by removing all elements until lookupDepth, and them pushing back the same elements plus pushCount.
Not very intuitive, because that's not how it is implemented, but that was the code author's idea.
this will require to refactor all opcodes in the OpCode enum, won't it? Seems there are a lot of them. Can we just add toString() method to that enum, so that we could print opcode internals in a format that fits our debugging purposes?
I don't mind doing the re-factor. In all cases except DUPx, SWAPx, DUPN, SWAPN, it will be simply duplicating the "retire" value so the line: ADD(0x01, 2, 1, VERY_LOW_TIER),
will become: ADD(0x01, 2, 2, 1, VERY_LOW_TIER),
The Opcode class has the fields:
And a comment describes them as : in-args,out-args
But they are not what is seems.
require
is really a stack lookupDepth.ret
cannot be easily explained, it is basically (lookupDepth+pushCount
).I suggest removing
ret
andrequire
and replace them with 3 arguments: (lookupDepth
,popCount
,pushCount
).While
popCount
won't be referenced in the code, it's useful to have it as reference and for debugging.For most opcodes the definition won't change. For DUPx, SWAPx, DUPN, SWAPN it will change.
verifyStackOverflow()
will also need to be modified.The text was updated successfully, but these errors were encountered: