[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
additions to KCL-LOW
- To: commonloops.pa@Xerox.COM
- Subject: additions to KCL-LOW
- From: harrisr@turing.cs.rpi.edu (Richard Harris)
- Date: Mon, 22 Aug 88 20:26:35 EDT
- Redistributed: commonloops.pa
Add (or change) the following functions to KCL-LOW to improve its speed.
The same cache miss problem that Frank Halasz reported in EXCL
happens in KCL.
Rick Harris
(defmacro %logand (&rest args)
(if (null args)
-1
(labels ((bin (args)
(if (null (cdr args))
`(the fixnum ,(car args))
`(the fixnum (logand (the fixnum ,(car args))
,(bin (cdr args)))))))
(bin args))))
(defmacro %logxor (&rest args)
(if (null args)
0
(labels ((bin (args)
(if (null (cdr args))
`(the fixnum ,(car args))
`(the fixnum (logxor (the fixnum ,(car args))
,(bin (cdr args)))))))
(bin args))))
(defmacro %+ (&rest args)
(if (null args)
0
(labels ((bin (args)
(if (null (cdr args))
`(the fixnum ,(car args))
`(the fixnum (+ (the fixnum ,(car args))
,(bin (cdr args)))))))
(bin args))))
(defmacro %1+ (x) `(the fixnum (1+ (the fixnum ,x))))
(defmacro %svref (vector index)
`(svref (the simple-vector ,vector) (the fixnum ,index)))
(defsetf %svref (vector index) (new-value)
`(setf (svref (the simple-vector ,vector) (the fixnum ,index))
,new-value))
;;
;;;;;; Generating CACHE numbers
;;
(unless (get 'si:address 'compiler::inline-always)
(push '((t) fixnum nil nil "(int)#0") (get 'si:address 'compiler::inline-always)))
;symbols are (stored every) 9 words, so (ash x -2) is fine
(defmacro symbol-cache-no (symbol mask)
(if (and (constantp symbol)
(constantp mask))
`(load-time-eval (logand (ash (si:address ,symbol) -2) ,mask))
`(%logand (ash (the fixnum (si:address ,symbol)) -2) ,mask)))
;structures are (stored every) 4 words, need (ash x -4)
(defmacro object-cache-no (object mask)
`(%logand (ash (the fixnum (si:address ,object)) -4) ,mask))