mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: add GOEXPERIMENT=runtimefree
This CL is part of a series of CLs to triangulate between the runtime, compiler, and standard library to reduce how much work the GC must do. An overall design document is in CL 700255. This CL stack implements a runtime.free within the runtime, and then uses it via automatic calls inserted by the compiler when the compiler proves it is safe to do so. In the future, we can also consider possibly a limited set of explicit calls from certain low-level portions of the standard library. When called, runtime.free allows immediate reuse of memory without waiting for a GC cycle. The goals include less overall CPU usage by the GC, longer times between GC cycles (with less overall time with the write barrier enabled), and more cache-friendly allocations for user code. Here, we just add the GOEXPERIMENT=runtimefree flag. It currently defaults to on, but can be disabled with GOEXPERIMENT=noruntimefree. The actual implementation starts in CL 673695. Updates #74299 Change-Id: I2f1f04dbdca51f4aaa735fd65bb2719c298d922e Reviewed-on: https://go-review.googlesource.com/c/go/+/700235 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
d7a52f9369
commit
5dcaf9a01b
4 changed files with 20 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) {
|
||||||
RegabiArgs: regabiSupported,
|
RegabiArgs: regabiSupported,
|
||||||
Dwarf5: dwarf5Supported,
|
Dwarf5: dwarf5Supported,
|
||||||
RandomizedHeapBase64: true,
|
RandomizedHeapBase64: true,
|
||||||
|
RuntimeFree: true,
|
||||||
SizeSpecializedMalloc: true,
|
SizeSpecializedMalloc: true,
|
||||||
GreenTeaGC: true,
|
GreenTeaGC: true,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
src/internal/goexperiment/exp_runtimefree_off.go
Normal file
8
src/internal/goexperiment/exp_runtimefree_off.go
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||||
|
|
||||||
|
//go:build !goexperiment.runtimefree
|
||||||
|
|
||||||
|
package goexperiment
|
||||||
|
|
||||||
|
const RuntimeFree = false
|
||||||
|
const RuntimeFreeInt = 0
|
||||||
8
src/internal/goexperiment/exp_runtimefree_on.go
Normal file
8
src/internal/goexperiment/exp_runtimefree_on.go
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||||
|
|
||||||
|
//go:build goexperiment.runtimefree
|
||||||
|
|
||||||
|
package goexperiment
|
||||||
|
|
||||||
|
const RuntimeFree = true
|
||||||
|
const RuntimeFreeInt = 1
|
||||||
|
|
@ -113,6 +113,9 @@ type Flags struct {
|
||||||
// platforms.
|
// platforms.
|
||||||
RandomizedHeapBase64 bool
|
RandomizedHeapBase64 bool
|
||||||
|
|
||||||
|
// RuntimeFree enables the runtime to free and reuse memory more eagerly in some circumstances with compiler help.
|
||||||
|
RuntimeFree bool
|
||||||
|
|
||||||
// SizeSpecializedMalloc enables malloc implementations that are specialized per size class.
|
// SizeSpecializedMalloc enables malloc implementations that are specialized per size class.
|
||||||
SizeSpecializedMalloc bool
|
SizeSpecializedMalloc bool
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue