[m-rev.] diff: more shorthand macros in runtime

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Apr 7 08:29:15 AEST 2004


Add macros that allow the compiler to generate smaller .c files, especially
but not exclusively with debugging enabled.

runtime/mercury_calls.h:
	Add a noprof_ equivalent of the only call macro that didn't already
	have one.

runtime/mercury_goto.h:
	Add macros that declare labels without mercury__ prefixes in their
	arguments, and macros that declare more than one label at a time.

	Likewise add macros for use in the construction of lists of label
	layout structures that do not need mercury__ prefixes and can expand
	to the addresses of more than one layout structure.

runtime/mercury_heap.h:
runtime/mercury_tags.h:
	Add variants of existing macros that provide MR_mktag() wrappers
	around tags, so they don't have to appear in the macro invocation.

runtime/mercury_stacks.h:
	Allow stackvars and framevars to be referred to by shorter names.

	Simplify the implementation and clarify the documentation of some
	existing macros.

runtime/mercury_stack_layout.h:
	Add macros that declare layout structures without mercury__
	prefixes in their arguments, and macros that declare more than one
	layout structure at a time.

Zoltan.

cvs diff: Diffing .
Index: mercury_calls.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_calls.h,v
retrieving revision 1.9
diff -u -b -r1.9 mercury_calls.h
--- mercury_calls.h	23 Nov 2000 02:00:23 -0000	1.9
+++ mercury_calls.h	6 Apr 2004 07:43:50 -0000
@@ -26,7 +26,7 @@
 ** if we're using gcc non-local gotos to jump between functions then
 ** we need to do ASM_FIXUP_REGS after each return from a procedure call.
 ** However, if we're using asm labels, then this is done in the
-** Define_label(), Define_static(), and Define_Entry() macros,
+** MR_define_label(), MR_define_static(), and MR_define_Entry() macros,
 ** so there's no need to do it here.
 ** Also if we're using native gc, then the fixup_gp label below
 ** would stuff up the succip values, so we can't do it.
@@ -100,6 +100,12 @@
 			MR_debugtailcall(MR_LABEL(label));	\
 			MR_PROFILE(MR_LABEL(label), (current_label)); \
 			MR_set_prof_current_proc(MR_LABEL(label)); \
+			MR_GOTO_LABEL(label);			\
+		} while (0)
+
+#define	MR_noprof_localtailcall(label)				\
+		do {						\
+			MR_debugtailcall(MR_LABEL(label));	\
 			MR_GOTO_LABEL(label);			\
 		} while (0)
 
Index: mercury_goto.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.39
diff -u -b -r1.39 mercury_goto.h
--- mercury_goto.h	1 Apr 2004 04:51:05 -0000	1.39
+++ mercury_goto.h	6 Apr 2004 16:50:12 -0000
@@ -90,6 +90,72 @@
 #define MR_LABEL_LAYOUT(label) 						\
 	((const MR_Label_Layout *) (MR_Word) &MR_LABEL_LAYOUT_NAME(label))
 
