Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate GC hooking into Julia GC. #2092

Merged
merged 1 commit into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ READLINE_CPPFLAGS = @READLINE_CPPFLAGS@
READLINE_LDFLAGS = @READLINE_LDFLAGS@
READLINE_LIBS = @READLINE_LIBS@

JULIA_CPPFLAGS = @JULIA_CPPFLAGS@
JULIA_LDFLAGS = @JULIA_LDFLAGS@
JULIA_LIBS = @JULIA_LIBS@

BUILD_BOEHM_GC = @BUILD_BOEHM_GC@
BOEHM_GC_CPPFLAGS = @BOEHM_GC_CPPFLAGS@
BOEHM_GC_LDFLAGS = @BOEHM_GC_LDFLAGS@
Expand Down
4 changes: 4 additions & 0 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ GAP_PKG_CPPFLAGS += $(DEFS)
GAP_CPPFLAGS += $(GMP_CPPFLAGS)
GAP_CPPFLAGS += $(ZLIB_CPPFLAGS)
GAP_CPPFLAGS += $(READLINE_CPPFLAGS)
GAP_CPPFLAGS += $(JULIA_CPPFLAGS)
GAP_CPPFLAGS += $(BOEHM_GC_CPPFLAGS)
GAP_CPPFLAGS += $(LIBATOMIC_OPS_CPPFLAGS)

GAP_PKG_CPPFLAGS += $(GMP_CPPFLAGS)
GAP_PKG_CPPFLAGS += $(ZLIB_CPPFLAGS)
GAP_PKG_CPPFLAGS += $(READLINE_CPPFLAGS)
GAP_PKG_CPPFLAGS += $(JULIA_CPPFLAGS)
GAP_PKG_CPPFLAGS += $(BOEHM_GC_CPPFLAGS)
GAP_PKG_CPPFLAGS += $(LIBATOMIC_OPS_CPPFLAGS)

Expand Down Expand Up @@ -195,6 +197,7 @@ GAP_LDFLAGS = $(ABI_CFLAGS)
GAP_LDFLAGS += $(GMP_LDFLAGS)
GAP_LDFLAGS += $(ZLIB_LDFLAGS)
GAP_LDFLAGS += $(READLINE_LDFLAGS)
GAP_LDFLAGS += $(JULIA_LDFLAGS)
GAP_LDFLAGS += $(BOEHM_GC_LDFLAGS)
GAP_LDFLAGS += $(LIBATOMIC_OPS_LDFLAGS)

Expand All @@ -213,6 +216,7 @@ GAP_LIBS =
GAP_LIBS += $(GMP_LIBS)
GAP_LIBS += $(ZLIB_LIBS)
GAP_LIBS += $(READLINE_LIBS)
GAP_LIBS += $(JULIA_LIBS)
GAP_LIBS += $(BOEHM_GC_LIBS)
GAP_LIBS += $(LIBATOMIC_OPS_LIBS)

Expand Down
50 changes: 48 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ dnl
dnl User setting: garbage collector to use
dnl
AC_ARG_WITH([gc],
[AS_HELP_STRING([--with-gc@<:@=default|gasman|boehm@:>@],
[AS_HELP_STRING([--with-gc@<:@=default|gasman|boehm|julia@:>@],
[specify which garbage collector to use (default: gasman; for HPC-GAP: boehm)])],
[],
[with_gc=default])
Expand All @@ -223,7 +223,10 @@ AS_CASE([$with_gc],
AC_SUBST([GC_SOURCES], [src/gasman.c])
AC_DEFINE([USE_GASMAN], [1], [define as 1 if GASMAN is used])
],
[*], [AC_MSG_ERROR([Invalid gc method '$with_gc', use default|none|gasman|boehm])],
[julia], [AC_SUBST([GC_SOURCES], [src/julia_gc.c])
AC_DEFINE([USE_JULIA_GC], [1], [define as 1 if the Julia GC is used])
],
[*], [AC_MSG_ERROR([Invalid gc method '$with_gc', use default|none|gasman|boehm|julia])],
)
AC_MSG_RESULT([$with_gc])

Expand Down Expand Up @@ -471,6 +474,49 @@ AC_SUBST([READLINE_CPPFLAGS])
AC_SUBST([READLINE_LDFLAGS])
AC_SUBST([READLINE_LIBS])


dnl Find julia
AC_ARG_WITH([julia],
[AS_HELP_STRING([--with-julia@<:@=PREFIX@:>@],
[specify a prefix where julia can be found])])

AS_IF([test "x$with_julia" != xno],[
JULIA_LIBS="-ljulia"
AS_CASE([x"$with_julia"],
[xyes|x],[
JULIA_CPPFLAGS=
JULIA_LDFLAGS=
],
[*],[
JULIA_CPPFLAGS="-I$with_julia/include/julia"
JULIA_LDFLAGS="-L$with_julia/lib -Wl,-rpath,$with_julia/lib"
JULIA_LIBS="-ljulia"
]
)

AX_CHECK_LIBRARY([JULIA], [julia.h], [julia], [jl_gc_alloc], [], [], [])

# TODO: also check for gcext.h, so that we can be sure the user is pointing
# at a modified version of Julia.

AS_IF([test $ax_cv_have_JULIA = yes],[
AC_DEFINE([HAVE_LIBJULIA], [1], [Define if you have libjulia])
],[
AS_CASE([x"$with_julia"],
[x], [JULIA_CPPFLAGS= JULIA_LDFLAGS= JULIA_LIBS=],
[*], [AC_MSG_FAILURE([--with-julia was given, but test for julia failed])]
)
])
])

dnl TODO: check if $with_gc = julia; if so, error out if julia is not found


AC_SUBST([JULIA_CPPFLAGS])
AC_SUBST([JULIA_LDFLAGS])
AC_SUBST([JULIA_LIBS])


dnl Find ward (if HPC-GAP mode is enabled)
AC_ARG_WITH([ward],
[AS_HELP_STRING([--with-ward@<:@=PREFIX@:>@],
Expand Down
6 changes: 6 additions & 0 deletions src/gasman.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ static inline void CHANGED_BAG(Bag bag)
{
}

#elif defined(USE_JULIA_GC)

void CHANGED_BAG(Bag bag);

int IsGapObj(void *);

#elif defined(MEMORY_CANARY)

/****************************************************************************
Expand Down
Loading