home *** CD-ROM | disk | FTP | other *** search
- ;;; -*- Package: SPARC -*-
- ;;;
- ;;; **********************************************************************
- ;;; This code was written as part of the Spice Lisp project at
- ;;; Carnegie-Mellon University, and has been placed in the public domain.
- ;;; If you want to use this code or any part of Spice Lisp, please contact
- ;;; Scott Fahlman (FAHLMAN@CMUC).
- ;;; **********************************************************************
- ;;;
- ;;; $Header: alloc.lisp,v 1.2 91/04/03 00:54:51 wlott Exp $
- ;;;
- ;;; Allocation VOPs for the SPARC port.
- ;;;
- ;;; Written by William Lott.
- ;;;
-
- (in-package "SPARC")
-
-
- ;;;; LIST and LIST*
-
- (define-vop (list-or-list*)
- (:args (things :more t))
- (:temporary (:scs (descriptor-reg) :type list) ptr)
- (:temporary (:scs (descriptor-reg)) temp)
- (:temporary (:scs (descriptor-reg) :type list :to (:result 0) :target result)
- res)
- (:temporary (:scs (non-descriptor-reg) :type random) ndescr)
- (:info num)
- (:results (result :scs (descriptor-reg)))
- (:variant-vars star)
- (:policy :safe)
- (:generator 0
- (cond ((zerop num)
- (move result null-tn))
- ((and star (= num 1))
- (move result (tn-ref-tn things)))
- (t
- (macrolet
- ((store-car (tn list &optional (slot cons-car-slot))
- `(let ((reg
- (sc-case ,tn
- ((any-reg descriptor-reg zero null)
- ,tn)
- (control-stack
- (load-stack-tn temp ,tn)
- temp))))
- (storew reg ,list ,slot list-pointer-type))))
- (let ((cons-cells (if star (1- num) num)))
- (pseudo-atomic (ndescr)
- (inst add res alloc-tn list-pointer-type)
- (inst add alloc-tn alloc-tn
- (* (pad-data-block cons-size) cons-cells))
- (move ptr res)
- (dotimes (i (1- cons-cells))
- (store-car (tn-ref-tn things) ptr)
- (setf things (tn-ref-across things))
- (inst add ptr ptr (pad-data-block cons-size))
- (storew ptr ptr
- (- cons-cdr-slot cons-size)
- list-pointer-type))
- (store-car (tn-ref-tn things) ptr)
- (cond (star
- (setf things (tn-ref-across things))
- (store-car (tn-ref-tn things) ptr cons-cdr-slot))
- (t
- (storew null-tn ptr
- cons-cdr-slot list-pointer-type)))
- (assert (null (tn-ref-across things)))
- (move result res))))))))
-
- (define-vop (list list-or-list*)
- (:variant nil))
-
- (define-vop (list* list-or-list*)
- (:variant t))
-
-
- ;;;; Special purpose inline allocators.
-
- (define-vop (allocate-code-object)
- (:args (boxed-arg :scs (any-reg))
- (unboxed-arg :scs (any-reg)))
- (:results (result :scs (descriptor-reg)))
- (:temporary (:scs (non-descriptor-reg)) ndescr)
- (:temporary (:scs (any-reg) :from (:argument 0)) boxed)
- (:temporary (:scs (non-descriptor-reg) :from (:argument 1)) unboxed)
- (:generator 100
- (inst add boxed boxed-arg (fixnum (1+ code-trace-table-offset-slot)))
- (inst and boxed (lognot lowtag-mask))
- (inst srl unboxed unboxed-arg word-shift)
- (inst add unboxed lowtag-mask)
- (inst and unboxed (lognot lowtag-mask))
- (pseudo-atomic (ndescr)
- (inst add result alloc-tn other-pointer-type)
- (inst add alloc-tn boxed)
- (inst add alloc-tn unboxed)
- (inst sll ndescr boxed (- type-bits word-shift))
- (inst or ndescr code-header-type)
- (storew ndescr result 0 other-pointer-type)
- (storew unboxed result code-code-size-slot other-pointer-type)
- (storew null-tn result code-entry-points-slot other-pointer-type)
- (storew null-tn result code-debug-info-slot other-pointer-type))))
-
- (define-vop (make-symbol)
- (:args (name :scs (descriptor-reg) :to :eval))
- (:temporary (:scs (non-descriptor-reg)) temp)
- (:results (result :scs (descriptor-reg) :from :argument))
- (:policy :fast-safe)
- (:translate make-symbol)
- (:generator 37
- (with-fixed-allocation (result temp symbol-header-type symbol-size)
- (inst li temp unbound-marker-type)
- (storew temp result symbol-value-slot other-pointer-type)
- (storew temp result symbol-function-slot other-pointer-type)
- (storew temp result symbol-setf-function-slot other-pointer-type)
- (inst li temp (make-fixup "_undefined_tramp" :foreign))
- (storew temp result symbol-raw-function-addr-slot
- other-pointer-type)
- (storew null-tn result symbol-plist-slot other-pointer-type)
- (storew name result symbol-name-slot other-pointer-type)
- (storew null-tn result symbol-package-slot other-pointer-type))))
-
-
-