Skip to content

Commit b0c85d7

Browse files
authored
Make header size unconditional (Marshal) (#2095)
* Make header size unconditional (`Marshal`). * Bootstrap
1 parent 800475d commit b0c85d7

File tree

5 files changed

+3
-6
lines changed

5 files changed

+3
-6
lines changed

ocaml/boot/ocamlc

252 Bytes
Binary file not shown.

ocaml/boot/ocamllex

-1.14 KB
Binary file not shown.

ocaml/runtime4/intern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ CAMLprim value caml_marshal_data_size(value buff, value ofs)
922922
default:
923923
caml_failwith("Marshal.data_size: bad object");
924924
}
925-
return Val_long((header_len - 20) + data_len);
925+
return Val_long((header_len - 16) + data_len);
926926
}
927927

928928
/* Resolution of code pointers */

ocaml/stdlib/marshal.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ external from_channel: in_channel -> 'a = "caml_input_value"
5050
external from_bytes_unsafe: bytes -> int -> 'a = "caml_input_value_from_bytes"
5151
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"
5252

53-
external runtime5 : unit -> bool = "%runtime5"
54-
let runtime5 = runtime5 ()
55-
56-
let header_size = if runtime5 then 16 else 20
53+
let header_size = 16
5754

5855
let data_size buff ofs =
5956
if ofs < 0 || ofs > Bytes.length buff - header_size

ocaml/testsuite/tests/statmemprof/callstacks.flat-float-array.reference

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
5656
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15
5757
Called from Callstacks in file "callstacks.ml", line 101, characters 2-27
5858
-----------
59-
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 70, characters 9-35
59+
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 67, characters 9-35
6060
Called from Callstacks.alloc_unmarshal in file "callstacks.ml", line 64, characters 12-87
6161
Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
6262
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15

0 commit comments

Comments
 (0)