diff options
author | Ștefan Talpalaru <stefantalpalaru@yahoo.com> | 2018-10-11 22:15:17 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-11 22:15:17 +0200 |
commit | 10f5f6776799af43ae34501e7aa47fb7fe52dd20 (patch) | |
tree | 57b817a1d29c5e47c886cc0db14e5e4872a90bbf /compiler/cgen.nim | |
parent | d48e964950d92a57c24770d40ef0f05ddfe51b7e (diff) | |
download | Nim-10f5f6776799af43ae34501e7aa47fb7fe52dd20.tar.gz |
gogc: GCC-8.2.0 compatibility and other improvements (#9211)
- Go's write barriers are now plugged-in in all the relevant points - "gcGo" is correctly classified by usesWriteBarrier() - some gogc structures and functions now use golib wrappers to keep GCC version-specific conditions out of the compiler/stdlib code - we no longer allow mixing the C malloc with Go's - fix a problem with string copying
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r-- | compiler/cgen.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 37b07d38d..86aa7fb45 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -702,8 +702,12 @@ proc closureSetup(p: BProc, prc: PSym) = #echo "created environment: ", env.id, " for ", prc.name.s assignLocalVar(p, ls) # generate cast assignment: - linefmt(p, cpsStmts, "$1 = ($2) ClE_0;$n", - rdLoc(env.loc), getTypeDesc(p.module, env.typ)) + if p.config.selectedGC == gcGo: + linefmt(p, cpsStmts, "#unsureAsgnRef((void**) $1, ($2) ClE_0);$n", + addrLoc(p.config, env.loc), getTypeDesc(p.module, env.typ)) + else: + linefmt(p, cpsStmts, "$1 = ($2) ClE_0;$n", + rdLoc(env.loc), getTypeDesc(p.module, env.typ)) proc containsResult(n: PNode): bool = if n.kind == nkSym and n.sym.kind == skResult: |