Changeset 624


Ignore:
Timestamp:
Mar 6, 2004, 11:50:02 PM (21 years ago)
Author:
Gary Byers
Message:

Foreign thread initialization needs to emulate shallow per-thread binding.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/ppc-threads-utils.lisp

    r85 r624  
    160160         (initial-bindings (%fixnum-ref bsp )))
    161161    (declare (fixnum bsp))
    162     (flet ((save-binding (value symbol prev)
    163              (setf (%fixnum-ref bsp -4) value
    164                    (%fixnum-ref bsp -8) symbol
    165                    (%fixnum-ref bsp -12) prev
    166                    bsp (- bsp 3))))
    167       (save-binding nil '*current-lisp-thread* 0)
    168       (save-binding nil '*current-process* bsp)
     162    ;; Um, this is a little more complicated now that we use
     163    ;; thread-local shallow binding
     164    (flet ((save-binding (new-value svar prev)
     165             (let* ((idx (%svref svar target::svar.idx-cell))
     166                    (byte-idx (ash idx target::fixnum-shift))
     167                    (binding-vector (%fixnum-ref (%current-tcr) target::tcr.tlb-pointer))
     168                    (old-value (%fixnum-ref  binding-vector byte-idx)))
     169             (setf (%fixnum-ref binding-vector byte-idx) new-value
     170                   (%fixnum-ref bsp (ash -1 target::word-shift)) old-value
     171                   (%fixnum-ref bsp (ash -2 target::word-shift)) idx
     172                   (%fixnum-ref bsp (ash -3 target::word-shift)) prev
     173                   bsp (- bsp 3)))))
     174      (save-binding nil (ensure-svar '*current-lisp-thread*) 0)
     175      (save-binding nil (ensure-svar '*current-process*) bsp)
    169176      (dolist (pair initial-bindings)
    170         (save-binding (funcall (cdr pair)) (car pair) bsp))
     177        (save-binding (funcall (cdr pair)) (ensure-svar (car pair)) bsp))
    171178      (setf (%fixnum-ref (%current-tcr) ppc32::tcr.db-link) bsp)
    172179      ;; Ensure that pending unwind-protects (for WITHOUT-INTERRUPTS
     
    176183        (unless (eql 0 top-catch)
    177184          (setf (%fixnum-ref top-catch ppc32::catch-frame.db-link) bsp)))))
    178   (let* ((thread (new-lisp-thread-from-tcr (%current-tcr) nil)))
     185  (let* ((thread (new-lisp-thread-from-tcr (%current-tcr) "foreign")))
    179186    (setq *current-lisp-thread* thread
    180187          *current-process*
Note: See TracChangeset for help on using the changeset viewer.