Skip to content

Commit

Permalink
Autogenerate a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
snuglas committed May 11, 2018
1 parent 02edec2 commit 7427d22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/compiler/generic/objdef.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
;;; in c-land. However, we need sight of so many parts of it from Lisp that
;;; it makes sense to define it here anyway, so that the GENESIS machinery
;;; can take care of maintaining Lisp and C versions.
(!define-primitive-object (thread)
(!define-primitive-object (thread :size primitive-thread-object-length)
;; no_tls_value_marker is borrowed very briefly at thread startup to
;; pass the address of initial-function into new_thread_trampoline.
;; tls[0] = NO_TLS_VALUE_MARKER_WIDETAG because a the tls index slot
Expand Down Expand Up @@ -477,11 +477,6 @@
;; but we need somewhere to read it from.
#!+(and immobile-space 64-bit sb-thread) (function-layout))

(defconstant primitive-thread-object-length
(sb!vm::primitive-object-length
(find 'sb!vm::thread sb!vm::*primitive-objects*
:key 'sb!vm::primitive-object-name)))

;;; Compute the smallest TLS index that will be assigned to a special variable
;;; that does not map onto a thread slot.
;;; Given N thread slots, the tls indices are 0..N-1 scaled by word-shift.
Expand Down
5 changes: 3 additions & 2 deletions src/compiler/generic/vm-macs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
(defvar *!late-primitive-object-forms* nil)

(defmacro !define-primitive-object
((name &key lowtag widetag alloc-trans (type t))
((name &key lowtag widetag alloc-trans (type t)
(size (symbolicate name "-SIZE")))
&rest slot-specs)
(collect ((slots) (specials) (constants) (forms) (inits))
(let ((offset (if widetag 1 0))
Expand Down Expand Up @@ -141,7 +142,7 @@
(setf variable-length-p t))
(incf offset length)))
(unless variable-length-p
(constants `(defconstant ,(symbolicate name "-SIZE") ,offset)))
(constants `(defconstant ,size ,offset)))
#-c-headers-only
(when alloc-trans
(forms `(def-alloc ,alloc-trans ,offset
Expand Down

0 comments on commit 7427d22

Please sign in to comment.