0.9.9.36:
[sbcl.git] / src / compiler / ppc / c-call.lisp
index a218792..be7be0e 100644 (file)
                          (inst lis reg high)
                          (inst ori reg reg low))))
                 ;; Setup the args
-                (load-address-into arg1 (get-lisp-obj-address #'enter-alien-callback))
+
+                ;; CLH 2006/02/10 -Following JES' logic in
+                ;; x86-64/c-call.lisp, we need to access
+                ;; ENTER-ALIEN-CALLBACK through the symbol-value slot
+                ;; of SB-ALIEN::*ENTER-ALIEN-CALLBACK* to ensure that
+                ;; it works if GC moves ENTER-ALIEN-CALLBACK.
+                ;;
+                ;; old way:
+                ;; (load-address-into arg1 (get-lisp-obj-address #'enter-alien-callback))
+
+                ;; new way:
+                ;; (load-symbol arg1 'sb!alien::*enter-alien-callback*)
+                ;;
+                ;; whoops: can't use load-symbol here as null-tn might
+                ;; not be loaded with the proper value as we are
+                ;; coming in from C code. Use nil-value constant
+                ;; instead, following the logic in x86-64/c-call.lisp.
+                (load-address-into arg1 (+ nil-value (static-symbol-offset
+                                                      'sb!alien::*enter-alien-callback*)))
+                (loadw arg1 arg1 symbol-value-slot other-pointer-lowtag)
+
                 (inst li arg2 (fixnumize index))
                 (inst addi arg3 sp n-foreign-linkage-area-bytes)
                 ;; FIXME: This was (- (* RETURN-AREA-SIZE N-WORD-BYTES)), while