Repository navigation
Conversation
| with Out_of_memory | Invalid_argument _ -> raise OutOfMemory | ||
| with Out_of_memory -> raise OutOfMemory |
There was a problem hiding this comment.
Gemini tells me this can still raise Invalid_argument when size exceeds Sys.max_array_length or Int64.of_int Stdlib.max_int.
| | I64AT -> I64.le_u i 0x1_0000_0000_0000L | ||
|
|
||
| let create n = | ||
| if n > Int64.(div max_int page_size) then raise OutOfMemory else |
There was a problem hiding this comment.
Gemini tells me that there will be an uncaught Invalid_argument for page counts in [2^46, 2^47 - 1] on 64-bit OCaml. This is the range where size > Int64.of_int Stdlib.max_int.
| ;; (assert_return (invoke "size" (i32.const 0xFFFF)) | ||
| ;; (either (i32.const 1) (i32.const 0x1_0000)) | ||
| ;; ) |
There was a problem hiding this comment.
| ;; (assert_return (invoke "size" (i32.const 0xFFFF)) | |
| ;; (either (i32.const 1) (i32.const 0x1_0000)) | |
| ;; ) | |
| ;; (assert_return (invoke "size")) | |
| ;; (either (i32.const 1) (i32.const 0x1_0000)) | |
| ;; ) |
| (assert_return (invoke "grow" (i64.const 0xFFFF_FFFF_FFFF)) | ||
| (either (i64.const -1) (i64.const 1)) | ||
| ) | ||
| (assert_return (invoke "size") | ||
| (either (i64.const 1) (i64.const 0x1_0000_0000_0000)) | ||
| ) |
There was a problem hiding this comment.
Why are these commented out as being potentially too slow for 32-bit tables and memories but not 64-bit tables and memories? Is it assumed that the 64-bit tests will always fail to grow quickly in practice?
There was a problem hiding this comment.
Yes, precisely. For the 64-bit ones the grow cannot succeed on any practical machine, since it would take up the entire hardware address space.
|
Comments addressed, PTAL. |
Fixes #2281 and fixes #2288.