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

kernel: when using julia_gc, call jl_atexit_hook in SyExit #2931

Merged
merged 2 commits into from
Oct 19, 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
10 changes: 3 additions & 7 deletions src/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ void InformProfilingThatThisIsAForkedGAP(void)
// Allow 20 chracters to allow space for .%d.gz
const int SUPPORTED_PATH_LEN = GAP_PATH_MAX - 20;
if(strlen(profileState.filename) > SUPPORTED_PATH_LEN) {
Pr("Filename can be at most %d character when forking", SUPPORTED_PATH_LEN, 0L);
SyExit(1);
Panic("Filename can be at most %d character when forking", SUPPORTED_PATH_LEN);
}
if (endsWithgz(profileState.filename)) {
snprintf(filenamecpy, sizeof(filenamecpy), "%.*s.%d.gz",
Expand Down Expand Up @@ -599,17 +598,14 @@ struct InterpreterHooks profileHooks = { visitStat,
void enableAtStartup(char * filename, Int repeats, TickMethod tickMethod)
{
if(profileState_Active) {
fprintf(stderr, "-P or -C can only be passed once\n");
exit(1);
Panic("-P or -C can only be passed once\n");
}

profileState.OutputRepeats = repeats;

fopenMaybeCompressed(filename, &profileState);
if(!profileState.Stream) {
fprintf(stderr, "Failed to open '%s' for profiling output.\n", filename);
fprintf(stderr, "Abandoning starting GAP.\n");
exit(1);
Panic("Failed to open '%s' for profiling output.\n", filename);
}

strlcpy(profileState.filename, filename, GAP_PATH_MAX);
Expand Down
7 changes: 2 additions & 5 deletions src/saveload.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,8 @@ static void LoadBagData ( void )
flags = LoadUInt1();
size = LoadUInt();

if (TNAM_TNUM(type) == NULL)
{
Pr("Bad type %d, size %d\n",type,size);
exit(1);
}
if (TNAM_TNUM(type) == NULL)
Panic("Bad type %d, size %d\n", (int)type, (int)size);

/* Get GASMAN to set up the bag for me */
bag = NextBagRestoring( type, flags, size );
Expand Down
11 changes: 9 additions & 2 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
#include "hpc/misc.h"
#endif

#ifdef USE_JULIA_GC
#include "julia.h"
#endif

#include <assert.h>
#include <fcntl.h>
#include <stdarg.h>
Expand Down Expand Up @@ -547,7 +551,10 @@ void SyUSleep ( UInt msecs )
void SyExit (
UInt ret )
{
exit( (int)ret );
#ifdef USE_JULIA_GC
jl_atexit_hook(ret);
#endif
exit( (int)ret );
}


Expand All @@ -563,7 +570,7 @@ void Panic_(const char * file, int line, const char * fmt, ...)
vfprintf(stderr, fmt, args);
va_end (args);
fputs("\n", stderr);
exit(1);
SyExit(1);
}


Expand Down