Skip to content

Commit

Permalink
flambda-backend: Make header size unconditional (Marshal) (ocaml-fl…
Browse files Browse the repository at this point in the history
…ambda#2095)

* Make header size unconditional (`Marshal`).

* Bootstrap
  • Loading branch information
xclerc authored Nov 29, 2023
1 parent 88f522a commit 08ba140
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 6 deletions.
Binary file modified boot/ocamlc
Binary file not shown.
Binary file modified boot/ocamllex
Binary file not shown.
2 changes: 1 addition & 1 deletion runtime4/intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ CAMLprim value caml_marshal_data_size(value buff, value ofs)
default:
caml_failwith("Marshal.data_size: bad object");
}
return Val_long((header_len - 20) + data_len);
return Val_long((header_len - 16) + data_len);
}

/* Resolution of code pointers */
Expand Down
5 changes: 1 addition & 4 deletions stdlib/marshal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ external from_channel: in_channel -> 'a = "caml_input_value"
external from_bytes_unsafe: bytes -> int -> 'a = "caml_input_value_from_bytes"
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"

external runtime5 : unit -> bool = "%runtime5"
let runtime5 = runtime5 ()

let header_size = if runtime5 then 16 else 20
let header_size = 16

let data_size buff ofs =
if ofs < 0 || ofs > Bytes.length buff - header_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15
Called from Callstacks in file "callstacks.ml", line 101, characters 2-27
-----------
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 70, characters 9-35
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 67, characters 9-35
Called from Callstacks.alloc_unmarshal in file "callstacks.ml", line 64, characters 12-87
Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15
Expand Down

0 comments on commit 08ba140

Please sign in to comment.