git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge branch 'master' into faster-primitives
1e53e82Andy Arvanitis
runtime/purescript.h+6−6
@@ -150,12 +150,12 @@ namespace purescript {
150
150
151 }; // class boxed::weak
151 }; // class boxed::weak
152
152
153− class ref {
153+ class recur {
154 std::shared_ptr<boxed> sptr;
154 std::shared_ptr<boxed> sptr;
155 std::shared_ptr<boxed::weak> wptr;
155 std::shared_ptr<boxed::weak> wptr;
156
156
157 public:
157 public:
158− ref() : sptr(std::make_shared<boxed>())
158+ recur() : sptr(std::make_shared<boxed>())
159 , wptr(std::make_shared<boxed::weak>(*sptr)) {}
159 , wptr(std::make_shared<boxed::weak>(*sptr)) {}
160
160
161 operator const boxed&() const {
161 operator const boxed&() const {
@@ -175,7 +175,7 @@ namespace purescript {
175 }
175 }
176
176
177 template <typename T>
177 template <typename T>
178− auto operator=(T&& right) -> ref& {
178+ auto operator=(T&& right) -> recur& {
179 *sptr = std::forward<T>(right);
179 *sptr = std::forward<T>(right);
180 *wptr = *sptr;
180 *wptr = *sptr;
181 return *this;
181 return *this;
@@ -184,7 +184,7 @@ namespace purescript {
184 class weak {
184 class weak {
185 std::shared_ptr<boxed::weak> wptr;
185 std::shared_ptr<boxed::weak> wptr;
186 public:
186 public:
187− weak(const ref& r) : wptr(r.wptr) {}
187+ weak(const recur& r) : wptr(r.wptr) {}
188
188
189 operator boxed() const {
189 operator boxed() const {
190 return *wptr;
190 return *wptr;
@@ -197,8 +197,8 @@ namespace purescript {
197 auto operator()(const boxed& arg) const -> boxed {
197 auto operator()(const boxed& arg) const -> boxed {
198 return static_cast<boxed>(*wptr)(arg);
198 return static_cast<boxed>(*wptr)(arg);
199 }
199 }
200− }; // class ref::weak
200+ }; // class recur::weak
201− }; // class boxed::ref
201+ }; // class boxed::recur
202
202
203 }; // class boxed
203 }; // class boxed
204
204
src/CodeGen/Cpp.hs+2−2
@@ -255,10 +255,10 @@ moduleToCpp (Module _ coms mn _ imps _ foreigns decls) _ =
255 bindersToCpp ss binders vals
255 bindersToCpp ss binders vals
256 valueToCpp (Let _ ds val) = do
256 valueToCpp (Let _ ds val) = do
257 let recurs = concatMap getNames $ filter isRec ds
257 let recurs = concatMap getNames $ filter isRec ds
258− recurDs = (\v -> AST.Var Nothing $ "boxed::ref " <> identToCpp v) <$> recurs
258+ recurDs = (\v -> AST.Var Nothing $ "boxed::recur " <> identToCpp v) <$> recurs
259 recurDsWeak = (\v -> AST.Var
259 recurDsWeak = (\v -> AST.Var
260 Nothing
260 Nothing
261− ("boxed::ref::weak " <> identToCpp v <> unretainedSuffix <> "(" <> identToCpp v <> ")")
261+ ("boxed::recur::weak " <> identToCpp v <> unretainedSuffix <> "(" <> identToCpp v <> ")")
262 ) <$> recurs
262 ) <$> recurs
263 mutualRecurWarning = if any isMutRec $ filter isRec ds
263 mutualRecurWarning = if any isMutRec $ filter isRec ds
264 then [AST.Var Nothing "#pragma message(\"Mutually recursive lets will cause retain cycles (memory leaks)\") //"]
264 then [AST.Var Nothing "#pragma message(\"Mutually recursive lets will cause retain cycles (memory leaks)\") //"]