fix save/restore in multi-process YAPOR.
This commit is contained in:
parent
bd502a39ac
commit
4c343d0762
7
C/grow.c
7
C/grow.c
|
@ -1432,7 +1432,12 @@ Yap_growglobal(CELL **ptr)
|
||||||
{
|
{
|
||||||
unsigned long sz = sizeof(CELL) * K16;
|
unsigned long sz = sizeof(CELL) * K16;
|
||||||
|
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
|
if (number_workers != 1) {
|
||||||
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (NOfThreads != 1) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
28
C/save.c
28
C/save.c
|
@ -608,7 +608,12 @@ do_save(int mode) {
|
||||||
static Int
|
static Int
|
||||||
p_save(void)
|
p_save(void)
|
||||||
{
|
{
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
|
if (number_workers != 1) {
|
||||||
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (NOfThreads != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -622,7 +627,13 @@ p_save(void)
|
||||||
static Int
|
static Int
|
||||||
p_save2(void)
|
p_save2(void)
|
||||||
{
|
{
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
|
if (number_workers != 1) {
|
||||||
|
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||||
|
"cannot perform save: more than a worker/thread running");
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (NOfThreads != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,
|
Yap_Error(SYSTEM_ERROR,TermNil,
|
||||||
"cannot perform save: more than a worker/thread running");
|
"cannot perform save: more than a worker/thread running");
|
||||||
|
@ -757,6 +768,7 @@ get_heap_info(void)
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
OldHeapTop = (ADDR) get_cellptr();
|
OldHeapTop = (ADDR) get_cellptr();
|
||||||
|
|
||||||
if (Yap_ErrorMessage)
|
if (Yap_ErrorMessage)
|
||||||
return -1;
|
return -1;
|
||||||
OldHeapUsed = (Int) get_cell();
|
OldHeapUsed = (Int) get_cell();
|
||||||
|
@ -940,8 +952,9 @@ get_hash(void)
|
||||||
static int
|
static int
|
||||||
CopyCode(void)
|
CopyCode(void)
|
||||||
{
|
{
|
||||||
if (myread(splfild, (char *) Yap_HeapBase, (Unsigned(OldHeapTop) - Unsigned(OldHeapBase))) < 0)
|
if (myread(splfild, (char *) Yap_HeapBase, (Unsigned(OldHeapTop) - Unsigned(OldHeapBase))) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,7 +1000,7 @@ static int
|
||||||
get_coded(int flag, OPCODE old_ops[])
|
get_coded(int flag, OPCODE old_ops[])
|
||||||
{
|
{
|
||||||
char my_end_msg[256];
|
char my_end_msg[256];
|
||||||
|
|
||||||
if (get_regs(flag) < 0)
|
if (get_regs(flag) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (get_insts(old_ops) < 0)
|
if (get_insts(old_ops) < 0)
|
||||||
|
@ -1762,7 +1775,12 @@ p_restore(void)
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
Term t1 = Deref(ARG1);
|
Term t1 = Deref(ARG1);
|
||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) && !defined(THREADS)
|
||||||
|
if (number_workers != 1) {
|
||||||
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
#elif defined(THREADS)
|
||||||
if (NOfThreads != 1) {
|
if (NOfThreads != 1) {
|
||||||
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|
Reference in New Issue