[cffi-devel] New patches: 3-Feb-2006: x86-64

James Bielman jamesjb at jamesjb.com
Thu Feb 16 06:40:00 UTC 2006


"Hoehle, Joerg-Cyril" <Joerg-Cyril.Hoehle at t-systems.com> writes:

> James Bielman writes:
>>Hmm, I've tried to install an x86 CLISP in a 32-bit chroot to prepare
>>to implement and test this, but I'm a little concerned about the fact
>>that MACHINE-TYPE still returns X86-64 on a 32-bit x86 build.  Is
>>there a better way to tell whether we are running an x86 or x86-64
>>CLISP?
>
> I'm sorry, I don't understand what you observed, what you want or
> what you need. Feel free to elaborate.

Sorry... here's my train of thought: I wanted to support long long on
CLISP either based on the version or whether it is built for a 64-bit
target (amd64).

The problem is that I can't see any way to distinguish between a
32-bit CLISP and a 64-bit CLISP when running on an amd64:

;;; a 64-bit clisp:
[jamesjb at phi ~] clisp -q -norc
[1]> (integer-length most-positive-fixnum)
48
[2]> *features*
(:READLINE :REGEXP :SYSCALLS :I18N :LOOP :COMPILER :CLOS :MOP :CLISP :ANSI-CL
 :COMMON-LISP :LISP=CL :INTERPRETER :SOCKETS :GENERIC-STREAMS
 :LOGICAL-PATHNAMES :SCREEN :FFI :GETTEXT :UNICODE :BASE-CHAR=CHARACTER :PC386
 :UNIX)
[3]> (machine-type)
"X86_64"
[4]> 

;;; a 32-bit clisp:
[jamesjb at phi ~] dchroot
Executing shell in 'breezy32' chroot.
[jamesjb at breezy32 ~] clisp -q -norc
[1]> (integer-length most-positive-fixnum)
24
[2]> *features*
(:REGEXP :SYSCALLS :I18N :LOOP :COMPILER :CLOS :MOP :CLISP :ANSI-CL
 :COMMON-LISP :LISP=CL :INTERPRETER :SOCKETS :GENERIC-STREAMS
 :LOGICAL-PATHNAMES :FFI :GETTEXT :UNICODE :BASE-CHAR=CHARACTER :PC386 :UNIX)
[3]> (machine-type)
"X86_64"

I can punt on this and just check the version, but I also would like
to push CFFI-FEATURES:X86-64 onto *FEATURES* for a 64-bit CLISP, but I
don't know how to reliably get that information (since MACHINE-TYPE
returns "X86_64" even in a 32-bit CLISP and *FEATURES* doesn't have
anything pertinent.)

The other Lisp implementations I have installed define MACHINE-TYPE to
return the type of the target machine, instead of the actual
machine---so a 32-bit SBCL returns "X86" even though the machine is
actually an amd64 (although SBCL has :x86 / :x64-64 features so I
don't need to depend on this behavior...)

James



More information about the cffi-devel mailing list