[m-rev.] diff: add missing out-of-line definitions for MR_box_{int64, uint64}

Julien Fischer jfischer at opturion.com
Sun Mar 15 17:03:40 AEDT 2020


Branches: master, version-20_01-branch

The set of circumstances where these definitions are required
is fairly rare, which is why we have not noticed it until now.

------

Add missing out-of-line definitions for MR_box_{int64,uint64}.

runtime/mercury.c:
      Provide out-of-line definitions for MR_box_{int64,uint64} when using
      boxed 64-bit integers and *not* using GCC.

Julien.

diff --git a/runtime/mercury.c b/runtime/mercury.c
index cefd3d8..9aaf920 100644
--- a/runtime/mercury.c
+++ b/runtime/mercury.c
@@ -93,6 +93,40 @@ MR_OUTLINE_DEFN(

  #endif // MR_BOXED_FLOAT && !MR_GNUC

+#if defined(MR_BOXED_INT64S) && !defined(MR_GNUC)
+
+MR_OUTLINE_DEFN(
+    MR_Box
+    MR_box_int64(int64_t i)
+,
+    {
+        int64_t *ptr;
+
+        MR_make_hp_int64_aligned();
+        ptr = MR_new_object_atomic(int64_t, sizeof(int64_t),
+            MR_ALLOC_SITE_INT64, NULL);
+        *ptr = i;
+        return (MR_Box) ptr;
+    }
+)
+
+MR_OUTLINE_DEFN(
+    MR_Box
+    MR_box_uint64(uint64_t i)
+,
+    {
+        uint64_t *ptr;
+
+        MR_make_hp_uint64_aligned();
+        ptr = MR_new_object_atomic(uint64_t, sizeof(uint64_t),
+            MR_ALLOC_SITE_UINT64, NULL);
+        *ptr = i;
+        return (MR_Box) ptr;
+    }
+)
+
+#endif // MR_BOXED_INT64S && !MR_GNUC
+
  #endif // ! MR_HIGHLEVEL_CODE

  ////////////////////////////////////////////////////////////////////////////


More information about the reviews mailing list