+#define MR_PROC_LAYOUT1(label)						\
+	MR_PROC_LAYOUT(MR_add_prefix(label)),
+
+#define MR_LABEL_LAYOUT1(e, ln1)					\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),
+
+#define MR_LABEL_LAYOUT2(e, ln1, ln2)					\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),
+
+#define MR_LABEL_LAYOUT3(e, ln1, ln2, ln3)				\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),
+
+#define MR_LABEL_LAYOUT4(e, ln1, ln2, ln3, ln4)				\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),
+
+#define MR_LABEL_LAYOUT5(e, ln1, ln2, ln3, ln4, ln5)			\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln5)),
+
+#define MR_LABEL_LAYOUT6(e, ln1, ln2, ln3, ln4, ln5, ln6)		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln5)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln6)),
+
+#define MR_LABEL_LAYOUT7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln5)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln6)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln7)),
+
+#define MR_LABEL_LAYOUT8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)	\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln5)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln6)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln7)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln8)),
+
+#define MR_LABEL_LAYOUT9(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8, ln9) \
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln1)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln2)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln3)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln4)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln5)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln6)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln7)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln8)),		\
+	MR_LABEL_LAYOUT(MR_label_name(MR_add_prefix(e), ln9)),
+
 /*
 ** Passing the name of a label to MR_insert_{internal,entry}_label
 ** causes that name to be included in the executable as static readonly data.
@@ -946,6 +1012,256 @@
 	MR_init_uci_local_select(mod, name, type, arity, mode, num, 1, 1, 0)
 #define	MR_init_uci_local_sl(mod, name, type, arity, mode, num)		\
 	MR_init_uci_local_select(mod, name, type, arity, mode, num, 0, 0, 1)
+
+#define	MR_def_extern_entry(e)						\
+	MR_define_extern_entry(MR_add_prefix(e));
+
+#define	MR_def_entry(e)							\
+	MR_define_entry(MR_add_prefix(e));
+
+#define	MR_def_static(e)						\
+	MR_define_static(MR_add_prefix(e));
+
+#define	MR_def_local(e)							\
+	MR_define_local(MR_add_prefix(e));
+
+#define	MR_def_label(e, ln)						\
+	MR_define_label(MR_label_name(MR_add_prefix(e), ln));
+
+#define	MR_init_entry1(e)						\
+	MR_init_entry(MR_add_prefix(e));
+
+#define	MR_init_entry1_sl(e)						\
+	MR_init_entry_sl(MR_add_prefix(e));
+
+#define	MR_init_local1(e)						\
+	MR_init_local(MR_add_prefix(e));
+
+#define	MR_init_local1_sl(e)						\
+	MR_init_local_sl(MR_add_prefix(e));
+
+#define	MR_init_label1(e, ln1)						\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));
+
+#define	MR_init_label2(e, ln1, ln2)					\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));
+
+#define	MR_init_label3(e, ln1, ln2, ln3)				\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));
+
+#define	MR_init_label4(e, ln1, ln2, ln3, ln4)				\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln4));
+
+#define	MR_init_label5(e, ln1, ln2, ln3, ln4, ln5)			\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln5));
+
+#define	MR_init_label6(e, ln1, ln2, ln3, ln4, ln5, ln6)			\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln6));
+
+#define	MR_init_label7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln7));
+
+#define	MR_init_label8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)	\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln7));		\
+	MR_init_label(MR_label_name(MR_add_prefix(e), ln8));
+
+#define	MR_init_label1_sl(e)						\
+	MR_init_label_sl(MR_add_prefix(e));
+
+#define	MR_init_label_sl1(e, ln1)					\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));
+
+#define	MR_init_label_sl2(e, ln1, ln2)					\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));
+
+#define	MR_init_label_sl3(e, ln1, ln2, ln3)				\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));
+
+#define	MR_init_label_sl4(e, ln1, ln2, ln3, ln4)				\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));
+
+#define	MR_init_label_sl5(e, ln1, ln2, ln3, ln4, ln5)			\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));
+
+#define	MR_init_label_sl6(e, ln1, ln2, ln3, ln4, ln5, ln6)			\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));
+
+#define	MR_init_label_sl7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln7));
+
+#define	MR_init_label_sl8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)	\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln7));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln8));
+
+#define	MR_init_label_sl1(e, ln1)					\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));
+
+#define	MR_init_label_sl2(e, ln1, ln2)					\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));
+
+#define	MR_init_label_sl3(e, ln1, ln2, ln3)				\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));
+
+#define	MR_init_label_sl4(e, ln1, ln2, ln3, ln4)			\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));
+
+#define	MR_init_label_sl5(e, ln1, ln2, ln3, ln4, ln5)			\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));
+
+#define	MR_init_label_sl6(e, ln1, ln2, ln3, ln4, ln5, ln6)		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));
+
+#define	MR_init_label_sl7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln7));
+
+#define	MR_init_label_sl8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)	\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln7));		\
+	MR_init_label_sl(MR_label_name(MR_add_prefix(e), ln8));
+
+#define	MR_decl_extern_entry(e)						\
+	MR_declare_extern_entry(MR_add_prefix(e));
+
+#define	MR_decl_entry(e)						\
+	MR_declare_entry(MR_add_prefix(e));
+
+#define	MR_decl_static(e)						\
+	MR_declare_static(MR_add_prefix(e));
+
+#define	MR_decl_local(e)						\
+	MR_declare_local(MR_add_prefix(e));
+
+#define	MR_decl_label1(e, ln1)						\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));
+
+#define	MR_decl_label2(e, ln1, ln2)					\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));
+
+#define	MR_decl_label3(e, ln1, ln2, ln3)				\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));
+
+#define	MR_decl_label4(e, ln1, ln2, ln3, ln4)				\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln4));
+
+#define	MR_decl_label5(e, ln1, ln2, ln3, ln4, ln5)			\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln5));
+
+#define	MR_decl_label6(e, ln1, ln2, ln3, ln4, ln5, ln6)			\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln6));
+
+#define	MR_decl_label7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln7));
+
+#define	MR_decl_label8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)	\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln1));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln2));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln3));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln4));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln5));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln6));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln7));		\
+	MR_declare_label(MR_label_name(MR_add_prefix(e), ln8));
 
 /* definitions for computed gotos */
 
