| // Copyright 2019 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Make sure we use the deferreturn live map instead of |
| // the entry live map when handling a segv in a function |
| const filler int64 = 0x123456789abcdef0 |
| func (h *HeapObj) init() { |
| for i := 0; i < len(*h); i++ { |
| func (h *HeapObj) check() { |
| for i := 0; i < len(*h); i++ { |
| err = "filler overwritten" |
| func gc(shouldFinalize bool) { |
| if shouldFinalize != finalized { |
| err = "heap object finalized at the wrong time" |
| runtime.SetFinalizer(h, func(h *HeapObj) { |
| // h should not be live here. Previously we used to |
| // use the function entry point as the place to get |
| // the live map when handling a segv. |
| *(*int)(nil) = 0 // trigger a segv |