1.0.3.12: Use the interpreter when creating functions for undeclared aliens
authorJuho Snellman <jsnell@iki.fi>
Fri, 2 Mar 2007 05:05:32 +0000 (05:05 +0000)
committerJuho Snellman <jsnell@iki.fi>
Fri, 2 Mar 2007 05:05:32 +0000 (05:05 +0000)
          * No sense in invoking the compiler, since the functions will
            just be discarded after one use.
          * Undeclared aliens should no longer be hideously expensive

NEWS
src/code/target-alieneval.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index b05c5bf..90beb97 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ changes in sbcl-1.0.4 relative to sbcl-1.0.3:
     and gethostbyname, on platforms where the newer functions are available.
     As a result, the ALIASES field of HOST-ENT will always be NIL on these
     platforms.
+  * optimization: code using alien values with undeclared types is much faster
   * bug fix: >= and <= gave wrong results when used with NaNs.
   * bug fix: the #= and ## reader macros now interact reasonably with
     funcallable instances.
index 21585e6..5d0036a 100644 (file)
@@ -538,33 +538,38 @@ allocated using ``malloc'', so it can be passed to foreign functions which use
 \f
 ;;;; NATURALIZE, DEPORT, EXTRACT-ALIEN-VALUE, DEPOSIT-ALIEN-VALUE
 
+(defun coerce-to-interpreted-function (lambda-form)
+  (let (#!+sb-eval
+        (*evaluator-mode* :interpret))
+    (coerce lambda-form 'function)))
+
 (defun naturalize (alien type)
   (declare (type alien-type type))
-  (funcall (coerce (compute-naturalize-lambda type) 'function)
+  (funcall (coerce-to-interpreted-function (compute-naturalize-lambda type))
            alien type))
 
 (defun deport (value type)
   (declare (type alien-type type))
-  (funcall (coerce (compute-deport-lambda type) 'function)
+  (funcall (coerce-to-interpreted-function (compute-deport-lambda type))
            value type))
 
 (defun deport-alloc (value type)
   (declare (type alien-type type))
-  (funcall (coerce (compute-deport-alloc-lambda type) 'function)
+  (funcall (coerce-to-interpreted-function (compute-deport-alloc-lambda type))
            value type))
 
 (defun extract-alien-value (sap offset type)
   (declare (type system-area-pointer sap)
            (type unsigned-byte offset)
            (type alien-type type))
-  (funcall (coerce (compute-extract-lambda type) 'function)
+  (funcall (coerce-to-interpreted-function (compute-extract-lambda type))
            sap offset type))
 
 (defun deposit-alien-value (sap offset type value)
   (declare (type system-area-pointer sap)
            (type unsigned-byte offset)
            (type alien-type type))
-  (funcall (coerce (compute-deposit-lambda type) 'function)
+  (funcall (coerce-to-interpreted-function (compute-deposit-lambda type))
            sap offset type value))
 \f
 ;;;; ALIEN-FUNCALL, DEFINE-ALIEN-ROUTINE
index d4aa3db..5081f96 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.3.11"
+"1.0.3.12"