fix global variable core dump in threaded yapor.
This commit is contained in:
parent
404331ac0f
commit
10744069fc
27
C/grow.c
27
C/grow.c
@ -64,7 +64,7 @@ STATIC_PROTO(Int p_inform_stack_overflows, (void));
|
|||||||
STATIC_PROTO(int growstack, (long));
|
STATIC_PROTO(int growstack, (long));
|
||||||
STATIC_PROTO(void MoveGlobal, (void));
|
STATIC_PROTO(void MoveGlobal, (void));
|
||||||
STATIC_PROTO(void MoveLocalAndTrail, (void));
|
STATIC_PROTO(void MoveLocalAndTrail, (void));
|
||||||
STATIC_PROTO(void SetHeapRegs, (void));
|
STATIC_PROTO(void SetHeapRegs, (int));
|
||||||
STATIC_PROTO(void AdjustTrail, (int, int));
|
STATIC_PROTO(void AdjustTrail, (int, int));
|
||||||
STATIC_PROTO(void AdjustLocal, (void));
|
STATIC_PROTO(void AdjustLocal, (void));
|
||||||
STATIC_PROTO(void AdjustGlobal, (long));
|
STATIC_PROTO(void AdjustGlobal, (long));
|
||||||
@ -111,7 +111,7 @@ cpcellsd(register CELL *Dest, register CELL *Org, CELL NOf)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SetHeapRegs(void)
|
SetHeapRegs(int copying_threads)
|
||||||
{
|
{
|
||||||
#ifdef undf7
|
#ifdef undf7
|
||||||
fprintf(Yap_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, Yap_GlobalBase, H, LCL0, ASP);
|
fprintf(Yap_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, Yap_GlobalBase, H, LCL0, ASP);
|
||||||
@ -185,10 +185,12 @@ SetHeapRegs(void)
|
|||||||
S = PtoGloAdjust(S);
|
S = PtoGloAdjust(S);
|
||||||
else if (IsOldLocalPtr(S))
|
else if (IsOldLocalPtr(S))
|
||||||
S = PtoLocAdjust(S);
|
S = PtoLocAdjust(S);
|
||||||
if (GlobalArena)
|
if (!copying_threads) {
|
||||||
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena)));
|
if (GlobalArena)
|
||||||
if (GlobalDelayArena)
|
GlobalArena = AbsAppl(PtoGloAdjust(RepAppl(GlobalArena)));
|
||||||
GlobalDelayArena = GlobalAdjust(GlobalDelayArena);
|
if (GlobalDelayArena)
|
||||||
|
GlobalDelayArena = GlobalAdjust(GlobalDelayArena);
|
||||||
|
}
|
||||||
#ifdef COROUTINING
|
#ifdef COROUTINING
|
||||||
if (DelayedVars)
|
if (DelayedVars)
|
||||||
DelayedVars = AbsAppl(PtoGloAdjust(RepAppl(DelayedVars)));
|
DelayedVars = AbsAppl(PtoGloAdjust(RepAppl(DelayedVars)));
|
||||||
@ -306,7 +308,7 @@ AdjustPair(register CELL t0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
AdjustTrail(int adjusting_heap, int duplicate_references)
|
AdjustTrail(int adjusting_heap, int thread_copying)
|
||||||
{
|
{
|
||||||
volatile tr_fr_ptr ptt;
|
volatile tr_fr_ptr ptt;
|
||||||
|
|
||||||
@ -326,6 +328,9 @@ AdjustTrail(int adjusting_heap, int duplicate_references)
|
|||||||
TrailTerm(ptt) = GlobalAdjust(reg);
|
TrailTerm(ptt) = GlobalAdjust(reg);
|
||||||
else if (IsOldTrail(reg))
|
else if (IsOldTrail(reg))
|
||||||
TrailTerm(ptt) = TrailAdjust(reg);
|
TrailTerm(ptt) = TrailAdjust(reg);
|
||||||
|
else if (thread_copying) {
|
||||||
|
RESET_VARIABLE(&TrailTerm(ptt));
|
||||||
|
}
|
||||||
} else if (IsPairTerm(reg)) {
|
} else if (IsPairTerm(reg)) {
|
||||||
TrailTerm(ptt) = AdjustPair(reg);
|
TrailTerm(ptt) = AdjustPair(reg);
|
||||||
#ifdef MULTI_ASSIGNMENT_VARIABLES /* does not work with new structures */
|
#ifdef MULTI_ASSIGNMENT_VARIABLES /* does not work with new structures */
|
||||||
@ -682,7 +687,7 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o
|
|||||||
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size;
|
TrDiff = LDiff = GDiff = GDiff0 = DelayDiff = BaseDiff = size;
|
||||||
XDiff = HDiff = 0;
|
XDiff = HDiff = 0;
|
||||||
GSplit = NULL;
|
GSplit = NULL;
|
||||||
SetHeapRegs();
|
SetHeapRegs(FALSE);
|
||||||
MoveLocalAndTrail();
|
MoveLocalAndTrail();
|
||||||
if (fix_code) {
|
if (fix_code) {
|
||||||
CELL *SaveOldH = OldH;
|
CELL *SaveOldH = OldH;
|
||||||
@ -860,7 +865,7 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit)
|
|||||||
GSplit = hsplit;
|
GSplit = hsplit;
|
||||||
XDiff = HDiff = 0;
|
XDiff = HDiff = 0;
|
||||||
Yap_GlobalBase = old_GlobalBase;
|
Yap_GlobalBase = old_GlobalBase;
|
||||||
SetHeapRegs();
|
SetHeapRegs(FALSE);
|
||||||
if (do_grow) {
|
if (do_grow) {
|
||||||
MoveLocalAndTrail();
|
MoveLocalAndTrail();
|
||||||
if (hsplit) {
|
if (hsplit) {
|
||||||
@ -1401,7 +1406,7 @@ execute_growstack(long size0, int from_trail, int in_parser, tr_fr_ptr *old_trp,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ASP -= 256;
|
ASP -= 256;
|
||||||
SetHeapRegs();
|
SetHeapRegs(FALSE);
|
||||||
if (from_trail) {
|
if (from_trail) {
|
||||||
Yap_TrailTop += size0;
|
Yap_TrailTop += size0;
|
||||||
}
|
}
|
||||||
@ -1739,7 +1744,7 @@ Yap_CopyThreadStacks(int worker_q, int worker_p)
|
|||||||
DynamicArrays = NULL;
|
DynamicArrays = NULL;
|
||||||
StaticArrays = NULL;
|
StaticArrays = NULL;
|
||||||
GlobalVariables = NULL;
|
GlobalVariables = NULL;
|
||||||
SetHeapRegs();
|
SetHeapRegs(TRUE);
|
||||||
CopyLocalAndTrail();
|
CopyLocalAndTrail();
|
||||||
MoveGlobal();
|
MoveGlobal();
|
||||||
AdjustStacksAndTrail(0, TRUE);
|
AdjustStacksAndTrail(0, TRUE);
|
||||||
|
@ -172,10 +172,6 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
LOCK(Yap_heap_regs->low_level_trace_lock);
|
LOCK(Yap_heap_regs->low_level_trace_lock);
|
||||||
sc = Yap_heap_regs;
|
sc = Yap_heap_regs;
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
if (vsc_count < 637746000LL)
|
|
||||||
return;
|
|
||||||
if (vsc_count == 637746933LL)
|
|
||||||
jmp_deb(1);
|
|
||||||
#ifdef THREADS
|
#ifdef THREADS
|
||||||
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
Yap_heap_regs->thread_handle[worker_id].thread_inst_count++;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user