The Possibility of a Side-Register

The possibility can be considered, that in a certain implementation of LISP, a side-register on the CPU keeps track of what the data-type is, that the main register points to. But as the following experiment shows, this would only help accelerate how LISP expressions are evaluated, and does not affect how Common LISP in particular, stores the data-type in a variable. I.e., on the assumption that the data-type is held in a side-register, we could additionally assume that it gets inserted into the plist of a symbol, whenever we assign the value to the symbol. And what I have shown below, is that this additional assumption would be false, in the case of Common LISP:

 


GCL (GNU Common Lisp)  2.6.12 CLtL1    Oct 28 2014 10:02:30
Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
Binary License:  GPL due to GPL'ed components: (XGCL READLINE UNEXEC)
Modifications of this banner must retain notice of a compatible license
Dedicated to the memory of W. Schelter

Use (help) to get some basic information on how to use GCL.
Temporary directory for compiler files set to /tmp/

>(defparameter *test-symbol*
    (string "Hello, World!") )

*TEST-SYMBOL*

>*test-symbol*

"Hello, World!"

>(symbol-plist '*test-symbol*)

NIL

>(defparameter *test-symbol*
    (list 'Foo 'Blatz 'Bar) )

*TEST-SYMBOL*

>*test-symbol*

(FOO BLATZ BAR)

>(symbol-plist '*test-symbol*)

NIL

>(defparameter *test-symbol*
    0 "This time it is a number.")

*TEST-SYMBOL*

>*test-symbol*

0

>(symbol-plist '*test-symbol*)

(SYSTEM:VARIABLE-DOCUMENTATION "This time it is a number.")

>(quit)

 

(Edit 10/01/2016 : ) In other words, the way in which the variables or symbols store a data-type, and some data, can easily be, of their virtual CAAR being the data-type, and their virtual CDAR being the data, if their virtual CAR is the value. But, if the LISP interpreter was always to apply that in its internal representation of some data, say within the evaluation of a complex structure of lists and atoms, time would get wasted in the CAR and the CDR, of whatever is being referenced by a single CPU register, repeatedly getting dereferenced as such.

Further, some slight error in processing lists could end up loading the CAR of the CPU register into it, or something from the former CDR by itself, so that this ordering might not be conserved.

And so the LISP interpreter might be faster and more stable, if it was to reserve two CPU registers and not one, to indicate the current data. But as I wrote above, then this does not get packed into any plist, when a value is assigned to the variable.

Dirk

 

Print Friendly, PDF & Email

One thought on “The Possibility of a Side-Register”

Leave a Reply

Your email address will not be published. Required fields are marked *

Please Prove You Are Not A Robot *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>