Skip to content

Commit a9c6223

Browse files
committed
Temporary / for CI.
1 parent a16c8a3 commit a9c6223

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

ocaml/runtime/amd64.S

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,23 @@ LBL(caml_call_gc):
545545
CFI_ENDPROC
546546
ENDFUNCTION(G(caml_call_gc))
547547

548+
FUNCTION(G(caml_raise_stack_overflow_XXX))
549+
CFI_STARTPROC
550+
CFI_SIGNAL_FRAME
551+
ENTER_FUNCTION
552+
LBL(caml_raise_stack_overflow_XXX):
553+
SAVE_ALL_REGS
554+
movq %r15, Caml_state(gc_regs)
555+
SWITCH_OCAML_TO_C
556+
C_call (GCALL(caml_raise_stack_overflow))
557+
SWITCH_C_TO_OCAML
558+
movq Caml_state(gc_regs), %r15
559+
RESTORE_ALL_REGS
560+
LEAVE_FUNCTION
561+
ret
562+
CFI_ENDPROC
563+
ENDFUNCTION(G(caml_raise_stack_overflow_XXX))
564+
548565
FUNCTION(G(caml_alloc1))
549566
CFI_STARTPROC
550567
ENTER_FUNCTION

ocaml/runtime/signals_nat.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
#define CAML_INTERNALS
1717

18+
#include <unistd.h>
19+
#define __USE_GNU
20+
#include <sys/ucontext.h>
21+
1822
/* Signal handling, code specific to the native-code compiler */
1923

2024
#include <signal.h>
@@ -93,7 +97,8 @@ void caml_garbage_collection(void)
9397
sigact.sa_sigaction = (void (*)(int,siginfo_t *,void *)) (name); \
9498
sigact.sa_flags = SA_SIGINFO
9599

96-
#include <unistd.h>
100+
101+
CAMLextern void caml_raise_stack_overflow_XXX(void);
97102

98103
DECLARE_SIGNAL_HANDLER(segv_handler)
99104
{
@@ -104,7 +109,7 @@ DECLARE_SIGNAL_HANDLER(segv_handler)
104109
char* protected_low = (char *) block + page_size;
105110
char* protected_high = protected_low + page_size;
106111
if ((fault_addr >= protected_low) && (fault_addr < protected_high)) {
107-
caml_raise_stack_overflow();
112+
context->uc_mcontext.gregs[REG_RIP]= (greg_t) &caml_raise_stack_overflow_XXX;
108113
} else {
109114
act.sa_handler = SIG_DFL;
110115
act.sa_flags = 0;

ocaml/testsuite/tests/runtime-errors/stackoverflow.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
88
9-
*)
109
1110
let rec f x =
1211
if not (x = 0 || x = 10000 || x = 20000)

ocaml/testsuite/tests/runtime-errors/stackoverflow.opt.reference

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ x = 20000
66
x = 10000
77
x = 0
88
second Stack overflow caught
9-
Called from Stackoverflow in file "stackoverflow.ml", line 35, characters 4-47
9+
Called from Stackoverflow in file "stackoverflow.ml", line 34, characters 4-47
1010
!p = 42

0 commit comments

Comments
 (0)