Re: patch: don't store literal null pointers in saved images
James Bielman <[email protected]> Tue, 09 May 2006 07:22:19 -0700
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> writes: > Hi, James. The point of the defvar's is to avoid creating a new null > every time clsql needs a pointer to null-void. Your patch is nice to > support openmcl's save-application feature, but do think there is an > alternative way to support openmcl's save-application without > recreating a pointer each time with define-symbol-macro? > > If not, perhaps your patch can be modified to use > define-symbol-macro only on openmcl (and maybe sbcl with its > save-lisp-and-die) with the presumption that the advantages of > supporting save-application outweights the minor microoptimization > of reusing an already created pointer. Here's a better patch that adds a macro for defining pointer variables that might need to be initialized, and using an OpenMCL macro to reset the bindings when a saved image is loaded. (It's too bad DEFLOADVAR isn't exported, but there's a lot of OpenMCL example code that uses it, so I don't feel too guilty about it...) > Last, it interesting to hear about the CLSQL testsuite failures on > openmcl. I haven't had an openmcl box for a while. But, openmcl did > use to pass all of the CLSQL test suite. It appears there has been > some regression, unfortunately. I'm guessing here, but I bet it did pass all the tests with other database backends. A few years ago I got Oracle working with OpenMCL on PPC and there were a few test failures back then---I think I'd forgotten about them until now (I wonder if anyone else uses CLSQL-ORACLE on OpenMCL... :) If you have an AMD64 box handy, the OpenMCL port in CVS is progressing very nicely, and should work for CLSQL testing as well. James _______________________________________________ CLSQL-Devel mailing list [email protected] http://lists.b9.com/mailman/listinfo/clsql-devel
clsql-null-pointer-2.diff
(application/octet-stream, 1.8 KB)
--- clsql-3.5.7/db-oracle/oracle-api.lisp 2005-11-14 18:44:14.000000000 -0800 +++ clsql-devel/db-oracle/oracle-api.lisp 2006-05-09 07:10:29.000000000 -0700 @@ -37,9 +37,18 @@ (uffi:def-foreign-type oci-svc-ctx :pointer-void) (uffi:def-foreign-type oci-stmt :pointer-void) - -(defvar +null-void-pointer+ (uffi:make-null-pointer :void)) -(defvar +null-void-pointer-pointer+ (uffi:make-null-pointer :pointer-void)) +;;; Define a special variable, like DEFVAR, that will be initialized +;;; to a pointer which may need to be reset when a saved image is +;;; loaded. This is needed for OpenMCL, which sets pointers to "dead +;;; macptrs" when a saved image is loaded. +(defmacro define-pointer-var (name value &optional doc) + #-openmcl `(defvar ,name ,value ,doc) + #+openmcl `(ccl::defloadvar ,name ,value ,doc)) + +(define-pointer-var +null-void-pointer+ + (uffi:make-null-pointer :void)) +(define-pointer-var +null-void-pointer-pointer+ + (uffi:make-null-pointer :pointer-void)) ;;; Check an OCI return code for erroricity and signal a reasonably ;;; informative condition if so. --- clsql-3.5.7/db-oracle/oracle-sql.lisp 2006-02-28 08:07:59.000000000 -0800 +++ clsql-devel/db-oracle/oracle-sql.lisp 2006-05-09 07:08:14.000000000 -0700 @@ -37,11 +37,11 @@ (defmacro deref-vp (foreign-object) `(the vp-type (uffi:deref-pointer (the vpp-type ,foreign-object) :pointer-void))) -(defvar +unsigned-char-null-pointer+ +(define-pointer-var +unsigned-char-null-pointer+ (uffi:make-null-pointer :unsigned-char)) -(defvar +unsigned-short-null-pointer+ +(define-pointer-var +unsigned-short-null-pointer+ (uffi:make-null-pointer :unsigned-short)) -(defvar +unsigned-int-null-pointer+ +(define-pointer-var +unsigned-int-null-pointer+ (uffi:make-null-pointer :unsigned-int)) ;; constants - from OCI?