Commit 7ac0a8bc authored by Austin Clements's avatar Austin Clements

runtime: remove unused gcTriggerAlways

This was used during the implementation of concurrent runtime.GC() but
now there's nothing that triggers GC unconditionally. Remove this
trigger type and simplify (gcTrigger).test() accordingly.

Change-Id: I17a893c2ed1f661b8146d7783d529f71735c9105
Reviewed-on: https://go-review.googlesource.com/c/go/+/66090
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMichael Knyszek <mknyszek@google.com>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
parent 4b142806
...@@ -1136,15 +1136,10 @@ type gcTrigger struct { ...@@ -1136,15 +1136,10 @@ type gcTrigger struct {
type gcTriggerKind int type gcTriggerKind int
const ( const (
// gcTriggerAlways indicates that a cycle should be started
// unconditionally, even if GOGC is off or we're in a cycle
// right now. This cannot be consolidated with other cycles.
gcTriggerAlways gcTriggerKind = iota
// gcTriggerHeap indicates that a cycle should be started when // gcTriggerHeap indicates that a cycle should be started when
// the heap size reaches the trigger heap size computed by the // the heap size reaches the trigger heap size computed by the
// controller. // controller.
gcTriggerHeap gcTriggerHeap gcTriggerKind = iota
// gcTriggerTime indicates that a cycle should be started when // gcTriggerTime indicates that a cycle should be started when
// it's been more than forcegcperiod nanoseconds since the // it's been more than forcegcperiod nanoseconds since the
...@@ -1161,13 +1156,7 @@ const ( ...@@ -1161,13 +1156,7 @@ const (
// that the exit condition for the _GCoff phase has been met. The exit // that the exit condition for the _GCoff phase has been met. The exit
// condition should be tested when allocating. // condition should be tested when allocating.
func (t gcTrigger) test() bool { func (t gcTrigger) test() bool {
if !memstats.enablegc || panicking != 0 { if !memstats.enablegc || panicking != 0 || gcphase != _GCoff {
return false
}
if t.kind == gcTriggerAlways {
return true
}
if gcphase != _GCoff {
return false return false
} }
switch t.kind { switch t.kind {
...@@ -1233,7 +1222,7 @@ func gcStart(trigger gcTrigger) { ...@@ -1233,7 +1222,7 @@ func gcStart(trigger gcTrigger) {
} }
// For stats, check if this GC was forced by the user. // For stats, check if this GC was forced by the user.
work.userForced = trigger.kind == gcTriggerAlways || trigger.kind == gcTriggerCycle work.userForced = trigger.kind == gcTriggerCycle
// In gcstoptheworld debug mode, upgrade the mode accordingly. // In gcstoptheworld debug mode, upgrade the mode accordingly.
// We do this after re-checking the transition condition so // We do this after re-checking the transition condition so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment