From 04c502ea9374372b1cd5d350aa95af4829fbae22 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Fri, 2 Mar 2007 05:05:32 +0000 Subject: [PATCH] 1.0.3.12: Use the interpreter when creating functions for undeclared aliens * 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 | 1 + src/code/target-alieneval.lisp | 15 ++++++++++----- version.lisp-expr | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b05c5bf..90beb97 100644 --- 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. diff --git a/src/code/target-alieneval.lisp b/src/code/target-alieneval.lisp index 21585e6..5d0036a 100644 --- a/src/code/target-alieneval.lisp +++ b/src/code/target-alieneval.lisp @@ -538,33 +538,38 @@ allocated using ``malloc'', so it can be passed to foreign functions which use ;;;; 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)) ;;;; ALIEN-FUNCALL, DEFINE-ALIEN-ROUTINE diff --git a/version.lisp-expr b/version.lisp-expr index d4aa3db..5081f96 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4