Skip to content

Commit

Permalink
Rename function subtype widetags to SIMPLE-FUN-WIDETAG, etc.
Browse files Browse the repository at this point in the history
FUNCALLABLE-INSTANCE-HEADER-WIDETAG is deleted, but the other two
remain for compatibility with many uses outside of SBCL sources,
though they are not used internally.
  • Loading branch information
snuglas committed Apr 16, 2017
1 parent 044959a commit f25fa78
Show file tree
Hide file tree
Showing 57 changed files with 120 additions and 114 deletions.
2 changes: 1 addition & 1 deletion make-target-2-load.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
(when (typep obj 'class)
(when (slot-boundp obj 'sb-pcl::%documentation)
(clear-it (slot-value obj 'sb-pcl::%documentation)))))
(#.sb-vm:funcallable-instance-header-widetag
(#.sb-vm:funcallable-instance-widetag
(when (typep obj 'standard-generic-function)
(when (slot-boundp obj 'sb-pcl::%documentation)
(clear-it (slot-value obj 'sb-pcl::%documentation)))))))
Expand Down
9 changes: 6 additions & 3 deletions package-data-list.lisp-expr
Original file line number Diff line number Diff line change
Expand Up @@ -2951,7 +2951,9 @@ structure representations"
"CATCH-BLOCK-SC-NUMBER" "CATCH-BLOCK-SIZE"
"CATCH-BLOCK-TAG-SLOT" "CERROR-TRAP"
"CLOSURE-FUN-SLOT"
"CLOSURE-HEADER-WIDETAG" "CLOSURE-INFO-OFFSET"
"CLOSURE-HEADER-WIDETAG" ; don't use
"CLOSURE-WIDETAG"
"CLOSURE-INFO-OFFSET"
"CODE-CODE-SIZE-SLOT" "CODE-CONSTANTS-OFFSET"
"CODE-DEBUG-INFO-SLOT"
"CODE-HEADER-WIDETAG" "COMPLEX-ARRAY-WIDETAG"
Expand Down Expand Up @@ -3011,11 +3013,12 @@ structure representations"
"FP-CONSTANT-SC-NUMBER"
"FP-DOUBLE-ZERO-SC-NUMBER" "FP-SINGLE-ZERO-SC-NUMBER"
"FUNCALLABLE-INSTANCE-TRAMPOLINE-SLOT"
"FUNCALLABLE-INSTANCE-HEADER-WIDETAG"
"FUNCALLABLE-INSTANCE-WIDETAG"
"FUNCALLABLE-INSTANCE-INFO-OFFSET"
"SIMPLE-FUN-ARGLIST-SLOT" "SIMPLE-FUN-CODE-OFFSET"
"FUN-END-BREAKPOINT-TRAP"
"SIMPLE-FUN-HEADER-WIDETAG"
"SIMPLE-FUN-HEADER-WIDETAG" ; don't use
"SIMPLE-FUN-WIDETAG"
"SIMPLE-FUN-NAME-SLOT"
"FUN-POINTER-LOWTAG"
"SIMPLE-FUN-SELF-SLOT"
Expand Down
4 changes: 2 additions & 2 deletions src/assembly/alpha/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
(:temp nl0-tn non-descriptor-reg nl0-offset)
(:temp ocfp-tn non-descriptor-reg ocfp-offset)
(:temp lra-tn descriptor-reg lra-offset))
(inst lword simple-fun-header-widetag) ;; header
(inst lword simple-fun-widetag) ;; header
(inst lword (make-fixup 'undefined-tramp-tagged
:assembly-routine)) ;; self
(dotimes (i (- simple-fun-code-offset 2))
Expand Down Expand Up @@ -66,7 +66,7 @@
fun-pointer-lowtag))))
((:temp code-tn descriptor-reg code-offset)
(:temp lexenv-tn descriptor-reg lexenv-offset))
(inst lword simple-fun-header-widetag)
(inst lword simple-fun-widetag)
(inst lword (make-fixup 'funcallable-instance-tramp
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand Down
8 changes: 4 additions & 4 deletions src/assembly/arm/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(+ xundefined-tramp fun-pointer-lowtag))))
((:temp lexenv-tn descriptor-reg lexenv-offset))
HEADER
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'undefined-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand All @@ -29,7 +29,7 @@
fun-pointer-lowtag))))
((:temp r8-tn unsigned-reg r8-offset))
HEADER
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'undefined-alien-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -45,7 +45,7 @@
(:export (closure-tramp
(+ xclosure-tramp fun-pointer-lowtag))))
((:temp lexenv-tn descriptor-reg lexenv-offset))
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'closure-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand All @@ -61,7 +61,7 @@
(+ xfuncallable-instance-tramp
fun-pointer-lowtag))))
((:temp lexenv-tn descriptor-reg lexenv-offset))
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'funcallable-instance-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand Down
8 changes: 4 additions & 4 deletions src/assembly/arm64/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
fun-pointer-lowtag))))
()
HEADER
(inst dword simple-fun-header-widetag)
(inst dword simple-fun-widetag)
(inst dword (make-fixup 'undefined-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -33,7 +33,7 @@
fun-pointer-lowtag))))
((:temp r8-tn unsigned-reg r8-offset))
HEADER
(inst dword simple-fun-header-widetag)
(inst dword simple-fun-widetag)
(inst dword (make-fixup 'undefined-alien-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -51,7 +51,7 @@
(+ xclosure-tramp
fun-pointer-lowtag))))
()
(inst dword simple-fun-header-widetag)
(inst dword simple-fun-widetag)
(inst dword (make-fixup 'closure-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -70,7 +70,7 @@
(+ xfuncallable-instance-tramp
fun-pointer-lowtag))))
()
(inst dword simple-fun-header-widetag)
(inst dword simple-fun-widetag)
(inst dword (make-fixup 'funcallable-instance-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst dword nil-value))
Expand Down
4 changes: 2 additions & 2 deletions src/assembly/hppa/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
fun-pointer-lowtag))))
((:temp lra-tn descriptor-reg lra-offset)
(:temp temp non-descriptor-reg nl0-offset))
(inst word simple-fun-header-widetag) ;; header
(inst word simple-fun-widetag) ;; header
(inst word (make-fixup 'undefined-tramp-tagged
:assembly-routine)) ;; self
(dotimes (i (- simple-fun-code-offset 2))
Expand Down Expand Up @@ -85,7 +85,7 @@
(+ funcallable-instance-tramp-header
fun-pointer-lowtag))))
nil
(inst word simple-fun-header-widetag) ;;header
(inst word simple-fun-widetag) ;;header
(inst word (make-fixup 'funcallable-instance-tramp :assembly-routine)) ;; self
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand Down
6 changes: 3 additions & 3 deletions src/assembly/mips/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
fun-pointer-lowtag))))
((:temp nl0 unsigned-reg nl0-offset)
(:temp lra descriptor-reg lra-offset))
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'undefined-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -38,7 +38,7 @@
(+ xclosure-tramp
fun-pointer-lowtag))))
()
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'closure-tramp-tagged
:assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
Expand All @@ -58,7 +58,7 @@
(+ xfuncallable-instance-tramp
fun-pointer-lowtag))))
()
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'funcallable-instance-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand Down
4 changes: 2 additions & 2 deletions src/assembly/ppc/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(+ xundefined-tramp
fun-pointer-lowtag))))
((:temp fdefn-tn descriptor-reg fdefn-offset))
(inst word simple-fun-header-widetag) ;; header
(inst word simple-fun-widetag) ;; header
(inst word (make-fixup 'undefined-tramp-tagged
:assembly-routine)) ;; self
(dotimes (i (- simple-fun-code-offset 2))
Expand Down Expand Up @@ -52,7 +52,7 @@
(+ xfuncallable-instance-tramp
fun-pointer-lowtag))))
((:temp fdefn-tn descriptor-reg fdefn-offset))
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'funcallable-instance-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand Down
6 changes: 3 additions & 3 deletions src/assembly/sparc/tramps.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(+ xundefined-tramp fun-pointer-lowtag))))
((:temp cname-tn descriptor-reg cname-offset))
(without-scheduling ()
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'undefined-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand All @@ -27,7 +27,7 @@
((:temp lexenv-tn descriptor-reg lexenv-offset)
(:temp cname-tn descriptor-reg cname-offset))
(without-scheduling ()
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'closure-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand All @@ -46,7 +46,7 @@
fun-pointer-lowtag))))
((:temp lexenv-tn descriptor-reg lexenv-offset))
(without-scheduling ()
(inst word simple-fun-header-widetag)
(inst word simple-fun-widetag)
(inst word (make-fixup 'funcallable-instance-tramp :assembly-routine))
(dotimes (i (- simple-fun-code-offset 2))
(inst word nil-value))
Expand Down
4 changes: 2 additions & 2 deletions src/code/class.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ between the ~A definition and the ~A definition"
(random-class) ; used for unknown type codes

(function
:codes (#.sb!vm:closure-header-widetag
#.sb!vm:simple-fun-header-widetag)
:codes (#.sb!vm:closure-widetag
#.sb!vm:simple-fun-widetag)
:state :read-only
:prototype-form (function (lambda () 42)))

Expand Down
2 changes: 1 addition & 1 deletion src/code/fdefinition.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
;; if we already know that FUNCTION is a function.
;; It will signal a type error if not, which is the right thing to do anyway.
;; (this isn't quite a true predicate)
(and (= (fun-subtype function) sb!vm:closure-header-widetag)
(and (= (fun-subtype function) sb!vm:closure-widetag)
;; Prior to cold-init fixing up the load-time-value, this compares
;; %closure-fun to 0, which is ok - it returns NIL.
(eq (load-time-value (%closure-fun (symbol-function '%coerce-name-to-fun))
Expand Down
4 changes: 2 additions & 2 deletions src/code/room.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(make-room-info :name 'bignum
:kind :other))

(setf (svref *meta-room-info* closure-header-widetag)
(setf (svref *meta-room-info* closure-widetag)
(make-room-info :name 'closure
:kind :closure))

Expand All @@ -69,7 +69,7 @@
(make-room-info :name 'instance
:kind :instance))

(setf (svref *meta-room-info* funcallable-instance-header-widetag)
(setf (svref *meta-room-info* funcallable-instance-widetag)
(make-room-info :name 'funcallable-instance
:kind :closure))

Expand Down
8 changes: 4 additions & 4 deletions src/code/target-misc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
(declare (function function))
;; It's too bad that TYPECASE isn't able to generate equivalent code.
(case (fun-subtype function)
(#.sb!vm:closure-header-widetag
(#.sb!vm:closure-widetag
(%closure-fun function))
(#.sb!vm:funcallable-instance-header-widetag
(#.sb!vm:funcallable-instance-widetag
;; %FUNCALLABLE-INSTANCE-FUNCTION is not known to return a FUNCTION.
;; Is that right? Shouldn't we always initialize to something
;; that is a function, such as an error-signaling trampoline?
Expand Down Expand Up @@ -121,7 +121,7 @@
;;; or NIL if there's none
(defun %fun-name (function)
(case (fun-subtype function)
(#.sb!vm:funcallable-instance-header-widetag
(#.sb!vm:funcallable-instance-widetag
(let (#!+(or sb-eval sb-fasteval)
(layout (%funcallable-instance-layout function)))
;; We know that funcallable-instance-p is true,
Expand All @@ -140,7 +140,7 @@
function)
(return-from %fun-name
(sb!mop:generic-function-name function))))))
(#.sb!vm:closure-header-widetag
(#.sb!vm:closure-widetag
(multiple-value-bind (name namedp) (closure-name function)
(when namedp
(return-from %fun-name name)))))
Expand Down
4 changes: 2 additions & 2 deletions src/code/x86-64-vm.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
;; in arch_write_linkage_table_jmp() and arch_do_displaced_inst().
(setf (sap-ref-32 sap 0) #x058B48 ; REX MOV [RIP-n]
(signed-sap-ref-32 sap 3) (- ea (+ (sap-int sap) 7))) ; disp
(let ((i (if (/= (fun-subtype fun) funcallable-instance-header-widetag)
(let ((i (if (/= (fun-subtype fun) funcallable-instance-widetag)
7
(let ((disp8 (- (ash funcallable-instance-function-slot
word-shift)
Expand Down Expand Up @@ -264,7 +264,7 @@
(case (sap-ref-8 (int-sap obj) 0)
(#.fdefn-widetag
(make-lisp-obj (logior obj other-pointer-lowtag)))
(#.funcallable-instance-header-widetag
(#.funcallable-instance-widetag
(make-lisp-obj (logior obj fun-pointer-lowtag)))
(#.code-header-widetag
(let ((code (make-lisp-obj (logior obj other-pointer-lowtag))))
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/alpha/alloc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
(let* ((size (+ length closure-info-offset))
(alloc-size (pad-data-block size)))
(inst li
(logior (ash (1- size) n-widetag-bits) closure-header-widetag)
(logior (ash (1- size) n-widetag-bits) closure-widetag)
temp)
(pseudo-atomic (:extra (if stack-allocate-p 0 alloc-size))
(cond (stack-allocate-p
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/alpha/cell.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
(:generator 38
(let ((normal-fn (gen-label)))
(load-type type function (- fun-pointer-lowtag))
(inst xor type simple-fun-header-widetag type)
(inst xor type simple-fun-widetag type)
(inst addq function
(- (ash simple-fun-code-offset word-shift) fun-pointer-lowtag)
lip)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/alpha/insts.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
(define-instruction simple-fun-header-word (segment)
(:cost 0)
(:emitter
(emit-header-data segment simple-fun-header-widetag)))
(emit-header-data segment simple-fun-widetag)))

(define-instruction lra-header-word (segment)
(:cost 0)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/arm/alloc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
(load-immediate-word pa-flag
(logior
(ash (1- size) n-widetag-bits)
closure-header-widetag))
closure-widetag))
(storew pa-flag result 0 fun-pointer-lowtag)
(storew function result closure-fun-slot fun-pointer-lowtag)))))

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/arm/cell.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
(emit-label closure-tramp-fixup)
(inst word (make-fixup 'closure-tramp :assembly-routine)))
(load-type type function (- fun-pointer-lowtag))
(inst cmp type simple-fun-header-widetag)
(inst cmp type simple-fun-widetag)
(inst mov :eq lip function)
(inst load-from-label :ne lip lip closure-tramp-fixup)
(storew lip fdefn fdefn-raw-addr-slot other-pointer-lowtag)
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/arm/insts.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@

(define-instruction simple-fun-header-word (segment)
(:emitter
(emit-header-data segment simple-fun-header-widetag)))
(emit-header-data segment simple-fun-widetag)))

(define-instruction lra-header-word (segment)
(:emitter
Expand Down Expand Up @@ -1186,7 +1186,7 @@
(inst ldr temp (@ lip (- other-pointer-lowtag)))
;; And finally we use the header value (a count in words),
;; plus the fact that the top two bits of the widetag are
;; clear (SIMPLE-FUN-HEADER-WIDETAG is #x2A and
;; clear (SIMPLE-FUN-WIDETAG is #x2A and
;; RETURN-PC-HEADER-WIDETAG is #x36) to compute the boxed
;; address of the code component.
(inst sub code lip (lsr temp (- 8 word-shift))))))))
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/arm64/alloc.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
(load-immediate-word pa-flag
(logior
(ash (1- size) n-widetag-bits)
closure-header-widetag))
closure-widetag))
(storew pa-flag result 0 fun-pointer-lowtag)
(storew function result closure-fun-slot fun-pointer-lowtag)))))

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/arm64/cell.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
(inst add-sub lip function (- (* simple-fun-code-offset n-word-bytes)
fun-pointer-lowtag))
(load-type type function (- fun-pointer-lowtag))
(inst cmp type simple-fun-header-widetag)
(inst cmp type simple-fun-widetag)
(inst b :eq SIMPLE-FUN)
(load-inline-constant lip '(:fixup closure-tramp :assembly-routine) lip)
SIMPLE-FUN
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/arm64/insts.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@

(define-instruction simple-fun-header-word (segment)
(:emitter
(emit-header-data segment simple-fun-header-widetag)))
(emit-header-data segment simple-fun-widetag)))

(define-instruction lra-header-word (segment)
(:emitter
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/generic/core.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
(error "Can't statically link to undefined function ~S" name))
((not (<= sb!vm:immobile-space-start addr sb!vm:immobile-space-end))
(error "Can't statically link to ~S: code is movable" name))
((neq (fun-subtype fun) sb!vm:simple-fun-header-widetag)
((neq (fun-subtype fun) sb!vm:simple-fun-widetag)
(error "Can't statically link to ~S: non-simple function" name))
(t
(sap-ref-word (int-sap addr)
Expand Down
Loading

0 comments on commit f25fa78

Please sign in to comment.