We cannot use ARCH_INTNAT_PRINTF_FORMAT because it isn't guaranteed to
match values of type size_t.
Since this is debugging code, we go for the simple solution and cast
to long.
During clean phase for consistency we need to check if the key
checked or got is alive or not. Three possibilities:
- Doesn't unset the key, but still return the right value as if it
is unset.
- Unset the key and the data
- Clean the ephemeron
Testing aliveness is a little costly, so it is better to amortize
this cost. Previously the last possibility was implemented but a
better trade-off seems the second one, since the clean phase is still
going to clean the ephemeron eventually.
And fix a bug in the handling of ephemeron during minor collection
found thanks to this test. Oldifying of ephemerons' data was not iterated
enough because `oldify_todo_list` doesn't become non-null each time
`caml_oldify_one` is run.
During one mark phase instead of iterating on every ephemerons every time,
we don't iterate on the one which data is alive (not white) or at none
(weak pointer).
That give us a complexity in O(n*(p+1))
with m the number of ephemerons,
p is the maximum of the distance to an ephemeron from its nearest root
p = max_{e \in ephemerons} min_{r \in roots} distance(r,e)
One worst case is when ephemerons e_1, ..., e_n are linked
e_1.data = e_2, ... e_{n-1}.data = e_n but they have been created
in the reverse order and are iterated from e_n to e_1, O(n*n). In
order to mitigate this the ephemerons are automatically sorted
during mark in the order they are triggered. So during the next
marking phase the ephemerons will be iterated from e_1 to e_n
giving a complexity of O(n).
- use the generic abstract tag like weak pointers
- a weak pointer is implemented using an ephemeron (one additionnal word)
- add for every full GC a complexity of O((n+m)*(m+1))
with m the number of pure ephemerons,
n the number of ephemerons used as weak pointers
- multiple keys, modifiable keys
A value disappears from a weak array only when it really becomes unreachable.
Previously it was not the case if:
- the value is referenced by two weak arrays and during the incremental cleaning
one weak arrays have been cleaned and the other is accessed,
- the value has a finalizer and the finalizer make it alive again.
Allows the four native Windows ports to compile FlexDLL and flexlink
"in-tree" by placing the sources in directory `flexdll` and issuing
`make -f Makefile.nt flexdll`
FlexDLL must still be installed somewhere in PATH before OCaml itself
can be compiled. The `flexdll` target leaves the OCaml build tree in a
sufficiently clean state to allow `world` to be run after installation
of FlexDLL.
Microsoft improved the support for C99 in Visual Studio 2015 and added a
compliant implementation of snprintf. Tightens the criteria for
`caml_snprintf` being used instead to ignore the Universal CRT.
(report by Kakadu)
The format `"%ld"` cannot be portably used for values of type
`code_t`; one can use `"%" ARCH_INTNAT_PRINTF_FORMAT "d"` instead, as
intnat is configured to be the integer type of pointer size.
does not need to point to a valid header when the GC is called. On the
other hand, the major GC can only start a cycle when the minor heap
(allocation arena) is empty.
1. Revert "Switch to -custom for bytecode tests."
This reverts commit 6b7f81caf5.
2. Revert "Fix Changelog."
This reverts commit d94488d7b5.
3.Revert "Fix testsuite: use binary channels."
This reverts commit 840f7ca506.
4. Revert "Fix testsuite: do not require a globally installed ocamlrun."
This reverts commit 0388ef46d9.
5. Revert "Merge branch 'trunk' of https://github.com/bvaugon/ocaml into bvaugon-trunk"
This reverts commit 1ff6db10bf, reversing
changes made to 89d116c514.
In a format following that of Gc.print_stat. I chose to print only the "quick_stat"
values rather than call gc_ctrl.c::heap_stats because it's lighter, and the extra
information is typically not very useful at program exit.
Also adds documentation for the 0x400 flag (in man and Gc module)
This replaces the previous undocumented 0x400 that only displayed the
total (minwords + majwords - prowords) and with a different format,
since keeping both wouldn't provide more information.
This way, error handling is done in the OS-specific file (unix.c or win32.c).
In turn, this makes it easier to report a good Sys_error exception
in case of Win32 socket I/O error.