for review: cleanup of part of the runtime
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Apr 16 17:52:21 AEST 1999
For review by anyone.
Estimated hours taken: 2
Prefix everything defined in runtime/mercury_{stacks,tags}.h MR_.
In the process, get rid of the grade component MR_DEBUG_NONDET_STACK,
since this makes the update to mercury_stacks.h simpler and its use is
long obsolete (e.g. the grade handling stuff in handle_options.m doesn't
know about it, nor do the grade handling script fragments).
runtime/mercury_tags.h:
Put MR_ prefixes in front of everything defined here.
runtime/mercury_stacks.h:
Put MR_ prefixes in front of everything defined here.
Remove support for MR_DEBUG_NONDET_STACK. Replace most of the
lost functionality by calling an updated mkframe_msg.
Remove the definitions of push() and pop(). Their use conflicts with
the idea that everything on the det stack is part of a frame, which
the RTTI stuff depends on.
runtime/mercury_bootstrap.h:
Add backward compability macros for the old names in the above two
files.
Remove some old entries in this file which are no longer needed.
runtime/mercury_wrapper.c:
Remove the only uses of push() and pop().
Put MR_ in front of some things that need them.
runtime/mercury_engine.c:
Put MR_ in front of some things that need them.
runtime/mercury_misc.[ch]:
Make mkframe_msg get the name of the procedure that owns the stack
frame from an explicitly passed argument, rather than the prednm slot
(which no longer exists). This actually improves low-level debugging
support without MR_DEBUG_NONDET_STACK.
Remove unnecessary return statements.
runtime/mercury_debug.h:
Pass on the new arg of mkframe_msg.
Fix long lines.
runtime/mercury_conf_param.h:
Remove the documentation of MR_DEBUG_NONDET_STACK.
runtime/mercury_grade.h:
Remove the grade component of MR_DEBUG_NONDET_STACK.
library/io.m:
library/std_util.m:
library/string.m:
Add prefixes to some references to the runtime.
Zoltan.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.106
diff -u -b -u -r1.106 llds_out.m
--- llds_out.m 1999/04/16 06:04:40 1.106
+++ llds_out.m 1999/04/16 08:47:30
@@ -1368,7 +1368,7 @@
(
{ FrameInfo = ordinary_frame(Msg, Num, MaybeStruct) },
( { MaybeStruct = yes(pragma_c_struct(StructName, _, _)) } ->
- io__write_string("\tmkpragmaframe("""),
+ io__write_string("\tMR_mkpragmaframe("""),
output_c_quoted_string(Msg),
io__write_string(""", "),
io__write_int(Num),
@@ -1378,7 +1378,7 @@
output_code_addr(FailCont),
io__write_string(");\n")
;
- io__write_string("\tmkframe("""),
+ io__write_string("\tMR_mkframe("""),
output_c_quoted_string(Msg),
io__write_string(""", "),
io__write_int(Num),
@@ -1390,12 +1390,12 @@
{ FrameInfo = temp_frame(Kind) },
(
{ Kind = det_stack_proc },
- io__write_string("\tmkdettempframe("),
+ io__write_string("\tMR_mkdettempframe("),
output_code_addr(FailCont),
io__write_string(");\n")
;
{ Kind = nondet_stack_proc },
- io__write_string("\tmktempframe("),
+ io__write_string("\tMR_mktempframe("),
output_code_addr(FailCont),
io__write_string(");\n")
)
@@ -1481,14 +1481,14 @@
io__write_string(");\n").
output_instruction(incr_sp(N, Msg), _) -->
- io__write_string("\tincr_sp_push_msg("),
+ io__write_string("\tMR_incr_sp_push_msg("),
io__write_int(N),
io__write_string(", """),
output_c_quoted_string(Msg),
io__write_string(""");\n").
output_instruction(decr_sp(N), _) -->
- io__write_string("\tdecr_sp_pop_msg("),
+ io__write_string("\tMR_decr_sp_pop_msg("),
io__write_int(N),
io__write_string(");\n").
@@ -1850,7 +1850,7 @@
;
[]
),
- io__write_string("temp"),
+ io__write_string("MR_temp"),
io__write_string(Type),
io__write_int(Next),
{ Next1 is Next + 1 },
@@ -2643,16 +2643,16 @@
output_goto(do_succeed(Last), _) -->
(
{ Last = no },
- io__write_string("succeed();\n")
+ io__write_string("MR_succeed();\n")
;
{ Last = yes },
- io__write_string("succeed_discard();\n")
+ io__write_string("MR_succeed_discard();\n")
).
output_goto(do_redo, _) -->
globals__io_lookup_bool_option(use_macro_for_redo_fail, UseMacro),
(
{ UseMacro = yes },
- io__write_string("redo();\n")
+ io__write_string("MR_redo();\n")
;
{ UseMacro = no },
io__write_string("GOTO(ENTRY(do_redo));\n")
@@ -2661,7 +2661,7 @@
globals__io_lookup_bool_option(use_macro_for_redo_fail, UseMacro),
(
{ UseMacro = yes },
- io__write_string("fail();\n")
+ io__write_string("MR_fail();\n")
;
{ UseMacro = no },
io__write_string("GOTO(ENTRY(do_fail));\n")
@@ -3075,7 +3075,7 @@
:- mode output_tag(in, di, uo) is det.
output_tag(Tag) -->
- io__write_string("mktag("),
+ io__write_string("MR_mktag("),
io__write_int(Tag),
io__write_string(")").
@@ -3287,23 +3287,23 @@
io__write_string(")")
).
output_rval(mkword(Tag, Exprn)) -->
- io__write_string("mkword("),
+ io__write_string("MR_mkword("),
output_tag(Tag),
io__write_string(", "),
output_rval_as_type(Exprn, data_ptr),
io__write_string(")").
output_rval(lval(Lval)) -->
% if a field is used as an rval, then we need to use
- % the const_field() macro, not the field() macro,
+ % the MR_const_field() macro, not the MR_field() macro,
% to avoid warnings about discarding const,
- % and similarly for mask_field.
+ % and similarly for MR_mask_field.
( { Lval = field(MaybeTag, Rval, FieldNum) } ->
( { MaybeTag = yes(Tag) } ->
- io__write_string("const_field("),
+ io__write_string("MR_const_field("),
output_tag(Tag),
io__write_string(", ")
;
- io__write_string("const_mask_field(")
+ io__write_string("MR_const_mask_field(")
),
output_rval(Rval),
io__write_string(", "),
@@ -3315,7 +3315,7 @@
output_rval(create(Tag, _Args, _Unique, CellNum, _Msg)) -->
% emit a reference to the static constant which we
% declared in output_rval_decls.
- io__write_string("mkword(mktag("),
+ io__write_string("MR_mkword(MR_mktag("),
io__write_int(Tag),
io__write_string("), "),
io__write_string("&mercury_const_"),
@@ -3336,7 +3336,7 @@
io__write_string(")")
;
{ MemRef = heap_ref(Rval, Tag, FieldNum) },
- io__write_string("(Word *) &field("),
+ io__write_string("(Word *) &MR_field("),
output_tag(Tag),
io__write_string(", "),
output_rval(Rval),
@@ -3349,17 +3349,17 @@
:- mode output_unary_op(in, di, uo) is det.
output_unary_op(mktag) -->
- io__write_string("mktag").
+ io__write_string("MR_mktag").
output_unary_op(tag) -->
- io__write_string("tag").
+ io__write_string("MR_tag").
output_unary_op(unmktag) -->
- io__write_string("unmktag").
+ io__write_string("MR_unmktag").
output_unary_op(mkbody) -->
- io__write_string("mkbody").
+ io__write_string("MR_mkbody").
output_unary_op(body) -->
- io__write_string("body").
+ io__write_string("MR_body").
output_unary_op(unmkbody) -->
- io__write_string("unmkbody").
+ io__write_string("MR_unmkbody").
output_unary_op(hash_string) -->
io__write_string("hash_string").
output_unary_op(bitwise_complement) -->
@@ -3475,42 +3475,42 @@
io__write_int(N),
io__write_string(")").
output_lval(succip) -->
- io__write_string("succip").
+ io__write_string("MR_succip").
output_lval(sp) -->
- io__write_string("sp").
+ io__write_string("MR_sp").
output_lval(hp) -->
- io__write_string("hp").
+ io__write_string("MR_hp").
output_lval(maxfr) -->
- io__write_string("maxfr").
+ io__write_string("MR_maxfr").
output_lval(curfr) -->
- io__write_string("curfr").
+ io__write_string("MR_curfr").
output_lval(succfr(Rval)) -->
- io__write_string("bt_succfr("),
+ io__write_string("MR_succfr_slot("),
output_rval(Rval),
io__write_string(")").
output_lval(prevfr(Rval)) -->
- io__write_string("bt_prevfr("),
+ io__write_string("MR_prevfr_slot("),
output_rval(Rval),
io__write_string(")").
output_lval(redofr(Rval)) -->
- io__write_string("bt_redofr("),
+ io__write_string("MR_redofr_slot("),
output_rval(Rval),
io__write_string(")").
output_lval(redoip(Rval)) -->
- io__write_string("bt_redoip("),
+ io__write_string("MR_redoip_slot("),
output_rval(Rval),
io__write_string(")").
output_lval(succip(Rval)) -->
- io__write_string("bt_succip("),
+ io__write_string("MR_succip_slot("),
output_rval(Rval),
io__write_string(")").
output_lval(field(MaybeTag, Rval, FieldNum)) -->
( { MaybeTag = yes(Tag) } ->
- io__write_string("field("),
+ io__write_string("MR_field("),
output_tag(Tag),
io__write_string(", ")
;
- io__write_string("mask_field(")
+ io__write_string("MR_mask_field(")
),
output_rval(Rval),
io__write_string(", "),
@@ -3521,11 +3521,11 @@
output_lval(temp(Type, Num)) -->
(
{ Type = r },
- io__write_string("tempr"),
+ io__write_string("MR_tempr"),
io__write_int(Num)
;
{ Type = f },
- io__write_string("tempf"),
+ io__write_string("MR_tempf"),
io__write_int(Num)
).
output_lval(mem_ref(Rval)) -->
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/exceptions
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.174
diff -u -b -u -r1.174 io.m
--- io.m 1999/03/10 23:24:33 1.174
+++ io.m 1999/03/26 05:12:52
@@ -3148,9 +3148,9 @@
[will_not_call_mercury, thread_safe], "
/* convert mercury_argv from a vector to a list */
{ int i = mercury_argc;
- Args = list_empty();
+ Args = MR_list_empty();
while (--i >= 0) {
- Args = list_cons((Word) mercury_argv[i], Args);
+ Args = MR_list_cons((Word) mercury_argv[i], Args);
}
}
update_io(IO0, IO);
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.144
diff -u -b -u -r1.144 std_util.m
--- std_util.m 1999/04/16 06:05:19 1.144
+++ std_util.m 1999/04/16 08:48:03
@@ -1539,8 +1539,8 @@
}
arg_type = ArgTypes;
- for (list_length = 0; !list_is_empty(arg_type); list_length++) {
- arg_type = list_tail(arg_type);
+ for (list_length = 0; !MR_list_is_empty(arg_type); list_length++) {
+ arg_type = MR_list_tail(arg_type);
}
if (list_length != arity) {
@@ -1880,10 +1880,10 @@
/* Type check list of arguments */
for (i = 0; i < arity; i++) {
- if (list_is_empty(arg_list)) {
+ if (MR_list_is_empty(arg_list)) {
return FALSE;
}
- list_arg_type_info = field(0, list_head(arg_list),
+ list_arg_type_info = field(0, MR_list_head(arg_list),
UNIV_OFFSET_FOR_TYPEINFO);
arg_type_info = (Word) MR_create_type_info(
@@ -1893,11 +1893,11 @@
if (comp != COMPARE_EQUAL) {
return FALSE;
}
- arg_list = list_tail(arg_list);
+ arg_list = MR_list_tail(arg_list);
}
/* List should now be empty */
- return list_is_empty(arg_list);
+ return MR_list_is_empty(arg_list);
}
/*
@@ -1917,9 +1917,9 @@
for (i = 0; i < arity; i++) {
field(mktag(0), term_vector, i) =
- field(mktag(0), list_head(arg_list),
+ field(mktag(0), MR_list_head(arg_list),
UNIV_OFFSET_FOR_DATA);
- arg_list = list_tail(arg_list);
+ arg_list = MR_list_tail(arg_list);
}
}
@@ -1972,8 +1972,8 @@
}
for (i = 0; i < arity; i++) {
field(mktag(0), type_info, i + extra_args) =
- list_head(arg_types_list);
- arg_types_list = list_tail(arg_types_list);
+ MR_list_head(arg_types_list);
+ arg_types_list = MR_list_tail(arg_types_list);
}
return (Word) type_info;
@@ -2022,7 +2022,7 @@
Word type_info_list, *functors;
restore_transient_registers();
- type_info_list = list_empty();
+ type_info_list = MR_list_empty();
while (--arity >= 0) {
Word argument;
@@ -2042,7 +2042,7 @@
restore_transient_registers();
/* Join the argument to the front of the list */
- type_info_list = list_cons(argument, type_info_list);
+ type_info_list = MR_list_cons(argument, type_info_list);
}
save_transient_registers();
@@ -2696,7 +2696,7 @@
Arity = info.arity;
/* Build argument list */
- Arguments = list_empty();
+ Arguments = MR_list_empty();
i = info.arity;
while (--i >= 0) {
@@ -2705,7 +2705,7 @@
incr_hp(Argument, 2);
/* Join the argument to the front of the list */
- Arguments = list_cons(Argument, Arguments);
+ Arguments = MR_list_cons(Argument, Arguments);
/* Fill in the arguments */
arg_pseudo_type_info = info.type_info_vector[i];
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.111
diff -u -b -u -r1.111 string.m
--- string.m 1999/03/25 04:59:01 1.111
+++ string.m 1999/03/26 05:14:04
@@ -598,10 +598,10 @@
size = sizeof(Word);
len = 1;
list_ptr = Chars;
- while (!list_is_empty(list_ptr)) {
+ while (!MR_list_is_empty(list_ptr)) {
size++;
len++;
- list_ptr = list_tail(list_ptr);
+ list_ptr = MR_list_tail(list_ptr);
}
/*
** allocate (length + 1) bytes of heap space for string
@@ -619,9 +619,9 @@
** in reverse order.
*/
list_ptr = Chars;
- while (!list_is_empty(list_ptr)) {
- Str[--len] = (char) list_head(list_ptr);
- list_ptr = list_tail(list_ptr);
+ while (!MR_list_is_empty(list_ptr)) {
+ Str[--len] = (char) MR_list_head(list_ptr);
+ list_ptr = MR_list_tail(list_ptr);
}
}").
@@ -1602,10 +1602,10 @@
:- pragma c_code(string__to_int_list(Str::in, IntList::out),
[will_not_call_mercury, thread_safe], "{
const char *p = Str + strlen(Str);
- IntList = list_empty();
+ IntList = MR_list_empty();
while (p > Str) {
p--;
- IntList = list_cons((UnsignedChar) *p, IntList);
+ IntList = MR_list_cons((UnsignedChar) *p, IntList);
}
}").
@@ -1621,9 +1621,9 @@
*/
size = sizeof(Word);
int_list_ptr = IntList;
- while (!list_is_empty(int_list_ptr)) {
+ while (! MR_list_is_empty(int_list_ptr)) {
size++;
- int_list_ptr = list_tail(int_list_ptr);
+ int_list_ptr = MR_list_tail(int_list_ptr);
}
/*
** allocate (length + 1) bytes of heap space for string
@@ -1636,9 +1636,9 @@
*/
size = 0;
int_list_ptr = IntList;
- while (!list_is_empty(int_list_ptr)) {
- Str[size++] = list_head(int_list_ptr);
- int_list_ptr = list_tail(int_list_ptr);
+ while (! MR_list_is_empty(int_list_ptr)) {
+ Str[size++] = MR_list_head(int_list_ptr);
+ int_list_ptr = MR_list_tail(int_list_ptr);
}
/*
** null terminate the string
cvs diff: Diffing profiler
cvs diff: Diffing runtime
Index: runtime/mercury_bootstrap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.5
diff -u -b -u -r1.5 mercury_bootstrap.h
--- mercury_bootstrap.h 1999/03/22 08:09:01 1.5
+++ mercury_bootstrap.h 1999/04/05 12:48:53
@@ -15,7 +15,7 @@
#ifndef MERCURY_BOOTSTRAP_H
#define MERCURY_BOOTSTRAP_H
-#define NONDET_FIXED_SIZE MR_NONDET_FIXED_SIZE
+#ifndef MERCURY_NO_BOOTSTRAP
#define succip MR_succip
#define hp MR_hp
@@ -23,7 +23,32 @@
#define curfr MR_curfr
#define maxfr MR_maxfr
+/* stuff from mercury_stacks.h */
+
#define detstackvar(n) MR_stackvar(n)
+
+#define incr_sp_push_msg(n, m) MR_incr_sp_push_msg((n), (m))
+#define decr_sp_pop_msg(n) MR_decr_sp_pop_msg(n)
+#define incr_sp(n) MR_incr_sp(n)
+#define decr_sp(n) MR_decr_sp(n)
+
+#define push(w) ( \
+ *MR_sp = (Word) (w), \
+ debugpush(*MR_sp, MR_sp), \
+ MR_sp = MR_sp + 1, \
+ detstack_overflow_check(), \
+ (void)0 \
+ )
+
+#define pop() ( \
+ MR_sp = MR_sp - 1, \
+ debugpop(*MR_sp, MR_sp), \
+ detstack_underflow_check(), \
+ /* return */ *MR_sp \
+ )
+
+#define NONDET_FIXED_SIZE MR_NONDET_FIXED_SIZE
+
#define framevar(n) MR_framevar((n) + 1)
#define bt_prevfr(fr) MR_prevfr_slot(fr)
@@ -34,24 +59,53 @@
#define bt_prednm(fr) MR_prednm_slot(fr)
#define bt_var(fr, n) MR_based_framevar(fr, (n) + 1)
-#define curprevfr bt_prevfr(MR_curfr)
-#define curredoip bt_redoip(MR_curfr)
-#define curredofr bt_redofr(MR_curfr)
-#define cursuccip bt_succip(MR_curfr)
-#define cursuccfr bt_succfr(MR_curfr)
-#define curprednm bt_prednm(MR_curfr)
+#define curprevfr MR_prevfr_slot(MR_curfr)
+#define curredoip MR_redoip_slot(MR_curfr)
+#define curredofr MR_redofr_slot(MR_curfr)
+#define cursuccip MR_succip_slot(MR_curfr)
+#define cursuccfr MR_succfr_slot(MR_curfr)
+#define curprednm MR_prednm_slot(MR_curfr)
+
+#define prednm_slot(fr) "unknown"
+#define MR_prednm_slot(fr) "unknown"
+
+#define mkframe(p, s, r) MR_mkframe((p), (s), (r))
+#define mkpragmaframe(p,s,n,r) MR_mkpragmaframe((p), (s), n, (r))
+#define mktempframe(r) MR_mktempframe(r)
+#define mkdettempframe(r) MR_mkdettempframe(r)
+#define succeed() MR_succeed()
+#define succeed_discard() MR_succeed_discard()
+#define fail() MR_fail()
+#define redo() MR_redo()
+
+/* stuff from mercury_tags.h */
+
+#define WORDBITS MR_WORDBITS
+
+#define mktag(t) MR_mktag(t)
+#define unmktag(w) MR_unmktag(w)
+#define tag(w) MR_tag(w)
+#define mkbody(i) MR_mkbody(i)
+#define unmkbody(w) MR_unmkbody(w)
+#define body(w, t) MR_body((w), (t))
+#define strip_tag(w) MR_strip_tag(w)
+
+#define mkword(t, p) MR_mkword((t), (p))
+#define field(t, p, i) MR_field((t), (p), (i))
+#define const_field(t, p, i) MR_const_field((t), (p), (i))
+#define mask_field(p, i) MR_mask_field((p), (i))
+#define const_mask_field(p, i) MR_const_mask_field((p), (i))
+
+#define list_is_empty(l) MR_list_is_empty(l)
+#define list_head(l) MR_list_head(l)
+#define list_tail(l) MR_list_tail(l)
+#define list_empty() MR_list_empty()
+#define list_cons(h, t) MR_list_cons((h), (t))
/*
-** This should be removed soon - the latest compiler does not generate it.
-*/
-#define modframe(redoip) \
- do { \
- curredoip = redoip; \
- } while (0)
-
-/*
** The code generated by Mercury 0.8 includes references to these macros.
*/
+
#define MR_OBTAIN_GLOBAL_C_LOCK() MR_OBTAIN_GLOBAL_LOCK("pragma c code")
#define MR_RELEASE_GLOBAL_C_LOCK() MR_RELEASE_GLOBAL_LOCK("pragma c code")
@@ -63,6 +117,7 @@
** will link. The stage 2 compiler will just generate type_ctor_*
** references anyway, so then these #defines are not needed.
*/
+
#define MR_INIT_BASE_TYPE_INFO MR_INIT_TYPE_CTOR_INFO
#define mercury_data_array__base_type_functors_array_1 \
@@ -152,5 +207,6 @@
#define mercury_data_private_builtin__base_type_info_type_info_1_struct \
mercury_data_private_builtin__type_ctor_info_type_info_1_struct
+#endif /* not MERCURY_NO_BOOTSTRAP */
#endif /* MERCURY_BOOTSTRAP_H */
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.18
diff -u -b -u -r1.18 mercury_conf_param.h
--- mercury_conf_param.h 1999/04/16 06:05:28 1.18
+++ mercury_conf_param.h 1999/04/16 08:48:09
@@ -120,11 +120,6 @@
** Causes the generated code to become bigger and less efficient.
** Slows down compilation.
**
-** MR_DEBUG_NONDET_STACK
-** Include a "name" field in the nondet stack frames.
-** (Since this affects binary compatibility,
-** this is a "compilation model" option which affects the grade.)
-**
** MR_DEBUG_AGC_SCHEDULING
** Display debugging information while scheduling accurate garbage
** collection.
Index: runtime/mercury_debug.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_debug.h,v
retrieving revision 1.6
diff -u -b -u -r1.6 mercury_debug.h
--- mercury_debug.h 1998/08/24 08:24:36 1.6
+++ mercury_debug.h 1999/03/26 02:46:01
@@ -45,7 +45,7 @@
#define debugpop(val, sp) ((void)0)
#define debugregs(msg) ((void)0)
#define debugframe(msg) ((void)0)
-#define debugmkframe() ((void)0)
+#define debugmkframe(predname) ((void)0)
#define debugsucceed() ((void)0)
#define debugsucceeddiscard() ((void)0)
#define debugfail() ((void)0)
@@ -75,13 +75,16 @@
(save_transient_registers(), incr_hp_debug_msg((val), (hp))))
#define debugincrsp(val, sp) \
- IF (MR_detstackdebug, (save_transient_registers(), incr_sp_msg((val), (sp))))
+ IF (MR_detstackdebug, \
+ (save_transient_registers(), incr_sp_msg((val), (sp))))
#define debugdecrsp(val, sp) \
- IF (MR_detstackdebug, (save_transient_registers(), decr_sp_msg((val), (sp))))
+ IF (MR_detstackdebug, \
+ (save_transient_registers(), decr_sp_msg((val), (sp))))
#define debugpush(val, sp) \
- IF (MR_detstackdebug, (save_transient_registers(), push_msg((val), (sp))))
+ IF (MR_detstackdebug, \
+ (save_transient_registers(), push_msg((val), (sp))))
#define debugpop(val, sp) \
IF (MR_detstackdebug, (save_transient_registers(), pop_msg(val, sp)))
@@ -89,8 +92,9 @@
#define debugregs(msg) \
IF (MR_progdebug, (save_transient_registers(), printregs(msg)))
-#define debugmkframe() \
- IF (MR_nondstackdebug, (save_transient_registers(), mkframe_msg()))
+#define debugmkframe(predname) \
+ IF (MR_nondstackdebug, \
+ (save_transient_registers(), mkframe_msg(predname)))
#define debugframe(msg) \
IF (MR_progdebug, (save_transient_registers(), printframe(msg)))
@@ -99,7 +103,8 @@
IF (MR_nondstackdebug, (save_transient_registers(), succeed_msg()))
#define debugsucceeddiscard() \
- IF (MR_nondstackdebug, (save_transient_registers(), succeeddiscard_msg()))
+ IF (MR_nondstackdebug, \
+ (save_transient_registers(), succeeddiscard_msg()))
#define debugfail() \
IF (MR_nondstackdebug, (save_transient_registers(), fail_msg()))
@@ -108,7 +113,8 @@
IF (MR_nondstackdebug, (save_transient_registers(), redo_msg()))
#define debugcall(proc, succ_cont) \
- IF (MR_calldebug, (save_transient_registers(), call_msg(proc, succ_cont)))
+ IF (MR_calldebug, \
+ (save_transient_registers(), call_msg(proc, succ_cont)))
#define debugtailcall(proc) \
IF (MR_calldebug, (save_transient_registers(), tailcall_msg(proc)))
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.15
diff -u -b -u -r1.15 mercury_engine.c
--- mercury_engine.c 1998/11/05 03:53:34 1.15
+++ mercury_engine.c 1999/03/26 03:35:23
@@ -539,16 +539,16 @@
BEGIN_CODE
Define_entry(do_redo);
- redo();
+ MR_redo();
Define_entry(do_fail);
- fail();
+ MR_fail();
Define_entry(do_succeed);
- succeed();
+ MR_succeed();
Define_entry(do_last_succeed);
- succeed_discard();
+ MR_succeed_discard();
Define_entry(do_not_reached);
printf("reached not_reached\n");
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.17
diff -u -b -u -r1.17 mercury_grade.h
--- mercury_grade.h 1999/03/29 06:15:07 1.17
+++ mercury_grade.h 1999/03/31 09:55:13
@@ -151,11 +151,7 @@
#define MR_GRADE_PART_9 MR_PASTE2(MR_GRADE_PART_8, _sa)
#endif
-#ifndef MR_DEBUG_NONDET_STACK
- #define MR_GRADE_PART_10 MR_GRADE_PART_9
-#else
- #define MR_GRADE_PART_10 MR_PASTE2(MR_GRADE_PART_9, _debugNDS)
-#endif
+#define MR_GRADE_PART_10 MR_GRADE_PART_9
#if defined(PIC_REG) && defined(USE_GCC_GLOBAL_REGISTERS) && defined(__i386__)
#define MR_GRADE_PART_11 MR_PASTE2(MR_GRADE_PART_10, _picreg)
Index: runtime/mercury_misc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_misc.c,v
retrieving revision 1.16
diff -u -b -u -r1.16 mercury_misc.c
--- mercury_misc.c 1999/03/26 04:44:00 1.16
+++ mercury_misc.c 1999/03/31 09:55:13
@@ -23,12 +23,11 @@
#ifdef MR_LOWLEVEL_DEBUG
void
-mkframe_msg(void)
+mkframe_msg(const char *predname)
{
restore_transient_registers();
- printf("\nnew choice point for procedure %s\n",
- MR_prednm_slot(MR_curfr));
+ printf("\nnew choice point %s for procedure %s\n", predname);
printf("new fr: "); printnondstack(MR_curfr);
printf("prev fr: "); printnondstack(MR_prevfr_slot(MR_curfr));
printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
@@ -38,8 +37,6 @@
if (MR_detaildebug) {
dumpnondstack();
}
-
- return;
}
void
@@ -47,7 +44,7 @@
{
restore_transient_registers();
- printf("\nsucceeding from procedure %s\n", MR_prednm_slot(MR_curfr));
+ printf("\nsucceeding from procedure\n");
printf("curr fr: "); printnondstack(MR_curfr);
printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
printf("succ ip: "); printlabel(MR_succip_slot(MR_curfr));
@@ -55,8 +52,6 @@
if (MR_detaildebug) {
printregs("registers at success");
}
-
- return;
}
void
@@ -64,7 +59,7 @@
{
restore_transient_registers();
- printf("\nsucceeding from procedure %s, discarding frame\n", MR_prednm_slot(MR_curfr));
+ printf("\nsucceeding from procedure\n");
printf("curr fr: "); printnondstack(MR_curfr);
printf("succ fr: "); printnondstack(MR_succfr_slot(MR_curfr));
printf("succ ip: "); printlabel(MR_succip_slot(MR_curfr));
@@ -72,8 +67,6 @@
if (MR_detaildebug) {
printregs("registers at success");
}
-
- return;
}
void
@@ -81,12 +74,10 @@
{
restore_transient_registers();
- printf("\nfailing from procedure %s\n", MR_prednm_slot(MR_curfr));
+ printf("\nfailing from procedure\n");
printf("curr fr: "); printnondstack(MR_curfr);
printf("fail fr: "); printnondstack(MR_prevfr_slot(MR_curfr));
printf("fail ip: "); printlabel(MR_redoip_slot(curprevfr_slot(MR_curfr)));
-
- return;
}
void
@@ -94,12 +85,10 @@
{
restore_transient_registers();
- printf("\nredo from procedure %s\n", MR_prednm_slot(MR_curfr));
+ printf("\nredo from procedure\n");
printf("curr fr: "); printnondstack(MR_curfr);
printf("redo fr: "); printnondstack(MR_maxfr);
printf("redo ip: "); printlabel(MR_redoip_slot(MR_maxfr));
-
- return;
}
void
@@ -108,8 +97,6 @@
printf("\ncalling "); printlabel(proc);
printf("continuation "); printlabel(succcont);
printregs("registers at call");
-
- return;
}
void
@@ -120,8 +107,6 @@
printf("\ntail calling "); printlabel(proc);
printf("continuation "); printlabel(MR_succip);
printregs("registers at tailcall");
-
- return;
}
void
@@ -129,8 +114,6 @@
{
printf("\nreturning from determinate procedure\n");
printregs("registers at proceed");
-
- return;
}
void
@@ -138,8 +121,6 @@
{
printf("put value %9lx at ", (long) (Integer) val0);
printheap(addr);
-
- return;
}
void
@@ -148,8 +129,6 @@
printf("put values %9lx,%9lx at ",
(long) (Integer) val0, (long) (Integer) val1);
printheap(addr);
-
- return;
}
void
@@ -161,7 +140,6 @@
printf("increment hp by %ld from ", (long) (Integer) val);
printheap(addr);
#endif
- return;
}
void
@@ -169,8 +147,6 @@
{
printf("increment sp by %ld from ", (long) (Integer) val);
printdetstack(addr);
-
- return;
}
void
@@ -178,8 +154,6 @@
{
printf("decrement sp by %ld from ", (long) (Integer) val);
printdetstack(addr);
-
- return;
}
void
@@ -187,8 +161,6 @@
{
printf("push value %9lx to ", (long) (Integer) val);
printdetstack(addr);
-
- return;
}
void
@@ -196,8 +168,6 @@
{
printf("pop value %9lx from ", (long) (Integer) val);
printdetstack(addr);
-
- return;
}
#endif /* defined(MR_LOWLEVEL_DEBUG) */
@@ -228,8 +198,6 @@
printf("%8lx ", (long) x);
}
printf("\n");
-
- return;
}
#endif /* defined(MR_DEBUG_GOTOS) */
@@ -244,16 +212,12 @@
printint(Word n)
{
printf("int %ld\n", (long) (Integer) n);
-
- return;
}
void
printstring(const char *s)
{
printf("string %p %s\n", (const void *) s, s);
-
- return;
}
void
@@ -267,7 +231,6 @@
printf("ptr %p\n",
(const void *) h);
#endif
- return;
}
void
@@ -278,9 +241,6 @@
printf("frame at ptr %p, offset %3ld words\n",
(const void *) fr,
(long) (Integer) (fr - MR_CONTEXT(nondetstack_zone)->min));
-#ifdef MR_DEBUG_NONDET_STACK
- printf("\t predname %s\n", MR_prednm_slot(fr));
-#endif
printf("\t succip "); printlabel(MR_succip_slot(fr));
printf("\t redoip "); printlabel(MR_redoip_slot(fr));
printf("\t succfr "); printnondstack(MR_succfr_slot(fr));
@@ -291,7 +251,6 @@
i, (long) (Integer) MR_based_framevar(fr,i),
(unsigned long) MR_based_framevar(fr,i));
}
- return;
}
void
@@ -304,7 +263,6 @@
fr = MR_prevfr_slot(fr)) {
dumpframe(fr);
}
- return;
}
void
@@ -314,7 +272,6 @@
dumpframe(MR_curfr);
print_ordinary_regs();
- return;
}
void
@@ -331,8 +288,6 @@
printf("%-9s", "sp:"); printdetstack(MR_sp);
print_ordinary_regs();
-
- return;
}
static void
@@ -362,7 +317,6 @@
MR_printdetstackptr(const Word *s)
{
MR_print_detstackptr(stdout, s);
- return;
}
void
@@ -371,7 +325,6 @@
fprintf(fp, "det %3ld (%p)",
(long) (Integer) (s - MR_CONTEXT(detstack_zone)->min),
(const void *) s);
- return;
}
void
@@ -380,14 +333,12 @@
printf("ptr %p, offset %3ld words\n",
(const void *) s,
(long) (Integer) (s - MR_CONTEXT(detstack_zone)->min));
- return;
}
void
MR_printnondstackptr(const Word *s)
{
MR_print_nondstackptr(stdout, s);
- return;
}
void
@@ -396,35 +347,14 @@
fprintf(fp, "non %3ld (%p)",
(long) (Integer) (s - MR_CONTEXT(nondetstack_zone)->min),
(const void *) s);
- return;
}
void
printnondstack(const Word *s)
{
-#ifndef MR_DEBUG_NONDET_STACK
printf("ptr %p, offset %3ld words\n",
(const void *) s,
(long) (Integer) (s - MR_CONTEXT(nondetstack_zone)->min));
-#else
- if (s > MR_CONTEXT(nondetstack_zone)->min) {
- printf("ptr %p, offset %3ld words, procedure %s\n",
- (const void *) s,
- (long) (Integer)
- (s - MR_CONTEXT(nondetstack_zone)->min),
- (const char *) s[PREDNM]);
- } else {
- /*
- ** This handles the case where the prevfr of the first frame
- ** is being printed.
- */
- printf("ptr %p, offset %3ld words\n",
- (const void *) s,
- (long) (Integer)
- (s - MR_CONTEXT(nondetstack_zone)->min));
- }
-#endif
- return;
}
void
Index: runtime/mercury_misc.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_misc.h,v
retrieving revision 1.14
diff -u -b -u -r1.14 mercury_misc.h
--- mercury_misc.h 1999/03/26 04:44:02 1.14
+++ mercury_misc.h 1999/03/31 09:55:13
@@ -20,7 +20,7 @@
#include <stdlib.h> /* for `size_t' */
#ifdef MR_LOWLEVEL_DEBUG
-extern void mkframe_msg(void);
+extern void mkframe_msg(const char *);
extern void succeed_msg(void);
extern void succeeddiscard_msg(void);
extern void fail_msg(void);
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.15
diff -u -b -u -r1.15 mercury_stacks.h
--- mercury_stacks.h 1998/12/16 20:38:15 1.15
+++ mercury_stacks.h 1999/03/26 05:44:29
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 1995-1998 The University of Melbourne.
+** Copyright (C) 1995-1999 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
@@ -20,7 +20,7 @@
#define MR_based_stackvar(base_sp, n) ((base_sp)[-(n)])
#define MR_stackvar(n) MR_based_stackvar(MR_sp, n)
-#define incr_sp_push_msg(n, msg) \
+#define MR_incr_sp_push_msg(n, msg) \
( \
debugincrsp(n, MR_sp), \
dump_push_msg(msg), \
@@ -29,7 +29,7 @@
(void)0 \
)
-#define decr_sp_pop_msg(n) \
+#define MR_decr_sp_pop_msg(n) \
( \
debugdecrsp(n, MR_sp), \
dump_pop_msg(), \
@@ -38,35 +38,20 @@
(void)0 \
)
-#define incr_sp(n) ( \
+#define MR_incr_sp(n) ( \
debugincrsp(n, MR_sp), \
MR_sp = MR_sp + (n), \
detstack_overflow_check(), \
(void)0 \
)
-#define decr_sp(n) ( \
+#define MR_decr_sp(n) ( \
debugdecrsp(n, MR_sp), \
MR_sp = MR_sp - (n), \
detstack_underflow_check(), \
(void)0 \
)
-#define push(w) ( \
- *MR_sp = (Word) (w), \
- debugpush(*MR_sp, MR_sp), \
- MR_sp = MR_sp + 1, \
- detstack_overflow_check(), \
- (void)0 \
- )
-
-#define pop() ( \
- MR_sp = MR_sp - 1, \
- debugpop(*MR_sp, MR_sp), \
- detstack_underflow_check(), \
- /* return */ *MR_sp \
- )
-
/* DEFINITIONS FOR NONDET STACK FRAMES */
#define MR_PREVFR (-0) /* prev frame on stack, set up at call */
@@ -76,23 +61,15 @@
#define MR_SUCCFR (-4) /* frame of caller proc, set up at call */
#define MR_DETFR (-3) /* sp, in model_det temp frames only */
-#ifdef MR_DEBUG_NONDET_STACK
- #define MR_PREDNM (-5) /* for debugging, set up at call */
- #define MR_prednm_slot(fr) LVALUE_CAST(const char *, \
- ((Word *) fr)[MR_PREDNM])
- #define MR_NONDET_FIXED_SIZE 6 /* units: words */
-#else
- #define MR_prednm_slot(fr) "unknown"
- #define MR_NONDET_FIXED_SIZE 5 /* units: words */
-#endif
-
/*
** Code that traverses the nondet stack depends on the relationship
** MR_NONDET_TEMP_SIZE < MR_DET_TEMP_SIZE < MR_NONDET_FIXED_SIZE.
+** All three sizes are measured in words.
*/
#define MR_NONDET_TEMP_SIZE 3 /* prevfr, redoip, redofr */
#define MR_DET_TEMP_SIZE 4 /* prevfr, redoip, redofr, detfr */
+#define MR_NONDET_FIXED_SIZE 5 /* prevfr, redoip, redofr, succip, succfr */
#define MR_SAVEVAL (-MR_NONDET_FIXED_SIZE)
/* saved values start at this offset */
@@ -108,14 +85,8 @@
#define MR_framevar(n) MR_based_framevar(MR_curfr, n)
/* DEFINITIONS FOR MANIPULATING THE NONDET STACK */
-
-#ifdef MR_DEBUG_NONDET_STACK
- #define mkframe_save_prednm(prednm) (MR_prednm_slot(MR_curfr) = prednm)
-#else
- #define mkframe_save_prednm(prednm) /* nothing */
-#endif
-#define mkframe(prednm, numslots, redoip) \
+#define MR_mkframe(predname, numslots, redoip) \
do { \
reg Word *prevfr; \
reg Word *succfr; \
@@ -129,8 +100,7 @@
MR_succip_slot(MR_curfr) = MR_succip; \
MR_succfr_slot(MR_curfr) = succfr; \
MR_redofr_slot(MR_curfr) = MR_curfr; \
- mkframe_save_prednm(prednm); \
- debugmkframe(); \
+ debugmkframe(predname); \
nondstack_overflow_check(); \
} while (0)
@@ -139,7 +109,7 @@
/* just like mkframe, but also reserves space for a struct */
/* with the given tag at the bottom of the nondet stack frame */
-#define mkpragmaframe(prednm, numslots, structname, redoip) \
+#define MR_mkpragmaframe(predname, numslots, structname, redoip) \
do { \
reg Word *prevfr; \
reg Word *succfr; \
@@ -154,12 +124,11 @@
MR_succip_slot(MR_curfr) = MR_succip; \
MR_succfr_slot(MR_curfr) = succfr; \
MR_redofr_slot(MR_curfr) = MR_curfr; \
- mkframe_save_prednm(prednm); \
- debugmkframe(); \
+ debugmkframe(predname); \
nondstack_overflow_check(); \
} while (0)
-#define mktempframe(redoip) \
+#define MR_mktempframe(redoip) \
do { \
reg Word *prevfr; \
reg Word *succfr; \
@@ -173,7 +142,7 @@
nondstack_overflow_check(); \
} while (0)
-#define mkdettempframe(redoip) \
+#define MR_mkdettempframe(redoip) \
do { \
reg Word *prevfr; \
reg Word *succfr; \
@@ -188,7 +157,7 @@
nondstack_overflow_check(); \
} while (0)
-#define succeed() do { \
+#define MR_succeed() do { \
reg Word *childfr; \
\
debugsucceed(); \
@@ -197,7 +166,7 @@
GOTO(MR_succip_slot(childfr)); \
} while (0)
-#define succeed_discard() \
+#define MR_succeed_discard() \
do { \
reg Word *childfr; \
\
@@ -209,7 +178,7 @@
} while (0)
-#define fail() do { \
+#define MR_fail() do { \
debugfail(); \
MR_maxfr = MR_prevfr_slot(MR_maxfr); \
nondstack_underflow_check(); \
@@ -218,7 +187,7 @@
} while (0)
-#define redo() do { \
+#define MR_redo() do { \
debugredo(); \
MR_curfr = MR_redofr_slot(MR_maxfr); \
GOTO(MR_redoip_slot(MR_maxfr)); \
Index: runtime/mercury_tags.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.4
diff -u -b -u -r1.4 mercury_tags.h
--- mercury_tags.h 1998/10/19 01:20:02 1.4
+++ mercury_tags.h 1999/03/26 03:31:49
@@ -18,7 +18,7 @@
/* DEFINITIONS FOR WORD LAYOUT */
-#define WORDBITS (CHAR_BIT * sizeof(Word))
+#define MR_WORDBITS (CHAR_BIT * sizeof(Word))
/* TAGBITS specifies the number of bits in each word that we can use for tags */
#ifndef TAGBITS
@@ -35,81 +35,76 @@
#ifdef HIGHTAGS
-#define mktag(t) ((Word)(t) << (WORDBITS - TAGBITS))
-#define unmktag(w) ((Word)(w) >> (WORDBITS - TAGBITS))
-#define tag(w) ((w) & ~(~(Word)0 >> TAGBITS))
-#define mkbody(i) (i)
-#define unmkbody(w) (w)
-#define body(w, t) ((w) & (~(Word)0 >> TAGBITS))
-#define strip_tag(w) ((w) & (~(Word)0 >> TAGBITS))
+#define MR_mktag(t) ((Word)(t) << (WORDBITS - TAGBITS))
+#define MR_unmktag(w) ((Word)(w) >> (WORDBITS - TAGBITS))
+#define MR_tag(w) ((w) & ~(~(Word)0 >> TAGBITS))
+#define MR_mkbody(i) (i)
+#define MR_unmkbody(w) (w)
+#define MR_body(w, t) ((w) & (~(Word)0 >> TAGBITS))
+#define MR_strip_tag(w) ((w) & (~(Word)0 >> TAGBITS))
#else /* ! HIGHTAGS */
-#define mktag(t) (t)
-#define unmktag(w) (w)
-#define tag(w) ((w) & ((1 << TAGBITS) - 1))
-#define mkbody(i) ((i) << TAGBITS)
-#define unmkbody(w) ((Word) (w) >> TAGBITS)
-#define body(w, t) ((w) - (t))
-#define strip_tag(w) ((w) & (~(Word)0 << TAGBITS))
+#define MR_mktag(t) (t)
+#define MR_unmktag(w) (w)
+#define MR_tag(w) ((w) & ((1 << TAGBITS) - 1))
+#define MR_mkbody(i) ((i) << TAGBITS)
+#define MR_unmkbody(w) ((Word) (w) >> TAGBITS)
+#define MR_body(w, t) ((w) - (t))
+#define MR_strip_tag(w) ((w) & (~(Word)0 << TAGBITS))
#endif /* ! HIGHTAGS */
/*
-** the result of mkword() is cast to (Word *), not to (Word)
-** because mkword() may be used in initializers for static constants
+** the result of MR_mkword() is cast to (Word *), not to (Word)
+** because MR_mkword() may be used in initializers for static constants
** and casts from pointers to integral types are not valid
** constant-expressions in ANSI C. It cannot be (const Word *) because
** some ANSI C compilers won't allow assignments where the RHS is of type
** const and the LHS is not declared const.
*/
-#define mkword(t, p) ((Word *)((char *)(p) + (t)))
-#define field(t, p, i) ((Word *) body((p), (t)))[i]
-#define const_field(t, p, i) ((const Word *) body((p), (t)))[i]
+#define MR_mkword(t, p) ((Word *)((char *)(p) + (t)))
-#define mask_field(p, i) ((Word *) strip_tag(p))[i]
-#define const_mask_field(p, i) ((const Word *) strip_tag(p))[i]
+#define MR_field(t, p, i) ((Word *) body((p), (t)))[i]
+#define MR_const_field(t, p, i) ((const Word *) body((p), (t)))[i]
+#define MR_mask_field(p, i) ((Word *) strip_tag(p))[i]
+#define MR_const_mask_field(p, i) ((const Word *) strip_tag(p))[i]
+
/*
-** the following list_* macros are used by handwritten C code
-** that needs to access Mercury lists.
+** the following MR_list_* macros are used by handwritten C code
+** that needs to access Mercury lists. The definitions of these macros
+** depend on the data representation scheme used by compiler/make_tags.m.
*/
+
+#define MR_RAW_TAG_NIL 0
+#define MR_RAW_TAG_CONS 1
-#define bTAG_NIL 0
-#define bTAG_CONS 1
-#define bTAG_VAR 3 /* for Prolog-style variables */
- /* ... but currently not used */
-
-#define TAG_NIL mktag(bTAG_NIL)
-#define TAG_CONS mktag(bTAG_CONS)
-#define TAG_VAR mktag(bTAG_VAR)
+#define MR_TAG_NIL MR_mktag(MR_RAW_TAG_NIL)
+#define MR_TAG_CONS MR_mktag(MR_RAW_TAG_CONS)
#if TAGBITS > 0
-#define list_is_empty(list) (tag(list) == TAG_NIL)
-#define list_head(list) field(TAG_CONS, (list), 0)
-#define list_tail(list) field(TAG_CONS, (list), 1)
-#define list_empty() ((Word) mkword(TAG_NIL, mkbody(0)))
-#define list_cons(head,tail) \
- ((Word) mkword(TAG_CONS, create2((head),(tail))))
+#define MR_list_is_empty(list) (MR_tag(list) == MR_TAG_NIL)
+#define MR_list_head(list) MR_field(MR_TAG_CONS, (list), 0)
+#define MR_list_tail(list) MR_field(MR_TAG_CONS, (list), 1)
+#define MR_list_empty() ((Word) MR_mkword(MR_TAG_NIL, MR_mkbody(0)))
+#define MR_list_cons(head,tail) ((Word) MR_mkword(MR_TAG_CONS, \
+ create2((head),(tail))))
#else
-#define list_is_empty(list) (field(mktag(0), (list), 0) == bTAG_NIL)
-#define list_head(list) field(mktag(0), (list), 1)
-#define list_tail(list) field(mktag(0), (list), 2)
-#define list_empty() ((Word) mkword(mktag(0), create1(bTAG_NIL)))
-#define list_cons(head,tail) \
- ((Word) mkword(mktag(0), create3(bTAG_CONS, (head), (tail))))
+#define MR_list_is_empty(list) (MR_field(MR_mktag(0), (list), 0) \
+ == MR_RAW_TAG_NIL)
+#define MR_list_head(list) MR_field(MR_mktag(0), (list), 1)
+#define MR_list_tail(list) MR_field(MR_mktag(0), (list), 2)
+#define MR_list_empty() ((Word) MR_mkword(MR_mktag(0), \
+ create1(MR_RAW_TAG_NIL)))
+#define MR_list_cons(head,tail) ((Word) MR_mkword(MR_mktag(0), \
+ create3(MR_RAW_TAG_CONS, \
+ (head), (tail))))
#endif
-
-/* for Prolog-style variables... currently not used */
-#define deref(pt) do { \
- while (tag(pt) == TAG_VAR) \
- (pt) = * (Word *) \
- body((pt), TAG_VAR); \
- } while(0)
#endif /* not MERCURY_TAGS_H */
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.34
diff -u -b -u -r1.34 mercury_wrapper.c
--- mercury_wrapper.c 1999/04/16 03:07:59 1.34
+++ mercury_wrapper.c 1999/04/16 08:48:15
@@ -921,19 +921,19 @@
switch (i) {
case SI_RN:
- printf("succip");
+ printf("MR_succip");
break;
case HP_RN:
- printf("hp");
+ printf("MR_hp");
break;
case SP_RN:
- printf("sp");
+ printf("MR_sp");
break;
case CF_RN:
- printf("curfr");
+ printf("MR_curfr");
break;
case MF_RN:
- printf("maxfr");
+ printf("MR_maxfr");
break;
case MR_TRAIL_PTR_RN:
printf("MR_trail_ptr");
@@ -977,11 +977,13 @@
BEGIN_CODE
Define_entry(do_interpreter);
- push(MR_hp);
- push(MR_succip);
- push(MR_maxfr);
- mkframe("interpreter", 1, LABEL(global_fail));
+ MR_incr_sp(3);
+ MR_stackvar(1) = MR_hp;
+ MR_stackvar(2) = MR_succip;
+ MR_stackvar(3) = MR_maxfr;
+ MR_mkframe("interpreter", 1, LABEL(global_fail));
+
MR_nondet_stack_trace_bottom = MR_maxfr;
MR_stack_trace_bottom = LABEL(global_success);
@@ -1027,9 +1029,10 @@
if (MR_profiling) MR_prof_turn_off_time_profiling();
#endif
- MR_maxfr = (Word *) pop();
- MR_succip = (Code *) pop();
- MR_hp = (Word *) pop();
+ MR_hp = MR_stackvar(1);
+ MR_succip = MR_stackvar(2);
+ MR_maxfr = MR_stackvar(3);
+ MR_decr_sp(3);
#ifdef MR_LOWLEVEL_DEBUG
if (MR_finaldebug && MR_detaildebug) {
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trial
cvs diff: Diffing util
More information about the developers
mailing list