Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 27 Oct 2012 10:03:10 -0500 From: Chris Hinsley Newsgroups: comp.lang.forth Date: Sat, 27 Oct 2012 16:03:10 +0100 Message-ID: <201210271603106615-chrishinsley@gmailcom> References: <2012102715594849117-chrishinsley@gmailcom> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: well formed flag ? User-Agent: Unison/2.1.9 Lines: 42 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-dyPIAL0/VJx0yn/D2WJfs0ivpoBAZ+56B41BIzyuD1+HsvnxDmoZYVIc6KwNfYIjweTesDwV5+F0bxj!YE4ZcpBy9nX5WMffv8AoejXV/l4nEAr2PiYRXzFjPQ0CEtp1qnocjd3ZSGXMfPfeH/4v+g== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2152 Xref: csiph.com comp.lang.forth:16764 On 2012-10-27 14:59:48 +0000, Chris Hinsley said: > Folks, I'm doing some tweaking to my hobby Forth compiler and just been > doing some inlineing work. > > I'm not very happy about the size of the x86 code for comparision words > (I know I could reduce the code size if I had a full optimizing code > generator, but I don't yet…) this is my code for "<" > > defword ">", 0, WORD_GT, WORD_INLINE_COMMA > POPDSP eax > cmp eax, ebx > setg bl > movzx ebx, bl > neg ebx > ret > defword_end > > I followed the 'well formed flag' comments in Ms Rathers book for this, > but the IF and TRUE, FALSE words only talk about 0 for false or not > zero for true. Is it definately the case that Forth needs -1 to come > from the comparason words ? > > Are you allowed to write code that _needs_ the -1 from the ">" ? ie if > it produce just a 1, would that be incorrect ? > > Chris I might also add that my 0BRANCH word is: defword "0BRANCH", 0, WORD_ZBRANCH, WORD_INLINE_COMMA mov eax, ebx POPDSP ebx test eax, eax jz strict near i_jmp ret defword_end Regards Chris