Open hja3 opened 1 week ago
This looks like the flat float array optimization going awry: arrays that contains floats are optimized to contain unboxed float using a runtime check. Here, your code is constructing an array whose first value is a float, and it may trigger this optimisation which is wrong because the rest of the array doesn't contain floats.
If you have the time, you could test this hypothesis by testing your code with an option switch with the ocaml-option-no-flat-floarray
configuration package enabled.
Ah yes I see, it is attempting to load a float at the time of the crash. That explanation makes sense. Thank you for the suggestion, I will certainly test it, hopefully this evening, and report back the result.
Yes, the float array optimisation appears to have been the problem. With the optimisation disabled I ran the application for 10 minutes before killing it manually. Beforehand, it could survive not even 100 frames!
Please note, a small patch to the olivine opam package was necessary, included below. The additional build step was required to make the olivine library visible to ocamlfind, and the dependencies have been updated to reflect the move to ppxlib.
diff --git a/olivine.opam b/olivine.opam
index 5432d04..fca4f14 100644
--- a/olivine.opam
+++ b/olivine.opam
@@ -10,13 +10,13 @@ bug-reports: "https://github.com/Octachron/olivine/issues"
build:[
["./configure.sh"]
[make "vk"]
+ ["dune" "build" "-p" name "-j" jobs "@install"]
]
depends: [
"dune" {build}
- "ppx_tools_versioned"
- "ocaml-migrate-parsetree"
+ "ppxlib"
"xmlm"
"fmt"
"menhir" {build}
Please see the supporting info from the coredump below.
The function camlVkTypesPipeline_depth_stencil_state_create_info.fun_1421 is the keep_alive code generated in aster/structured.ml:403, called from the construct function on lines 471-472. It maps Obj.refr over the fields of the struct places them into an array. I don't understand how Obj works exactly and am only prodding at it from the outside, but what is happening, I think, is that a number of the fields of Pipeline_depth_stencil_state_create_info are immediate values, not pointers, and when caml_make_array tries to dereference those values, it crashes. The crash may be reproduced easily with a subset of the depth stencil data
which segfaults at the same instruction.
Coredump info for the application: