Commit Graph

22 Commits (master)

Author SHA1 Message Date
Damien Doligez dff48afa72 If the major GC is in Phase_idle, caml_gc_major_slice must start a new
major GC cycle instead of just calling caml_major_collection_slice.
fixes #7813
2020-11-03 11:09:35 +01:00
Damien Doligez 0069123c61
clean up and fix GC message 0x1 (#9949) 2020-10-09 12:02:00 +02:00
Sadiq Jaffer c10217818f
Garbage collector colours change (#9756) 2020-09-17 17:24:04 +02:00
Leo White dfd0c0cc77 Report full major collections in Gc stats 2020-06-25 14:24:41 +01:00
Enguerrand Decorne b7f0494df5 Rewrite the instrumented runtime to store traces in the CTF format.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
2020-04-30 10:32:01 +02:00
Jacques-Henri Jourdan 975bc47f51 Make sure the atom table and minor heap have their own dedicated pages.
We need to make sure they do not share a page with code, otherwise the
GC and the polymorphic hash and comparison functions will follow code
pointers and potentially trigger a segfault.
2020-01-06 14:16:12 +01:00
Jacques-Henri Jourdan 214be9c698 Get rid of [caml_normalize_heap_increment], which had a misleading name and inline it at the only place it is used. 2020-01-06 14:15:15 +01:00
Guillaume Munch-Maccagnoni d0f70f757a Resource-safe C interface for async callbacks
Introduce caml_process_pending_actions and
caml_process_pending_actions_exn: a variant of the former which does
not raise but returns a value that has to be checked against
Is_exception_value.

I keep the current conventions from caml_callback{,_exn}: For a
resource-safe interface, we mostly care about the _exn variants, but
every time there is a public _exn function I provide a function that
raises directly for convenience.

They are introduced and documented in caml/signals.h.

Private functions are converted to their _exn variant on the way as
needed: for internal functions of the runtime, it is desirable to go
towards a complete elimination of functions that raise implicitly.

Get rid of the distant logic of caml_raise_in_async_callback. Instead,
caml_process_pending_events takes care itself of its something_to_do
"resource". This avoids calling the former function in places
unrelated to asynchronous callbacks.
2019-10-17 20:14:19 +02:00
Guillaume Munch-Maccagnoni 2433b9373f Separate caml_check_urgent_gc back into GC actions and async callbacks
In 8691, caml_check_urgent_gc was merged with the function that runs
asynchronous callbacks. The rationale was that caml_check_urgent_gc
already runs finalisers, and so could have run any asynchronous
callbacks.

We agreed on a different strategy: we know that users could not rely
on asynchronous callbacks being called at this point, so take the
opportunity to make it callback-safe, like was done for allocation
functions.

The new check_urgent_gc no longer calls finalisers (nor any
callbacks), and instead two internal functions are introduced:

* caml_do_urgent_gc_and_callbacks : function to perform actions
  unconditionally.

* caml_check_urgent_gc_and_callbacks : function that checks for
  something to do, and then executes all actions (GC and callbacks).
2019-10-15 19:24:41 +02:00
Damien Doligez 01bdd5bbc4
best-fit allocator (#8809) 2019-10-15 13:52:16 +02:00
Jose Fernando Lopez Fernandez e6096b8f6c Removed function caml_init_alloc_for_heap from memory.h (#8710)
* Removed the function 'caml_init_alloc_from_heap' from memory.h, as well as it's definition in memory.c, and the calling code in gc_ctrl.c. The function was unconditionally returning zero with no other functionality, as explained in issue #8709.

No change entry needed.
2019-09-23 16:04:43 +02:00
KC Sivaramakrishnan 126383b2b2 Fix long lines 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan c06038a0ee Move backtrace support global variables to domain state.
Since we cannot access backtrace position in cmmgen.ml anymore,
Cmm.raise_kind in removed. Instead, we use Lambda.raise_kind. When
assembly code is generated, we reset the backtrace position to 0 in the
case of regular raise. Importantly, the semantics remains the same.
2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan 755f5444f1 Move all statistics variables to domain state 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan 28c5b9c860 Various minor heap pointers moved to domain state 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan 45b1e18f59 young_ptr and young_limit are now in domain state 2019-08-23 09:50:05 +05:30
Jacques-Henri Jourdan 42ab59aab1 Use [caml_something_to_do] both in native and bytecode mode to remember that callbacks are pending.
This make us able to get rid of to xxx_to_do variables in `final.c`
and `memprof.c`. The variable is reset to 0 when entering
`caml_check_urgent_gc`, which is now the main entry point for
asynchronous callbacks. In case a callback raises an exception, we
need to set it back to 1 to make sure no callback is missed.
2019-06-06 16:08:06 +02:00
Jacques-Henri Jourdan 79088fb09d Guarantee that no finalisers will be called while allocating memory in OCaml heap from C code.
The finalizers and all the other asynchronous callbacks (including
signal handlers, memprof callbacks and finalizers) are now called in a
common function, [caml_async_callbacks]. It is called in
[caml_check_urgent_gc] and wherever [caml_process_pending_signals] was
called.

This makes it possible to simplify the [caml_gc_dispatch] logic by
removing the loop it contains, since it no longer calls finalizers.
2019-06-05 14:25:26 +02:00
Damien Doligez 718f5949e0 fix #7829: pointer comparisons in assertions 2019-04-08 08:47:12 +01:00
Damien Doligez 17b64ac2b2
Add caml_alloc_custom_mem (#1738)
* add caml_alloc_custom_mem and corresponding GC parameters
* fix a bug in tests/misc/ephetest2.ml
2018-11-06 13:42:48 +01:00
Damien Doligez b6cf38d9d6
MPR#7814: fix non-prefixed symbol names in debug and instrumented runtimes (#1900)
* make `names_of_instructions` a static variable
* use lowercase names for CAML_INSTR functions, variables, and structs
* add changelog entry
2018-07-13 16:06:36 +02:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00