diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 736581c..7440e51 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -6072,6 +6072,7 @@ will end up as a recursive call to ourselves. (|intloopReadConsole| "" newStepNo))) \end{chunk} + \section{Helper Functions} \defunsec{getenviron}{Get the value of an evironment variable} \calls{getenviron}{getenv} @@ -13337,6 +13338,122 @@ This was rewritten by NAG to remove flet. \end{chunk} +\section{Functions on interpreter objects} +Interpreter objects used to be called triples because they had the +structure [value, type, environment]. For many years, the environment +was not used, so finally in January, 1990, the structure of objects +was changed to be (type . value). This was chosen because it was the +structure of objects of type Any. Sometimes the values are wrapped +(see the function isWrapped to see what this means physically). +Wrapped values are not actual values belonging to their types. An +unwrapped value must be evaluated to get an actual value. A wrapped +value must be unwrapped before being passed to a library function. +Typically, an unwrapped value in the interpreter consists of LISP +code, e.g., parts of a function that is being constructed. +-- RSS 1/14/90 + +These are the new structure functions. + +\defmacro{mkObj} +\begin{chunk}{defmacro mkObj} +(defmacro |mkObj| (val mode) + `(cons ,mode ,val)) + +\end{chunk} + +\defmacro{mkObjWrap} +\calls{mkObjWrap}{wrap} +\begin{chunk}{defmacro mkObjWrap} +(defmacro |mkObjWrap| (val mode) + `(cons ,mode (|wrap| ,val))) + +\end{chunk} + +\defmacro{mkObjCode} +\begin{chunk}{defmacro mkObjCode} +(defmacro |mkObjCode| (val mode) + `(cons 'cons (cons (mkq ,mode) (cons ,val nil)))) + +\end{chunk} + +\defmacro{objNew} +\begin{chunk}{defmacro objNew} +(defmacro |objNew| (val mode) + `(cons ,mode ,val)) + +\end{chunk} + +\defmacro{objNewWrap} +\begin{chunk}{defmacro objNewWrap} +(defmacro |objNewWrap| (val mode) + `(cons ,mode (|wrap| ,val))) + +\end{chunk} + +\defmacro{objNewCode} +\begin{chunk}{defmacro objNewCode} +(defmacro |objNewCode| (val mode) + `(cons 'cons (cons (mkq ,mode) (cons ,val nil)))) + +\end{chunk} + +\defmacro{objSetVal} +\begin{chunk}{defmacro objSetVal} +(defmacro |objSetVal| (obj val) + `(rplacd ,obj ,val)) + +\end{chunk} + +\defmacro{objSetMode} +\begin{chunk}{defmacro objSetMode} +(defmacro |objSetMode| (obj mode) + `(rplaca ,obj ,mode)) + +\end{chunk} + +\defmacro{objVal} +\begin{chunk}{defmacro objVal} +(defmacro |objVal| (obj) + `(cdr ,obj)) + +\end{chunk} + +\defmacro{objValUnwrap} +\begin{chunk}{defmacro objValUnwrap} +(defmacro |objValUnwrap| (obj) + `(|unwrap| (cdr ,obj))) + +\end{chunk} + +\defmacro{objMode} +\begin{chunk}{defmacro objMode} +(defmacro |objMode| (obj) + `(car ,obj)) + +\end{chunk} + +\defun{objEnv}{objEnv} +\begin{chunk}{defun objEnv 0} +(defun |objEnv| (obj) + (declare (special $NE) (ignore obj)) + $NE) + +\end{chunk} + +\defmacro{objCodeVal} +\begin{chunk}{defmacro objCodeVal} +(defmacro |objCodeVal| (obj) + `(caddr ,obj)) + +\end{chunk} + +\defmacro{objCodeMode} +\begin{chunk}{defmacro objCodeMode} +(defmacro |objCodeMode| (obj) + `(cadr ,obj)) + +\end{chunk} + \section{Macro handling} \defun{phMacro}{phMacro} \tpdhere{The pform function has a leading percent sign} @@ -58388,6 +58505,19 @@ digits in TechExplorer. Since Saturn is gone we can remove it. \getchunk{defmacro makeMatrix1U16} \getchunk{defmacro makeMatrixU32} \getchunk{defmacro makeMatrix1U32} +\getchunk{defmacro mkObj} +\getchunk{defmacro mkObjCode} +\getchunk{defmacro mkObjWrap} +\getchunk{defmacro objCodeVal} +\getchunk{defmacro objCodeMode} +\getchunk{defmacro objMode} +\getchunk{defmacro objNew} +\getchunk{defmacro objNewCode} +\getchunk{defmacro objNewWrap} +\getchunk{defmacro objSetMode} +\getchunk{defmacro objSetVal} +\getchunk{defmacro objVal} +\getchunk{defmacro objValUnwrap} \getchunk{defmacro qsDot26432} \getchunk{defmacro qsDot2Mod6432} \getchunk{defmacro qsMod6432} @@ -58586,6 +58716,7 @@ digits in TechExplorer. Since Saturn is gone we can remove it. \getchunk{defun npPop3 0} \getchunk{defun npPush 0} +\getchunk{defun objEnv 0} \getchunk{defun opTran 0} \getchunk{defun pfAndLeft 0} diff --git a/changelog b/changelog index 1777d01..a0e098f 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20141111 tpd src/axiom-website/patches.html 20141111.01.tpd.patch +20141111 tpd books/bookvol5 make obj fns into macros for performance +20141111 tpd src/interp/i-intern.lisp merge obj handling functions 20141109 tpd src/axiom-website/patches.html 20141109.02.tpd.patch 20141109 tpd books/bookvol5 fix remake handling of source files 20141109 tpd src/axiom-website/patches.html 20141109.01.tpd.patch diff --git a/patch b/patch index e20fcde..aec97ef 100644 --- a/patch +++ b/patch @@ -1,4 +1,3 @@ -books/bookvol5 fix remake handling of source files +books/bookvol5 turn object rep into macro form for inline -The source file on the )show function was missing after -'make clean ; make' +Object wrapping/unwrapping is now macros for inline performance. diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 88866e7..5ecf7aa 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4696,6 +4696,8 @@ books/bookvolbib fix missing quote
books/Makefile move SPADEDIT and make it executable
20141109.02.tpd.patch books/bookvol5 fix remake handling of source files
+20141111.01.tpd.patch +books/bookvol5 make obj fns into macros for performance
diff --git a/src/interp/i-intern.lisp.pamphlet b/src/interp/i-intern.lisp.pamphlet index b854f66..ea09722 100644 --- a/src/interp/i-intern.lisp.pamphlet +++ b/src/interp/i-intern.lisp.pamphlet @@ -2484,124 +2484,6 @@ by x. x is a VAT. (QUOTE T)))))) \end{chunk} -\section{Functions on interpreter objects} -Interpreter objects used to be called triples because they had the -structure [value, type, environment]. For many years, the environment -was not used, so finally in January, 1990, the structure of objects -was changed to be (type . value). This was chosen because it was the -structure of objects of type Any. Sometimes the values are wrapped -(see the function isWrapped to see what this means physically). -Wrapped values are not actual values belonging to their types. An -unwrapped value must be evaluated to get an actual value. A wrapped -value must be unwrapped before being passed to a library function. -Typically, an unwrapped value in the interpreter consists of LISP -code, e.g., parts of a function that is being constructed. --- RSS 1/14/90 - -These are the new structure functions. - -\subsection{mkObj} -\begin{chunk}{*} -;mkObj(val, mode) == CONS(mode,val) -- old names - -(DEFUN |mkObj| (|val| |mode|) (CONS |mode| |val|)) - -\end{chunk} -\subsection{mkObjWrap} -\begin{chunk}{*} -;mkObjWrap(val, mode) == CONS(mode,wrap val) - -(DEFUN |mkObjWrap| (|val| |mode|) (CONS |mode| (|wrap| |val|))) - -\end{chunk} -\subsection{mkObjCode} -\begin{chunk}{*} -;mkObjCode(val, mode) == ['CONS, MKQ mode,val ] - -(DEFUN |mkObjCode| (|val| |mode|) - (CONS (QUOTE CONS) (CONS (MKQ |mode|) (CONS |val| NIL)))) - -\end{chunk} -\subsection{objNew} -\begin{chunk}{*} -;objNew(val, mode) == CONS(mode,val) -- new names as of 10/14/93 - -(DEFUN |objNew| (|val| |mode|) (CONS |mode| |val|)) - -\end{chunk} -\subsection{objNewWrap} -\begin{chunk}{*} -;objNewWrap(val, mode) == CONS(mode,wrap val) - -(DEFUN |objNewWrap| (|val| |mode|) (CONS |mode| (|wrap| |val|))) - -\end{chunk} -\subsection{objNewCode} -\begin{chunk}{*} -;objNewCode(val, mode) == ['CONS, MKQ mode,val ] - -(DEFUN |objNewCode| (|val| |mode|) - (CONS (QUOTE CONS) (CONS (MKQ |mode|) (CONS |val| NIL)))) - -\end{chunk} -\subsection{objSetVal} -\begin{chunk}{*} -;objSetVal(obj,val) == RPLACD(obj,val) - -(DEFUN |objSetVal| (|obj| |val|) (RPLACD |obj| |val|)) - -\end{chunk} -\subsection{objSetMode} -\begin{chunk}{*} -;objSetMode(obj,mode) == RPLACA(obj,mode) - -(DEFUN |objSetMode| (|obj| |mode|) (RPLACA |obj| |mode|)) - -\end{chunk} -\subsection{objVal} -\begin{chunk}{*} -;objVal obj == CDR obj - -(DEFUN |objVal| (|obj|) (CDR |obj|)) - -\end{chunk} -\subsection{objValUnwrap} -\begin{chunk}{*} -;objValUnwrap obj == unwrap CDR obj - -(DEFUN |objValUnwrap| (|obj|) (|unwrap| (CDR |obj|))) - -\end{chunk} -\subsection{objMode} -\begin{chunk}{*} -;objMode obj == CAR obj - -(DEFUN |objMode| (|obj|) (CAR |obj|)) - -\end{chunk} -\subsection{objEnv} -\begin{chunk}{*} -;objEnv obj == $NE - -(DEFUN |objEnv| (|obj|) - (declare (special $NE) (ignore |obj|)) - $NE) - -\end{chunk} -\subsection{objCodeVal} -\begin{chunk}{*} -;objCodeVal obj == CADDR obj - -(DEFUN |objCodeVal| (|obj|) (CADDR |obj|)) - -\end{chunk} -\subsection{objCodeMode} -\begin{chunk}{*} -;objCodeMode obj == CADR obj - -(DEFUN |objCodeMode| (|obj|) (CADR |obj|)) - -\end{chunk} \section{Library compiler structures needed by the interpreter} Tuples and Crosses \subsection{asTupleNew}