[m-rev.] more LLDS accurate GC fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 15 18:04:37 AEST 2003


On 15-Oct-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I will post a revised version of my patch and/or a relative diff
> which does this.

Here's a relative diff.

--- mercury_deep_copy_body.h.old2	Wed Oct 15 15:14:35 2003
+++ mercury_deep_copy_body.h	Wed Oct 15 18:00:30 2003
@@ -638,16 +638,23 @@
             ** the value of the foreign type.  But I don't see any
             ** better alternative at the moment.
             */
-            if (!in_range(data_value)) {
+            if (lower_limit != NULL && !in_range(data_value)) {
                 /*
-                ** If the foreign value does not point into the heap,
-                ** then we know it is not a pointer, so it is safe to
+                ** If the foreign value does not point into the area of
+                ** the heap that we are copying, then it is safe to
                 ** leave it unchanged.  
                 **
-                ** It is important to allow these cases,
+                ** It is important to allow these cases, when doing partial
+                ** copies (as occurs with accurate GC or solutions),
                 ** since they include the common cases of pointer types
                 ** that point to the C heap, global data, or stack data.
                 ** io__stream is a particularly important example.
+                **
+                ** However, when doing complete copies (lower_limit == NULL),
+                ** we should not allow shallow copying of foreign types,
+                ** because in cases where the foreign type is (or represents)
+                ** a pointer of some kind, that might violate unique mode
+                ** correctness.  That's why we check lower_limit != NULL above.
                 */
                 new_data = data;
             } else {

-- 
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