Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!news2.euro.net!postnews2.euro.net!news.wanadoo.nl!not-for-mail From: mhx@iae.nl (Marcel Hendrix) Subject: Re: RAFTS-like compiler; some progress Newsgroups: comp.lang.forth Message-ID: <84669394018434@frunobulax.edu> Date: Sat, 9 Feb 2013 10:37:51 +0200 References: <1312b2dd-a9d0-4702-a675-ae3589616162@w4g2000vbk.googlegroups.com> X-Newsreader: iForth 2.0 console (October 21, 2006) Lines: 46 Organization: Wanadoo NNTP-Posting-Date: 09 Feb 2013 09:37:26 GMT NNTP-Posting-Host: s529d937f.adsl.online.nl X-Trace: 1360402646 dr1.euro.net 53085 82.157.147.127:53174 X-Complaints-To: abuse@wanadoo.nl Xref: csiph.com comp.lang.forth:19572 Alex McDonald writes Re: RAFTS-like compiler; some progress [..] >> > I've made a small amount of progress with the analytic compiler. >> > Here's the IL with hand edited comments; >> >> > : testif 1 2 if 3 4 if 5 then then 6 ; >> There is a typical Forth problem with this definition. This is how iForth translates : testif2 1 0 if 3 0 if 5 then then 6 ; $014049C0 : [trashed] $014049CA cmp rbx, rbx $014049CD mov rdi, 1 d# $014049D4 mov rcx, rdi $014049D7 mov rbx, rcx $014049DA je $014049F9 offset NEAR $014049E0 cmp rcx, rcx $014049E3 push rbx $014049E4 mov rbx, 3 d# $014049EB je $014049F9 offset NEAR $014049F1 push rbx $014049F2 mov rbx, 5 d# $014049F9 push rbx $014049FA push 6 b# $014049FC ; Apparently the optimizer sees that "2/4 if" can be evaluated at compile-time. Why didn't it just compile $01404A80 : [trashed] $01404A8A push 1 b# $01404A8C push 6 b# $01404A8E ; The iForth reason is that authors expect to be able to write 0 value addr : tt 0 if [ 3 , here cell- TO addr ] then addr @ . ; -marcel