Skip to content

Commit

Permalink
Fix pre-gc init and move out of gc-specific files
Browse files Browse the repository at this point in the history
This includes the Cando initialization, which expects the command
line arguments to be in place already. This initialization doesn't
actually do anything boehm-specific etc. so having it triplicated
is unnecessary.
  • Loading branch information
Bike committed Oct 26, 2024
1 parent 3ba3c5f commit ea939d2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 31 deletions.
12 changes: 0 additions & 12 deletions src/gctools/boehmGarbageCollection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,6 @@ void boehm_clear_finalizer_list(gctools::Tagged object_tagged) {

}; // namespace gctools

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_EXTERN
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_EXTERN
#endif

namespace gctools {
__attribute__((noinline)) void startupBoehm(gctools::ClaspInfo* claspInfo) {
GC_set_handle_fork(1);
Expand Down Expand Up @@ -436,12 +430,6 @@ __attribute__((noinline)) void startupBoehm(gctools::ClaspInfo* claspInfo) {
GC_register_my_thread(&gc_stack_base);
#endif

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_CALLS
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_CALLS
#endif

//
// Set up the _lisp and symbols memory as roots
//
Expand Down
6 changes: 0 additions & 6 deletions src/gctools/mmtkGarbageCollection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ THE SOFTWARE.
#include <clasp/core/compiler.h>
#include <clasp/gctools/snapshotSaveLoad.h>

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_EXTERN
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_EXTERN
#endif

THREAD_LOCAL MMTk_Mutator my_mutator;

namespace gctools {
Expand Down
12 changes: 0 additions & 12 deletions src/gctools/mpsGarbageCollection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ extern mps_addr_t cons_skip(mps_addr_t client);
extern mps_addr_t weak_obj_skip(mps_addr_t client);
};

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_EXTERN
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_EXTERN
#endif

namespace gctools {

THREAD_LOCAL ThreadLocalAllocationPoints my_thread_allocation_points;
Expand Down Expand Up @@ -1087,12 +1081,6 @@ __attribute__((noinline)) void startupMemoryPoolSystem(gctools::ClaspInfo* clasp
if (res != MPS_RES_OK)
GC_RESULT_ERROR(res, "Could not create awl pool");

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_CALLS
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_CALLS
#endif // ifndef SCRAPING

// register the current and only thread
mps_thr_t global_thread;
res = mps_thread_reg(&global_thread, global_arena);
Expand Down
15 changes: 14 additions & 1 deletion src/gctools/startRunStop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ static void clasp_terminate_handler(void) {

}; // namespace gctools

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_EXTERN
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_EXTERN
#endif

extern "C" {

int startup_clasp(void** stackMarker, gctools::ClaspInfo* claspInfo, int* exitCode) {
Expand Down Expand Up @@ -263,6 +269,14 @@ int startup_clasp(void** stackMarker, gctools::ClaspInfo* claspInfo, int* exitCo
#endif
gctools::initialize_signals(DEFAULT_THREAD_INTERRUPT_SIGNAL);

core::global_options = new core::CommandLineOptions(claspInfo->_argc, claspInfo->_argv);

#ifndef SCRAPING
#define ALL_PREGCSTARTUPS_CALLS
#include PRE_GC_STARTUP_INC_H
#undef ALL_PREGCSTARTUPS_CALLS
#endif

#if defined(USE_MPS)
gctools::startupMemoryPoolSystem(claspInfo);
#elif defined(USE_BOEHM)
Expand All @@ -272,7 +286,6 @@ int startup_clasp(void** stackMarker, gctools::ClaspInfo* claspInfo, int* exitCo
claspInfo->_mpiSize);
#endif

core::global_options = new core::CommandLineOptions(claspInfo->_argc, claspInfo->_argv);
core::transfer_StartupInfo_to_my_thread();
my_thread->startUpVM();

Expand Down

0 comments on commit ea939d2

Please sign in to comment.