Index: mercury_heap.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_heap.h,v
retrieving revision 1.30
diff -u -b -r1.30 mercury_heap.h
--- mercury_heap.h	12 Nov 2003 10:52:22 -0000	1.30
+++ mercury_heap.h	6 Apr 2004 11:55:18 -0000
@@ -283,6 +283,11 @@
 			(dest) = (typename *) tmp;			\
 		} while (0)
 
+#define	MR_alloc_heap(dest, count)					\
+	MR_tag_offset_incr_hp((dest), MR_mktag(0), 0, (count))
+#define	MR_tag_alloc_heap(dest, tag, count)				\
+	MR_tag_offset_incr_hp((dest), MR_mktag(tag), 0, (count))
+
 #ifdef MR_HIGHLEVEL_CODE
 
 /*
Index: mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.76
diff -u -b -r1.76 mercury_stack_layout.h
--- mercury_stack_layout.h	1 Apr 2004 04:51:06 -0000	1.76
+++ mercury_stack_layout.h	6 Apr 2004 09:38:08 -0000
@@ -422,7 +422,7 @@
 ** the others are the fields of MR_Label_Layouts.
 */
 
-#define	MR_DEF_LL(e, ln, port, h, path, vc, lt, vn, tv)			\
+#define	MR_DEF_LL_GEN(e, ln, port, h, path, vc, lt, vn, tv)		\
 	static const MR_Label_Layout 					\
 		MR_LABEL_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)) \
 	= {								\
@@ -434,7 +434,7 @@
 		((const MR_Type_Param_Locns *) tv)			\
 	}
 
-#define	MR_DEF_LLNVI(e, ln, port, h, path)				\
+#define	MR_DEF_LLNVI_GEN(e, ln, port, h, path)				\
 	static const MR_Label_Layout_No_Var_Info			\
 		MR_LABEL_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)) \
 	= {								\
@@ -443,6 +443,40 @@
 		(h), (path), -1						\
 	}
 
