The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Introduce Runtime IDs

The configuration of a given version of OCaml is now described using a
combination of the host triplet and a new ID value (documented in
runtime/Mangling.md).
Misc.RuntimeID added to manipulate these IDs and configure calculates
the values required for the bytecode and native runtimes. These are then
intended to be used to mangle filenames so that different configurations
which store files in public search paths cease interfering with each
other.

+539 -1
+5
Changes
··· 91 91 (David Allsopp, review by Jonah Beckford, Antonin Décimo, Damien Doligez, 92 92 Samuel Hym and Vincent Laviron) 93 93 94 + - #14245: Introduce Runtime IDs for use in filename mangling to allow different 95 + configurations and different versions of the runtime system to coexist 96 + harmoniously on a single system. 97 + (David Allsopp, review by Damien Doligez and Samuel Hym) 98 + 94 99 - #12269, #12410, #13063: Fix unsafety, deadlocks, and/or leaks should 95 100 rare errors happen during domain creation and thread 96 101 creation/registration.
+4
Makefile.build_config.in
··· 195 195 196 196 BUILD_TRIPLET = @build@ 197 197 198 + # Zinc Runtime ID is needed for installation only 199 + ZINC_RUNTIME_ID_HI = @zinc_runtime_id_hi@ 200 + ZINC_RUNTIME_ID = @zinc_runtime_id_lo@$(ZINC_RUNTIME_ID_HI) 201 + 198 202 # Platform-dependent command to create symbolic links 199 203 LN = @ln@ 200 204
+4
Makefile.config.in
··· 220 220 AWK=@AWK@ 221 221 NAKED_POINTERS=false 222 222 223 + # Runtime ID values 224 + BYTECODE_RUNTIME_ID=@bytecode_runtime_id@ 225 + NATIVE_RUNTIME_ID=@native_runtime_id@ 226 + 223 227 # Deprecated variables 224 228 225 229 ## Variables deprecated since OCaml 5.3
+4 -1
build-aux/ocaml_version.m4
··· 29 29 30 30 # The three following components (major, minor and patch level) MUST be 31 31 # integers. They MUST NOT be left-padded with zeros and all of them, 32 - # including the patchlevel, are mandatory. 32 + # including the patchlevel, are mandatory. OCAML__RELEASE_NUMBER must be 33 + # incremented with each minor release, and likewise must be an unpadded integer. 33 34 34 35 m4_define([OCAML__VERSION_MAJOR], [5]) 35 36 m4_define([OCAML__VERSION_MINOR], [5]) 37 + m4_define([OCAML__RELEASE_NUMBER], [21]) 36 38 m4_define([OCAML__VERSION_PATCHLEVEL], [0]) 39 + 37 40 # Note that the OCAML__VERSION_EXTRA string defined below is always empty 38 41 # for officially-released versions of OCaml. 39 42 m4_define([OCAML__VERSION_EXTRA], [dev0-2025-04-28])
+96
configure
··· 800 800 build_vendor 801 801 build_cpu 802 802 build 803 + native_runtime_id 804 + bytecode_runtime_id 805 + zinc_runtime_id_hi 806 + zinc_runtime_id_lo 803 807 build_map_flags 804 808 srcdir_abs_real 805 809 srcdir_abs ··· 960 964 CMI_MAGIC_NUMBER 961 965 EXEC_MAGIC_NUMBER 962 966 MAGIC_LENGTH 967 + OCAML_RELEASE_NUMBER 963 968 OCAML_VERSION_SHORT 964 969 OCAML_VERSION_EXTRA 965 970 OCAML_VERSION_PATCHLEVEL ··· 3417 3422 3418 3423 OCAML_VERSION_SHORT=5.5 3419 3424 3425 + OCAML_RELEASE_NUMBER=21 3426 + 3420 3427 printf "%s\n" "#define MAGIC_NUMBER_PREFIX \"Caml1999\"" >>confdefs.h 3421 3428 3422 3429 printf "%s\n" "#define MAGIC_NUMBER_VERSION \"037\"" >>confdefs.h ··· 3601 3608 3602 3609 3603 3610 3611 + 3612 + 3613 + 3614 + 3604 3615 ## Generated files 3605 3616 3606 3617 ac_config_files="$ac_config_files Makefile.build_config" ··· 3650 3661 printf "%s\n" "#define OCAML_VERSION 50500" >>confdefs.h 3651 3662 3652 3663 printf "%s\n" "#define OCAML_VERSION_STRING \"5.5.0+dev0-2025-04-28\"" >>confdefs.h 3664 + 3665 + printf "%s\n" "#define OCAML_RELEASE_NUMBER 21" >>confdefs.h 3653 3666 3654 3667 3655 3668 # Works out how many "o"s are needed in quoted strings ··· 24485 24498 *) : 24486 24499 ;; 24487 24500 esac 24501 + 24502 + # Determine the three Runtime IDs (see runtime/Mangling.md) 24503 + 24504 + 24505 + 24506 + 24507 + 24508 + # Bits 0-4 (dev + low 4 bits of release) 24509 + 24510 + 24511 + # Bits 5-6 (high 2 bits of release) 24512 + 24513 + 24514 + # Bits 7-9 (low 3 bits of reserved) 24515 + quintet1="1 + $(expr \( $reserved_header_bits \* 4 \) % 32)" 24516 + quintet1="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet1 \) + 1))" 24517 + 24518 + # Bits 10-11 (high 2 bits of reserved) 24519 + quintet2_byte="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $reserved_header_bits / 8 \) + 1))" 24520 + 24521 + # Bit 12 (no-flat-float-array) 24522 + if $flat_float_array 24523 + then : 24524 + quintet2_zinc='0' 24525 + else $as_nop 24526 + quintet2_byte="4 + $quintet2_byte" 24527 + quintet2_zinc='4' 24528 + fi 24529 + # Bit 13 (fp) 24530 + if $frame_pointers 24531 + then : 24532 + quintet2_native="8 + $quintet2_byte" 24533 + else $as_nop 24534 + quintet2_native="$quintet2_byte" 24535 + fi 24536 + # Bit 14 (tsan) 24537 + if $tsan 24538 + then : 24539 + quintet2_native="16 + $quintet2_native" 24540 + fi 24541 + 24542 + quintet2_zinc="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet2_zinc \) + 1))" 24543 + quintet2_byte="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet2_byte \) + 1))" 24544 + quintet2_native="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet2_native \) + 1))" 24545 + 24546 + # Bit 15 (int31) 24547 + if $arch64 24548 + then : 24549 + quintet3_zinc='0' 24550 + else $as_nop 24551 + quintet3_zinc='1' 24552 + fi 24553 + # Bit 16 (static) 24554 + if ! $supports_shared_libraries 24555 + then : 24556 + quintet3_zinc="2 + $quintet3_zinc" 24557 + fi 24558 + # Bit 17 (no-compression) 24559 + if test x"$zstd_status" != 'xok' 24560 + then : 24561 + quintet3_zinc="4 + $quintet3_zinc" 24562 + fi 24563 + # Bit 18 (ansi) 24564 + case $target,$windows_unicode in #( 24565 + *-*-mingw32,0|*-pc-windows,0) : 24566 + quintet3="8 + $quintet3_zinc" ;; #( 24567 + *) : 24568 + quintet3="$quintet3_zinc" ;; 24569 + esac 24570 + # Bit 19 (mutable-string) cannot be set since OCaml 5.0 24571 + 24572 + quintet3_zinc="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet3_zinc \) + 1))" 24573 + quintet3="$(echo '0123456789abcdefghijklmnopqrstuv' | cut -c $(expr \( $quintet3 \) + 1))" 24574 + 24575 + zinc_runtime_id_lo="b1" 24576 + zinc_runtime_id_hi="${quintet2_zinc}${quintet3_zinc}" 24577 + bytecode_runtime_id="b${quintet1}${quintet2_byte}${quintet3}" 24578 + native_runtime_id="b${quintet1}${quintet2_native}${quintet3}" 24579 + 24580 + # Update the values for is_official_release and release_number in 24581 + # utils/config.common.ml.in (this is done when tools/autogen is run, not each 24582 + # time configure is run!) 24583 + 24488 24584 24489 24585 # Do not permanently cache the result of flexdll.h 24490 24586 unset ac_cv_header_flexdll_h
+80
configure.ac
··· 110 110 AC_SUBST([OCAML_VERSION_PATCHLEVEL], [OCAML__VERSION_PATCHLEVEL]) 111 111 AC_SUBST([OCAML_VERSION_EXTRA], [OCAML__VERSION_EXTRA]) 112 112 AC_SUBST([OCAML_VERSION_SHORT], [OCAML__VERSION_SHORT]) 113 + AC_SUBST([OCAML_RELEASE_NUMBER], [OCAML__RELEASE_NUMBER]) 113 114 AC_DEFINE([MAGIC_NUMBER_PREFIX], ["][MAGIC_NUMBER__PREFIX]["]) 114 115 AC_DEFINE([MAGIC_NUMBER_VERSION], ["][MAGIC_NUMBER__VERSION]["]) 115 116 AC_DEFINE([EXEC_MAGIC_LENGTH], [MAGIC_NUMBER__LENGTH]) ··· 279 280 AC_SUBST([srcdir_abs]) 280 281 AC_SUBST([srcdir_abs_real]) 281 282 AC_SUBST([build_map_flags]) 283 + AC_SUBST([zinc_runtime_id_lo]) 284 + AC_SUBST([zinc_runtime_id_hi]) 285 + AC_SUBST([bytecode_runtime_id]) 286 + AC_SUBST([native_runtime_id]) 282 287 283 288 ## Generated files 284 289 ··· 308 313 AC_DEFINE([OCAML_VERSION_EXTRA], ["][OCAML__VERSION_EXTRA]["])]) 309 314 AC_DEFINE([OCAML_VERSION], [OCAML__VERSION_NUMBER]) 310 315 AC_DEFINE([OCAML_VERSION_STRING], ["][OCAML__VERSION]["]) 316 + AC_DEFINE([OCAML_RELEASE_NUMBER], [OCAML__RELEASE_NUMBER]) 311 317 312 318 # Works out how many "o"s are needed in quoted strings 313 319 AC_CONFIG_COMMANDS_PRE(OCAML_QUOTED_STRING_ID) ··· 3089 3095 # This is required as otherwise floats are printed 3090 3096 # as "Infinity" and "Inf" instead of the expected "inf" 3091 3097 [AC_DEFINE([HAS_BROKEN_PRINTF], [1])]) 3098 + 3099 + # Determine the three Runtime IDs (see runtime/Mangling.md) 3100 + m4_define([ALPHABET], [0123456789abcdefghijklmnopqrstuv]) 3101 + AC_DEFUN([BASE32], ["$(echo 'ALPHABET' | cut -c $(expr \( $1 \) + 1))"]) 3102 + 3103 + m4_cond(OCAML__DEVELOPMENT_VERSION, [true], 3104 + [m4_define([ID_VERSION], m4_eval((OCAML__RELEASE_NUMBER << 1) + 1))], 3105 + [m4_define([ID_VERSION], m4_eval((OCAML__RELEASE_NUMBER << 1)))]) 3106 + 3107 + # Bits 0-4 (dev + low 4 bits of release) 3108 + m4_define([QUINTET0], 3109 + [m4_substr(ALPHABET, m4_eval(ID_VERSION & 31), [1])]) 3110 + 3111 + # Bits 5-6 (high 2 bits of release) 3112 + m4_define([QUINTET1_ZINC], 3113 + [m4_substr(ALPHABET, m4_eval(ID_VERSION >> 5), [1])]) 3114 + 3115 + # Bits 7-9 (low 3 bits of reserved) 3116 + quintet1="QUINTET1_ZINC + $(expr \( $reserved_header_bits \* 4 \) % 32)" 3117 + quintet1=BASE32([$quintet1]) 3118 + 3119 + # Bits 10-11 (high 2 bits of reserved) 3120 + quintet2_byte=BASE32([$reserved_header_bits / 8]) 3121 + 3122 + # Bit 12 (no-flat-float-array) 3123 + AS_IF([$flat_float_array], 3124 + [quintet2_zinc='0'], 3125 + [quintet2_byte="4 + $quintet2_byte" 3126 + quintet2_zinc='4']) 3127 + # Bit 13 (fp) 3128 + AS_IF([$frame_pointers], 3129 + [quintet2_native="8 + $quintet2_byte"], 3130 + [quintet2_native="$quintet2_byte"]) 3131 + # Bit 14 (tsan) 3132 + AS_IF([$tsan], 3133 + [quintet2_native="16 + $quintet2_native"]) 3134 + 3135 + quintet2_zinc=BASE32([$quintet2_zinc]) 3136 + quintet2_byte=BASE32([$quintet2_byte]) 3137 + quintet2_native=BASE32([$quintet2_native]) 3138 + 3139 + # Bit 15 (int31) 3140 + AS_IF([$arch64], 3141 + [quintet3_zinc='0'], 3142 + [quintet3_zinc='1']) 3143 + # Bit 16 (static) 3144 + AS_IF([! $supports_shared_libraries], 3145 + [quintet3_zinc="2 + $quintet3_zinc"]) 3146 + # Bit 17 (no-compression) 3147 + AS_IF([test x"$zstd_status" != 'xok'], 3148 + [quintet3_zinc="4 + $quintet3_zinc"]) 3149 + # Bit 18 (ansi) 3150 + AS_CASE([$target,$windows_unicode], 3151 + [*-*-mingw32,0|*-pc-windows,0], 3152 + [quintet3="8 + $quintet3_zinc"], 3153 + [quintet3="$quintet3_zinc"]) 3154 + # Bit 19 (mutable-string) cannot be set since OCaml 5.0 3155 + 3156 + quintet3_zinc=BASE32([$quintet3_zinc]) 3157 + quintet3=BASE32([$quintet3]) 3158 + 3159 + zinc_runtime_id_lo="QUINTET0[]QUINTET1_ZINC" 3160 + zinc_runtime_id_hi="${quintet2_zinc}${quintet3_zinc}" 3161 + bytecode_runtime_id="QUINTET0${quintet1}${quintet2_byte}${quintet3}" 3162 + native_runtime_id="QUINTET0${quintet1}${quintet2_native}${quintet3}" 3163 + 3164 + # Update the values for is_official_release and release_number in 3165 + # utils/config.common.ml.in (this is done when tools/autogen is run, not each 3166 + # time configure is run!) 3167 + m4_syscmd([sed -e '/^let is_official_release =/s/=.*/= ]'\ 3168 + 'm4_if(OCAML__DEVELOPMENT_VERSION,true,false,true)[/' \ 3169 + -e '/^let release_number =/s/=.*/= ]OCAML__RELEASE_NUMBER[/' \ 3170 + utils/config.common.ml.in > utils/config.common.ml.in.new 3171 + mv -f utils/config.common.ml.in.new utils/config.common.ml.in]) 3092 3172 3093 3173 # Do not permanently cache the result of flexdll.h 3094 3174 unset ac_cv_header_flexdll_h
+1
release-info/howto.md
··· 165 165 166 166 # update build-aux/ocaml_version.m4 with the new future branch, 167 167 # 4.07.0+dev1-2018-06-26 => 4.08.0+dev0-2018-06-30 168 + # Also increment OCAML__RELEASE_NUMBER in build-aux/ocaml_version.m4 168 169 # Update ocaml-variants.opam with new version. 169 170 tools/autogen 170 171 # Add a "Working version" section" to Changes
+135
runtime/Mangling.md
··· 1 + # Filename Mangling 2 + 3 + ## Background 4 + 5 + OCaml compiler installations exist in isolation. When running the compiler, it 6 + is assumed that the caller will have configured the environment of the compiler 7 + such that files and settings related to other compiler installations will not 8 + interfere. 9 + 10 + This is not true of the runtime. Shared libraries are loaded from a global 11 + namespace (dynamically loaded bytecode stub libraries and the shared versions of 12 + both the native and bytecode runtimes) and programs may be searched in a global 13 + PATH. To allow programs compiled against different coinstalled versions of the 14 + runtime to be executed, a name mangling scheme is used for the runtime's 15 + executables and shared libraries. 16 + 17 + ## Filename Mangling 18 + 19 + Filenames are mangled using one or both of two pieces of configuration 20 + information. The first is the standard "autoconf" triplet on which the runtime 21 + executes (e.g. `x86_64-pc-linux-gnu`). The other is a summary of the runtime 22 + version and configuration called the Runtime ID. This information is a series of 23 + bits encoded in base32 using the alphabet `[0-9a-v]` and with the quintets laid 24 + out little-endian. 25 + 26 + Mangling is applied to the name of any file which will be searched for at 27 + runtime: 28 + 29 + - `ocamlrun` (and variants) are triplet-prefixed and Bytecode-suffixed. For 30 + example, `x86_64-pc-linux-gnu-ocamlrun-a140` is OCaml 5.5 configured with 31 + `--disable-flat-float-array` on 64-bit Intel/AMD Linux. A symbolic link is 32 + still created for `ocamlrun` pointing to this mangled name. Additionally, a 33 + symbolic link is also created for `ocamlrun-a140`, using the Zinc-suffix. 34 + - C stub libraries loaded by both the bytecode runtime and bytecode `Dynlink` 35 + library are triplet- and Bytecode-suffixed. For example, 36 + `dllunixbyt-x86_64-pc-linux-gnu-a140.so` contains the C stubs for the Unix 37 + library for OCaml 5.5 configured with `--disable-flat-float-array` on 64-bit 38 + Intel/AMD Linux. 39 + - Shared versions of the bytecode and native runtimes (`libcamlrun_shared.so` 40 + and `libasmrun_shared.so`) are triplet- and Bytecode/Native-suffixed 41 + respectively. For example, `libasmrun-x86_64-pc-linux-gnu-a1k0.so` and 42 + `libcamlrun-x86_64-pc-linux-gnu-a140.so` are OCaml 5.5 configured with 43 + `--disable-flat-float-array` and `--enable-tsan` on 64-bit Intel/AMD Linux 44 + (note the **tsan** bit not being set for the name of libcamlrun). 45 + Additionally, symbolic links are also created for `libasmrun_shared.so` and 46 + `libcamlrun_shared.so`. 47 + 48 + ## Runtime ID 49 + 50 + A Runtime ID is a bit string describing a given OCaml runtime. At present, 51 + 20 bits are used, but the format is intended to be trivially extensible. 52 + Ultimately, the only requirement is that each version and configuration 53 + generates some kind of unique identifier which can then be used in filenames. 54 + 55 + - Bit 0 (**dev**): Development bit. This should be set for development versions 56 + of OCaml or for customised compilers. If it is not set, the compiler should be 57 + an unaltered official release. 58 + - Bits 1-6 (**release**): OCaml release number. This is incremented for each 59 + minor release of the compiler, with OCaml 3.12.0[^1] being release 0. At 60 + present, the ordering of release numbers matches the semantic ordering of the 61 + version numbers, but this is not guaranteed and should not be assumed[^2]. 62 + - Bits 7-11 (**reserved**): Number of reserved bits in the OCaml value header. 63 + This is the number passed to `--enable-reserved-header-bits` when the compiler 64 + distribution was configured. 65 + - Bit 12 (**no-flat-float-array**): Set if the compiler distribution was 66 + configured with `--disable-flat-float-array`. 67 + - Bit 13 (**fp**): Set if the compiler distribution was configured with 68 + `--enable-frame-pointers`. Affects the **native** runtime only. 69 + - Bit 14 (**tsan**): For OCaml 5.2 onwards, set if the compiler distribution was 70 + configured with `--enable-tsan`. Prior to OCaml 5.2, set if the compiler 71 + distribution was configured with `--enable-spacetime` (this option was removed 72 + in OCaml 4.12, meaning this bit is always unset for OCaml 4.12-5.1). Affects 73 + the **native** runtime only. 74 + - Bit 15 (**int31**): Set if the runtime uses 31-bit `int` values (i.e. runtimes 75 + running on 32-bit systems). 76 + - Bit 16 (**static**): Set if the runtime does not support shared libraries, 77 + meaning dynamic loading of C code is not supported in bytecode, and native 78 + dynlink is not supported at all. 79 + - Bit 17 (**no-compression**): For OCaml 5.1 onwards, set if the runtime does 80 + not support compressed marshalling. Prior to OCaml 5.1, set if the compiler 81 + distribution was configured with `--enable-naked-pointers` (this bit was 82 + always unset for OCaml 5.0, since it supports neither naked pointers nor 83 + compressed marshalling). 84 + - Bit 18 (**ansi**): Set if the compiler distribution was configured with the 85 + legacy support `WINDOWS_UNICODE=ansi`. 86 + - Bit 19 (**mutable-string**): Set if the compiler distribution was configured 87 + with `--disable-force-safe-string`. This option was removed in OCaml 5.0, and 88 + the bit is available for re-use. When this bit is unset, strings are 89 + guaranteed to be immutable. 90 + 91 + The bit descriptions are designed such that the default configuration of the 92 + latest version of the compiler has unset bits. The ordering of the bits is 93 + designed to mean ID values in the same version of OCaml will usually have the 94 + same opening sequence of characters (since `--enable-reserved-header-bits` is 95 + now rarely used) and laying out the characters little-endian in the mangling 96 + scheme means that the opening two characters of the Runtime ID define its 97 + version (and consequently its length, should that change in future). 98 + 99 + [^1]: OCaml 3.12.0 was the first version where `ocamlrun` supported the `-vnum` 100 + argument; the original author had a fantasy of backporting the scheme to the 101 + entire 4.x series, but following some therapy stopped at 4.08. The release 102 + numbering persists to allow for future madness. 103 + [^2]: In particular, should there be any additional releases in the OCaml 4.x 104 + series, these will have higher release numbers than releases already made in the 105 + OCaml 5.x series. 106 + 107 + ## Masks 108 + 109 + A particular configuration of the compiler has one Runtime ID, but this is used 110 + in three different contexts where certain bits are masked out: 111 + 112 + 1. _Bytecode Mask_: masks out bits which are only ever set by the native runtime 113 + (at present, **fp** and **tsan**). 114 + 2. _Native Mask_: masks out bits which are only ever set by the bytecode runtime 115 + (at present there aren't any). 116 + 3. _Zinc Mask_: masks out bits which are not related to bytecode portability. 117 + Where the _Bytecode_ and _Native_ masks relate to _runtimes_, the _Zinc_ mask 118 + relates to _bytecode images_. The Zinc ID therefore includes: 119 + - **release** and **dev** (a given bytecode image targets a specific version 120 + of OCaml) 121 + - **no-flat-float-array** (code compiled assuming that float arrays are boxed 122 + will segfault on runtimes which unbox them) 123 + - **int31**, **static**, and **no-compression** (a bytecode image using 124 + 63-bit integers, dynamically loaded C stubs and compressed marshalling will 125 + be rejected by an interpreter which doesn't support any of these features) 126 + 127 + Note that the inclusion of a bit in a mask is determined by whether that 128 + property affects the ability to load and execute the code, rather than whether 129 + it is semantically affected by it. For example, the **reserved** bits affects 130 + the value representation, and therefore both runtimes. It does not directly 131 + affect bytecode (although a bytecode program may use unsafe features to observe 132 + it). **reserved** is therefore part of both the _Bytecode_ and _Native Masks_, 133 + but not part of the _Zinc Mask_. Similarly, although **no-flat-float-array** 134 + affects code generation for bytecode, **mutable-string** never did, and so would 135 + not be included in the _Zinc Mask_.
+1
runtime/caml/version.h.in
··· 22 22 #undef OCAML_VERSION_EXTRA 23 23 #undef OCAML_VERSION 24 24 #undef OCAML_VERSION_STRING 25 + #undef OCAML_RELEASE_NUMBER
+8
utils/config.common.ml.in
··· 20 20 (* The main OCaml version string has moved to ../build-aux/ocaml_version.m4 *) 21 21 let version = Sys.ocaml_version 22 22 23 + (* is_official_release and release_number are automatically updated autoconf 24 + from values in ../build-aux/ocaml_version.m4 - do not edit these lines 25 + directly. *) 26 + let is_official_release = false 27 + let release_number = 21 28 + 23 29 external standard_library_default : unit -> string = "%standard_library_default" 24 30 25 31 let standard_library_default_raw = standard_library_default () ··· 154 160 p_bool "systhread_supported" systhread_supported; 155 161 p "host" host; 156 162 p "target" target; 163 + p "bytecode_runtime_id" bytecode_runtime_id; 164 + p "native_runtime_id" native_runtime_id; 157 165 p_bool "flambda" flambda; 158 166 p_bool "safe_string" safe_string; 159 167 p_bool "default_safe_string" default_safe_string;
+2
utils/config.fixed.ml
··· 59 59 let align_int64 = true 60 60 let function_sections = false 61 61 let afl_instrument = false 62 + let bytecode_runtime_id = "" 63 + let native_runtime_id = "" 62 64 let native_compiler = false 63 65 let tsan = false 64 66 let architecture = "none"
+3
utils/config.generated.ml.in
··· 71 71 let function_sections = @function_sections@ 72 72 let afl_instrument = @afl@ 73 73 74 + let bytecode_runtime_id = {@QS@|@bytecode_runtime_id@|@QS@} 75 + let native_runtime_id = {@QS@|@native_runtime_id@|@QS@} 76 + 74 77 let native_compiler = @native_compiler@ 75 78 76 79 let architecture = {@QS@|@arch@|@QS@}
+20
utils/config.mli
··· 23 23 val version: string 24 24 (** The current version number of the system *) 25 25 26 + val release_number: int 27 + (** The release number for the compiler 28 + 29 + @since 5.5 *) 30 + 31 + val is_official_release: bool 32 + (** True if the compiler is an unmodified official OCaml release 33 + 34 + @since 5.5 *) 35 + 26 36 val bindir: string 27 37 (** The directory containing the binary programs. If the compiler was configured 28 38 with [--with-relative-libdir] then this will be the directory containing the ··· 393 403 394 404 val shebangscripts : bool 395 405 (** Whether the target supports shebang scripts 406 + 407 + @since 5.5 *) 408 + 409 + val bytecode_runtime_id : string 410 + (** The Runtime ID for this build of the bytecode runtime system 411 + 412 + @since 5.5 *) 413 + 414 + val native_runtime_id : string 415 + (** The Runtime ID for this build of the native runtime system 396 416 397 417 @since 5.5 *) 398 418
+104
utils/misc.ml
··· 1433 1433 | Error err -> Error (Unexpected_error err) 1434 1434 | Ok () -> Ok info 1435 1435 end 1436 + 1437 + module RuntimeID = struct 1438 + type t = { 1439 + dev: bool; 1440 + release: int; 1441 + reserved: int; 1442 + no_flat_float_array: bool; 1443 + fp: bool; 1444 + tsan: bool; 1445 + int31: bool; 1446 + static: bool; 1447 + no_compression: bool; 1448 + ansi: bool; 1449 + } 1450 + 1451 + let make fn ?(dev = not Config.is_official_release) 1452 + ?(release = Config.release_number) 1453 + ?(reserved = Config.reserved_header_bits) 1454 + ?(no_flat_float_array = not Config.flat_float_array) 1455 + ?(fp = Config.with_frame_pointers) 1456 + ?(tsan = Config.tsan) 1457 + ?(int31 = (Sys.int_size = 31)) 1458 + ?(static = not Config.supports_shared_libraries) 1459 + ?(no_compression = (Config.compression_c_libraries = "")) 1460 + ?(ansi = Config.target_win32 && not Config.windows_unicode) () = 1461 + if release < 0 || release > 63 || reserved < 0 || reserved > 31 then 1462 + invalid_arg fn 1463 + else 1464 + {dev; release; reserved; no_flat_float_array; fp; tsan; int31; static; 1465 + no_compression; ansi} 1466 + 1467 + let make_zinc = 1468 + make "Misc.RuntimeID.make_zinc" 1469 + ~reserved:0 ~fp:false ~tsan:false ~ansi:false 1470 + 1471 + let make_bytecode = 1472 + make "Misc.RuntimeID.make_bytecode" ~fp:false ~tsan:false 1473 + 1474 + let make_native = make "Misc.RuntimeID.make_native" 1475 + 1476 + let is_zinc = function 1477 + | {dev = _; release = _; reserved = 0; no_flat_float_array = _; fp = false; 1478 + tsan = false; int31 = _; static = _; no_compression = _; ansi = false} -> 1479 + true 1480 + | _ -> 1481 + false 1482 + 1483 + let is_bytecode = function 1484 + | {dev = _; release = _; reserved = _; no_flat_float_array = _; fp = false; 1485 + tsan = false; int31 = _; static = _; no_compression = _; ansi = _} -> true 1486 + | _ -> false 1487 + 1488 + let is_native _ = true 1489 + 1490 + let to_string t = 1491 + let alpha = "0123456789abcdefghijklmnopqrstuv" in 1492 + let bit bit cond = if cond then 1 lsl bit else 0 in 1493 + let q0 = 1494 + (bit 0 t.dev) lor 1495 + ((t.release lsl 1) land 0b11110) (* 4 bits *) 1496 + in 1497 + let q1 = 1498 + t.release lsr 4 lor (* 2 bits *) 1499 + ((t.reserved lsl 2) land 0b11100) (* 3 bits *) 1500 + in 1501 + let q2 = 1502 + t.reserved lsr 3 lor (* 2 bits *) 1503 + bit 2 t.no_flat_float_array lor 1504 + bit 3 t.fp lor 1505 + bit 4 t.tsan 1506 + in 1507 + let q3 = 1508 + bit 0 t.int31 lor 1509 + bit 1 t.static lor 1510 + bit 2 t.no_compression lor 1511 + bit 3 t.ansi 1512 + (* bit 4 is unused *) 1513 + in 1514 + Printf.sprintf "%c%c%c%c" alpha.[q0] alpha.[q1] alpha.[q2] alpha.[q3] 1515 + 1516 + let of_string s = 1517 + if String.length s <> 4 then 1518 + None 1519 + else 1520 + let convert c = 1521 + match c with 1522 + | '0'..'9' -> Char.code c - Char.code '0' 1523 + | 'a'..'v' -> Char.code c - Char.code 'a' + 10 1524 + | _ -> min_int 1525 + in 1526 + let set bit q = (q land (1 lsl bit) <> 0) in 1527 + let q0 = convert s.[0] in 1528 + let q1 = convert s.[1] in 1529 + let q2 = convert s.[2] in 1530 + let q3 = convert s.[3] in 1531 + if q0 + q1 + q2 + q3 >= 0 then 1532 + Some {dev = set 0 q0; release = ((q1 land 0b11) lsl 4) lor (q0 lsr 1); 1533 + reserved = ((q2 land 0b11) lsl 2) lor (q1 lsr 2); 1534 + no_flat_float_array = set 2 q2; fp = set 3 q2; tsan = set 4 q2; 1535 + int31 = set 0 q3; static = set 1 q3; no_compression = set 2 q3; 1536 + ansi = set 3 q3; (* bit 4 of q3 is unused *)} 1537 + else 1538 + None 1539 + end
+72
utils/misc.mli
··· 875 875 are not checked. *) 876 876 end 877 877 878 + module RuntimeID : sig 879 + (** Manipulation of the Runtime ID values used to mangle the filenames of 880 + shared libraries and the bytecode interpreters. 881 + 882 + @since 5.5 *) 883 + 884 + (** Runtime IDs *) 885 + type t = private { 886 + dev: bool; 887 + (** [true] if this not an unaltered official release of OCaml *) 888 + release: int; 889 + (** Release number (OCaml 5.5 is release 21) *) 890 + reserved: int; 891 + (** The number of reserved bits (0-31) in the {v value v} header *) 892 + no_flat_float_array: bool; 893 + (** [true] if float arrays must be boxed (i.e. configured with 894 + {v --disable-flat-float-array v}) *) 895 + fp: bool; 896 + (** [true] if frame pointers are required (i.e. configured with 897 + {v --enable-frame-pointers v} *) 898 + tsan: bool; 899 + (** [true] if ThreadSanitizer (TSAN) is required (i.e. configured with 900 + {v --enable-tsan v}) *) 901 + int31: bool; 902 + (** [true] if the platform has 31-bit [int]s (i.e. 32-bit systems) *) 903 + static: bool; 904 + (** [true] if dynamic loading of libraries is not supported *) 905 + no_compression: bool; 906 + (** [true] if compressed marshalling is not supported *) 907 + ansi: bool; 908 + (** [true] if Unicode support on Windows is disabled *) 909 + } 910 + 911 + val make_zinc: ?dev:bool -> ?release:int 912 + -> ?no_flat_float_array:bool 913 + -> ?int31:bool -> ?static:bool -> ?no_compression:bool 914 + -> unit -> t 915 + (** Returns the Zinc Runtime ID for the given parameters (using default values 916 + from {!Config} and {!Sys} as necessary) *) 917 + 918 + val make_bytecode: ?dev:bool -> ?release:int 919 + -> ?reserved:int -> ?no_flat_float_array:bool 920 + -> ?int31:bool -> ?static:bool -> ?no_compression:bool 921 + -> ?ansi:bool 922 + -> unit -> t 923 + (** Returns the Bytecode Runtime ID for the given parameters (using default 924 + values from {!Config} and {!Sys} as necessary) *) 925 + 926 + val make_native: ?dev:bool -> ?release:int 927 + -> ?reserved:int -> ?no_flat_float_array:bool -> ?fp:bool -> ?tsan:bool 928 + -> ?int31:bool -> ?static:bool -> ?no_compression:bool 929 + -> ?ansi:bool 930 + -> unit -> t 931 + (** Returns the Native Runtime ID for the given parameters (using default 932 + values from {!Config} and {!Sys} as necessary) *) 933 + 934 + val is_zinc: t -> bool 935 + (** [is_zinc t] is true if [t] can be used as a Zinc Runtime ID *) 936 + 937 + val is_bytecode: t -> bool 938 + (** [is_bytecode t] is true if [t] can be used as a Bytecode Runtime ID *) 939 + 940 + val is_native: t -> bool 941 + (** [is_native t] is true if [t] can be used as a Native Runtime ID *) 942 + 943 + val to_string: t -> string 944 + (** Returns the 4-character representation of a {!t} *) 945 + 946 + val of_string: string -> t option 947 + (** Converts the 4-character representation back to a {!t} *) 948 + end 949 + 878 950 (** {1 Miscellaneous type aliases} *) 879 951 880 952 type filepath = string