EXECF (including XBYTE)
TonyB_
Posts: 2,178
in Propeller 2
I can't see a reason why anyone would ever use EXECF with the first skip bit set to 1. Why would you ever jump deliberately to an instruction and not execute it, when you could jump directly to the first instruction that you do want to execute?
I've looked at the latest Spin2 interpreter and the first skip bit is 0 for every bytecode from 00 to FF (with only the last two unused). Therefore, I think it would be safe to assume the instruction at the jump address will be executed, in which case a skip bit of 0 could be inserted automatically at the start of the skip pattern.
This would give us 22 skippable instructions after the first, increasing the length of the skip sequence from 22 to 23. I've already hit the current limit of 22 in XBYTE.
I've looked at the latest Spin2 interpreter and the first skip bit is 0 for every bytecode from 00 to FF (with only the last two unused). Therefore, I think it would be safe to assume the instruction at the jump address will be executed, in which case a skip bit of 0 could be inserted automatically at the start of the skip pattern.
This would give us 22 skippable instructions after the first, increasing the length of the skip sequence from 22 to 23. I've already hit the current limit of 22 in XBYTE.
Comments
All of those initial skip bits of 1 are avoidable, but if you don't want to change the opcode table then you could simply insert a NOP at the beginning:
{52}..{58} would take the same time as now and {51}..{58} an identical time. Note that the NOP would not reduce the useable skip pattern length.
Existing patterns with first skip bits always 0 could also stay the same, as follows.
Before
After
This is about EXECF in XBYTE, which wouldn't have random masks and dynamically created skip patterns.
A JIT compiler might create an XBYTE interpreter on the fly. Or, more likely, a compiler running on the PC might create a custom interpreter based on the instructions it sees in the program. Both of which could work around the change you propose, of course. and in the abstract your idea's a good one. But it's rather late in the day for us to be changing the instruction set. I think Chip definitely has the right idea to leave well enough alone for now. I hope he does take your proposal into account for P3.