+#define	MR_DEF_LL(e, ln, port, path, vc, lt, vn, tv)			\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, path, vc, lt, vn, tv)
+
+#define	MR_DEF_LLT(e, ln, port, path, vc, lt, vn, tv)			\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, path, vc, lt, vn, tv)
+
+#define	MR_DEF_LLCCC(e, ln, port, path, vc, lt, vn, tv)		\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, path, vc,			\
+		&MR_PASTE2(mercury_common_, lt),			\
+		&MR_PASTE2(mercury_common_, vn),			\
+		&MR_PASTE2(mercury_common_, tv))
+
+#define	MR_DEF_LLCC0(e, ln, port, path, vc, lt, vn)			\
+	MR_DEF_LL_GEN(e, ln, port, MR_FALSE, path, vc,			\
+		&MR_PASTE2(mercury_common_, lt),			\
+		&MR_PASTE2(mercury_common_, vn), 0)			\
+
+#define	MR_DEF_LLTCCC(e, ln, port, path, vc, lt, vn, tv)		\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, path, vc,			\
+		&MR_PASTE2(mercury_common_, lt),			\
+		&MR_PASTE2(mercury_common_, vn),			\
+		&MR_PASTE2(mercury_common_, tv))
+
+#define	MR_DEF_LLTCC0(e, ln, port, path, vc, lt, vn)			\
+	MR_DEF_LL_GEN(e, ln, port, MR_TRUE, path, vc,			\
+		&MR_PASTE2(mercury_common_, lt),			\
+		&MR_PASTE2(mercury_common_, vn), 0)
+
+#define	MR_DEF_LLNVI(e, ln, port, path)					\
+	MR_DEF_LLNVI_GEN(e, ln, port, MR_FALSE, path)
+
+#define	MR_DEF_LLNVIT(e, ln, port, path)				\
+	MR_DEF_LLNVI_GEN(e, ln, port, MR_TRUE, path)
+
 #define MR_DECL_LL(e, ln)						\
 	MR_declare_label(MR_label_name(MR_add_prefix(e), ln));		\
 	static const MR_Label_Layout 					\
@@ -452,6 +486,81 @@
 	MR_declare_label(MR_label_name(MR_add_prefix(e), ln));		\
 	static const MR_Label_Layout_No_Var_Info			\
 		MR_LABEL_LAYOUT_NAME(MR_label_name(MR_add_prefix(e), ln)); \
+
+#define MR_DECL_LL1(e, ln1)						\
+	MR_DECL_LL(e, ln1)
+
+#define MR_DECL_LL2(e, ln1, ln2)					\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)
+
+#define MR_DECL_LL3(e, ln1, ln2, ln3)					\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)
+
+#define MR_DECL_LL4(e, ln1, ln2, ln3, ln4)				\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)
+
+#define MR_DECL_LL5(e, ln1, ln2, ln3, ln4, ln5)				\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)
+
+#define MR_DECL_LL6(e, ln1, ln2, ln3, ln4, ln5, ln6)			\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)						\
+	MR_DECL_LL(e, ln6)
+
+#define MR_DECL_LL7(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7)		\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)						\
+	MR_DECL_LL(e, ln6)						\
+	MR_DECL_LL(e, ln7)
+
+#define MR_DECL_LL8(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8)		\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)						\
+	MR_DECL_LL(e, ln6)						\
+	MR_DECL_LL(e, ln7)						\
+	MR_DECL_LL(e, ln8)
+
+#define MR_DECL_LL9(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8, ln9)	\
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)						\
+	MR_DECL_LL(e, ln6)						\
+	MR_DECL_LL(e, ln7)						\
+	MR_DECL_LL(e, ln8)						\
+	MR_DECL_LL(e, ln9)
+
+#define MR_DECL_LL10(e, ln1, ln2, ln3, ln4, ln5, ln6, ln7, ln8, ln9, ln10) \
+	MR_DECL_LL(e, ln1)						\
+	MR_DECL_LL(e, ln2)						\
+	MR_DECL_LL(e, ln3)						\
+	MR_DECL_LL(e, ln4)						\
+	MR_DECL_LL(e, ln5)						\
+	MR_DECL_LL(e, ln6)						\
+	MR_DECL_LL(e, ln7)						\
+	MR_DECL_LL(e, ln8)						\
+	MR_DECL_LL(e, ln9)						\
+	MR_DECL_LL(e, ln10)
 
 /*-------------------------------------------------------------------------*/
 /*
Index: mercury_stacks.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.43
diff -u -b -r1.43 mercury_stacks.h
--- mercury_stacks.h	20 Mar 2004 05:51:27 -0000	1.43
+++ mercury_stacks.h	6 Apr 2004 12:26:18 -0000
@@ -86,23 +86,7 @@
 
 #define	MR_based_stackvar(base_sp, n)	((base_sp)[1 - (n)])
 #define	MR_stackvar(n)			MR_based_stackvar(MR_sp, (n))
-
-#define	MR_incr_sp_push_msg(n, msg)				\
-			(					\
-				MR_debugincrsp(n, MR_sp),	\
-				MR_sp = MR_sp + (n),		\
-				MR_detstack_overflow_check(),	\
-				MR_collect_det_frame_stats(n),	\
-				(void) 0			\
-			)
-
-#define	MR_decr_sp_pop_msg(n)					\
-			(					\
-				MR_debugdecrsp(n, MR_sp),	\
-				MR_sp = MR_sp - (n),		\
-				MR_detstack_underflow_check(),	\
-				(void) 0			\
-			)
+#define	MR_sv(n)			MR_stackvar(n)
 
 #define	MR_incr_sp(n)	(					\
 				MR_debugincrsp(n, MR_sp),	\
@@ -119,6 +103,16 @@
 				(void) 0			\
 			)
 
+/*
+** The msg argument of MR_incr_sp_push_msg is not used at runtime. It is
+** intended for use by tools/frame_sizes, which scans compiler-generated C
+** source files.
+*/
+
+#define	MR_incr_sp_push_msg(n, msg)	MR_incr_sp(n)
+
+#define	MR_decr_sp_pop_msg(n)		MR_decr_sp(n)
+
 /*---------------------------------------------------------------------------*/
 
 /* DEFINITIONS FOR NONDET STACK FRAMES */
