[m-dev.] diff: fix hlc.par.gc float deep_copy bug

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Nov 25 14:26:06 AEDT 2000


Estimated hours taken: 0.5

Fix a bug that broke tests/hard_coded/deep_copy and
tests/hard_coded/type_classes/existential_rtti in grade hlc.par.gc.

runtime/mercury_deep_copy_body.h:
	When boxing floats, if MR_HIGHLEVEL_CODE is defined, use
	MR_box_float() and MR_unbox_float() rather than
	MR_float_to_word() and MR_word_to_float().
	This is necessary because MR_float_to_word() uses the
	`MR_hp' register, even in .gc grades (as a temporary).
	That doesn't work in hlc.par.gc, since the thread-local
	storage for MR_hp doesn't get allocated in that grade.

Workspace: /home/pgrad/fjh/ws/hg3
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.31
diff -u -d -r1.31 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	2000/11/23 02:00:25	1.31
+++ runtime/mercury_deep_copy_body.h	2000/11/25 03:24:19
@@ -353,7 +353,17 @@
 
                 if (in_range(data_value)) {
                     MR_restore_transient_hp();
+#ifdef MR_HIGHLEVEL_CODE
+                    /*
+                    ** We can't use MR_float_to_word, since it uses
+                    ** MR_hp, which in grade hlc.par.gc will be a
+                    ** reference to thread-local storage that we haven't
+                    ** allocated.
+                    */
+                    new_data = MR_box_float(MR_unbox_float(data));
+#else
                     new_data = MR_float_to_word(MR_word_to_float(data));
+#endif
                     MR_save_transient_hp();
                     leave_forwarding_pointer(data_ptr, new_data);
                 } else {

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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