[m-dev.] diff:

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Nov 24 16:49:40 AEDT 2000


On 24-Nov-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> The `MR_' prefix change broke things in grade `none' and probably
> in other non-.gc grades.

This change has successfully compiled in both asm_fast.gc and none.
Since it has almost no chance of breaking anything and I am about to
go home for a weekend of exam marking, I will commit it now, before the
bootcheck finishes.

Estimated hours taken: 2

Make even things used only in grade none use MR_ prefixes.

runtime/mercury_memory.c:
	Delete some obsolete global variables that were replaced by fields
	of the engine structure ages ago. Their declaration gets a syntax
	error in grade none.

runtime/mercury_engine.h:
	Remove some confusing macros for referring to these fields.

runtime/mercury_*.[ch]
	Add MR_ prefixes as necessary.

	Get rid of references to the confusing macros.

library/exception.m:
	Add MR_ prefixes as necessary.

	Get rid of references to the confusing macros.

library/std_util.m:
	Add MR_ prefixes as necessary.

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
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/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
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/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.33
diff -u -b -r1.33 exception.m
--- library/exception.m	2000/11/23 01:59:54	1.33
+++ library/exception.m	2000/11/24 04:04:49
@@ -956,16 +956,19 @@
 #define swap_heaps()							\\
 {									\\
 	/* save the current heap */					\\
-	MR_Word *swap_heaps_temp_hp = MR_hp;				\\
-	MemoryZone *swap_heaps_temp_hp_zone = MR_heap_zone;		\\
+	MR_Word		*swap_heaps_temp_hp;				\\
+	MR_MemoryZone	*swap_heaps_temp_hp_zone;			\\
 									\\
+	swap_heaps_temp_hp = MR_hp;					\\
+	swap_heaps_temp_hp_zone = MR_ENGINE(heap_zone);			\\
+									\\
 	/* set heap to solutions heap */				\\
 	MR_hp = MR_sol_hp;						\\
-	MR_heap_zone = MR_solutions_heap_zone;				\\
+	MR_ENGINE(heap_zone) = MR_ENGINE(solutions_heap_zone);		\\
 									\\
 	/* set the solutions heap to be the old heap */			\\
 	MR_sol_hp = swap_heaps_temp_hp;					\\
-	MR_solutions_heap_zone = swap_heaps_temp_hp_zone;		\\
+	MR_ENGINE(solutions_heap_zone) = swap_heaps_temp_hp_zone;	\\
 }
 
 MR_define_extern_entry(mercury__exception__builtin_catch_3_0); /* det */
@@ -1362,21 +1365,21 @@
 	MR_Word * saved_solns_heap_ptr;
 
 	/* switch to the solutions heap */
