[m-rev.] diff: fix more runtime problems
Julien Fischer
juliensf at cs.mu.OZ.AU
Sat Sep 17 02:42:35 AEST 2005
Estimated hours taken: 0.5
Branches: main
Fix more bitrot in the runtime. This mainly affect grades
we don't use that much, e.g. lowlevel .par and .agc grades.
runtime/mercury_accurate_gc.c:
runtime/mercury_agc_debug.c:
Conform to the new field names in the zone structure.
Avoid warnings about casts in lvalues being a deprecated
feature.
runtime/mercury_thread.c:
As above and also fix a problem with a format string not
matching the arguments in a call to fprintf.
Julien.
Index: runtime/mercury_accurate_gc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_accurate_gc.c,v
retrieving revision 1.39
diff -u -r1.39 mercury_accurate_gc.c
--- runtime/mercury_accurate_gc.c 16 Sep 2005 14:48:39 -0000 1.39
+++ runtime/mercury_accurate_gc.c 16 Sep 2005 16:24:13 -0000
@@ -444,7 +444,7 @@
gc_scheduled = MR_FALSE;
gc_running = MR_FALSE;
- MR_succip = saved_success;
+ MR_succip_word = (MR_Word) saved_success;
MR_proceed();
MR_fatal_error("Unreachable code reached");
@@ -486,7 +486,7 @@
** The new heap pointer starts at the bottom of the new heap.
*/
swap_heaps();
- MR_virtual_hp = new_heap->min;
+ MR_virtual_hp = new_heap->MR_zone_min;
label = MR_lookup_internal_by_addr(success_ip);
label_layout = label->i_layout;
@@ -505,7 +505,7 @@
** easier to reset it than debug the problem at the moment
*/
fprintf(stderr, "MR_virtual_hp: %lx\n", (long) MR_virtual_hp);
- MR_virtual_hp = new_heap->min;
+ MR_virtual_hp = new_heap->MR_zone_min;
fprintf(stderr, "MR_virtual_hp: %lx\n", (long) MR_virtual_hp);
}
@@ -770,8 +770,8 @@
case MR_LONG_LVAL_TYPE_R:
if (registers_live) {
copy = MR_agc_deep_copy(MR_virtual_reg_value(locn_num), type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
MR_virtual_reg_assign(locn_num, copy);
}
break;
@@ -783,16 +783,16 @@
MR_based_stackvar(stack_pointer, locn_num) =
MR_agc_deep_copy(MR_based_stackvar(stack_pointer, locn_num),
type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
break;
case MR_LONG_LVAL_TYPE_FRAMEVAR:
MR_based_framevar(current_frame, locn_num) =
MR_agc_deep_copy(MR_based_framevar(current_frame, locn_num),
type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
break;
case MR_LONG_LVAL_TYPE_SUCCIP:
@@ -845,8 +845,8 @@
if (registers_live) {
locn_num = MR_SHORT_LVAL_NUMBER(locn);
copy = MR_agc_deep_copy(MR_virtual_reg_value(locn_num), type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
MR_virtual_reg_assign(locn_num, copy);
}
break;
@@ -855,16 +855,16 @@
locn_num = MR_SHORT_LVAL_NUMBER(locn);
MR_based_stackvar(stack_pointer, locn_num) = MR_agc_deep_copy(
MR_based_stackvar(stack_pointer, locn_num), type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
break;
case MR_SHORT_LVAL_TYPE_FRAMEVAR:
locn_num = MR_SHORT_LVAL_NUMBER(locn);
MR_based_framevar(current_frame, locn_num) = MR_agc_deep_copy(
MR_based_framevar(current_frame, locn_num), type_info,
- MR_ENGINE(MR_eng_heap_zone2->min),
- MR_ENGINE(MR_eng_heap_zone2->hardmax));
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+ MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
break;
default:
@@ -880,11 +880,14 @@
static void
resize_and_reset_redzone(MR_MemoryZone *old_heap, MR_MemoryZone *new_heap)
{
- /* These counts include some wasted space between ->min and ->bottom. */
+ /* These counts include some wasted space between
+ ** ->MR_zone_min and ->MR_zone_bottom.
+ */
size_t old_heap_space =
- (char *) old_heap->redzone_base - (char *) old_heap->bottom;
+ (char *) old_heap->MR_zone_redzone_base -
+ (char *) old_heap->MR_zone_bottom;
size_t new_heap_usage =
- (char *) MR_virtual_hp - (char *) new_heap->bottom;
+ (char *) MR_virtual_hp - (char *) new_heap->MR_zone_bottom;
size_t gc_heap_size;
/*
@@ -900,8 +903,8 @@
}
/* Reset the redzone on the new heap */
- old_heap->redzone_base = (MR_Word *)
- ((char *) old_heap->bottom + gc_heap_size);
+ old_heap->MR_zone_redzone_base = (MR_Word *)
+ ((char *) old_heap->MR_zone_bottom + gc_heap_size);
MR_reset_redzone(old_heap);
}
Index: runtime/mercury_agc_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.c,v
retrieving revision 1.26
diff -u -r1.26 mercury_agc_debug.c
--- runtime/mercury_agc_debug.c 7 Jul 2004 07:11:08 -0000 1.26
+++ runtime/mercury_agc_debug.c 16 Sep 2005 15:56:45 -0000
@@ -66,8 +66,9 @@
MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG - 1,
saved_regs);
- MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
- MR_virtual_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
+ MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
+ MR_virtual_hp =
+ MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
#endif /* !MR_HIGHLEVEL_CODE */
fflush(NULL);
@@ -291,8 +292,9 @@
** Call Mercury but use the debugging heap.
*/
- MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
- MR_virtual_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
+ MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
+ MR_virtual_hp =
+ MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
if (MR_get_type_and_value_base(label_layout, i,
current_regs, stack_pointer,
@@ -323,8 +325,9 @@
** Call Mercury but use the debugging heap.
*/
- MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
- MR_virtual_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
+ MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
+ MR_virtual_hp =
+ MR_ENGINE(MR_eng_debug_heap_zone->MR_zone_min);
if (MR_get_type_and_value_base(label_layout, i,
current_regs, stack_pointer,
@@ -417,10 +420,10 @@
break;
}
if (have_value) {
- if (value >= (MR_Word) heap_zone->min &&
- value < (MR_Word) heap_zone->hardmax) {
+ if (value >= (MR_Word) heap_zone->MR_zone_min &&
+ value < (MR_Word) heap_zone->MR_zone_hardmax) {
difference = (MR_Word *) value -
- (MR_Word *) heap_zone->min;
+ (MR_Word *) heap_zone->MR_zone_min;
fprintf(stderr, "\thp[%d]\t(%lx)", difference,
(long) value);
} else {
@@ -490,9 +493,10 @@
break;
}
if (have_value) {
- if (value >= (MR_Word) heap_zone->min &&
- value < (MR_Word) heap_zone->hardmax) {
- difference = (MR_Word *) value - (MR_Word *) heap_zone->min;
+ if (value >= (MR_Word) heap_zone->MR_zone_min &&
+ value < (MR_Word) heap_zone->MR_zone_hardmax) {
+ difference = (MR_Word *) value -
+ (MR_Word *) heap_zone->MR_zone_min;
fprintf(stderr, "\thp[%d]\t(%lx)", difference,
(long) value);
} else {
Index: runtime/mercury_thread.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_thread.c,v
retrieving revision 1.22
diff -u -r1.22 mercury_thread.c
--- runtime/mercury_thread.c 20 Jun 2005 02:16:44 -0000 1.22
+++ runtime/mercury_thread.c 16 Sep 2005 15:36:41 -0000
@@ -90,7 +90,7 @@
pthread_setspecific(MR_engine_base_key, eng);
MR_restore_registers();
#ifdef MR_ENGINE_BASE_REGISTER
- MR_engine_base = eng;
+ MR_engine_base_word = (MR_Word) eng;
#endif
#else
MR_memcpy(&MR_engine_base, eng, sizeof(MercuryEngine));
@@ -194,7 +194,8 @@
{
int err;
- fprintf(stderr, "%d waiting on %p (%p)\n", pthread_self(), cond, lock);
+ fprintf(stderr, "%ld waiting on %p (%p)\n", (long) pthread_self(),
+ cond, lock);
err = pthread_cond_wait(cond, lock);
assert(err == 0);
}
--------------------------------------------------------------------------
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