Skip to content

Commit

Permalink
Fix checksums GC_record_fault invocation on Darwin
Browse files Browse the repository at this point in the history
* checksums.c [MPROTECT_VDB] (GC_record_fault): Define regardless of
DARWIN.
* include/private/gc_priv.h [CHECKSUMS && MPROTECT_VDB]
(GC_record_fault): Declare regardless of DARWIN.
* os_dep.c [MPROTECT_VDB && DARWIN && CHECKSUMS]
(catch_exception_raise): Call GC_record_fault() (if GC_mprotect_state
is GC_MP_NORMAL only).
  • Loading branch information
ivmai committed Dec 14, 2023
1 parent a022304 commit da06919
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion checksums.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ STATIC word GC_faulted[NSUMS] = { 0 };

STATIC size_t GC_n_faulted = 0;

#if defined(MPROTECT_VDB) && !defined(DARWIN)
#ifdef MPROTECT_VDB
void GC_record_fault(struct hblk * h)
{
word page = (word)h & ~(word)(GC_page_size-1);
Expand Down
2 changes: 1 addition & 1 deletion include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ GC_EXTERN signed_word GC_bytes_found;
#endif

#ifdef CHECKSUMS
# if defined(MPROTECT_VDB) && !defined(DARWIN)
# ifdef MPROTECT_VDB
void GC_record_fault(struct hblk * h);
# endif
void GC_check_dirty(void);
Expand Down
3 changes: 3 additions & 0 deletions os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -5015,6 +5015,9 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED,
struct hblk * h = (struct hblk *)((word)addr & ~(word)(GC_page_size-1));
size_t i;

# ifdef CHECKSUMS
GC_record_fault(h);
# endif
UNPROTECT(h, GC_page_size);
for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
word index = PHT_HASH(h+i);
Expand Down

0 comments on commit da06919

Please sign in to comment.