anchor.diff:              `(sys.lap-x86:jmp ,value-extracted)
               type-error-label)
         (raise-type-error :r8 '(signed-byte 64)))
  +    (unless constant-offset
  +      (load-in-reg :r10 offset t)
  +      (fixnum-check :r10)
  +      ;; Convert to unboxed integer.
  +      (emit `(sys.lap-x86:mov64 :rdi :r10)
  +            `(sys.lap-x86:sar64 :rdi ,sys.int::+n-fixnum-bits+)))
       (load-in-reg :r9 array t)
  -    (load-in-reg :r10 offset t)
  -    (fixnum-check :r10)
  -    (emit `(sys.lap-x86:mov64 :rcx :r10))
       (load-in-r8 new-value t)
       (emit `(sys.lap-x86:mov64 :rdx :r8)
   	  `(sys.lap-x86:test64 :rdx ,sys.int::+fixnum-tag-mask+)
   	  `(sys.lap-x86:jnz ,bignum-path)
   	  ;; Convert to raw integer.
   	  `(sys.lap-x86:sar64 :rdx ,sys.int::+n-fixnum-bits+)
  -          value-extracted
  -	  `(sys.lap-x86:sar64 :rcx ,sys.int::+n-fixnum-bits+)
  -	  ;; Write.
  -	  `(sys.lap-x86:mov64 ,(object-ea :r9 :index '(:rcx 8)) :rdx))
  +          value-extracted)
  +    ;; Write.
  +    (cond (constant-offset
  +           (emit `(sys.lap-x86:mov64 ,(object-ea :r9 :slot constant-offset) :rdx)))
  +          (t
  +           (emit `(sys.lap-x86:mov64 ,(object-ea :r9 :index '(:rdi 8)) :rdx))))
       *r8-value*))
   
   (defbuiltin sys.int::%array-like-ref-t (array offset) ()
  -  (load-in-reg :r8 array t)
  -  (load-in-reg :r9 offset t)
  -  (fixnum-check :r9)
  -  (emit `(sys.lap-x86:mov64 :rcx :r9)
  -        `(sys.lap-x86:sar64 :rcx ,sys.int::+n-fixnum-bits+))
  -  (smash-r8)
  -  ;; Read.
  -  (emit `(sys.lap-x86:mov64 :r8 ,(object-ea :r8 :index '(:rcx 8))))
  -  (setf *r8-value* (list (gensym))))
  +  (let ((constant-offset (and (constant-type-p offset `(signed-byte ,(- 64 sys.int::+n-fixnum-bits+)))
  +                              (second offset))))
  +    (unless constant-offset
  +      (load-in-reg :r10 offset t)
  +      (fixnum-check :r10)
  +      ;; Convert to unboxed integer.
  +      (emit `(sys.lap-x86:mov64 :rdi :r10)
  +            `(sys.lap-x86:sar64 :rdi ,sys.int::+n-fixnum-bits+)))
  +    (load-in-reg :r8 array t)
  +    (smash-r8)
  +    ;; Read.
  +    (cond (constant-offset
  +           (emit `(sys.lap-x86:mov64 :r8 ,(object-ea :r8 :slot constant-offset))))
  +          (t
  +           (emit `(sys.lap-x86:mov64 :r8 ,(object-ea :r8 :index '(:rdi 8))))))
  +    (setf *r8-value* (list (gensym)))))
   
   (defbuiltin (setf sys.int::%array-like-ref-t) (new-value array offset) ()
  -  (load-in-reg :r9 array t)
  -  (load-in-reg :r10 offset t)
  -  (fixnum-check :r10)
  -  (emit `(sys.lap-x86:mov64 :rcx :r10)
  -        `(sys.lap-x86:sar64 :rcx ,sys.int::+n-fixnum-bits+))
  -  (load-in-r8 new-value t)
  -  ;; Write.
  -  (emit `(sys.lap-x86:mov64 ,(object-ea :r9 :index '(:rcx 8)) :r8))
  -  *r8-value*)
  +  (let ((constant-offset (and (constant-type-p offset `(signed-byte ,(- 64 sys.int::+n-fixnum-bits+)))
  +                              (second offset))))
  +    (unless constant-offset
  +      (load-in-reg :r10 offset t)
  +      (fixnum-check :r10)
  +      ;; Convert to unboxed integer.
  +      (emit `(sys.lap-x86:mov64 :rdi :r10)
  +            `(sys.lap-x86:sar64 :rdi ,sys.int::+n-fixnum-bits+)))
  +    (load-in-reg :r9 array t)
  +    (load-in-r8 new-value t)
  +    ;; Write.
  +    (cond (constant-offset
  +           (emit `(sys.lap-x86:mov64 ,(object-ea :r9 :slot constant-offset) :r8)))
  +          (t
  +           (emit `(sys.lap-x86:mov64 ,(object-ea :r9 :index '(:rdi 8)) :r8))))
  +    *r8-value*))
   
   ;;; Atomic operations.
   ;;; These functions index into the object like %ARRAY-LIKE-REF-T.
  
positive.code: ;;                   (t nil))
  ;;             slot-value)))
  (defbuiltin sys.int::%cas-array-like (object offset old new) ()
    (load-in-reg :r10 offset t)
    (fixnum-check :r10)
    (load-in-reg :r9 object t)
    (load-in-reg :r11 new t)
    (load-in-reg :r8 old t)
    (smash-r8)
    (emit
     ;; Convert size and slot number to integers.
     `(sys.lap-x86:mov64 :rcx :r10)
     `(sys.lap-x86:shr64 :rcx ,sys.int::+n-fixnum-bits+)
     `(sys.lap-x86:mov64 :rax :r8))
    (emit-gc-info :extra-registers :rax)
    (emit
     `(sys.lap-x86:lock)
     `(sys.lap-x86:cmpxchg ,(object-ea :r9 :index '(:rcx 8)) :r11))
    (cond ((member *for-value* '(:multiple :tail))
           ;; Return success and the old value.
           (emit `(sys.lap-x86:mov64 :r9 :rax))
           (emit-gc-info)
           (emit `(sys.lap-x86:mov64 :r8 nil)
                 `(sys.lap-x86:cmov64z :r8 (:constant t)))
           (load-constant :rcx 2)
           :multiple)
          (t ;; Just return the success state.
           (emit-gc-info)
           (predicate-result :z))))
  
  ;; Similar to %CAS-OBJECT, but performs two CAS operations on adjacent slots.
  ;; Returns the two old slot values and a success boolean.
  
negative.code: ;;             slot-value-1
  ;;             slot-value-2)))
  (defbuiltin sys.int::%dcas-array-like (object offset old-1 old-2 new-1 new-2) ()
    (let ((constant-offset (and (constant-type-p offset `(signed-byte ,(- 64 sys.int::+n-fixnum-bits+)))
                                (second offset))))
      (unless constant-offset
        (load-in-reg :r10 offset t)
        (fixnum-check :r10)
        ;; Convert to unboxed integer.
        (emit `(sys.lap-x86:mov64 :rdi :r10)
              `(sys.lap-x86:sar64 :rdi ,sys.int::+n-fixnum-bits+)))
      (load-in-reg :r8 object t)
      ;; Carefully load registers to avoid exposing the GC to a raw value.
      (load-in-reg :rbx new-1 t) ; rbx loaded (rbx is a value register).
      (load-in-reg :rax old-1 t) ; rbx, rax loaded.
      (emit-gc-info :extra-registers :rax)
      (load-in-reg :rcx new-2 t) ; rbx, rax, rcx loaded.
      (emit-gc-info :extra-registers :rax-rcx)
      (load-in-reg :rdx old-2 t) ; all registers loaded.
      (emit-gc-info :extra-registers :rax-rcx-rdx)
      (smash-r8)
      (cond (constant-offset
             (emit `(sys.lap-x86:lock)
                   `(sys.lap-x86:cmpxchg16b ,(object-ea :r8 :slot constant-offset))))
            (t
             (emit `(sys.lap-x86:lock)
                   `(sys.lap-x86:cmpxchg16b ,(object-ea :r8 :index '(:rdi 8))))))
      (cond ((member *for-value* '(:multiple :tail))
             ;; Return status and the old values.
             (emit `(sys.lap-x86:mov64 :r9 :rax))
             (emit `(sys.lap-x86:mov64 :r10 :rdx))
             (emit-gc-info)
             (emit `(sys.lap-x86:mov64 :r8 nil)
                   `(sys.lap-x86:cmov64z :r8 (:constant t)))
             (load-constant :rcx 3)
             :multiple)
            (t ;; Just return the status.
             (emit-gc-info)
             (predicate-result :z)))))
  