Blob Blame History Raw
From a3e0c4fff05c9a3a15fbbc2dbfadd9610ea257dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kim=20Nguy=E1=BB=85n?= <kn@lri.fr>
Date: Thu, 7 Aug 2014 14:10:27 +0200
Subject: [PATCH 07/11] Prevent the compiler from statically allocating an
 persistent variant (that is mutated by the OCaml runtime)

---
 runtime/value.ml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/runtime/value.ml b/runtime/value.ml
index 368b095..cac0600 100644
--- a/runtime/value.ml
+++ b/runtime/value.ml
@@ -169,7 +169,11 @@ let rec flatten = function
   | q -> q
 
 let eval_lazy_concat v =
-  let accu = Obj.magic (Pair (nil,Absent)) in
+  let accu =
+  (* prevent the ocamlopt from statically allocating the
+     value Pair(nil, Absent) *)
+  Obj.(magic (dup (repr (Pair (nil, Absent)))))
+  in
   let rec aux accu = function
     | Concat (x,y) -> aux (append_cdr accu x) y
     | v -> set_cdr accu v
-- 
1.9.3