X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Falpha%2Falloc.lisp;h=9a440a35ee0c860d8199f15989689ea3d29670c1;hb=dc71db379ab4162a45c393a2e828f619dae9fa32;hp=68f74e5e904841829589766cefaca9f43580672d;hpb=dfa55a883f94470267b626dae77ce7e7dfac3df6;p=sbcl.git diff --git a/src/compiler/alpha/alloc.lisp b/src/compiler/alpha/alloc.lisp index 68f74e5..9a440a3 100644 --- a/src/compiler/alpha/alloc.lisp +++ b/src/compiler/alpha/alloc.lisp @@ -1,24 +1,21 @@ -;;; -*- Package: ALPHA -*- -;;; -;;; ********************************************************************** -;;; This code was written as part of the CMU Common Lisp project at -;;; Carnegie Mellon University, and has been placed in the public domain. -;;; +;;;; allocation VOPs for the Alpha port -;;; -;;; ********************************************************************** -;;; -;;; Allocation VOPs for the Alpha port. -;;; -;;; Written by William Lott. -;;; Converted by Sean Hallgren. -;;; +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. (in-package "SB!VM") - - ;;;; LIST and LIST* +(defoptimizer (list stack-allocate-result) ((&rest args)) + (not (null args))) +(defoptimizer (list* stack-allocate-result) ((&rest args)) + (not (null (rest args)))) (define-vop (list-or-list*) (:args (things :more t)) @@ -30,6 +27,7 @@ (:results (result :scs (descriptor-reg))) (:variant-vars star) (:policy :safe) + (:node-var node) (:generator 0 (cond ((zerop num) (move null-tn result)) @@ -46,11 +44,17 @@ (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 (:extra (* (pad-data-block cons-size) - cons-cells)) - (inst bis alloc-tn list-pointer-type res) + (storew reg ,list ,slot list-pointer-lowtag)))) + (let* ((dx-p (awhen (sb!c::node-lvar node) (sb!c::lvar-dynamic-extent it))) + (cons-cells (if star (1- num) num)) + (space (* (pad-data-block cons-size) cons-cells))) + (pseudo-atomic (:extra (if dx-p 0 space)) + (cond (dx-p + (align-csp res) + (inst bis csp-tn list-pointer-lowtag res) + (inst lda csp-tn space csp-tn)) + (t + (inst bis alloc-tn list-pointer-lowtag res))) (move res ptr) (dotimes (i (1- cons-cells)) (store-car (tn-ref-tn things) ptr) @@ -58,15 +62,15 @@ (inst lda ptr (pad-data-block cons-size) ptr) (storew ptr ptr (- cons-cdr-slot cons-size) - list-pointer-type)) + list-pointer-lowtag)) (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))) + cons-cdr-slot list-pointer-lowtag))) + (aver (null (tn-ref-across things))) (move res result)))))))) (define-vop (list list-or-list*) @@ -74,9 +78,8 @@ (define-vop (list* list-or-list*) (:variant t)) - -;;;; Special purpose inline allocators. +;;;; special purpose inline allocators (define-vop (allocate-code-object) (:args (boxed-arg :scs (any-reg)) @@ -93,18 +96,18 @@ (inst srl unboxed-arg word-shift unboxed) (inst lda unboxed lowtag-mask unboxed) (inst and unboxed ndescr unboxed) - (inst sll boxed (- type-bits word-shift) ndescr) - (inst bis ndescr code-header-type ndescr) + (inst sll boxed (- n-widetag-bits word-shift) ndescr) + (inst bis ndescr code-header-widetag ndescr) (pseudo-atomic () - (inst bis alloc-tn other-pointer-type result) - (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) + (inst bis alloc-tn other-pointer-lowtag result) + (storew ndescr result 0 other-pointer-lowtag) + (storew unboxed result code-code-size-slot other-pointer-lowtag) + (storew null-tn result code-entry-points-slot other-pointer-lowtag) (inst addq alloc-tn boxed alloc-tn) (inst addq alloc-tn unboxed alloc-tn)) - (storew null-tn result code-debug-info-slot other-pointer-type))) + (storew null-tn result code-debug-info-slot other-pointer-lowtag))) (define-vop (make-fdefn) (:policy :fast-safe) @@ -113,44 +116,54 @@ (:temporary (:scs (non-descriptor-reg)) temp) (:results (result :scs (descriptor-reg) :from :argument)) (:generator 37 - (with-fixed-allocation (result temp fdefn-type fdefn-size) - (storew name result fdefn-name-slot other-pointer-type) - (storew null-tn result fdefn-function-slot other-pointer-type) + (with-fixed-allocation (result temp fdefn-widetag fdefn-size) + (storew name result fdefn-name-slot other-pointer-lowtag) + (storew null-tn result fdefn-fun-slot other-pointer-lowtag) (inst li (make-fixup "undefined_tramp" :foreign) temp) - (storew temp result fdefn-raw-addr-slot other-pointer-type)))) + (storew temp result fdefn-raw-addr-slot other-pointer-lowtag)))) (define-vop (make-closure) (:args (function :to :save :scs (descriptor-reg))) - (:info length) + (:info length stack-allocate-p) + (:ignore stack-allocate-p) (:temporary (:scs (non-descriptor-reg)) temp) (:results (result :scs (descriptor-reg))) + (:node-var node) (:generator 10 - (let ((size (+ length closure-info-offset))) - (inst li (logior (ash (1- size) type-bits) closure-header-type) temp) - (pseudo-atomic (:extra (pad-data-block size)) - (inst bis alloc-tn function-pointer-type result) - (storew temp result 0 function-pointer-type)) - (storew function result closure-function-slot function-pointer-type)))) + (let* ((size (+ length closure-info-offset)) + (alloc-size (pad-data-block size)) + (dx-p (node-stack-allocate-p node))) + (inst li + (logior (ash (1- size) n-widetag-bits) closure-header-widetag) + temp) + (pseudo-atomic (:extra (if dx-p 0 alloc-size)) + (cond (dx-p + ;; no need to align CSP: FUN-POINTER-LOWTAG already has + ;; the corresponding bit set + (inst bis csp-tn fun-pointer-lowtag result) + (inst lda csp-tn alloc-size csp-tn)) + (t + (inst bis alloc-tn fun-pointer-lowtag result))) + (storew temp result 0 fun-pointer-lowtag)) + (storew function result closure-fun-slot fun-pointer-lowtag)))) ;;; The compiler likes to be able to directly make value cells. -;;; (define-vop (make-value-cell) (:args (value :to :save :scs (descriptor-reg any-reg null zero))) (:temporary (:scs (non-descriptor-reg)) temp) (:results (result :scs (descriptor-reg))) (:generator 10 (with-fixed-allocation - (result temp value-cell-header-type value-cell-size)) - (storew value result value-cell-value-slot other-pointer-type))) - + (result temp value-cell-header-widetag value-cell-size) + (storew value result value-cell-value-slot other-pointer-lowtag)))) -;;;; Automatic allocators for primitive objects. +;;;; automatic allocators for primitive objects (define-vop (make-unbound-marker) (:args) (:results (result :scs (any-reg))) (:generator 1 - (inst li unbound-marker-type result))) + (inst li unbound-marker-widetag result))) (define-vop (fixed-alloc) (:args) @@ -162,7 +175,7 @@ (pseudo-atomic (:extra (pad-data-block words)) (inst bis alloc-tn lowtag result) (when type - (inst li (logior (ash (1- words) type-bits) type) temp) + (inst li (logior (ash (1- words) n-widetag-bits) type) temp) (storew temp result 0 lowtag))))) (define-vop (var-alloc) @@ -174,11 +187,11 @@ (:temporary (:scs (non-descriptor-reg)) header) (:temporary (:scs (non-descriptor-reg)) bytes) (:generator 6 - (inst lda bytes (* (1+ words) word-bytes) extra) - (inst sll bytes (- type-bits 2) header) - (inst lda header (+ (ash -2 type-bits) type) header) - (inst srl bytes lowtag-bits bytes) - (inst sll bytes lowtag-bits bytes) + (inst lda bytes (* (1+ words) n-word-bytes) extra) + (inst sll bytes (- n-widetag-bits 2) header) + (inst lda header (+ (ash -2 n-widetag-bits) type) header) + (inst srl bytes n-lowtag-bits bytes) + (inst sll bytes n-lowtag-bits bytes) (pseudo-atomic () (inst bis alloc-tn lowtag result) (storew header result 0 lowtag)