Commit Graph

38 Commits (001c2d12836f9c5d3b688af1f83412d39a9be195)

Author SHA1 Message Date
David Allsopp 001c2d1283 Restore Cygwin64 support 2020-09-21 13:36:03 +01:00
David Allsopp 17cceab054 Remaining functions requiring explicit export 2020-09-18 12:11:20 +01:00
David Allsopp 9a7a17c012 Add Sys.mkdir 2020-07-21 14:15:40 +01:00
Antonin Décimo 4d6d422867 Use the alignas C++ keyword when compiling in C++
See #9714.
2020-06-29 21:24:17 +02: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
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
David Allsopp a9f7d74bcf Add snprintf_os 2020-04-30 10:31:30 +02:00
madroach 82700678b2
Don't include stdio.h in caml/misc.h (#9483)
* Don't include stdio.h in caml/misc.h
There is no need to include stdio.h in caml/misc.h
This seems to have happened by accident in commit cddec18fde
On OpenBSD, stderr and stdout are macros defined in stdio.h
ppx_expect uses stderr and stdout as identifiers in
collector/expect_test_collector_stubs.c where caml/misc.h is included.
This confuses the C compiler, because the macro will get expanded where an identifier is expected.

* Remove fallback NULL definition in caml/misc.h

ISO C guarantees that NULL is defined in <stddef.h>

* include missing stdio in tests/compatibility/stub.c
2020-04-24 14:27:32 +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
Stephen Dolan f874b3ee01 Memprof: report different callstacks for different combined allocations 2020-01-25 22:55:56 +01:00
Kate 289521b977 Fix multiple definitions of a global variable when using the C interface with a C++ compiler (#9176)
The `CAML_STATIC_ASSERT` declares a global variable which was neither `static` nor `extern`.  Multiple uses of the macro cause multiple variables with the same name, which are accepted under the "common" C model but are rejected in C++ and in some C compilers that don't use the "common" model.  The fix is to declare the variable `extern`.
2019-12-12 16:19:55 +01:00
Konstantin Romanov d11a60bc22 Add attribute(align()) detection and fix XLC build. 2019-11-25 20:39:52 +01:00
Jacques-Henri Jourdan 5a53560e7d Fix address sanitizer check on INRIA CI (#9053)
Since the new stack overflow detection system (#8670), ASAN was confused.
We fix the issue by telling ASAN to not use a sigaltstack, and by disabling
ASAN on functions used by the stack overflow handler.
2019-10-19 11:39:30 +02:00
Damien Doligez 01bdd5bbc4
best-fit allocator (#8809) 2019-10-15 13:52:16 +02:00
David Allsopp 36b7a70713 Deprecate the addr typedef (#8896)
The typedef was guarded by CAML_INTERNALS, but given its accidental use
in the public Is_young macro, mark the typedef as deprecated in case
CAML_INTERNALS is being defined "in the wild" to workaround this.
2019-10-14 19:34:07 +02:00
Guillaume Munch-Maccagnoni b304042b29 Fix missing Caml_state (#8940)
* Fix free identifiers in spacetime

* Fix free identifiers in tools/gdb-macros

* [minor] Fix Caml_state fields in comments, and other comment updates

* Changes
2019-10-03 16:27:32 +02:00
David Allsopp 7f96c82fda Windows Unicode handling for ocamlyacc
This deals with the command line processing only (i.e. filenames) -
ocamlyacc continues to process .mly files as before.
2019-04-16 17:37:17 +01:00
David Allsopp a7b5bb6f06 Propagate Caml_state_field 2019-08-24 12:15:49 +02:00
KC Sivaramakrishnan e96220a96f Simplify awk scripts, fix comments and signatures. 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan b22240f53c Fix CAML_STATIC_ASSERT for MSVC 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan 1aec112619 Define alignment macro for MSVC compiler 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 b212aed0cb Make depend and fix typos 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan fc6f028492 Introduce domain state and steal exception pointer 2019-08-23 09:50:05 +05:30
Xavier Leroy 7ffa7d26c8 misc.h: include <stdarg.h> so that va_list is defined
Follow-up to PR#8630, commit cddec18fd.
2019-07-31 11:36:21 +02:00
Xavier Leroy 9d84841c46
Merge branch 'trunk' into fatal_error_abort 2019-07-31 11:18:57 +02:00
Jacques-Henri Jourdan 78de99ecc2 Xavier Clerc's remarks. 2019-07-16 13:42:04 +02:00
Jacques-Henri Jourdan 593f94055a Dynlink support for ocamldebug
This commit adds dynlink support for ocamldebug. As a side effect, it also:
  - factorizes the various functions searching for a code fragment into one,
    called [caml_find_code_fragment];
  - removes the [caml_register_code_fragment], which does not seem to
    be used anywhere, and which clearly should not be used by external code.
2019-07-16 10:52:48 +02:00
Jacques-Henri Jourdan a121072588
Merge branch 'trunk' into fatal_error_abort 2019-07-15 10:16:29 +02:00
Jacques-Henri Jourdan 1ea07c881b Fix Thread sanitizer after GPR#8691.
GPR#8691 refactored the signal/async callback system, and introduced
new data races to `caml_something_to_do` and friends. These data races
morally already existed and are "benign", in the sense that they can
only cause more checks for async callbacks.

The corresponding functions are now marked with a special attribute
for whitelisting them. We do no longer use -fsanitize-blacklist, which
seemed to fail preventing warnings (???).
2019-06-18 13:32:46 +02:00
Jacques-Henri Jourdan cddec18fde Add [caml_fatal_error_hook].
When not NULL, this hook is called when a fatal error is encountered
instead of printing an error message on stderr.
2019-06-08 23:05:16 +02:00
Jacques-Henri Jourdan 63a16e8e67 Major GC hooks are no longer allowed to interact with the GC heap. (#8711)
Earlier documentation comments suggested that major GC hooks can do things with the GC-managed heap.  This is problematic and not used in practice.

This commit changes the documentation comments to make it clear that major GC hools are not allowed to interact with the GC-managed heap.
2019-06-04 19:58:20 +02:00
Jacques-Henri Jourdan b838e48c39 Memprof: Instead of a Poisson process, use a binomial distribution.
The workaround used for ignoring samples in the minor heap in native
mode now makes allocation very slow (or non-terminating) when the
sampling rate is not small enough. This will be fixed when sampling in
the minor heap in native mode will be implemented.
2019-05-21 17:10:16 +02:00
Nicolás Ojeda Bär 8afe2db3c6 Runtime: hide & rename _T macro (#2075)
- Rename _T macro to T to avoid conflict with
- Do not use it for ASCII character literals
- Guard T macro with CAML_INTERNALS
2019-04-14 09:13:24 +02: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
Xavier Leroy 7e79186a12
Remove the C plugins mechanism (#1867)
The mechanism complicates the runtime system and is not very general
(only a few system functions are instrumented).  There are other ways
to intercept system calls that are more general and require no
modification to the source code of the runtime system.
2018-07-03 18:22:51 +01:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +02:00