mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 23:43:40 +00:00
runtime: make gc and scheduler asserts settable with build tags
This commit is contained in:
@@ -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
|
||||||
@@ -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
|
||||||
@@ -37,11 +37,7 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set gcDebug to true to print debug information.
|
const gcDebug = false
|
||||||
const (
|
|
||||||
gcDebug = false // print debug info
|
|
||||||
gcAsserts = gcDebug // perform sanity checks
|
|
||||||
)
|
|
||||||
|
|
||||||
// Some globals + constants for the entire GC.
|
// Some globals + constants for the entire GC.
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const gcAsserts = false // perform sanity checks
|
|
||||||
|
|
||||||
// Ever-incrementing pointer: no memory is freed.
|
// Ever-incrementing pointer: no memory is freed.
|
||||||
var heapptr = heapStart
|
var heapptr = heapStart
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import (
|
|||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const gcAsserts = false // perform sanity checks
|
|
||||||
|
|
||||||
var gcTotalAlloc uint64 // for runtime.MemStats
|
var gcTotalAlloc uint64 // for runtime.MemStats
|
||||||
var gcMallocs uint64
|
var gcMallocs uint64
|
||||||
var gcFrees uint64
|
var gcFrees uint64
|
||||||
|
|||||||
Reference in New Issue
Block a user