[m-rev.] diff: more cleanups in runtime

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Jun 21 13:12:52 AEST 2005


runtime/mercury_accurate_gc.h:
runtime/mercury_agc_debug.h:
runtime/mercury_array_macros.h:
runtime/mercury_construct.h:
runtime/mercury_deconstruct.h:
runtime/mercury_init.h:
runtime/mercury_layout_util.h:
runtime/mercury_stack_layout.h:
runtime/mercury_stack_trace.h:
runtime/mercury_trail.h:
	Fix some layout issues in these files. There are no algorithmic
	changes.

cvs diff: Diffing .
Index: mercury_accurate_gc.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_accurate_gc.h,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_accurate_gc.h
--- mercury_accurate_gc.h	7 Jun 2002 00:49:00 -0000	1.14
+++ mercury_accurate_gc.h	20 Jun 2005 02:20:10 -0000
@@ -47,7 +47,7 @@
 struct	MR_RootNode {
 	MR_Word *root;
 	MR_TypeInfo type_info;
-	struct MR_RootNode* next;
+	struct MR_RootNode	* next;
 };
 
 typedef	struct MR_RootNode	*MR_RootList;
Index: mercury_agc_debug.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_agc_debug.h,v
retrieving revision 1.6
diff -u -b -r1.6 mercury_agc_debug.h
--- mercury_agc_debug.h	4 Dec 2000 18:35:05 -0000	1.6
+++ mercury_agc_debug.h	20 Jun 2005 02:20:10 -0000
@@ -41,6 +41,7 @@
 ** 	label is the topmost label on the stack, heap_zone is the zone
 ** 	which the data is stored upon. 
 */
+
 extern	void	MR_agc_dump_nondet_stack_frames(MR_Internal *label,
 			MR_MemoryZone *heap_zone, MR_Word *stack_pointer,
 			MR_Word *current_frame, MR_Word *max_frame);
@@ -49,6 +50,7 @@
 ** MR_agc_dump_roots:
 ** 	Dump the extra rootset, writing all information about each root.
 */
+
 extern	void	MR_agc_dump_roots(MR_RootList roots);
 
 /*---------------------------------------------------------------------------*/
Index: mercury_array_macros.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_array_macros.h,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_array_macros.h
--- mercury_array_macros.h	12 Feb 2004 01:35:16 -0000	1.13
+++ mercury_array_macros.h	20 Jun 2005 02:20:10 -0000
@@ -1,4 +1,7 @@
 /*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
 ** Copyright (C) 1998-2000,2002, 2004 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.
@@ -59,8 +62,7 @@
 				base##s = MR_NEW_ARRAY(type, base##_max);   \
 			} else {					    \
 				base##_max *= 2;			    \
-				base##s = MR_RESIZE_ARRAY(base##s, type,    \
-						base##_max);		    \
+                base##s = MR_RESIZE_ARRAY(base##s, type, base##_max);   \
 			}						    \
 		}							    \
 	} while(0)
@@ -72,8 +74,7 @@
 				base##s = MR_GC_NEW_ARRAY(type, base##_max); \
 			} else {					    \
 				base##_max *= 2;			    \
-				base##s = MR_GC_RESIZE_ARRAY(base##s, type, \
-						base##_max);		    \
+                base##s = MR_GC_RESIZE_ARRAY(base##s, type, base##_max);\
 			}						    \
 		}							    \
 	} while(0)
@@ -97,10 +98,8 @@
 				base##_max = MR_max((init), (slot) + 1);    \
 				base##s = MR_NEW_ARRAY(type, base##_max);   \
 			} else {					    \
-				base##_max = MR_max(base##_max * 2,         \
-						(slot) + 1);                \
-				base##s = MR_RESIZE_ARRAY(base##s, type,    \
-						base##_max);		    \
+                base##_max = MR_max(base##_max * 2, (slot) + 1);        \
+                base##s = MR_RESIZE_ARRAY(base##s, type, base##_max);   \
 			}						    \
 		}							    \
 	} while(0)
@@ -123,12 +122,9 @@
 				base##s1 = MR_NEW_ARRAY(type, base##_max);    \
 				base##s2 = MR_NEW_ARRAY(type, base##_max);    \
 			} else {					      \
-				base##_max = MR_max(base##_max * 2,           \
-						(slot) + 1);                  \
-				base##s1 = MR_RESIZE_ARRAY(base##s1, type,    \
-						base##_max);		      \
-				base##s2 = MR_RESIZE_ARRAY(base##s2, type,    \
-						base##_max);		      \
+                base##_max = MR_max(base##_max * 2, (slot) + 1);        \
+                base##s1 = MR_RESIZE_ARRAY(base##s1, type, base##_max); \
+                base##s2 = MR_RESIZE_ARRAY(base##s2, type, base##_max); \
 			}						      \
 		}							      \
 	} while(0)
Index: mercury_construct.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_construct.h,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_construct.h
--- mercury_construct.h	18 Feb 2002 07:01:14 -0000	1.2
+++ mercury_construct.h	20 Jun 2005 02:20:10 -0000
@@ -18,17 +18,19 @@
 #include "mercury_type_info.h"
 #include "mercury_stack_layout.h"
 
+union MR_Construct_Functor_Union {
+	const MR_EnumFunctorDesc		*enum_functor_desc;
+	const MR_NotagFunctorDesc		*notag_functor_desc;
+	const MR_DuFunctorDesc			*du_functor_desc;
+};
+
 typedef struct MR_Construct_Info_Struct {
 	MR_ConstString		functor_name;
 	MR_Integer		arity;
 	const MR_PseudoTypeInfo	*arg_pseudo_type_infos;
 	const MR_ConstString	*arg_names;
 	MR_TypeCtorRep		type_ctor_rep;
-	union {
-		const MR_EnumFunctorDesc	*enum_functor_desc;
-		const MR_NotagFunctorDesc	*notag_functor_desc;
-		const MR_DuFunctorDesc		*du_functor_desc;
-	}			functor_info;
+	union MR_Construct_Functor_Union	functor_info;
 } MR_Construct_Info;
 
 /*
Index: mercury_deconstruct.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deconstruct.h,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_deconstruct.h
Index: mercury_init.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_init.h,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_init.h
--- mercury_init.h	15 Feb 2005 05:22:32 -0000	1.45
+++ mercury_init.h	20 Jun 2005 02:20:10 -0000
@@ -35,6 +35,7 @@
 ** mercury_main() is defined in the <module>_init.c file.
 ** It calls mercury_init(), mercury_call_main(), and then mercury_terminate().
 */
