From: Thomas A. Russ
Subject: Determining Compiler Advice Settings
Date: 
Message-ID: <22581@venera.isi.edu>
Is there any portable way for code to determine what the compiler
advice (like speed or safety) are?  What I have in mind is writing
something like the following:

   (defmacro safety-check (hairy-test-form error-message)
      (if (= COMPILER-SPEED-SETTING 3)
	nil
	`(unless ,hairy-test-form
	    (error error-message))))


That way one could write code that includes the checks unless the code
is compiled under the highest speed setting.  One work-around would be
to use *features* and the #+ reader, but I was wondering if a more
integrated approach would be possible.

--

Thomas A. Russ                                             ···@isi.edu    
USC/ISI, 4676 Admiralty Way, Marina del Rey, CA 90292      (310) 822-1511

From: Barry Margolin
Subject: Re: Determining Compiler Advice Settings
Date: 
Message-ID: <1avpnsINN7kr@early-bird.think.com>
In article <·····@venera.isi.edu> ···@isi.edu writes:
>Is there any portable way for code to determine what the compiler
>advice (like speed or safety) are?

No.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: John Tang Boyland
Subject: Re: Determining Compiler Advice Settings
Date: 
Message-ID: <1avrhlINN4in@agate.berkeley.edu>
In article <············@early-bird.think.com>, ······@think.com (Barry Margolin) writes:
|> In article <·····@venera.isi.edu> ···@isi.edu writes:
|> >Is there any portable way for code to determine what the compiler
|> >advice (like speed or safety) are?
|> 
|> No.

I was under the impression this was fixed in CLtL2 (see page 210-211)
so that one could say:

(defmacro my-macro (arg1 &environment env)
   (let* ((opt-state (declaration-information 'optimize env))
          (compilation-speed (second (assoc 'compilation-speed opt-state))))
      ...))

Allegro 4.1 doesn't have cl:declaration-information, but I assume
that's just because it's a new addition.

John
From: Barry Margolin
Subject: Re: Determining Compiler Advice Settings
Date: 
Message-ID: <1b09qcINNio7@early-bird.think.com>
In article <············@agate.berkeley.edu> ·······@CS.Berkeley.EDU (John Tang Boyland) writes:
>I was under the impression this was fixed in CLtL2 (see page 210-211)
>so that one could say:
>
>(defmacro my-macro (arg1 &environment env)
>   (let* ((opt-state (declaration-information 'optimize env))
>          (compilation-speed (second (assoc 'compilation-speed opt-state))))
>      ...))

DECLARATION-INFORMATION and all the related environment access operations
were later dropped by X3J13, and they're not in dpANS CL.  There were some
bugs in the design of this stuff; we decided that we had designed this
feature too late in the game and they weren't important enough to delay
finishing the draft while we debugged them.

Please encourage your vendors to adopt something like them, though.
Without experience with them, we'll never learn how they should be used and
designed.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar