On Fri, May 30, 2008 at 5:13 PM, Hans Hübner hans@huebner.org wrote:
On Fri, May 30, 2008 at 7:27 PM, Luís Oliveira luismbo@gmail.com wrote:
Thanks to the optimization mentioned above (a compiler macro for foreign-alloc), foreign-string-alloc calls PARSE-TYPE only at compile-time.
It seemingly does not:
CFFI> (trace parse-type) NIL CFFI> (foreign-string-alloc "foo") 0> Calling (PARSE-TYPE :CHAR) <0 PARSE-TYPE returned #<FOREIGN-BUILT-IN-TYPE :CHAR> 0> Calling (PARSE-TYPE :UINT8) <0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8> 0> Calling (PARSE-TYPE :UINT8) <0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8> 0> Calling (PARSE-TYPE :UINT8) <0 PARSE-TYPE returned #<FOREIGN-TYPEDEF :UINT8> 0> Calling (PARSE-TYPE :CHAR) <0 PARSE-TYPE returned #<FOREIGN-BUILT-IN-TYPE :CHAR> #<A Foreign Pointer #x2AAAB963F6D0> 4 CFFI> (lisp-implementation-version) "Version 1.2-r9471M (LinuxX8664)"
So, if I understand what you write, this basically means that the FOREIGN-ALLOC compiler macro does not work. I will try to isolate this and ask the Clozure folks for help.
The reason for this was the very high debug and safety optimization settings (safety 3 debug 3) that have been in use when compiling the application. When compiling with (debug 1 safety 2), the compiler macro is used as expected.
Thanks! Hans