Update of /cvsroot/sbcl/sbcl/src/compiler
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15547/src/compiler
18.104.22.168: fix with-pinned-objects stack corruption potential
* In the old WITH-PINNED-OBJECTS implementation we pushed pointers
onto stack explicitly (without telling the compiler), executed
the body, and _prior_to_returning_values_of_body_ popped the pointers.
If the values from the body were in progress of being returned via
unknown-values convention we would (try to) pop the pointers while
the last callee stack frame (where the values to be returned are)
is still on the stack. In many cases this was harmless, as the correct
SP was restored soon enough, but there were bad interactions as well.
* Solution: instead of explicitly pushing pointers, use a LET to
add binding to the current stack frame for the objects, and further
use a magic TOUCH-OBJECT function implemented with an empty VOP
to trick the compiler into keeping the variables live till the end
of the body.
Probably not perfect, but seems to do the job. Of the added test-case,
the MULTIPLE variants used to fail prior to this.
RCS file: /cvsroot/sbcl/sbcl/src/compiler/fndb.lisp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- fndb.lisp 16 Jul 2007 16:52:53 -0000 1.138
+++ fndb.lisp 9 Nov 2007 17:38:16 -0000 1.139
@@ -1520,10 +1520,10 @@
;;;; ALIEN and call-out-to-C stuff
-;;; 'unsafe' attribute because we store the arg on the stack, which is in
-;;; some sense 'passing it upwards'
-(defknown sb!vm::push-word-on-c-stack (system-area-pointer) (values) (unsafe))
-(defknown sb!vm::pop-words-from-c-stack (index) (values) ())
+;; Used by WITH-PINNED-OBJECTS
+#!+(or x86 x86-64)
+(defknown sb!vm::touch-object (t) (values)
+ (unsafe always-translatable))
(defknown foreign-symbol-dataref-sap (simple-string)