home .. forth .. colorforth mail list archive ..

[ColorForth] drop/dup Optimization


On the http://www.colorforth.com/install.htm page, it says "When one macro ends
with 'drop' and the next starts with 'dup' both may be eliminated"

I think this is backwards (maybe a typo).  DROP followed by DUP can't generally
be optimized away by eliminating both.  (Maybe "'dup' followed by 'drop'" is
what was intended.)

For example,

: foo  1 2 drop dup ;  \ result: ( 1 1 )

is not the same as

: foo  1 2 ;           \ result ( 1 2 )

Or maybe I'm missing something related to the caching of the top-of-stack in
EAX.  Or maybe the optimization is more sophisticated, being triggered only in
situations where "DROP DUP" really is a no-op.

-- Kris


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
------------------------

To Unsubscribe from this list, send mail to Mdaemon@xxxxxxxxxxxxxxxxxx with:
unsubscribe ColorForth
as the first and only line within the message body
Problems   -   List-Admin@xxxxxxxxxxxxxxxxxx
Main ColorForth site   -   http://www.colorforth.com