Discussion: Let's minimize our instruction set #61
jonasstrehle
started this conversation in
General
Replies: 1 comment
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Soo, just stumbled across the question if we really want to introduce instruction codes per operator and keyword etc.
Like there is the advantage that the decompilation would look great if we get a 1 to 1 mapping of the initial script, but also here we're going to run into issues once we implement branching or other more complex stuff such as loops, where without specific markers the decompiler can not tell what the initial script did exactly look like. Yeah, this is fancy and nice to have but shouldn't be our key focus here.
We should try to keep the whole instruction set as minimum as possible, not just because we are already on like 190 instructions by now (not all of them are implemented but you get the point).
Let's consider the operators for equality, do we have a point to declare operands such as
or does it make sense to implement some negation (what we need in any case for boolean toggles
!) to at least break it down to half of the instructions so the chain looks more likeneg(strict_equal(a, b))instead ofneg_strict_equal(a, b)? The issue is that we don't know if the operator used a negation or the negative variant of the operator then for decompilation, but I suppose this is a good tradeoff.Furthermore we could also get rid of such things as EQUAL_OR_SMALLER and just switch both of the operands for the compilation for the reverse case and use EQUAL_OR_GREATER then (or even
(a EQUALS b || a GREATER b). All of this shortcuts will nevertheless mean, that it is necessary that the order of operations doesn't consider the allowed order of operands if we would allow weird arbitrary type comparison such that1 == "1"is okay but"1" == 1is nok (or some better example I did not come up with yet). Also for strict vs loose equality we could store it as a flag inside the same instruction code do don't explode the opcode table as such:Some unverified information by gpt in the following
Common strategies:
All reactions