From: Drew McDermott
Subject: Accessing compiler-optimization settings
Date: 
Message-ID: <b83udg$3m7$1@news.ycc.yale.edu>
There is no portable way to determine the current global setting for
compiler-optimization settings such as speed, safety, etc.  That is, I 
can declaim (optimize (speed 2) ...)
but I can't figure out the most recent such declaim.  Even so, there are 
ways in Allegro to retrieve the information, and I suspect most 
implementations have their utilities for figuring it out.  Has anyone 
collected all these various utilities and created an 
implementation-independent interface to them?

Thanks.

       -- Drew McDermott
From: Duane Rettig
Subject: Re: Accessing compiler-optimization settings
Date: 
Message-ID: <4znmis81q.fsf@beta.franz.com>
Drew McDermott <··················@at.yale.dot.edu> writes:

> There is no portable way to determine the current global setting for
> compiler-optimization settings such as speed, safety, etc.  That is, I
> can declaim (optimize (speed 2) ...)
> 
> but I can't figure out the most recent such declaim.  Even so, there
> are ways in Allegro to retrieve the information, and I suspect most
> implementations have their utilities for figuring it out.  Has anyone
> collected all these various utilities and created an
> implementation-independent interface to them?

I was going to respond that there are variables that hold the optimization
qualties, but that it is dangerous and non-portable to access them that
way, especially since in our next major release these variables go away.

However, that got me thinking, that Allegro CL 6.2 does have enough of
the environments interface in it so that the following will work and
should be mostly portable among implementations that provide the
environments access functions at least close to what is described
in CLtL2 (note that these symbols are unexported, and thus not yet
supported):

CL-USER(1): (setq e1 (sys::make-augmentable-environment))
#<Augmentable :EVALUATION Environment NIL @ #x7149da32>
CL-USER(2): (setq e2 (sys::augment-environment e1 :declare '((optimize))))
#<Augmentable :EVALUATION Environment (1) @ #x7149ddfa>
CL-USER(3): (sys::declaration-information 'optimize e2)
((DEBUG 2) (SPEED 1) (SPACE 1) (SAFETY 1))
CL-USER(4): 

In our next major release, this will also work, but it will be easier,
since it will be possible to just say (sys:declaration-information 'optimize)
and the null optional environment will cause the current global qualities
to be accessed.

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182