@@ -177,6 +171,7 @@
 #define	MR_based_framevar(fr, n) (((MR_Word *) (fr))[MR_SAVEVAL + 1 - (n)])
 
 #define	MR_framevar(n)		MR_based_framevar(MR_curfr, n)
+#define	MR_fv(n)		MR_framevar(n)
 
 /*---------------------------------------------------------------------------*/
 
Index: mercury_tags.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_tags.h,v
retrieving revision 1.19
diff -u -b -r1.19 mercury_tags.h
--- mercury_tags.h	12 Feb 2004 06:54:56 -0000	1.19
+++ mercury_tags.h	6 Apr 2004 11:55:18 -0000
@@ -60,7 +60,7 @@
 #endif /* ! MR_HIGHTAGS */
 
 /*
-** the result of MR_mkword() is cast to (MR_Word *), not to (MR_Word)
+** The result of MR_mkword() is cast to (MR_Word *), not to (MR_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 MR_Word *) because
@@ -69,10 +69,15 @@
 */
 
 #define	MR_mkword(t, p)			((MR_Word *)((char *)(p) + (t)))
+#define	MR_tmkword(t, p)		(MR_mkword(MR_mktag(t), p))
+#define	MR_tbmkword(t, p)		(MR_mkword(MR_mktag(t), MR_mkbody(p)))
 
 #define	MR_field(t, p, i)		((MR_Word *) MR_body((p), (t)))[i]
 #define	MR_const_field(t, p, i)		((const MR_Word *) MR_body((p), (t)))[i]
 
+#define	MR_tfield(t, p, i)		(MR_field(MR_mktag(t), p, i))
+#define	MR_const_tfield(t, p, i)	(MR_const_field(MR_mktag(t), p, i))
+
 #define	MR_mask_field(p, i)		((MR_Word *) MR_strip_tag(p))[i]
 #define	MR_const_mask_field(p, i)	((const MR_Word *) MR_strip_tag(p))[i]
 
@@ -86,8 +91,11 @@
 #define	MR_hl_mask_field(p, i)		((MR_Box *) MR_strip_tag(p))[i]
 #define	MR_hl_const_mask_field(p, i)	((const MR_Box *) MR_strip_tag(p))[i]
 
+#define	MR_hl_tfield(t, p, i)		(MR_hl_field(MR_mktag(t), p, i))
+#define	MR_hl_const_tfield(t, p, i)	(MR_hl_const_field(MR_mktag(t), p, i))
+
 /*
-** the following macros are used by handwritten C code that needs to access 
+** The following macros are used by handwritten C code that needs to access 
 ** Mercury data structures. The definitions of these macros depend on the data 
 ** representation scheme used by compiler/make_tags.m.
 */
cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps
--------------------------------------------------------------------------
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