[m-rev.] for review: fix asm_fast.par.gc
Peter Wang
wangp at students.cs.mu.OZ.AU
Tue Mar 7 17:18:35 AEDT 2006
Estimated hours taken: 8
Branches: main
Fix a few problems in the low-level parallel grade.
compiler/par_conj_gen.m:
runtime/mercury_context.h:
Fix some off-by-one bugs introduced when `MR_sp' was changed to mean
the last used word on the det stack, rather than the first free word.
Update references to renamed fields in the MR_Context structure.
Change some `assert' calls to `MR_assert'.
Index: compiler/par_conj_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/par_conj_gen.m,v
retrieving revision 1.21
diff -u -r1.21 par_conj_gen.m
--- compiler/par_conj_gen.m 17 Nov 2005 15:57:26 -0000 1.21
+++ compiler/par_conj_gen.m 6 Mar 2006 12:06:49 -0000
@@ -264,7 +264,7 @@
copy_outputs(CI, [Var | Vars], SpSlot, Code) :-
code_info__get_variable_slot(CI, Var, SrcSlot),
( SrcSlot = stackvar(SlotNum) ->
- NegSlotNum = (- SlotNum),
+ NegSlotNum = (1 - SlotNum),
DestSlot = field(yes(0), lval(SpSlot), const(int_const(NegSlotNum)))
;
unexpected(this_file,
Index: runtime/mercury_context.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.h,v
retrieving revision 1.29
diff -u -r1.29 mercury_context.h
--- runtime/mercury_context.h 14 Sep 2005 23:42:07 -0000 1.29
+++ runtime/mercury_context.h 7 Mar 2006 06:15:00 -0000
@@ -275,17 +275,19 @@
MR_Context *f_n_c_context; \
int fork_new_context_i; \
\
- f_n_c_context = MR_create_context(); \
+ f_n_c_context = MR_create_context("fork_new_context", NULL); \
MR_IF_MR_THREAD_SAFE( \
- f_n_c_context->owner_thread = NULL; \
+ f_n_c_context->MR_ctxt_owner_thread = (MercuryThread) NULL; \
) \
for (fork_new_context_i = (numslots); \
fork_new_context_i > 0; \
fork_new_context_i--) \
{ \
- *(f_n_c_context->context_sp) = MR_stackvar(fork_new_context_i); \
+ *(f_n_c_context->MR_ctxt_sp) = MR_stackvar(fork_new_context_i); \
f_n_c_context->MR_ctxt_sp++; \
} \
+ /* `MR_ctxt_sp' points to the last used word */ \
+ f_n_c_context->MR_ctxt_sp--; \
f_n_c_context->MR_ctxt_resume = (child); \
MR_schedule(f_n_c_context); \
MR_GOTO(parent); \
@@ -448,13 +450,13 @@
MR_ENGINE(MR_eng_context).MR_ctxt_cutstack_zone; \
save_context_c->MR_ctxt_pnegstack_zone = \
MR_ENGINE(MR_eng_context).MR_ctxt_pnegstack_zone; \
- assert(MR_gen_stack == (MR_GenStackFrame *) \
+ MR_assert(MR_gen_stack == (MR_GenStackFrame *) \
MR_ENGINE(MR_eng_context).MR_ctxt_genstack_zone-> \
MR_zone_min); \
- assert(MR_cut_stack == (MR_CutStackFrame *) \
+ MR_assert(MR_cut_stack == (MR_CutStackFrame *) \
MR_ENGINE(MR_eng_context).MR_ctxt_cutstack_zone-> \
MR_zone_min); \
- assert(MR_pneg_stack == (MR_PNegStackFrame *) \
+ MR_assert(MR_pneg_stack == (MR_PNegStackFrame *) \
MR_ENGINE(MR_eng_context).MR_ctxt_pnegstack_zone-> \
MR_zone_min); \
) \
@@ -476,6 +478,7 @@
MR_SyncTerm *st; \
\
st = (MR_SyncTerm *) sync_term; \
+ MR_assert(st != NULL); \
MR_IF_THREAD_SAFE( \
pthread_mutex_init(&(st->MR_st_lock), MR_MUTEX_ATTR); \
) \
@@ -488,14 +491,15 @@
MR_SyncTerm *st; \
\
st = (MR_SyncTerm *) sync_term; \
+ MR_assert(st != NULL); \
MR_LOCK(&(st->MR_st_lock), "terminate"); \
(st->MR_st_count)--; \
if (st->MR_st_count == 0) { \
- assert(st->MR_st_parent != NULL); \
+ MR_assert(st->MR_st_parent != NULL); \
MR_UNLOCK(&(st->MR_st_lock), "terminate i"); \
MR_schedule(st->MR_st_parent); \
} else { \
- assert(st->MR_st_count > 0); \
+ MR_assert(st->MR_st_count > 0); \
MR_UNLOCK(&(st->MR_st_lock), "terminate ii"); \
} \
MR_destroy_context(MR_ENGINE(MR_eng_this_context)); \
@@ -507,13 +511,14 @@
MR_SyncTerm *st; \
\
st = (MR_SyncTerm *) sync_term; \
+ MR_assert(st != NULL); \
MR_LOCK(&(st->MR_st_lock), "continue"); \
(st->MR_st_count)--; \
if (st->MR_st_count == 0) { \
MR_UNLOCK(&(st->MR_st_lock), "continue i"); \
MR_GOTO((where_to)); \
} \
- assert(st->MR_st_count > 0); \
+ MR_assert(st->MR_st_count > 0); \
MR_save_context(MR_ENGINE(MR_eng_this_context)); \
MR_ENGINE(MR_eng_this_context)->MR_ctxt_resume = (where_to);\
st->MR_st_parent = MR_ENGINE(MR_eng_this_context); \
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list