Another way (How not to write a loop)

Rahul Dhesi dhesi at bsu-cs.UUCP
Sat Feb 20 06:49:46 AEST 1988


In article <7285 at brl-smoke.ARPA> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) 
writes:
[re floating add versus integer decrement & test]
>So, the Snobol implementor made a stupid decision, then.
>
>[On the] Gould PowerNode 9080,
>which has a remarkably similar architecture...to the IBM 360's...
>[a test showed that the] floating-point version burned 4.3 seconds of CPU
>time while the integer counter version's overhead was only 0.5 seconds.

I don't know what Dewar and Belcher, the authors of SPITBOL, would say to
this.  Here's what Griswold says in his book "The Macro Implementation
of Snobol4" (Freeman & Co. 1972).

"An amusing example of the difference between SNOBOL4 and SPITBOL
is provided by the way &STLIMIT is implemented and statement
numbers located....[In SNOBOL4] &STLIMIT (at a known location in UKYPBL)
is checked by init1.  If the statement limit has been exceeded, control
is transferred to an error routine....
   "SPITBOL, in its quest for efficiency, approaches these matters
quite differently.  At the beginning of each statement, the following
instruction occurs.

     AUR      SCNT,SINC

This instruction increments a floating-point register reserved for
statement counting.  SCNT is set up so that when &STLIMIT is exceeded,
a program interrupt occurs because of floating-point overflow.
An interrupt handler detects this interrupt as excessive statement
execution....

[some paragraphs later]

   "...In any event, SPITBOL is someone else's story to tell.  It is
a fascinating, well-designed, and cleverly implemented system which the
serious student of software is well advised to study....SPITBOL, of
course, is hardly machine-independent or portable.  Heavy use is made
of idiosyncracies of the 360 instruction set, and the coding is very
tight."
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi



More information about the Comp.lang.c mailing list