Types corresponding to the compiler's target machine#755
Types corresponding to the compiler's target machine#755mshinwell wants to merge 3 commits intoocaml:trunkfrom
Conversation
|
Since this is internal to the compiler it can easily be improved later. But why not, in the interest of generality, provide a module module type TARGETINT = sig ... end
module Targetint : TARGETINT = struct
include
(val
(match Sys.word_size with
| 32 -> (module Int32)
| 64 -> (module Int64)
| _ -> assert false) : T)
endThis would make it easy to replace Nativeint by Targetint in the native code backends. |
|
I was planning to have such an "int" module, but haven't had time. If someone wants to make a pull request against my branch I'll happily include it. |
|
I fully agree with @nojb 's proposal: in order for this to be reusable for cross-compilation, we need a compilation unit called Let's try to work as a group to produce this, rather than pushing the strict minimum needed for debugging support. |
|
@xavierleroy : My original idea was that |
|
@mshinwell : I'm not sure what you have in mind with "the target's addressing range might be substantively different from the range of machine integers". Since the birth of OCaml we've assumed that pointers/addresses, tagged integers, and native integers have the same bit size (32 or 64). I don't think we could make good use of a platform like x32 where pointers are 32 bits and integers are 64 bits. So, I fell that |
|
@xavierleroy The x32 case was the sort of thing I was thinking of. Will comment on the other GPR and close this one. |
more fixes for check-typo
This pull request provides a module that is intended to be used when code needs to manipulate values of the same width as the compiler's target machine. I think an abstraction like this will be needed for full cross compilation support; in the meanwhile, it is needed by the forthcoming
Asm_directivespull request.