Skip to content

Commit 22f456d

Browse files
committed
run-time: Initialize BDWGC from dylan_init_memory_manager
* 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.
1 parent c7aa4d4 commit 22f456d

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

sources/lib/run-time/boehm-collector.c

+13-8
Original file line numberDiff line numberDiff line change
@@ -1071,20 +1071,15 @@ void primitive_mps_ld_merge(void *d_into, void *d_obj)
10711071

10721072
MMError dylan_init_memory_manager(void)
10731073
{
1074+
#ifdef OPEN_DYLAN_BACKEND_HARP
10741075
gc_teb_t gc_teb = current_gc_teb();
1076+
assert(!gc_teb->gc_teb_inside_tramp);
1077+
#endif
10751078

10761079
if (Prunning_under_dylan_debuggerQ == FALSE) {
10771080
set_CONSOLE_CTRL_HANDLER(&DylanBreakControlHandler, TRUE);
10781081
}
10791082

1080-
assert(!gc_teb->gc_teb_inside_tramp);
1081-
1082-
/* Not required for the dll version of Boehm. */
1083-
/* GC_init(); */
1084-
1085-
/* Call this to enable incrementality. This doesn't work with the MM GC. */
1086-
/* GC_enable_incremental(); */
1087-
10881083
initialize_CRITICAL_SECTION(&polling_threads_lock);
10891084

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

1091+
GC_INIT();
1092+
1093+
/* Call this to enable incrementality. This doesn't work with the MM GC. */
1094+
/* GC_enable_incremental(); */
1095+
1096+
1097+
// start the mark threads before the main entry point is reached
1098+
// so that the debugger nub can identify them
1099+
GC_start_mark_threads();
1100+
10961101
return(0);
10971102
}
10981103

sources/lib/run-time/llvm-runtime-init.c

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#include <stdio.h>
44

55
#include "llvm-runtime.h"
6+
#include "mm.h"
67

7-
#ifdef GC_USE_BOEHM
8-
#include <gc/gc.h>
9-
#endif
8+
extern MMError dylan_init_memory_manager(void);
109

1110
void _Init_Run_Time(void)
1211
{
@@ -25,13 +24,7 @@ void _Init_Run_Time(void)
2524
#endif
2625
EstablishDylanExceptionHandlers();
2726

28-
#ifdef GC_USE_BOEHM
29-
GC_INIT();
30-
31-
// start the mark threads before the main entry point is reached
32-
// so that the debugger nub can identify them
33-
GC_start_mark_threads();
34-
#endif
27+
dylan_init_memory_manager();
3528

3629
primitive_initialize_thread_variables();
3730
}

0 commit comments

Comments
 (0)