Skip to content
This repository was archived by the owner on Nov 12, 2020. It is now read-only.

Commit a1bb26c

Browse files
authored
GPR#938 cont.: fix compilation for MSVC32 (#1170)
GPR#938 broke compilation for MSVC32: the stack probing in the runtime isn't implemented on Win32 (i386nt.asm), so the enhanced Is_in_code_area macro should only be used in the Win64-specific part of byterun/win32.c.
1 parent a8e770c commit a1bb26c

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

Changes

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,16 @@ Working version
201201

202202
### Runtime system:
203203

204-
- GPR#938: Stack overflow detection on 64-bit Windows
205-
(Olivier Andrieu)
206-
207204
- GPR#71: The runtime can now be shut down gracefully by means of the new
208205
caml_shutdown and caml_startup_pooled functions. The new 'c' flag in
209206
OCAMLRUNPARAM enables shutting the runtime properly on process exit.
210207
(Max Mouratov, review and discussion by Damien Doligez, Gabriel Scherer,
211208
Mark Shinwell, Thomas Braibant, Stephen Dolan, Pierre Chambart,
212209
François Bobot, Jacques Garrigue, David Allsopp, and Alain Frisch)
213210

211+
- GPR#938, GPR#1170: Stack overflow detection on 64-bit Windows
212+
(Olivier Andrieu)
213+
214214
Next major version (4.05.0):
215215
----------------------------
216216

byterun/win32.c

+11-10
Original file line numberDiff line numberDiff line change
@@ -521,16 +521,6 @@ static void caml_reset_stack (void *faulting_address)
521521
caml_raise_stack_overflow();
522522
}
523523

524-
/* Do not use the macro from address_class.h here. */
525-
#undef Is_in_code_area
526-
#define Is_in_code_area(pc) \
527-
( ((char *)(pc) >= caml_code_area_start && \
528-
(char *)(pc) <= caml_code_area_end) \
529-
|| ((char *)(pc) >= &caml_system__code_begin && \
530-
(char *)(pc) <= &caml_system__code_end) \
531-
|| (Classify_addr(pc) & In_code_area) )
532-
extern char caml_system__code_begin, caml_system__code_end;
533-
534524

535525
#ifndef _WIN64
536526
static LONG CALLBACK
@@ -565,6 +555,17 @@ static LONG CALLBACK
565555
extern char *caml_exception_pointer;
566556
extern value *caml_young_ptr;
567557

558+
/* Do not use the macro from address_class.h here. */
559+
#undef Is_in_code_area
560+
#define Is_in_code_area(pc) \
561+
( ((char *)(pc) >= caml_code_area_start && \
562+
(char *)(pc) <= caml_code_area_end) \
563+
|| ((char *)(pc) >= &caml_system__code_begin && \
564+
(char *)(pc) <= &caml_system__code_end) \
565+
|| (Classify_addr(pc) & In_code_area) )
566+
extern char caml_system__code_begin, caml_system__code_end;
567+
568+
568569
static LONG CALLBACK
569570
caml_stack_overflow_VEH (EXCEPTION_POINTERS* exn_info)
570571
{

0 commit comments

Comments
 (0)