[m-rev.] for review: fix agc forwarding pointers, et al
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Jun 6 17:18:46 AEST 2002
On 06-Jun-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> (The compiler still doesn't bootstrap, however,
> so obviously there is at least one bug still remaining ;-)
Well, I just found one of them: my new code was losing the
tags in deep_copy().
Hopefully this was the last bug ;-)
Actually there are also still a few unimplemented features,
in particular resizing the heap if/when it gets full.
--- mercury_deep_copy_body.h.old Thu Jun 6 16:44:49 2002
+++ mercury_deep_copy_body.h Thu Jun 6 16:44:52 2002
@@ -57,21 +57,23 @@
#define TYPECLASSINFO_FORWARDING_PTR_OFFSET -1
/*
-** RETURN_IF_OUT_OF_RANGE(MR_Word *pointer, int forwarding_pointer_offset):
+** RETURN_IF_OUT_OF_RANGE(MR_Word tagged_pointer, MR_Word *pointer,
+** int forwarding_pointer_offset):
** Check if `pointer' is either out of range, or has already been
** processed, and if so, return (from the function that called this macro)
** with the appropriate value.
**
-** If the pointer is out of range, we return the value unchanged.
+** If the pointer is out of range, we return the original tagged pointer
+** value unchanged.
** If the pointer has already been processed, then return the forwarding
** pointer that was saved in the object, which will be stored at
** pointer[forwarding_pointer_offset].
*/
-#define RETURN_IF_OUT_OF_RANGE(pointer, offset, rettype) \
+#define RETURN_IF_OUT_OF_RANGE(tagged_pointer, pointer, offset, rettype) \
do { \
if (!in_range(pointer)) { \
found_out_of_range_pointer(pointer); \
- return (rettype) (pointer); \
+ return (rettype) (tagged_pointer); \
} \
if_forwarding_pointer((pointer), \
return (rettype) (pointer)[offset]); \
@@ -195,7 +197,7 @@
#define MR_handle_sectag_remote_or_none(have_sectag) \
do { \
data_value = (MR_Word *) MR_body(data, ptag); \
- RETURN_IF_OUT_OF_RANGE(data_value, 0, MR_Word); \
+ RETURN_IF_OUT_OF_RANGE(data, data_value, 0, MR_Word); \
{ \
const MR_DuFunctorDesc *functor_desc; \
const MR_DuExistInfo *exist_info; \
@@ -349,7 +351,7 @@
assert(MR_tag(data) == 0);
data_value = (MR_Word *) MR_body(data, MR_mktag(0));
- RETURN_IF_OUT_OF_RANGE(data_value, 0, MR_Word);
+ RETURN_IF_OUT_OF_RANGE(data, data_value, 0, MR_Word);
{
MR_restore_transient_hp();
@@ -382,7 +384,7 @@
** So we can't do `assert(MR_tag(data) == 0)' here.
*/
- RETURN_IF_OUT_OF_RANGE((MR_Word *) data, 0, MR_Word);
+ RETURN_IF_OUT_OF_RANGE(data, (MR_Word *) data, 0, MR_Word);
{
MR_incr_saved_hp_atomic(new_data,
@@ -402,7 +404,7 @@
assert(MR_tag(data) == 0);
data_value = (MR_Word *) MR_body(data, MR_mktag(0));
- RETURN_IF_OUT_OF_RANGE(data_value, CLOSURE_FORWARDING_PTR_OFFSET,
+ RETURN_IF_OUT_OF_RANGE(data, data_value, CLOSURE_FORWARDING_PTR_OFFSET,
MR_Word);
/*
@@ -471,7 +473,7 @@
assert(MR_tag(data) == 0);
data_value = (MR_Word *) MR_body(data, MR_mktag(0));
- RETURN_IF_OUT_OF_RANGE(data_value, 0, MR_Word);
+ RETURN_IF_OUT_OF_RANGE(data, data_value, 0, MR_Word);
{
MR_Word *new_data_ptr;
@@ -512,7 +514,7 @@
assert(MR_tag(data) == 0);
data_value = (MR_Word *) MR_body(data, MR_mktag(0));
- RETURN_IF_OUT_OF_RANGE(data_value, 0, MR_Word);
+ RETURN_IF_OUT_OF_RANGE(data, data_value, 0, MR_Word);
{
MR_ArrayType *new_array;
@@ -653,7 +655,7 @@
copy_type_info(MR_TypeInfo type_info,
const MR_Word *lower_limit, const MR_Word *upper_limit)
{
- RETURN_IF_OUT_OF_RANGE((MR_Word *) type_info,
+ RETURN_IF_OUT_OF_RANGE((MR_Word) type_info, (MR_Word *) type_info,
TYPEINFO_FORWARDING_PTR_OFFSET, MR_TypeInfo);
{
@@ -715,7 +717,7 @@
{
MR_Word *typeclass_info = (MR_Word *) typeclass_info_param;
- RETURN_IF_OUT_OF_RANGE(typeclass_info,
+ RETURN_IF_OUT_OF_RANGE(typeclass_info_param, typeclass_info,
TYPECLASSINFO_FORWARDING_PTR_OFFSET, MR_Word);
{
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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