Browse Source

runtime: make gc and scheduler asserts settable with build tags

pull/3170/head
Damian Gryski 2 years ago
committed by Ron Evans
parent
commit
fca2de21b1
  1. 9
      src/runtime/build_asserts.go
  2. 9
      src/runtime/build_noasserts.go
  3. 6
      src/runtime/gc_conservative.go
  4. 2
      src/runtime/gc_leaking.go
  5. 2
      src/runtime/gc_none.go

9
src/runtime/build_asserts.go

@ -0,0 +1,9 @@
//go:build runtime_asserts
package runtime
// enable assertions for the garbage collector
const gcAsserts = true
// enable asserts for the scheduler
const schedulerAsserts = true

9
src/runtime/build_noasserts.go

@ -0,0 +1,9 @@
//go:build !runtime_asserts
package runtime
// disable assertions for the garbage collector
const gcAsserts = false
// disable assertions for the scheduler
const schedulerAsserts = false

6
src/runtime/gc_conservative.go

@ -37,11 +37,7 @@ import (
"unsafe"
)
// Set gcDebug to true to print debug information.
const (
gcDebug = false // print debug info
gcAsserts = gcDebug // perform sanity checks
)
const gcDebug = false
// Some globals + constants for the entire GC.

2
src/runtime/gc_leaking.go

@ -11,8 +11,6 @@ import (
"unsafe"
)
const gcAsserts = false // perform sanity checks
// Ever-incrementing pointer: no memory is freed.
var heapptr = heapStart

2
src/runtime/gc_none.go

@ -11,8 +11,6 @@ import (
"unsafe"
)
const gcAsserts = false // perform sanity checks
var gcTotalAlloc uint64 // for runtime.MemStats
var gcMallocs uint64
var gcFrees uint64

Loading…
Cancel
Save