+
 extern	int	mercury_main(int argc, char **argv);
 
 /*
@@ -51,6 +52,7 @@
 ** collector, sets some global variables, and then calls
 ** mercury_runtime_init().
 */
+
 extern	void	mercury_init(int argc, char **argv, void *stack_bottom);
 
 /*
@@ -58,6 +60,7 @@
 ** It just calls mercury_runtime_main(), which calls main/2
 ** in the Mercury program.
 */
+
 extern	void	mercury_call_main(void);
 
 /*
@@ -66,6 +69,7 @@
 ** any necessary cleanup, and then returns the appropriate
 ** exit status as set by io__set_exit_status.
 */
+
 extern	int	mercury_terminate(void);
 
 /*---------------------------------------------------------------------------*/
Index: mercury_layout_util.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_layout_util.h,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_layout_util.h
--- mercury_layout_util.h	25 Sep 2003 07:56:47 -0000	1.22
+++ mercury_layout_util.h	20 Jun 2005 02:20:10 -0000
@@ -101,14 +101,12 @@
 			MR_Word *saved_regs, MR_bool *succeeded);
 extern	MR_Word	MR_lookup_long_lval_base(MR_Long_Lval locn,
 			MR_Word *saved_regs, MR_Word *base_sp,
-			MR_Word *base_curfr,
-			MR_bool *succeeded);
+			MR_Word *base_curfr, MR_bool *succeeded);
 extern	MR_Word	MR_lookup_short_lval(MR_Short_Lval locn,
 			MR_Word *saved_regs, MR_bool *succeeded);
 extern	MR_Word	MR_lookup_short_lval_base(MR_Short_Lval locn,
 			MR_Word *saved_regs, MR_Word *base_sp,
-			MR_Word *base_curfr,
-			MR_bool *succeeded);
+			MR_Word *base_curfr, MR_bool *succeeded);
 
 /*
 ** Given information about the location of a variable (var) and a vector giving
Index: mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.90
diff -u -b -r1.90 mercury_stack_layout.h
--- mercury_stack_layout.h	7 Jun 2005 03:00:03 -0000	1.90
+++ mercury_stack_layout.h	20 Jun 2005 02:21:51 -0000
@@ -240,7 +240,7 @@
 ** event should have no effects that the user can see (no message printed, no
 ** increment of the event number etc), and false otherwise. Hidden events
 ** are sometimes needed by the declarative debugger to provide the proper
-** context for other events. XXX this field is not used yet.
+** context for other events.
 **
 ** The MR_sll_goal_path field contains an offset into the module-wide string
 ** table, leading to a string that gives the goal path associated with the
Index: mercury_stack_trace.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.37
diff -u -b -r1.37 mercury_stack_trace.h
--- mercury_stack_trace.h	2 Mar 2005 01:20:20 -0000	1.37
+++ mercury_stack_trace.h	20 Jun 2005 02:21:51 -0000
@@ -19,7 +19,8 @@
 /*---------------------------------------------------------------------------*/
 
 /*
-** MR_dump_stack:
+** MR_dump_stack
+**
 ** 	Given the succip, det stack pointer and current frame, generate a
 ** 	stack dump showing the name of each active procedure on the
 ** 	stack. If include_trace_data data is set, also print the
@@ -46,7 +47,8 @@
 			MR_Word *current_frame, MR_bool include_trace_data);
 
 /*
-** MR_dump_stack_from_layout:
+** MR_dump_stack_from_layout
+**
 **	This function does the same job and makes the same assumptions
 **	as MR_dump_stack, but instead of the succip, it takes the label
 **	layout of the current point in the current procedure as input.
@@ -77,7 +79,8 @@
 				MR_Print_Stack_Record print_stack_record);
 
 /*
-** MR_dump_nondet_stack:
+** MR_dump_nondet_stack
+**
 **	This function dumps the control slots of the nondet stack.
 **	If limit_addr is nonnull, dumps only frames above limit_addr.
 **	If limit is nonzero, dumps at most limit frames.
@@ -88,7 +91,8 @@
 			int frame_limit, int line_limit, MR_Word *maxfr);
 
 /*
-** MR_dump_nondet_stack_from_layout:
+** MR_dump_nondet_stack_from_layout
+**
 **	This function dumps the nondet stack.
 **	If limit_addr is nonnull, dumps only frames above limit_addr.
 **	If limit is nonzero, dumps at most limit frames.
@@ -101,7 +105,8 @@
 			MR_Word *base_sp, MR_Word *base_curfr);
 
 /*
-** MR_traverse_nondet_stack_from_layout:
+** MR_traverse_nondet_stack_from_layout
+**
 **	This function traverses the nondet stack, calling the specified
 **	function for each frame.
 */
