[m-dev.] for review: Stack dumps -- the main course (round 2)

Tyson Dowd trd at stimpy.cs.mu.oz.au
Fri Mar 6 23:59:16 AEDT 1998


On 06-Mar-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 06-Mar-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > compiler/Mmakefile:
> > library/Mmakefile:
> > profiler/Mmakefile:
> > runtime/Mmakefile:
> > 	Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
> > 	becasue mgnuc stops processing its options when it
> > 	encounters a non-mgnuc option.
> 
> > runtime/mercury_stack_layout.h:
> > 	All the old stack layout definitions from mercury_accurate_gc.h.
> > 	Add code for MR_DETERMINSIM_IS_DET_CODE_MODEL.
> 
> another misspelling (should be DETERMINISM) ;-)

Actually, it should be:

runtime/mercury_stack_layout.h:
	All the old stack layout definitions from mercury_accurate_gc.h.
	Add code for MR_DETISM_DET_CODE_MODEL.

Zoltan had the right idea - use the easy to spell "detism" instead.

(I have no idea how you keep picking up these spelling mistakes ;-).

> 
> > +/*
> > +** You need to run initialization code for grades without static
> > +** code addresses, for profiling, and any time you need to insert
> > +** labels into the label table.
> > +*/
> > +#if defined(MR_STATIC_CODE_ADDRESSES) || defined(PROFILE_CALLS) \
> > +	|| defined(DEBUG_LABELS) || defined(MR_INSERT_LABELS)
> > +  #define MR_NEED_INITIALIZATION_CODE
> > +#endif
> 
> Shouldn't that be
> 
> 	#if !defined(MR_STATIC_CODE_ADDRESSES) || ...
> 	    ^
> 	    ^
> 
> ?

Yes.

> Otherwise that looks OK, although I want to double-check that you
> got all the #ifdefs right.

I'm farily confident, but I wouldn't be shocked if there are some small
problems.

Here are the relevant .h files -- this should be enought to check the
#defines.  Let me know if you want to see more.

Index: mercury_conf.h.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_conf.h.in,v
retrieving revision 1.3
diff -u -r1.3 mercury_conf.h.in
--- mercury_conf.h.in	1997/11/23 09:31:48	1.3
+++ mercury_conf.h.in	1998/03/06 12:43:09
@@ -7,7 +7,8 @@
 /*
 ** mercury_conf.h.in -
 **	Various configuration parameters, determined automatically by
-**	the auto-configuration script.
+**	the auto-configuration script.  Implications of configuration 
+**	parameters, and combinations of paramters.
 */
 
 /*
@@ -197,5 +198,50 @@
 ** (True for SunOS 4.x.)
 */
 #undef MR_CANNOT_GROK_ASM_TYPE_DIRECTIVE
+
+/*
+** Implications of configuration parameters.
+**
+** Meaning of parameters:
+**
+** MR_USE_STACK_LAYOUTS -- stack layouts are in use, generate stack
+**                         layout structures.
+** MR_INSERT_LABELS     -- labels need to be inserted into the label table. 
+**			   (this also means the initialization code needs
+**			   to be run).
+** MR_NEED_INITIALIZATION_CODE -- the module specific initialization code
+**				  is needed (doesn't actually run the code,
+**				  however).
+*/
+
+#if defined(MR_STACK_TRACE) || defined(NATIVE_GC)
+  #define MR_USE_STACK_LAYOUTS
+  #define MR_INSERT_LABELS
+#endif
+
+#if defined(SPEED) && !defined(DEBUG_GOTOS) 
+  #define MR_INSERT_LABELS
+#endif
+
+/*
+** Static code addresses are available unless using gcc non-local gotos,
+** without assembler labels.
+*/
+#if	(defined(USE_GCC_NONLOCAL_GOTOS) && !defined(USE_ASM_LABELS))
+	#undef MR_STATIC_CODE_ADDRESSES
+#else
+	#define MR_STATIC_CODE_ADDRESSES
+#endif
+
+/*
+** You need to run initialization code for grades without static
+** code addresses, for profiling, and any time you need to insert
+** labels into the label table.
+*/
+#if !defined(MR_STATIC_CODE_ADDRESSES) || defined(PROFILE_CALLS) \
+	|| defined(DEBUG_LABELS) || defined(MR_INSERT_LABELS)
+  #define MR_NEED_INITIALIZATION_CODE
+#endif
+
 
 #endif /* MERCURY_CONF_H */
Index: mercury_goto.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_goto.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_goto.h
--- mercury_goto.h	1998/01/06 07:05:59	1.5
+++ mercury_goto.h	1998/03/05 06:09:35
@@ -9,9 +9,9 @@
 #ifndef MERCURY_GOTO_H
 #define MERCURY_GOTO_H
 
+#include "mercury_conf.h"
 #include "mercury_types.h"	/* for `Code *' */
 #include "mercury_debug.h"	/* for debuggoto() */
-#include "mercury_accurate_gc.h"
 
 #define paste(a,b) a##b
 #define stringify(string) #string
@@ -19,10 +19,10 @@
 #define skip(label) paste(skip_,label)
 
 #ifdef MR_USE_STACK_LAYOUTS
- #define MR_STACK_LAYOUT(label)        (Word *) (Word) \
+  #define MR_STACK_LAYOUT(label)        (Word *) (Word) \
 	&(paste(mercury_data__stack_layout__,label))
 #else
