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

Re: Bug#263020: Sys.word_size not constant folded #3034

Closed
vicuna opened this issue Aug 2, 2004 · 1 comment
Closed

Re: Bug#263020: Sys.word_size not constant folded #3034

vicuna opened this issue Aug 2, 2004 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Aug 2, 2004

Original bug ID: 3034
Reporter: administrator
Status: closed
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

tags 263020 upstream
thanks

On Mon, Aug 02, 2004 at 08:34:42PM +0200, Falk Hueffner wrote:

Package: ocaml-nox
Version: 3.08.0-2
Severity: normal
File: /usr/bin/ocamlopt

% cat test.ml && ocamlopt -c test.ml && objdump -d test.o
let f () = if Sys.word_size = 64 then 1 else 0;;

test.o: file format elf64-alpha

Disassembly of section .text:

0000000000000000 <camlTest__f_57>:
0: 00 00 bb 27 ldah gp,0(t12)
4: 00 00 bd 23 lda gp,0(gp)
8: 00 00 7d a4 ldq t2,0(gp)
c: 20 00 43 a4 ldq t1,32(t2)
10: b9 35 50 40 cmpeq t1,0x81,t11
14: 02 00 20 e7 beq t11,20 <camlTest__f_57+0x20>
18: 03 00 1f 20 lda v0,3
1c: 01 80 fa 6b ret
20: 01 00 1f 20 lda v0,1
24: 01 80 fa 6b ret
28: 1f 04 ff 47 nop
2c: 00 00 fe 2f unop

This makes it basically impossible to optimize for 32 or 64 bit.

Mmm, i am sending this to the ocaml upstream BTS, since i don't think i can do
real much about this, especially as i don't speak alpha assembly.

Still you should probably have a look at the nativeint module, which is 64bit
on 64bit arches and 32bit on 32bit arches.

Not sure what you really want to do though.

Friendly,

Sven Luther

@vicuna
Copy link
Author

vicuna commented Nov 9, 2004

Comment author: administrator

With bytecode, Sys.word_size is really a run-time variable (can compile on 32
bits and execute on 32 or 64 bits). No easy way to turn it into a compile-time
constant just for native-code compilation.

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

No branches or pull requests

1 participant