Skip to content

Commit

Permalink
run-time: Initialize BDWGC from dylan_init_memory_manager
Browse files Browse the repository at this point in the history
* sources/lib/run-time/boehm-collector.c
  (dylan_init_memory_manager): Only assert gc_teb_inside_tramp
   for the HARP run-time. Always invoke GC_INIT() and
   GC_start_mark_threads().

* sources/lib/run-time/llvm-runtime-init.c
  (_Init_Run_Time): Instead of using BDWGC-specific initialization,
   call dylan_init_memory_manager.
  • Loading branch information
housel committed Apr 19, 2024
1 parent 27a4352 commit 2b335d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
21 changes: 13 additions & 8 deletions sources/lib/run-time/boehm-collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,20 +1071,15 @@ void primitive_mps_ld_merge(void *d_into, void *d_obj)

MMError dylan_init_memory_manager(void)
{
#ifdef OPEN_DYLAN_BACKEND_HARP
gc_teb_t gc_teb = current_gc_teb();
assert(!gc_teb->gc_teb_inside_tramp);
#endif

if (Prunning_under_dylan_debuggerQ == FALSE) {
set_CONSOLE_CTRL_HANDLER(&DylanBreakControlHandler, TRUE);
}

assert(!gc_teb->gc_teb_inside_tramp);

/* Not required for the dll version of Boehm. */
/* GC_init(); */

/* Call this to enable incrementality. This doesn't work with the MM GC. */
/* GC_enable_incremental(); */

initialize_CRITICAL_SECTION(&polling_threads_lock);

if (Prunning_under_dylan_debuggerQ) {
Expand All @@ -1093,6 +1088,16 @@ MMError dylan_init_memory_manager(void)
class_breakpoint_events[1] = create_EVENT(NULL, FALSE, FALSE, NULL);
}

GC_INIT();

/* Call this to enable incrementality. This doesn't work with the MM GC. */
/* GC_enable_incremental(); */


// start the mark threads before the main entry point is reached
// so that the debugger nub can identify them
GC_start_mark_threads();

return(0);
}

Expand Down
13 changes: 3 additions & 10 deletions sources/lib/run-time/llvm-runtime-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
#include <stdio.h>

#include "llvm-runtime.h"
#include "mm.h"

#ifdef GC_USE_BOEHM
#include <gc/gc.h>
#endif
extern MMError dylan_init_memory_manager(void);

void _Init_Run_Time(void)
{
Expand All @@ -25,13 +24,7 @@ void _Init_Run_Time(void)
#endif
EstablishDylanExceptionHandlers();

#ifdef GC_USE_BOEHM
GC_INIT();

// start the mark threads before the main entry point is reached
// so that the debugger nub can identify them
GC_start_mark_threads();
#endif
dylan_init_memory_manager();

primitive_initialize_thread_variables();
}
Expand Down

0 comments on commit 2b335d9

Please sign in to comment.