@@ -116,9 +121,9 @@
 			MR_Traverse_Nondet_Frame_Func *traverse_frame_func,
 			void *traverse_frame_func_data);
 
-
 /*
-** MR_find_nth_ancestor:
+** MR_find_nth_ancestor
+**
 **	Return the layout structure of the return label of the call
 **	ancestor_level levels above the current call. Label_layout
 **	tells us how to decipher the stack of the current call, while
@@ -138,7 +143,8 @@
 			MR_Word **stack_trace_curfr, const char **problem);
 
 /*
-** MR_stack_walk_step:
+** MR_stack_walk_step
+**
 **	This function takes the entry_layout for the current stack
 **	frame (which is the topmost stack frame from the two stack
 **	pointers given), and moves down one stack frame, i.e. to the
@@ -172,9 +178,10 @@
 } MR_Stack_Walk_Step_Result;
 
 extern  MR_Stack_Walk_Step_Result
-MR_stack_walk_step(const MR_Proc_Layout *entry_layout,
+		MR_stack_walk_step(const MR_Proc_Layout *entry_layout,
 		const MR_Label_Layout **return_label_layout,
-		MR_Word **stack_trace_sp_ptr, MR_Word **stack_trace_curfr_ptr,
+			MR_Word **stack_trace_sp_ptr,
+			MR_Word **stack_trace_curfr_ptr,
 		const char **problem_ptr);
 
 /*
@@ -282,10 +289,10 @@
 extern	void	MR_print_proc_id_trace_and_context(FILE *fp,
 			MR_bool include_trace_data, MR_Context_Position pos,
 			const MR_Proc_Layout *entry,
-			MR_Word *base_sp, MR_Word *base_curfr, const char *path,
-			const char *filename, int lineno, MR_bool print_parent,
-			const char *parent_filename, int parent_lineno,
-			int indent);
+			MR_Word *base_sp, MR_Word *base_curfr,
+			const char *path, const char *filename, int lineno,
+			MR_bool print_parent, const char *parent_filename,
+			int parent_lineno, int indent);
 
 /*
 ** MR_dump_stack_record_print() prints one line of a stack dump.
Index: mercury_trail.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trail.h,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_trail.h
--- mercury_trail.h	7 Jul 2004 07:11:17 -0000	1.22
+++ mercury_trail.h	20 Jun 2005 02:21:51 -0000
@@ -54,6 +54,7 @@
 **	called when an exception is thrown,
 **	or when doing a retry in the debugger
 */
