diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-04-18 22:22:03 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-04-19 18:02:43 +0200 |
commit | bc7d1de7fd17d0cc2fe9895fda3a21f3aec3b891 (patch) | |
tree | ec5cbfc69ff7012a49ad0e070918b0267837e98a | |
parent | a394d31746d68c9478462bee1e22567632156dca (diff) | |
download | Nim-bc7d1de7fd17d0cc2fe9895fda3a21f3aec3b891.tar.gz |
added a note about what to not do
-rw-r--r-- | compiler/dfa.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/dfa.nim b/compiler/dfa.nim index 528e71b31..0072c9410 100644 --- a/compiler/dfa.nim +++ b/compiler/dfa.nim @@ -636,6 +636,16 @@ proc isAnalysableFieldAccess*(n: PNode; owner: PSym): bool = result = n.kind == nkSym and n.sym.owner == owner and owner.kind != skModule and (n.sym.kind != skParam or isSinkParam(n.sym)) # or n.sym.typ.kind == tyVar) + # Note: There is a different move analyzer possible that checks for + # consume(param.key); param.key = newValue for all paths. Then code like + # + # let splited = split(move self.root, x) + # self.root = merge(splited.lower, splited.greater) + # + # could be written without the ``move self.root``. However, this would be + # wrong! Then the write barrier for the ``self.root`` assignment would + # free the old data and all is lost! Lesson: Don't be too smart, trust the + # lower level C++ optimizer to specialize this code. proc genDef(c: var Con; n: PNode) = if n.kind == nkSym and n.sym.kind in InterestingSyms: |