[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pointer-less stack allocated arrays.

I recently visited Harvard and had an interesting
conversation with Stavros Macrakis.  He is an
Ada proponent with considerable experience with
Lisp, in particular, MacLisp.  He was very active
in the Macsyma project and gained much knowledge
about MacLisp's implementation. 

I brought up the subject of extensible languages
in reference to Richard Schooler's masters thesis
called "Partial Evaluation as a means of Language
Extensibility", MIT/LCS/TR-324, August 1984.  The
thesis suggests that Scheme makes a good intermediate
language; very suitable for partial evaluation.

Stavros immediately rejected the notion that Scheme
makes a good intermediate language because its model
of data is too general.  For example, consider the
task of taking the dot product of two vectors represented
by two arrays of floating point numbers.  Since arrays can
be returned from the function in which they are created,
they must be allocated from the heap.  Since garbage collection
can change the origin of the array, all references to elements
in the array must be accompanied with a reference to the array
header.  Thus the compiled code for Scheme can never be as
good as that produced by an Ada compiler said Starvos.

Many years ago, I asked Jonathan Rees if the T compiler could
place arrays on the stack when appropriate and eliminate the
unneccessary indirection in numerical arrays by replacing
pointers to floating point numbers with the actual numbers
as the array elements.  He claimed compiler declarations
would make this possible, but had many other more pressing issue 
to worry about in regards to the T compiler.  I am wondering
if there is interest in using ASSERT to allow the elimination of
many pointers in some programs.