Updated Destructors (rest)
This commit is contained in:
parent
64917905e9
commit
d6743cda74
|
@ -5,15 +5,15 @@ Nim's strings and sequences should become "GC-free" implementations and are exem
|
||||||
Rewrite rules (simplified)
|
Rewrite rules (simplified)
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
-------- -------------------- -----------------------------------------------------------
|
======== ==================== ===========================================================
|
||||||
Rule Pattern Meaning
|
Rule Pattern Meaning
|
||||||
-------- -------------------- -----------------------------------------------------------
|
======== ==================== ===========================================================
|
||||||
1 var x; stmts var x; try stmts finally: `=destroy`(x)
|
1 var x; stmts var x; try stmts finally: `=destroy`(x)
|
||||||
2 x = f() `=sink`(x, f())
|
2 x = f() `=sink`(x, f())
|
||||||
3 x = lastReadOf z `=sink`(x, z)
|
3 x = lastReadOf z `=sink`(x, z)
|
||||||
4 x = y `=`(x, y) # a copy
|
4 x = y `=`(x, y) # a copy
|
||||||
5 f(g()) var tmp; `=sink`(tmp, g()); f(tmp); `=destroy`(tmp)
|
5 f(g()) var tmp; `=sink`(tmp, g()); f(tmp); `=destroy`(tmp)
|
||||||
-------- -------------------- -----------------------------------------------------------
|
======== ==================== ===========================================================
|
||||||
|
|
||||||
Rule (5) can be optimized further to ``var tmp = bitwiseCopy(g()); f(tmp); =destroy(tmp)``.
|
Rule (5) can be optimized further to ``var tmp = bitwiseCopy(g()); f(tmp); =destroy(tmp)``.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue