Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Literals questi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3680 of 4160
Post > Topic >>

Literals question

by "Jeff M." <massung@[EMAIL PROTECTED] > Jan 4, 2008 at 11:29 AM

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.
 




 2 Posts in Topic:
Literals question
"Jeff M." <m  2008-01-04 11:29:22 
Re: Literals question
anton@[EMAIL PROTECTED]   2008-01-04 20:32:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 18 22:33:03 CDT 2008.