Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!utah-cs!shebs
From: shebs@utah-cs.UUCP (Stanley Shebs)
Newsgroups: net.lang
Subject: Re: what the PSL compiler *really* does
Message-ID: <3523@utah-cs.UUCP>
Date: Tue, 5-Nov-85 13:47:12 EST
Article-I.D.: utah-cs.3523
Posted: Tue Nov  5 13:47:12 1985
Date-Received: Thu, 7-Nov-85 06:31:03 EST
References: <2041@hcrvax.UUCP> <3509@utah-cs.UUCP> <2800@hplabsc.UUCP>
Reply-To: shebs@utah-cs.UUCP (Stanley shebs)
Organization: Univ of Utah CS Dept
Lines: 29

In article <2800@hplabsc.UUCP> nielsen@hplabsc.UUCP (Walter Nielsen) writes:

>> 	(for (from i 0 1000000) (do (+ 2 2)))
>
>If you look at the code generated by the PSL compiler, even at the 
>C-macro level (by setting *plap to t), you will see that (+ 2 2)
>never gets evaluated.  You should have gotten a message from the
>compiler to the effect of: 
>   "Value of (WCONST 4) not used, therefore not compiled"
>
>For that matter if you have a function defined as (DE FOO () (EQ 4 (+ 2 2))) 
>and compile it, the resulting function is identical to (DE FOO () T).  
>The reason for being is that the PSL compiler folds constants (i.e. 
>evaluates constant expressions at compile-time) and in the first case 
>does some data-flow analysis to see that the resulting value is never
>used again. 

>Walter

Sloppy me - should have checked on the machine first.  Of course, one
should complicate the code enough to confuse the compiler and keep it
from optimizing everything away;  the following improved test has been run by
me personally in vanilla PSL:

(defun foo () 
  (for (from i 0 100000) 
       (do (setq i (plus 2 i)))))

							stan shebs