Skip to content
Snippets Groups Projects
Commit 5efbe364 authored by rtoy's avatar rtoy
Browse files

Fix SSE2 bug when running

(defun testfn ()
  (let* ((i-gc-ed-u nil)
         (ext:*gc-notify-before* (lambda (a) (/ a 0.34d0))))
    (dotimes (i 100000)
      (setf i-gc-ed-u nil)
      (let* ((v1 (list (* 1d0 (random 10)) (* 1d0 (random 10))))
             (v2 (list (* 1d0 (random 10)) (* 1d0 (random 10))))
             (dot1 (reduce #'+ (mapcar #'* v1 v2)))
             (dot2 (reduce #'+ (mapcar #'* v1 v2))))
        (when (/= dot1 dot2)
          (print `(gc ,i-gc-ed-u v1 ,v1 v2 ,v2 dot1 ,dot1 dot2 ,dot2)))))))

Running this with sse2 would cuase dot1 and dot2 to sometimes be
different.  We forgot to save the SSE2 state in call_into_lisp.

(This bug was mentioned on comp.lang.lisp, http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/828371aa4800272c?hl=en#

x86-assem.S:
o Save and restore SSE2 state when running with SSE2 core.  (This
  might need more tweaking.  Should we use cpuid instead of looking at
  fpu_mode?)

gencgc.c:
o Save the SSE2 state, along with X87 state for SSE2 cores.
parent d8544caa
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment