From 8ec2d9a2adf625df174ab5a601b031c3e69db7a1 Mon Sep 17 00:00:00 2001 From: Reimer Behrends Date: Mon, 10 Feb 2020 14:06:49 +0100 Subject: [PATCH] WIP: GAP.jl integration. --- src/hpc/threadapi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/hpc/threadapi.c b/src/hpc/threadapi.c index a1092904276..b03294fde17 100644 --- a/src/hpc/threadapi.c +++ b/src/hpc/threadapi.c @@ -46,6 +46,10 @@ #include +#ifdef USE_JULIA_GC +#include "libgap-api.h" +#endif + #define RequireThread(funcname, op, argname) \ RequireArgumentConditionEx(funcname, op, "<" argname ">", \ @@ -431,6 +435,20 @@ void StopKeepAlive(Obj node) static GVarDescriptor GVarTHREAD_INIT; static GVarDescriptor GVarTHREAD_EXIT; +#ifdef USE_JULIA_GC +#define INTERPRETER_INIT 2 +void InitInterpreterState() +{ + if ((TLS(threadInit) & INTERPRETER_INIT) == 0) { + GAP_InitializeThread(); + } + TLS(threadInit) |= INTERPRETER_INIT; + STATE(NrError) = 0; + STATE(ThrownObject) = 0; + SWITCH_TO_OLD_LVARS(STATE(BottomLVars)); +} +#endif + static void ThreadedInterpreter(void * funcargs) { Obj tmp, func, oldLVars;