Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #19572

Re: RAFTS-like compiler; some progress

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> (permalink)
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

Show key headers only | View raw


Alex McDonald <blog@rivadpm.com> 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

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RAFTS-like compiler; some progress Alex McDonald <blog@rivadpm.com> - 2013-02-06 15:55 -0800
  Re: RAFTS-like compiler; some progress Spam@ControlQ.com - 2013-02-08 16:16 -0500
    Re: RAFTS-like compiler; some progress Alex McDonald <blog@rivadpm.com> - 2013-02-08 14:40 -0800
      Re: RAFTS-like compiler; some progress mhx@iae.nl (Marcel Hendrix) - 2013-02-09 10:37 +0200
        Re: RAFTS-like compiler; some progress Roelf Toxopeus <rt4all@notthis.hetnet.nl> - 2013-02-09 12:06 +0100
          Re: RAFTS-like compiler; some progress albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-09 15:46 +0000
        Re: RAFTS-like compiler; some progress anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-09 14:38 +0000
          Re: RAFTS-like compiler; some progress Brad Eckert <hwfwguy@gmail.com> - 2013-02-11 08:57 -0800
            Re: RAFTS-like compiler; some progress anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-11 17:39 +0000
              Re: RAFTS-like compiler; some progress Brad Eckert <hwfwguy@gmail.com> - 2013-02-11 10:48 -0800
                Re: RAFTS-like compiler; some progress Alex McDonald <blog@rivadpm.com> - 2013-02-11 18:56 -0800
                Re: RAFTS-like compiler; some progress Alex McDonald <blog@rivadpm.com> - 2013-02-11 18:58 -0800
                Re: RAFTS-like compiler; some progress anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-14 12:55 +0000
      Re: RAFTS-like compiler; some progress anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-09 14:44 +0000
        Re: RAFTS-like compiler; some progress Alex McDonald <blog@rivadpm.com> - 2013-02-11 19:09 -0800

csiph-web