Commit Graph

16 Commits (540996d21ee3793a1cecce252c81fb76a6b9fd61)

Author SHA1 Message Date
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Jeremy Yallop 131099adc3 Remove some unused primitives
caml_input_value_from_string (unused since e227fb007d)
caml_ml_flush_partial, caml_ml_output_partial (unused since 705054b3)
caml_obj_is_block (unused since b1f93a66)
2020-07-18 12:27:48 +01:00
Xavier Leroy 08e58c836e
More efficient management of code fragments (#9654)
* Introducing codefrag: a new runtime module to work with code fragments

This module collects all the operations on code fragments performed in
various places of the runtime systems.  Applies both to bytecode and
to native code.

The implementation is based on skiplists, so that "lookup fragment by
PC" and "lookup fragment by number" are efficient (logarithmic in the
number of code fragments).  "Lookup fragment by digest" remains
linear-time.

The new module also improves the handling of digests: now it is
possible to mark a code fragment as "no digest" i.e. not marshal-able.

* Use the new "codefrag" runtime module for marshaling and for the
  debugger interface

Replace the previous handling of code fragments with calls to the
functions provided by the "codefrag" runtime module.
2020-06-11 10:39:19 +02:00
David Allsopp 3aab294513 Replace static inline with Caml_inline
The inline keyword is consequently no longer forced on MSVC builds.
2020-02-11 09:33:55 +00: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
Jacques-Henri Jourdan 90073e96e5 Memprof tracking of interned data. 2019-08-27 19:14:56 +02:00
KC Sivaramakrishnan 6efd278286 Remove a level of indirection for accessing minor tables from Caml_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
Jacques-Henri Jourdan a2cc89c605 Bugfix: handle the OOM case in [capture_callstack_major]. 2019-05-21 15:13:44 +02:00
Jacques-Henri Jourdan cea1ff7534 Memprof sampling for blocks in the minor heap, allocated by C code.
Allocations ignored by this version
- Marshalling
- In the minor heap by natively-compiled OCaml code

Allocations potentially sampled
- In the major heap
- In the minor heap by C code and OCaml code in bytecode mode
2019-05-20 13:04:28 +02:00
Jacques-Henri Jourdan 052a950dea Statistical memory profiling of blocks allocated in the major heap. 2019-05-09 16:40:45 +02:00
Stephen Dolan 9f0bebf7f7 Make caml_named_value return a const value*.
This commit just adds "const" in several places.
2019-03-12 12:07:04 +00:00
Stephen Dolan e9b04bb0d5 Add CODE_CUSTOM_FIXED for fixed-size custom serializers.
As a space optimisation, custom serializers that always consume
the same number of bytes need not send the lengths explicitly.
2018-08-22 10:33:09 +01:00
Stephen Dolan 8072766a30 Make marshalled Custom_tag objects store their length.
Adds a new marshal code CODE_CUSTOM_LEN, which stores the lengths
(for both 32- and 64-bit) of each marshalled custom block. The
marshaller only uses CODE_CUSTOM_LEN, but the unmarshaller still
understands CODE_CUSTOM (So, old files still unmarshal, but new ones
don't work on old versions).

This allows the unmarshaller to know exactly how much memory is
needed before calling a custom `deserialize` function.
2018-07-03 12:12:55 +01:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00