From comments in typedtree.mli:
When introduced in 2000, this [type] enabled a more efficient code
generation for optional arguments. However, today the information is
redundant as labels are passed to [transl_apply] too. Could be cleaned
up.
I replaced all calls to stat_alloc_no_raise by plain mallocs.
Also, I reimplemented alloc_shr_no_raise by duplicating the code of alloc_shr to avoid any overhead induced by an extra function call.
Prevents the function `caml_alloc_shr` to raise an OOM exception
before intern_cleanup could be called (this complete commit 1e62f1b).
It defines a new caml_alloc_shr_no_raise function.
In the function, `intern_alloc` a call to caml_alloc_for_heap is very likely to
return NULL when reading a big marshaled value. If that happens, before raising
out_of_memory, it should call the `intern_cleanup` function to free the stack
as well as `intern_input` that may have been malloced by `caml_input_val`.
Similarly, `intern_cleanup` should also be called when we are not able to
allocate `intern_obj_table`. To do that, I added a function
`caml_stat_alloc_no_raise` which, like its brother, `caml_stat_alloc` wraps
some debugging information around a call to malloc. I could have used directly
malloc instead of adding a new function to memory.c, as it is done in other
places of the code (it has the drawback of not adding the debug tag).
Note that this fix is not perfect. The function `intern_alloc` could also raise
out_of_memory through its call to `caml_alloc_shr`. It is less likely to happen
since caml_alloc_shr is only called when the input is smaller than Max_wosize
but it could happen. In that case, there will be leak (but a smaller one).
IBM z Systems port of ocamlopt
This is a port of the OCaml native-code compiler to IBM's z Systems architecture under Linux.
z Systems (https://en.wikipedia.org/wiki/IBM_System_z), also known as "s390x" in the GNU/Linux world, is IBM's line of mainframe computers. They are supported by several Linux distributions: RHEL, Suse, Debian.
The OCaml port was developed by Bill O'Farrell at IBM Toronto, with help from Tristan Amini, based on OCaml 4.02.1. I upgraded the port to the current OCaml trunk and performed some simplifiications and fixes. A CLA was signed to cover the reuse of Bill O'Farrell's code.