Skip to content

Commit 9bfa44e

Browse files
committed
fix compat
1 parent d2cdaa7 commit 9bfa44e

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

compiler/lib/ocaml_compiler.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,5 +284,11 @@ module Cmo_format = struct
284284

285285
let force_link (t : t) = t.cu_force_link
286286

287-
let hints_pos (t : t) = t.cu_hint
287+
let hints_pos (t : t) = t.cu_hint [@@if ocaml_version >= (5, 3, 1)]
288+
289+
let hints_size (t : t) = t.cu_hintsize [@@if ocaml_version >= (5, 3, 1)]
290+
291+
let hints_size _ = 0 [@@if ocaml_version < (5, 3, 1)]
292+
293+
let hints_pos _ = 0 [@@if ocaml_version < (5, 3, 1)]
288294
end

compiler/lib/ocaml_compiler.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ module Cmo_format : sig
7575
val imports : t -> (string * string option) list
7676

7777
val hints_pos : t -> int
78+
79+
val hints_size : t -> int
7880
end

compiler/lib/parse_bytecode.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3196,7 +3196,7 @@ let from_cmo ?(includes = []) ?(include_cmis = false) ?(debug = false) compunit
31963196
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:0 ic);
31973197
if times () then Format.eprintf " read debug events: %a@." Timer.print t;
31983198
let hints = Hints.create () in
3199-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3199+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
32003200
then (
32013201
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
32023202
Hints.read hints ~orig:0 ic);
@@ -3221,7 +3221,7 @@ let from_cma ?(includes = []) ?(include_cmis = false) ?(debug = false) lib ic =
32213221
then (
32223222
seek_in ic compunit.Cmo_format.cu_debug;
32233223
Debug.read_event_list debug_data ~crcs:[] ~includes ~orig:!orig ic);
3224-
if Ocaml_compiler.Cmo_format.hints_pos compunit <> 0
3224+
if Ocaml_compiler.Cmo_format.hints_size compunit > 0
32253225
then (
32263226
seek_in ic (Ocaml_compiler.Cmo_format.hints_pos compunit);
32273227
Hints.read hints ~orig:!orig ic);

0 commit comments

Comments
 (0)