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
This commit is contained in:
Ștefan Talpalaru 2018-10-11 22:15:17 +02:00 • committed by Andreas Rumpf
commit 10f5f67767
5 changed files with 83 additions and 118 deletions

View file

@ -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: