compiler,runtime: implement a portable conservative GC

This commit is contained in:
Ayke van Laethem
2019-05-14 15:18:05 +02:00
parent 00e91ec569
commit 385d1d0a5d
12 changed files with 528 additions and 17 deletions
+8
View File
@@ -114,6 +114,14 @@ func (c *Compiler) Optimize(optLevel, sizeLevel int, inlinerThreshold uint) erro
builder.Populate(modPasses)
modPasses.Run(c.mod)
hasGCPass := c.addGlobalsBitmap()
hasGCPass = c.makeGCStackSlots() || hasGCPass
if hasGCPass {
if err := c.Verify(); err != nil {
return errors.New("GC pass caused a verification failure")
}
}
return nil
}