From eaa8ece954e400670eb23353cfde80f9c8be7e23 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 24 Mar 2009 23:54:13 +0000 Subject: [PATCH] Fixed allocation of mobile channel bundles, as apparently a clone is unnecessary --- backends/GenerateC.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends/GenerateC.hs b/backends/GenerateC.hs index b18507c..fc1ee22 100644 --- a/backends/GenerateC.hs +++ b/backends/GenerateC.hs @@ -1728,7 +1728,12 @@ cgenAssign m [vA, vB] (A.AllocChannelBundle _ n) call genVariable' vA A.Original (const $ Pointer $ Plain "mt_cb_t") tell ["=MTAllocChanType(wptr,", show (length fs), ",", if shA == A.Shared || shB == A.Shared then "true" else "false", ");"] - call genAssign m [vB] (el $ A.CloneMobile m $ A.ExprVariable m vA) + -- Mobile channel types start with a reference count of 2, so no need + -- to clone, just assign: + call genVariable' vB A.Original (const $ Pointer $ Plain "mt_cb_t") + tell ["="] + call genVariable' vA A.Original (const $ Pointer $ Plain "mt_cb_t") + tell [";"] where el e = A.ExpressionList m [e] cgenAssign m _ _ = call genMissing "Cannot perform assignment with multiple destinations or multiple sources"