aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2019-03-05 23:05:38 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-03-05 23:05:38 +0000
commit03ac8302a60099632ea1f95af14db5dfd83f2970 (patch)
tree2d09784730499ce1787c73cf4c43cd8d5d02d6f0 /libgo
parent934e992600497edec7ca89952d8d6579844a5164 (diff)
downloadgcc-03ac8302a60099632ea1f95af14db5dfd83f2970.zip
gcc-03ac8302a60099632ea1f95af14db5dfd83f2970.tar.gz
gcc-03ac8302a60099632ea1f95af14db5dfd83f2970.tar.bz2
runtime: enable precise GC checks when using stack maps
In the runtime there are bad pointer checks that currently don't work with the concervative collector. With stack maps, the GC is precise and the checks should work. Enable them. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/153871 From-SVN: r269406
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/runtime/mgcmark.go4
-rw-r--r--libgo/go/runtime/mgcsweep.go6
-rw-r--r--libgo/go/runtime/runtime1.go4
3 files changed, 9 insertions, 5 deletions
diff --git a/libgo/go/runtime/mgcmark.go b/libgo/go/runtime/mgcmark.go
index 9da881e..dc5e797 100644
--- a/libgo/go/runtime/mgcmark.go
+++ b/libgo/go/runtime/mgcmark.go
@@ -1106,9 +1106,9 @@ func scanstackblockwithmap(pc, b0, n0 uintptr, ptrmask *uint8, gcw *gcWork) {
// Preemption must be disabled.
//go:nowritebarrier
func shade(b uintptr) {
- if obj, span, objIndex := findObject(b, 0, 0, true); obj != 0 {
+ if obj, span, objIndex := findObject(b, 0, 0, !usestackmaps); obj != 0 {
gcw := &getg().m.p.ptr().gcw
- greyobject(obj, 0, 0, span, gcw, objIndex, true)
+ greyobject(obj, 0, 0, span, gcw, objIndex, !usestackmaps)
}
}
diff --git a/libgo/go/runtime/mgcsweep.go b/libgo/go/runtime/mgcsweep.go
index fb5ee6a..bc53de4 100644
--- a/libgo/go/runtime/mgcsweep.go
+++ b/libgo/go/runtime/mgcsweep.go
@@ -342,8 +342,10 @@ func (s *mspan) sweep(preserve bool) bool {
// it is not otherwise a problem. So we disable the test for gccgo.
nfreedSigned := int(nfreed)
if nalloc > s.allocCount {
- // print("runtime: nelems=", s.nelems, " nalloc=", nalloc, " previous allocCount=", s.allocCount, " nfreed=", nfreed, "\n")
- // throw("sweep increased allocation count")
+ if usestackmaps {
+ print("runtime: nelems=", s.nelems, " nalloc=", nalloc, " previous allocCount=", s.allocCount, " nfreed=", nfreed, "\n")
+ throw("sweep increased allocation count")
+ }
// For gccgo, adjust the freed count as a signed number.
nfreedSigned = int(s.allocCount) - int(nalloc)
diff --git a/libgo/go/runtime/runtime1.go b/libgo/go/runtime/runtime1.go
index 66091ff..e2567b3 100644
--- a/libgo/go/runtime/runtime1.go
+++ b/libgo/go/runtime/runtime1.go
@@ -362,7 +362,9 @@ func parsedebugvars() {
// At that point, if debug.invalidptr is set, we crash.
// This is not a problem, assuming that M1 really is dead and
// the pointer we discovered to it will not be used.
- // debug.invalidptr = 1
+ if usestackmaps {
+ debug.invalidptr = 1
+ }
for p := gogetenv("GODEBUG"); p != ""; {
field := ""