]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't assume arena is in address order
authorAustin Clements <austin@google.com>
Thu, 22 Feb 2018 17:30:27 +0000 (12:30 -0500)
committerAustin Clements <austin@google.com>
Fri, 23 Feb 2018 21:59:47 +0000 (21:59 +0000)
On amd64, the arena is no longer in address space order, but currently
the heap dumper assumes that it is. Fix this assumption.

Change-Id: Iab1953cd36b359d0fb78ed49e5eb813116a18855
Reviewed-on: https://go-review.googlesource.com/96776
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/heapdump.go

index 362cb7c308e98f4a055e9ed52ad183965b77002d..dbeaed92775026f96927ff7386f3c4968f6cfe64 100644 (file)
@@ -491,10 +491,13 @@ func dumpparams() {
        var arenaStart, arenaEnd uintptr
        for i, ha := range mheap_.arenas {
                if ha != nil {
-                       if arenaStart == 0 {
-                               arenaStart = arenaBase(uint(i))
+                       base := arenaBase(uint(i))
+                       if arenaStart == 0 || base < arenaStart {
+                               arenaStart = base
+                       }
+                       if base+heapArenaBytes > arenaEnd {
+                               arenaEnd = base + heapArenaBytes
                        }
-                       arenaEnd = arenaBase(uint(i)) + heapArenaBytes
                }
        }
        dumpint(uint64(arenaStart))