-	if (MR_heap_zone == MR_EXCEPTION_FRAMEVARS->heap_zone) {
+	if (MR_ENGINE(heap_zone) == MR_EXCEPTION_FRAMEVARS->heap_zone) {
 		swap_heaps();
 	}
 
 	saved_solns_heap_ptr = MR_hp;
 
 	/*
-	** deep_copy() the exception to the solutions heap.
+	** MR_deep_copy() the exception to the solutions heap.
 	** Note that we need to save/restore the hp register, if it
-	** is transient, before/after calling deep_copy().
+	** is transient, before/after calling MR_deep_copy().
 	*/
 	assert(MR_EXCEPTION_FRAMEVARS->heap_ptr <=
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
 	MR_save_transient_registers();
-	exception = deep_copy(&exception,
+	exception = MR_deep_copy(&exception,
 		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
 		MR_EXCEPTION_FRAMEVARS->heap_ptr,
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
@@ -1389,13 +1392,13 @@
 	assert(MR_EXCEPTION_FRAMEVARS->heap_ptr <= MR_hp);
 	MR_hp = MR_EXCEPTION_FRAMEVARS->heap_ptr;
 
-	/* deep_copy the exception back to the ordinary heap */
+	/* MR_deep_copy the exception back to the ordinary heap */
 	assert(MR_EXCEPTION_FRAMEVARS->solns_heap_ptr <=
-		MR_solutions_heap_zone->top);
+		MR_ENGINE(solutions_heap_zone)->top);
 	MR_save_transient_registers();
-	exception = deep_copy(&exception,
+	exception = MR_deep_copy(&exception,
 		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
-		saved_solns_heap_ptr, MR_solutions_heap_zone->top);
+		saved_solns_heap_ptr, MR_ENGINE(solutions_heap_zone)->top);
 	MR_restore_transient_registers();
 
 	/* reset the solutions heap */
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.206
diff -u -b -r1.206 std_util.m
--- library/std_util.m	2000/11/23 02:00:07	1.206
+++ library/std_util.m	2000/11/24 04:16:12
@@ -841,7 +841,7 @@
 "
 #ifndef CONSERVATIVE_GC
     {
-	MemoryZone *temp_zone;
+	MR_MemoryZone *temp_zone;
 	MR_Word *temp_hp;
 
 	temp_zone = MR_ENGINE(heap_zone);
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_deep_copy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.c,v
retrieving revision 1.21
diff -u -b -r1.21 mercury_deep_copy.c
--- runtime/mercury_deep_copy.c	2000/11/23 02:00:25	1.21
+++ runtime/mercury_deep_copy.c	2000/11/24 02:50:58
@@ -128,23 +128,25 @@
 
 	MR_restore_transient_hp();	/* Because we play with MR_hp */
 
-	if (lower_limit < MR_heap_zone->bottom ||
-			lower_limit > MR_heap_zone->top) {
-		lower_limit = MR_heap_zone->bottom;
+	if (lower_limit < MR_ENGINE(heap_zone)->bottom ||
+			lower_limit > MR_ENGINE(heap_zone)->top) {
+		lower_limit = MR_ENGINE(heap_zone)->bottom;
 	}
 
 	/* temporarily swap the heap with the global heap */
-	SWAP(MR_heap_zone, MR_global_heap_zone, MR_MemoryZone *);
+	SWAP(MR_ENGINE(heap_zone), MR_ENGINE(global_heap_zone),
+		MR_MemoryZone *);
 	SWAP(MR_hp, MR_global_hp, MR_Word *);
 
 	/* copy values from the heap to the global heap */
 	MR_save_transient_hp();
 	result = MR_deep_copy(&term, type_info, lower_limit,
-			MR_global_heap_zone->top);
+			MR_ENGINE(global_heap_zone)->top);
 	MR_restore_transient_hp();
 
 	/* swap the heap and global heap back again */
-	SWAP(MR_heap_zone, MR_global_heap_zone, MR_MemoryZone *);
+	SWAP(MR_ENGINE(heap_zone), MR_ENGINE(global_heap_zone),
+		MR_MemoryZone *);
 	SWAP(MR_hp, MR_global_hp, MR_Word *);
 
 	MR_save_transient_hp();	/* Because we played with MR_hp */
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.29
diff -u -b -r1.29 mercury_engine.c
--- runtime/mercury_engine.c	2000/11/23 02:00:27	1.29
+++ runtime/mercury_engine.c	2000/11/24 02:50:58
@@ -15,8 +15,8 @@
 #include	<setjmp.h>
 
 #include	"mercury_engine.h"
-#include	"mercury_memory_zones.h"	/* for create_zone() */
-#include	"mercury_memory_handlers.h"	/* for default_handler() */
+#include	"mercury_memory_zones.h"	/* for MR_create_zone() */
+#include	"mercury_memory_handlers.h"	/* for MR_default_handler() */
 
 #include	"mercury_dummy.h"
 
@@ -75,28 +75,31 @@
 	*/
 
 #ifndef	CONSERVATIVE_GC
-	eng->heap_zone = create_zone("heap", 1, heap_size, next_offset(),
-			heap_zone_size, default_handler);
+	eng->heap_zone = MR_create_zone("heap", 1, MR_heap_size,
+			MR_next_offset(), MR_heap_zone_size,
+			MR_default_handler);
 	eng->e_hp = eng->heap_zone->min;
 
 #ifdef	NATIVE_GC
-	eng->heap_zone2 = create_zone("heap2", 1, heap_size, next_offset(),
-			heap_zone_size, default_handler);
+	eng->heap_zone2 = MR_create_zone("heap2", 1, MR_heap_size,
+			MR_next_offset(), MR_heap_zone_size,
+			MR_default_handler);
 
   #ifdef MR_DEBUG_AGC_PRINT_VARS
-	eng->debug_heap_zone = create_zone("debug_heap", 1, debug_heap_size,
-			next_offset(), debug_heap_zone_size, default_handler);
+	eng->debug_heap_zone = MR_create_zone("debug_heap", 1,
+			MR_debug_heap_size, MR_next_offset(),
+			MR_debug_heap_zone_size, MR_default_handler);
   #endif
 #endif
 
-	eng->solutions_heap_zone = create_zone("solutions_heap", 1,
-			solutions_heap_size, next_offset(),
-			solutions_heap_zone_size, default_handler);
+	eng->solutions_heap_zone = MR_create_zone("solutions_heap", 1,
+			MR_solutions_heap_size, MR_next_offset(),
+			MR_solutions_heap_zone_size, MR_default_handler);
 	eng->e_sol_hp = eng->solutions_heap_zone->min;
 
-	eng->global_heap_zone = create_zone("global_heap", 1,
-			global_heap_size, next_offset(),
-			global_heap_zone_size, default_handler);
+	eng->global_heap_zone = MR_create_zone("global_heap", 1,
+			MR_global_heap_size, MR_next_offset(),
+			MR_global_heap_zone_size, MR_default_handler);
 	eng->e_global_hp = eng->global_heap_zone->min;
 #endif
 
@@ -181,8 +184,8 @@
 **	call_engine() will call MR_save_registers() before returning.
 **	That will copy the real registers we use to the fake_reg array.
 **
-**	Beware, however, that if you are planning to return to C code
-**	that did not #include "mercury_regs.h" (directly or via e.g. "mercury_imp.h"),
+**	Beware, however, that if you are planning to return to C code that did
+**	not #include "mercury_regs.h" (directly or via e.g. "mercury_imp.h"),
 **	and you have fiddled with the Mercury registers or invoked
 **	call_engine() or anything like that, then you will need to
 **	save the real registers that C is using before modifying the
@@ -196,9 +199,9 @@
 **	invoke call_engine() to invoke invoke Mercury routines (which
 **	in turn invoke C functions which ... etc. ad infinitum.)
 **
-**	call_engine() calls setjmp() and then invokes call_engine_inner()
+**	MR_call_engine() calls setjmp() and then invokes call_engine_inner()
 **	which does the real work.  call_engine_inner() exits by calling
-**	longjmp() to return to call_engine().  There are two 
+**	longjmp() to return to MR_call_engine().  There are two 
 **	different implementations of call_engine_inner(), one for gcc,
 **	and another portable version that works on standard ANSI C compilers.
 */
Index: runtime/mercury_engine.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.h,v
retrieving revision 1.19
diff -u -b -r1.19 mercury_engine.h
--- runtime/mercury_engine.h	2000/11/23 02:00:27	1.19
+++ runtime/mercury_engine.h	2000/11/24 02:50:58
@@ -295,15 +295,6 @@
 	} while (0)
 
 /*
-** Macros for easy access to heap zones.
-*/
-#ifndef	CONSERVATIVE_GC
-  #define MR_heap_zone			MR_ENGINE(heap_zone)
-  #define MR_solutions_heap_zone	MR_ENGINE(solutions_heap_zone)
-  #define MR_global_heap_zone		MR_ENGINE(global_heap_zone)
-#endif
-
-/*
 ** Functions for creating/destroying a MercuryEngine.
 */
 extern	MercuryEngine	*MR_create_engine(void);
Index: runtime/mercury_heap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_heap.h,v
retrieving revision 1.17
diff -u -b -r1.17 mercury_heap.h
--- runtime/mercury_heap.h	2000/11/23 02:00:29	1.17
+++ runtime/mercury_heap.h	2000/11/24 02:50:58
@@ -102,7 +102,7 @@
 			(dest) = (MR_Word) MR_mkword(tag, (MR_Word) MR_hp),\
 			MR_debugincrhp(count, MR_hp),			\
 			MR_hp += (count),				\
-			heap_overflow_check(),				\
+			MR_heap_overflow_check(),			\
 			(void) 0					\
 		)
   #define MR_tag_incr_hp_atomic(dest, tag, count) 			\
Index: runtime/mercury_memory.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory.c,v
retrieving revision 1.23
diff -u -b -r1.23 mercury_memory.c
--- runtime/mercury_memory.c	2000/11/23 02:00:34	1.23
+++ runtime/mercury_memory.c	2000/11/24 05:40:29
@@ -126,13 +126,9 @@
 /*
 ** Define the memory zones used by the Mercury runtime.
 ** (The trail zone is declared in mercury_trail.c.)
+** XXX All the zones should be in mercury_engine.h
 */
-MR_MemoryZone *MR_detstack_zone;
-MR_MemoryZone *MR_nondetstack_zone;
-#ifndef CONSERVATIVE_GC
-  MR_MemoryZone *MR_heap_zone;
-  MR_MemoryZone *MR_solutions_heap_zone;
-#endif
+
 #ifdef	MR_USE_MINIMAL_MODEL
   MR_MemoryZone *MR_generatorstack_zone;
   MR_MemoryZone *MR_cutstack_zone;
@@ -230,7 +226,7 @@
 		MR_solutions_heap_zone_size = MR_unit;
 	}
 	if (MR_global_heap_zone_size >= MR_global_heap_size) {
-		global_heap_zone_size = MR_unit;
+		MR_global_heap_zone_size = MR_unit;
 	}
 #endif
 
Index: runtime/mercury_memory_handlers.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.h,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_memory_handlers.h
--- runtime/mercury_memory_handlers.h	2000/11/23 02:00:35	1.4
+++ runtime/mercury_memory_handlers.h	2000/11/24 02:50:58
@@ -17,7 +17,7 @@
 #include "mercury_memory_zones.h"
 
 /*
-** MR_default_handler is a function that can be passed to create_zone to
+** MR_default_handler is a function that can be passed to MR_create_zone to
 ** unprotect enough of the redzone to allow the access to succeed, or
 ** fail if there is no space left in the zone.
 */
@@ -25,7 +25,7 @@
 extern	MR_ZoneHandler MR_default_handler;
 
 /*
-** MR_null_handler is a function that can be passed to create_zone
+** MR_null_handler is a function that can be passed to MR_create_zone
 ** which always fails.
 */
 
Index: runtime/mercury_memory_zones.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.h,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_memory_zones.h
--- runtime/mercury_memory_zones.h	2000/11/23 02:00:36	1.8
+++ runtime/mercury_memory_zones.h	2000/11/24 02:50:58
@@ -198,7 +198,7 @@
 
 /*
 ** MR_construct_zone(Name, Id, Base, Size, Offset, RedZoneSize, FaultHandler)
-** has the same behaviour as create_zone, except instread of allocating
+** has the same behaviour as MR_create_zone, except instread of allocating
 ** the memory, it takes a pointer to a region of memory that must be at
 ** least Size + unit[*] bytes, or if MR_PROTECTPAGE is defined, then it
 ** must be at least Size + 2 * unit[*] bytes.
Index: runtime/mercury_stacks.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stacks.h,v
retrieving revision 1.23
diff -u -b -r1.23 mercury_stacks.h
--- runtime/mercury_stacks.h	2000/11/23 02:00:41	1.23
+++ runtime/mercury_stacks.h	2000/11/24 02:50:58
@@ -325,7 +325,8 @@
 			/* save the heap and solutions heap pointers */	      \
 			MR_EXCEPTION_FRAMEVARS->heap_ptr = MR_hp;	      \
 			MR_EXCEPTION_FRAMEVARS->solns_heap_ptr = MR_sol_hp;   \
-			MR_EXCEPTION_FRAMEVARS->heap_zone = MR_heap_zone;     \
+			MR_EXCEPTION_FRAMEVARS->heap_zone = 		      \
+				MR_ENGINE(heap_zone);			      \
 		)							      \
 		MR_IF_USE_TRAIL(					      \
 			/* save the trail state */			      \
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 samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
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
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list