diff: report error for mixing tabling & trailing
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jul 27 01:18:20 AEST 1998
library/private_builtin.m:
Ensure that tabling will report a "sorry, not implemented"
error if used in a grade with trailing. This is necessary
because the code that would be needed to save and restore
the trail state has not been implemented.
Also use `\\' instead of `\' for macro line continuations
inside pragma c_code, so that the generated C code doesn't
contain very long lines (and so that the `#line' directives
work properly).
doc/reference_manual.texi:
Document that with the current implementation, trailing
does not work in all compilation grades.
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.99
diff -u -r1.99 reference_manual.texi
--- reference_manual.texi 1998/07/16 02:44:11 1.99
+++ reference_manual.texi 1998/07/26 15:07:48
@@ -3310,7 +3310,7 @@
semantics. If the @samp{io__state} arguments were
left off, then the Mercury implementation might apply
undesirable optimizations (e.g. reordering, duplicate
-call elimination, tabling, lazy evaluation...)
+call elimination, tabling, lazy evaluation, @dots{})
to this procedure, which could effect the behaviour
of the program in unpredictable ways.
@@ -4306,6 +4306,15 @@
This ensures that code which does not use tabling does not pay any
runtime overheads from the more complicated execution mechanism
required by (minimal model) tabling.
+
+ at strong{Please note:}
+the current implementation of tabling does not support all the
+possible compilation grades (see the "Compilation model options"
+section of the Mercury User's Guide) allowed by the Mercury
+implementation. In particular, if you enable the use of trailing,
+or if you select a garbage collection method other than the default
+(conservative), then any use of tabling will result in a
+``Sorry, not implemented'' error at runtime.
@node Termination analysis
@subsection Termination analysis
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.2
diff -u -r1.2 private_builtin.m
--- private_builtin.m 1998/05/27 14:46:19 1.2
+++ private_builtin.m 1998/07/26 15:13:22
@@ -937,33 +937,33 @@
ResumeStackNode** ML_resumption_stack = NULL;
-#define ML_RESUME_PUSH() \
- do { \
- ++ML_resumption_sp; \
- if (ML_resumption_sp >= ML_resumption_stack_size || \
- ML_resumption_stack == NULL) \
- { \
- ML_resumption_stack_size = \
- ML_resumption_stack_size*2; \
- ML_resumption_stack = table_reallocate( \
- ML_resumption_stack, \
- ML_resumption_stack_size*sizeof( \
- ResumeStackNode*)); \
- } \
- ML_resumption_stack[ML_resumption_sp] = table_allocate( \
- sizeof(ResumeStackNode)); \
+#define ML_RESUME_PUSH() \\
+ do { \\
+ ++ML_resumption_sp; \\
+ if (ML_resumption_sp >= ML_resumption_stack_size || \\
+ ML_resumption_stack == NULL) \\
+ { \\
+ ML_resumption_stack_size = \\
+ ML_resumption_stack_size*2; \\
+ ML_resumption_stack = table_reallocate( \\
+ ML_resumption_stack, \\
+ ML_resumption_stack_size*sizeof( \\
+ ResumeStackNode*)); \\
+ } \\
+ ML_resumption_stack[ML_resumption_sp] = table_allocate( \\
+ sizeof(ResumeStackNode)); \\
} while (0)
-#define ML_RESUME_POP() \
- do { \
- if (ML_resumption_sp < 0) { \
- fatal_error(""resumption stack underflow""); \
- } \
- table_free(ML_resumption_stack[ML_resumption_sp]); \
- --ML_resumption_sp; \
+#define ML_RESUME_POP() \\
+ do { \\
+ if (ML_resumption_sp < 0) { \\
+ fatal_error(""resumption stack underflow""); \\
+ } \\
+ table_free(ML_resumption_stack[ML_resumption_sp]); \\
+ --ML_resumption_sp; \\
} while (0)
-#define ML_RESUME_VAR \
+#define ML_RESUME_VAR \\
ML_resumption_stack[ML_resumption_sp]
/*
@@ -1036,6 +1036,15 @@
ML_RESUME_VAR->s_p = MR_sp;
ML_RESUME_VAR->cur_fr = MR_curfr;
ML_RESUME_VAR->max_fr = MR_maxfr;
+
+#ifdef MR_USE_TRAIL
+ /*
+ ** We ought to save the trail state here --
+ ** this is not yet implemented.
+ */
+ MR_fatal_error(""Sorry, not implemented: ""
+ ""can't have both tabling and trailing"");
+#endif
ML_RESUME_VAR->changed = 1;
--
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.
More information about the developers
mailing list