I'm curious (using ITC or DTC) if any implementations have tried
implementing literals inline with NEXT as opposed to using a word, and
what the cost trade-off was. For example, I'm thinking something like
this:
- assume all words are at least 4-byte aligned
- NEXT checks the LSB @[EMAIL PROTECTED]
[IP], and if set, pushes a literal ([IP] >> 1)
- otherwise do normal execution of [IP]
NEXT might then look something similar to (using ARM as an example,
with PUSH/POP macros for easy reading):
; assume r2 = IP and r0 = TOS
ldr r1, [r2], #4
tst r1, #1
pushne r0
asrne r0, r1, #1
bne NEXT
; ... do regular next here ...
NEXT is now slightly larger (perhaps to the point of not being worthy
of inlining?), and has a compare in there. However, I wonder if (given
the program), this might be better overall. For example, at what % of
the code being integer literals would this break even and start
becoming an optimization or would that never happen?
Anyway, just something I was thinking about and wondering if it had
been tried before - I assume it has - or at least the idea was dumped
quickly for one reason or another.
Jeff M.


|