Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!wuarchive!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!ames!amdahl!pacbell!noe!marc From: marc@noe.UUCP (Marc de Groot) Newsgroups: comp.lang.forth Subject: Re: Forth in C Message-ID: <725@noe.UUCP> Date: 22 Nov 89 01:41:57 GMT References: <8911142050.AA16286@jade.berkeley.edu> <717@noe.UUCP> <7026@pt.cs.cmu.edu> Sender: usenet@noe.UUCP Reply-To: marc@noe.UUCP (Marc de Groot) Organization: Noe Systems, San Francisco Lines: 31 In article <7026@pt.cs.cmu.edu> koopman@a.gp.cs.cmu.edu (Philip Koopman) writes: >In article <717@noe.UUCP>, marc@noe.UUCP (Marc de Groot) writes: >> I use the asm("..."); pseudo-op to assemble an indirect branch instruction. >> This turns into some very efficient code, even with my awful pcc-derived >> 80286 C compiler. >How much faster did it go? The PCC compilers I've seen tend to >use an indirect jump table to implement case statements, which >isn't that far away from what you're doing. Did you measure >enough speed improvement to be worthwhile? Does your C compiler >us jump tables? Yes, my C compiler does use jump tables. No, I did not actually time it. I looked at a disassembly of the code. My token-threaded Forth has the dictionary in an array of short. That means that every reference into the dictionary requires a left-shift of the subscript and adding the dictionary's base address before fetching. Then it sets up the arguments for the jump through the table. The indirect- threaded code that I posted does not need to do this and uses considerably fewer instructions. ^M > >-- Phil -- Marc de Groot (KG6KF) These ARE my employer's opinions! Noe Systems, San Francisco UUCP: uunet!hoptoad!noe!marc Internet: marc@kg6kf.AMPR.ORG