aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile
diff options
context:
space:
mode:
authorMark Freeman <mark@golang.org>2025-10-20 16:29:44 -0400
committerGopher Robot <gobot@golang.org>2025-10-23 13:16:51 -0700
commit9fcdc814b200da8d7e5bc8c9b89e42393c26c63d (patch)
tree7de221ccd2d19135131c7a4cfbe8807175cc2e47 /src/cmd/compile
parent8401512a9be9db590622f237f2e087b5cd79c13c (diff)
downloadgo-9fcdc814b200da8d7e5bc8c9b89e42393c26c63d.tar.xz
go/types, types2: rename loaded namedState to lazyLoaded
This is a minor renaming to help differentiate the two kinds of loading that can happen for named types (eager and lazy). Use of the term "loaded" suggests that it might also apply to types which are eagerly-loaded, which is not the case. This change uses "lazyLoaded" instead to mark this difference. Change-Id: Iee170024246d9adf3eed978bde2b0500f6d490b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/713282 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/compile')
-rw-r--r--src/cmd/compile/internal/types2/named.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/cmd/compile/internal/types2/named.go b/src/cmd/compile/internal/types2/named.go
index 0823839d81..a275e26a0c 100644
--- a/src/cmd/compile/internal/types2/named.go
+++ b/src/cmd/compile/internal/types2/named.go
@@ -142,7 +142,7 @@ type instance struct {
// according to the below diagram:
//
// unresolved
-// loaded
+// lazyLoaded
// resolved
// └── hasMethods
// └── hasUnder
@@ -158,9 +158,9 @@ type instance struct {
// set left-to-right, they are:
//
// 0000 | unresolved
-// 1000 | loaded
-// 1100 | resolved, which implies loaded
-// 1110 | hasMethods, which implies resolved (which in turn implies loaded)
+// 1000 | lazyLoaded
+// 1100 | resolved, which implies lazyLoaded
+// 1110 | hasMethods, which implies resolved (which in turn implies lazyLoaded)
// 1101 | hasUnder, which implies resolved ...
// 1111 | both hasMethods and hasUnder which implies resolved ...
//
@@ -169,9 +169,9 @@ type stateMask uint32
const (
// before resolved, type parameters, RHS, underlying, and methods might be unavailable
- resolved stateMask = 1 << iota // methods might be unexpanded (for instances)
+ lazyLoaded stateMask = 1 << iota // methods are available, but constraints might be unexpanded (for generic types)
+ resolved // methods might be unexpanded (for instances)
hasMethods // methods are all expanded (for instances)
- loaded // methods are available, but constraints might be unexpanded (for generic types)
hasUnder // underlying type is available
)
@@ -213,7 +213,7 @@ func NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
// All others:
// Effectively, nothing happens.
func (n *Named) resolve() *Named {
- if n.stateHas(resolved | loaded) { // avoid locking below
+ if n.stateHas(resolved | lazyLoaded) { // avoid locking below
return n
}
@@ -223,7 +223,7 @@ func (n *Named) resolve() *Named {
defer n.mu.Unlock()
// only atomic for consistency; we are holding the mutex
- if n.stateHas(resolved | loaded) {
+ if n.stateHas(resolved | lazyLoaded) {
return n
}
@@ -267,7 +267,7 @@ func (n *Named) resolve() *Named {
n.fromRHS = underlying // for cycle detection
n.methods = methods
- n.setState(loaded) // avoid deadlock calling delayed functions
+ n.setState(lazyLoaded) // avoid deadlock calling delayed functions
for _, f := range delayed {
f()
}
@@ -716,7 +716,7 @@ func (n *Named) expandRHS() (rhs Type) {
}
assert(!n.stateHas(resolved))
- assert(n.inst.orig.stateHas(resolved | loaded))
+ assert(n.inst.orig.stateHas(resolved | lazyLoaded))
if n.inst.ctxt == nil {
n.inst.ctxt = NewContext()