There is still at least one Microsoft-supported version of the CRT which
does not include the secure versions of various functions, and
consequently does not include `_set_invalid_parameter_handler`.
Tests for the definition and inclusion of
caml_install_invalid_parameter_handler refined to detect
`__STDC_SECURE_LIB__` defined in `crtdefs.h`. This is a badly documented,
but standardised, define. Although `__STDC_SECURE_LIB__` is compatible
with MinGW, I have retained the test for `_MSC_VER` and so kept this as an
MSVC-only patch.
This enables correct stack unwinding, and helps prevent random crashes on OS X
due to Cocoa or other Objective-C (or C++) external functions walking
our stack.
Platform debuggers such as `gdb` and `lldb` can now show a full stack trace for
call stacks that include ocamlopt-generated code. Specifically, this commit adds
base pointer information to the stack unwinding metadata of runtime function
`caml_start_program`.
It's easy to forget that the assembler ignores the program's
control flow when computing the resulting CFA offset of the
various CFI_ADJUST directives. Note that unbalanced
CFI_ADJUST directives in one assembly routine cause all offsets
in all subsequent routines to be shifted by the corresponding
amount.
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 PIC mode, Itailcall_imm should jumpt to the PLT of the called function.
Also: use %r7 rather than %r1 to pass the function pointer argument to caml_c_call. It can be that caml_c_call is in a different shared object than the caller. In this case, %r0 and %r1 can be destroyed by PLT stub code, according to the ELF ABI.
Move the cold path (the one that calls the GC when alloc_ptr < alloc_limit)
as much as possible to the end of the function.
Use la and lay to produce shorter code.
Following the previous commit, %r12 becomes usable as a normal register.
However it must be saved in caml_call_gc.
Independently: change Proc.loc_external_arguments to account for the
160 reserved bytes at bottom of stack. Then, caml_c_call and
emission of code for Iextcall(false) no longer need to account for
those reserved bytes.
Using the low bit of return addresses to mark already-scanned stack frames improves GC time on architectures that ignore this bit in 'return' instructions, like Power. Otherwise, as is the case for zSystem, clearing up this bit before every 'return' instruction costs too much in running time.
asmrun/stack.h: turn off the marking of return addresses for z
asmcomp/s390x/emit.mlp: suppress clearing of low bit of return addresses
This simplify the code, would have prevented GPR#205 and prepare ground
for upcoming improved backtrace generation.
From: Frédéric Bour <frederic.bour@lakaban.net>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16367 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
And share backtrace.c between asmrun and byterun.
From: Frédéric Bour <frederic.bour@lakaban.net>
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16365 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02