+
 /*---------------------------------------------------------------------------*/
 
 /* void MR_mark_ticket_stack(MR_Word &); */
@@ -87,10 +88,11 @@
 			(save_ticket_counter);			\
 	} while(0)
 
-	/* 
-	** Called when we create a choice point
-	** (including semidet choice points).
-	*/
+/* 
+** Called when we create a choice point
+** (including semidet choice points).
+*/
+
 /* void MR_store_ticket(MR_Word &); */
 #define MR_store_ticket(save_trail_ptr)				\
 	do {							\
@@ -98,14 +100,15 @@
 		MR_ticket_counter = ++MR_ticket_high_water;	\
 	} while(0)
 
-	/*
-	** Unwind restoration info back to `old'.  `kind' indicates
-	** whether we are restoring or just discarding the info.
-	** 
-	** Note that the commented out calls to save/restore
-	** transient registers are not needed because
-	** MR_trail_ptr is never a real register.
-	*/
+/*
+** Unwind restoration info back to `old'.  `kind' indicates
+** whether we are restoring or just discarding the info.
+** 
+** Note that the commented out calls to save/restore
+** transient registers are not needed because
+** MR_trail_ptr is never a real register.
+*/
+
 /* void MR_reset_ticket(MR_Word, MR_untrail_reason); */
 #define MR_reset_ticket(old, kind)				\
 	do {							\
@@ -324,6 +327,7 @@
 ** N.B. Use `MR_trail_ptr', defined in mercury_regorder.h,
 ** not `MR_trail_ptr_var'.
 */
+
 extern MR_TrailEntry *MR_trail_ptr_var;
 
 /*
@@ -336,6 +340,7 @@
 ** N.B.  Use `MR_ticket_counter', defined in mercury_regorder.h,
 ** not `MR_ticket_counter_var'.
 */
+
 extern MR_Unsigned MR_ticket_counter_var;
 
 /*
@@ -348,6 +353,7 @@
 ** N.B.  Use `MR_ticket_high_water', defined in mercury_regorder.h,
 ** not `MR_ticket_high_water_var'.
 */
+
 extern MR_Unsigned MR_ticket_high_water_var;
 
 /*---------------------------------------------------------------------------*/
@@ -366,6 +372,7 @@
 ** Make sure that when the current execution is
 ** backtracked over, `value' is placed in `address'.
 */
+
 #define MR_trail_value(address, value)		\
 	do {							\
 		MR_store_value_trail_entry(MR_trail_ptr,	\
@@ -380,6 +387,7 @@
 ** backtracked over, the value currently in `address'
 ** is restored.
 */
+
 #define MR_trail_current_value(address) \
 	MR_trail_value((address), *(address))
 
@@ -394,6 +402,7 @@
 ** current choice is committed to), then
 ** (*untrail_func)(value, MR_commit) is called.
 */
+
 #define MR_trail_function(untrail_func, datum)				\
 	do {								\
 		MR_store_function_trail_entry((MR_trail_ptr),		\
@@ -404,6 +413,7 @@
 /*
 ** Apply all the trail entries between MR_trail_ptr and old_trail_ptr.
 */
+
 void MR_untrail_to(MR_TrailEntry *old_trail_ptr, MR_untrail_reason reason);
 
 /* abstract type */
@@ -430,6 +440,7 @@
 ** then code A will be executed if and only if the
 ** current choicepoint is the same in both calls.
 */
+
 #define MR_current_choicepoint_id() ((const MR_ChoicepointId) MR_ticket_counter)
 
 /*
@@ -438,6 +449,7 @@
 ** A macro defining a "null" ChoicepointId.
 ** This is suitable for use in static initializers.
 */
+
 #define MR_null_choicepoint_id() ((const MR_ChoicepointId)0)
 
 /*
@@ -451,6 +463,7 @@
 ** If either of the choice points have been
 ** backtracked over, the behaviour is undefined.
 */
+
 #define MR_choicepoint_newer(x, y) ((x) > (y))
 
 #endif /* not MERCURY_TRAIL_H */
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