+(defun allocation (alloc-tn size &optional ignored dynamic-extent lowtag)
+ (declare (ignore ignored))
+ (when dynamic-extent
+ (allocation-dynamic-extent alloc-tn size lowtag)
+ (return-from allocation (values)))
+ (let ((NOT-INLINE (gen-label))
+ (DONE (gen-label))
+ ;; Yuck.
+ (in-elsewhere (eq *elsewhere* sb!assem::**current-segment**))
+ ;; thread->alloc_region.free_pointer
+ (free-pointer
+ #!+sb-thread
+ (make-ea :qword
+ :base thread-base-tn :scale 1
+ :disp (* n-word-bytes thread-alloc-region-slot))
+ #!-sb-thread
+ (make-ea :qword
+ :scale 1 :disp
+ (make-fixup "boxed_region" :foreign)))
+ ;; thread->alloc_region.end_addr
+ (end-addr
+ #!+sb-thread
+ (make-ea :qword
+ :base thread-base-tn :scale 1
+ :disp (* n-word-bytes (1+ thread-alloc-region-slot)))
+ #!-sb-thread
+ (make-ea :qword
+ :scale 1 :disp
+ (make-fixup "boxed_region" :foreign 8))))
+ (cond (in-elsewhere
+ (allocation-tramp alloc-tn size lowtag))
+ (t
+ (inst mov temp-reg-tn free-pointer)
+ (if (tn-p size)
+ (if (location= alloc-tn size)
+ (inst add alloc-tn temp-reg-tn)
+ (inst lea alloc-tn
+ (make-ea :qword :base temp-reg-tn :index size)))
+ (inst lea alloc-tn
+ (make-ea :qword :base temp-reg-tn :disp size)))
+ (inst cmp end-addr alloc-tn)
+ (inst jmp :be NOT-INLINE)
+ (inst mov free-pointer alloc-tn)
+ (if lowtag
+ (inst lea alloc-tn (make-ea :byte :base temp-reg-tn :disp lowtag))
+ (inst mov alloc-tn temp-reg-tn))
+ (emit-label DONE)
+ (assemble (*elsewhere*)
+ (emit-label NOT-INLINE)
+ (cond ((numberp size)
+ (allocation-tramp alloc-tn size lowtag))
+ (t
+ (inst sub alloc-tn free-pointer)
+ (allocation-tramp alloc-tn alloc-tn lowtag)))
+ (inst jmp DONE))))
+ (values)))
+