Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(system-type 'word) on 'pb always reports 64 #4692

Closed
LiberalArtist opened this issue Jul 3, 2023 · 2 comments
Closed

(system-type 'word) on 'pb always reports 64 #4692

LiberalArtist opened this issue Jul 3, 2023 · 2 comments

Comments

@LiberalArtist
Copy link
Contributor

LiberalArtist commented Jul 3, 2023

The documentation for system-type says:

In 'word mode, the result is either 32 or 64 to indicate whether Racket is running as a 32-bit program or 64-bit program.

The implementation for CS is:

[(word) (if (> (fixnum-width) 32) 64 32)]

But, on pb and tpb machine types, fixnums may be larger than the word size at the OS level.

@mflatt
Copy link
Member

mflatt commented Jul 4, 2023

I'm not sure what the result should be. It's accurate in the sense that it reflects the size of addresses within Racket. Meanwhile, to use Racket's FFI — and therefore, to much much of anything with Racket besides maybe bootstrapping Racket — you'll need to have a more specific machine type, like pb64l.

Is there some case where the result from (system-type 'word) would matter for pb or tpb?

(Is it even possible to build Racket as pb or tpb, as opposed to just Chez Scheme? I've lost track.)

@LiberalArtist
Copy link
Contributor Author

(Is it even possible to build Racket as pb or tpb, as opposed to just Chez Scheme? I've lost track.)

It seems it is not, which is fine with me! An attempt just now with ../configure --enable-csonly --enable-pb --disable-pbchunk --enable-mach=pb --enable-scheme=scheme failed at the point of:

gcc -g -O2 -Wall -o cs/c/raw_racketcs cs/c/main.o cs/c/boot.o cs/c/ChezScheme/pb/boot/pb/libkernel.a cs/c/ChezScheme/pb/lz4/lib/liblz4.a cs/c/rktio/librktio.a -rdynamic -ldl -lm  -lrt  -lncurses -lz -lffi
cs/c/ChezScheme/pb/bin/pb/scheme -B cs/c/ChezScheme/pb/boot/pb/petite.boot -B cs/c/ChezScheme/pb/boot/pb/scheme.boot --script ../cs/c/to-vfasl.ss cs/c/ChezScheme/pb/boot/pb/petite.boot cs/c/petite-v.boot
Exception in vfasl: cannot vfasl with unknown endianness
failed
 in build-one
 in loop
 in module->hash
make: *** [Makefile:18: all] Error 1

The question came up while I was revisiting #3948 (an especially improbable situation to be in with a pb Racket), and I was trying to determine whether:

(format "tpb~a~a"
        (system-type 'word)
        (if (system-big-endian?)
            "b"
            "l"))

would produce the right pbarch machine type for the current system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants