[m-dev.] for review: fix tabling bugs
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Aug 12 02:48:32 AEST 1999
Zoltan, could you please review this one?
Estimated hours taken: 1.5
runtime/mercury_tabling.c:
Fix a couple of bugs:
- the hash table search in MR_int_hash_lookup_or_add
was missing the line `bucket++'.
- the code for tabling higher-order pred closures
was quite bogus; I replaced it.
Workspace: /home/mercury0/fjh/mercury
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.7
diff -u -r1.7 mercury_tabling.c
--- mercury_tabling.c 1999/07/06 06:32:17 1.7
+++ mercury_tabling.c 1999/08/11 16:41:35
@@ -7,6 +7,7 @@
#include "mercury_imp.h"
#include "mercury_type_info.h"
+#include "mercury_ho_call.h"
#include <stdio.h>
/*---------------------------------------------------------------------------*/
@@ -109,7 +110,6 @@
while (BUCKET(table, bucket)) {
++bucket;
-
if (bucket == SIZE(table))
bucket = 0;
}
@@ -146,6 +146,7 @@
return &p->data;
}
+ bucket++;
if (bucket == SIZE(table))
bucket = 0;
@@ -218,8 +219,8 @@
if (key == word_to_float(p->key)) {
return &p->data;
}
- ++bucket;
+ ++bucket;
if (bucket == SIZE(table))
bucket = 0;
@@ -296,8 +297,8 @@
if (res == 0) {
return &p->data;
}
- ++bucket;
+ ++bucket;
if (bucket == SIZE(table))
bucket = 0;
@@ -596,18 +597,29 @@
break;
case MR_TYPECTOR_REP_PRED: {
+ /*
+ ** XXX tabling of the closures by tabling their code address
+ ** and arguments is not yet implemented, due to the difficulty
+ ** of figuring out the closure argument types.
+ */
+ #if 0
+ MR_closure closure = (MR_Closure *) data_value;
+ Word num_hidden_args = closure->MR_closure_num_hidden_args;
int i;
- Word args = data_value[0];
-
- MR_DEBUG_TABLE_STRING(table, args);
- MR_DEBUG_TABLE_STRING(table, data_value[1]);
- for (i = 0; i < args; i++) {
+ MR_DEBUG_TABLE_INT(table, closure->MR_closure_code);
+ for (i = 1; i <= num_hidden_args; i++) {
MR_DEBUG_TABLE_ANY(table,
- (Word *) type_info[i + TYPEINFO_OFFSET_FOR_PRED_ARGS],
- data_value[i+2]);
+ <type_info for hidden closure argument number i>,
+ closure->MR_closure_hidden_args(i));
}
break;
+ #endif
+ /*
+ ** Instead, we use the following rather simplistic means of
+ ** tabling closures: we just table based on the closure address.
+ */
+ MR_DEBUG_TABLE_INT(table, data_value);
}
case MR_TYPECTOR_REP_UNIV:
MR_DEBUG_TABLE_TYPEINFO(table,
--
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