Instrumenting Lisp for Maxima ??



Henry -- I sense you are asking for several different things here.  The
compilation strategy for Lisp has perhaps changed only in minor ways
since the ANS 20 years ago, but it has changed a lot since 40 years ago
:-).

Henry Baker <hbaker1 at pipeline.com> wrote:

   I might be interested in gathering some statistics about Maxima,
   particularly in its use of cons cells and other allocated objects.

I know that Maxima doesn't officially support Allegro, but Allegro's
(room t) walks the heap collecting and printing the actual numbers and
bytes of heap for each implementational built-in type.  (I.e., symbol,
cons, specialized simple arays, complex, floats and double floats, but
not non-simple or non-vector arrays, which are represented as an array
header pointing at a simple array).  A (gc t) followed by a (room t)
tells you pretty much everything about the live objects in the heap.

(I believe rjf can advise you how to compile Maxima in the free Allegro
Express.)
   
   If I were to want to instrument every car, cdr, cons, rplaca,
   replacd, eq, gc, is there a Lisp in which I could turn off all
   "inlining" of these instructions and then replace them with my own?

This needs to be split into two parts.  A simple declamation

 (declaim (notinline car cdr rplaa rplacd ...))

about all the functions in which you are interested before compiling
code ought bypass any inlining.  (However, inlining many of these
functions is so fundamental to compilation strategy that it wou;dn't
surprise me if some implementations wouldn't entirely survoive such a
declamation.  Haven't thought about this deeply.)
   
   Should I attempt to use something like Common Lisp's namespaces &
   fake out Maxima that way?

But it is still prohibited for you to modify or replace any of the
operators in the COMMON-LISP package, except maybe with trace, so if you
want to analyze calls to these operators, I believe, yes, you'd need to
handcraft an alternative cl package and read/compile your code
(i.e. Maxima) in a package using that package instead of CL.

All the operators you mention are functions, but I'm sure you're aware
of the difference of monitoring the expansions of macros
   
HTH.