- #define MR_STACK_LAYOUT(label) (Word *) NULL
+  #define MR_STACK_LAYOUT(label) (Word *) NULL
 #endif /* MR_USE_STACK_LAYOUTS */
 
 
@@ -34,24 +34,23 @@
 ** accurate garbage collection.
 */
 
-#if defined(SPEED) && !defined(DEBUG_GOTOS) && !defined(NATIVE_GC)
-#define	make_label(n, a, l)	/* nothing */
+#if !defined(MR_INSERT_LABELS)
+  #define	make_label(n, a, l)	/* nothing */
 #else
-#define	make_label(n, a, l)	make_entry(n, a, l)
+  #define	make_label(n, a, l)	make_entry(n, a, l)
 #endif
 
-#if defined(SPEED) && !defined(DEBUG_GOTOS) && !defined(PROFILE_CALLS) \
-			&& !defined(NATIVE_GC)
-#define make_local(n, a, l)	/* nothing */
+#if !defined(MR_INSERT_LABELS) && !defined(PROFILE_CALLS)
+  #define make_local(n, a, l)	/* nothing */
 #else 
-#define make_local(n, a, l)	make_entry(n, a, l)
+  #define make_local(n, a, l)	make_entry(n, a, l)
 #endif
 
-#if defined(SPEED) && !defined(DEBUG_LABELS) && !defined(DEBUG_GOTOS) \
-			&& !defined(PROFILE_CALLS) && !defined(NATIVE_GC)
-#define make_entry(n, a, l)	/* nothing */
+#if !defined(MR_INSERT_LABELS) && !defined(PROFILE_CALLS) \
+		&& !defined(DEBUG_LABELS)
+  #define make_entry(n, a, l)	/* nothing */
 #else
-#define make_entry(n, a, l)	insert_entry(n, a, MR_STACK_LAYOUT(l))
+  #define make_entry(n, a, l)	insert_entry(n, a, MR_STACK_LAYOUT(l))
 #endif
 
 
@@ -517,7 +516,7 @@
   #define init_local(label)	make_local(stringify(label), &&label, label)
   #define Define_label(label)	Define_local(label)
   #define Declare_label(label)	/* no declaration required */
-  #ifdef NATIVE_GC
+  #ifdef MR_INSERT_LABELS
    #define init_label(label)	\
 	make_label(stringify(label), &&entry(label), label)
   #else
Index: mercury_type_info.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_type_info.h
--- mercury_type_info.h	1998/01/23 12:12:05	1.4
+++ mercury_type_info.h	1998/03/05 06:22:27
@@ -326,17 +326,6 @@
 */
 
 /*
-** Static code addresses are available, unless using gcc non-local gotos,
-** without assembler labels.
-*/
-
-#if	(defined(USE_GCC_NONLOCAL_GOTOS) && !defined(USE_ASM_LABELS))
-	#undef MR_STATIC_CODE_ADDRESSES
-#else
-	#define MR_STATIC_CODE_ADDRESSES
-#endif
-
-/*
 ** Definitions for initialization of base_type_infos. If
 ** MR_STATIC_CODE_ADDRESSES are not available, we need to initialize
 ** the special predicates in the base_type_infos.
Index: mercury_grade.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_grade.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_grade.h
--- mercury_grade.h	1997/12/05 15:56:31	1.5
+++ mercury_grade.h	1998/03/06 12:43:25
@@ -31,11 +31,11 @@
 #define MR_PASTE2(p1,p2)	MR_PASTE2_2(p1,p2)
 #define MR_PASTE2_2(p1,p2)	p1##p2
 
-/* paste 9 macros together */
-#define MR_PASTE10(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
-				MR_PASTE10_2(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
-#define MR_PASTE10_2(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) \
-				p1##p2##p3##p4##p5##p6##p7##p8##p9##p10
+/* paste 11 macros together */
+#define MR_PASTE11(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) \
+				MR_PASTE11_2(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11)
+#define MR_PASTE11_2(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11) \
+				p1##p2##p3##p4##p5##p6##p7##p8##p9##p10##p11
 
 /*
 ** Here we build up the MR_GRADE macro part at a time,
@@ -151,7 +151,19 @@
   #define MR_GRADE_PART_10
 #endif
 
-#define MR_GRADE		MR_PASTE10(			\
+/*
+** Stack traces aren't strictly binary incompatible - but if you
+** try to do a stack trace you might find it doesn't work very
+** well unless all modules are compiled in with --stack-trace.
+** Hence we consider it effectively binary incompatible.
+*/
+#if defined(MR_STACK_TRACE)
+  #define MR_GRADE_PART_11	_strce
+#else
+  #define MR_GRADE_PART_11
+#endif
+
+#define MR_GRADE		MR_PASTE11(			\
 					MR_GRADE_PART_1,	\
 					MR_GRADE_PART_2,	\
 					MR_GRADE_PART_3,	\
@@ -161,7 +173,8 @@
 					MR_GRADE_PART_7,	\
 					MR_GRADE_PART_8,	\
 					MR_GRADE_PART_9,	\
-					MR_GRADE_PART_10	\
+					MR_GRADE_PART_10,	\
+					MR_GRADE_PART_11	\
 				)
 
 #define MR_GRADE_VAR		MR_PASTE2(MR_grade_,MR_GRADE)





More information about the developers mailing list