[m-dev.] diff: fix for bug in init_context()
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Feb 26 02:28:56 AEDT 2000
Estimated hours taken: 0.5
Fix a bug reported by Renaud Paquay <rpa at miscrit.be>.
runtime/mercury_context.c:
When initializing the maxfr and curfr fields of a context,
ensure that we allocate space for the first frame.
Also initialize the redofr slot of the first frame to NULL,
to match what we do with the succfr and prevfr slots.
Workspace: /d-drive/home/hg/fjh/mercury
Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.21
diff -u -d -r1.21 mercury_context.c
--- runtime/mercury_context.c 2000/02/09 19:32:36 1.21
+++ runtime/mercury_context.c 2000/02/25 15:27:58
@@ -110,9 +110,16 @@
nondstack_size, next_offset(), nondstack_zone_size,
default_handler);
}
- c->context_maxfr = c->nondetstack_zone->min;
- c->context_curfr = c->nondetstack_zone->min;
+ /*
+ ** Note that maxfr and curfr point to the last word in the frame,
+ ** not to the first word, so we need to add the size of the frame,
+ ** minus one word, to the base address to get the maxfr/curfr pointer
+ ** for the first frame on the nondet stack.
+ */
+ c->context_maxfr = c->nondetstack_zone->min + MR_NONDET_FIXED_SIZE - 1;
+ c->context_curfr = c->context_maxfr;
MR_redoip_slot(c->context_curfr) = ENTRY(do_not_reached);
+ MR_redofr_slot(c->context_curfr) = NULL;
MR_prevfr_slot(c->context_curfr) = NULL;
MR_succip_slot(c->context_curfr) = ENTRY(do_not_reached);
MR_succfr_slot(c->context_curfr) = NULL;
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list