-
Notifications
You must be signed in to change notification settings - Fork 18k
go/types: make instantiation concurrency-safe #47910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Change https://golang.org/cl/344390 mentions this issue: |
Change https://golang.org/cl/346557 mentions this issue: |
This may be a concern for x/tools/go/ssa. Building for each package is done in its own go routine. Each will likely be instantiating types. |
This is a port of CL 345929 to go/types. It is also a step toward making instantiation concurrency-safe. Also fix some whitespace in instantiate.go. Updates #47910 Change-Id: Icdeb227cb83eee15da6db90daab294c8c55db601 Reviewed-on: https://go-review.googlesource.com/c/go/+/346557 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Robert Griesemer <[email protected]> TryBot-Result: Go Bot <[email protected]>
Change https://golang.org/cl/349410 mentions this issue: |
Change https://golang.org/cl/349411 mentions this issue: |
Named type expansion and loading were conceptually similar: a mechanism for lazily resolving type information in a concurrency-safe manner. Unify them into a 'resolve' method, that delegates to a resolver func to produce type parameters, underlying, and methods. By leveraging the sync.Once field on Named for instance expansion, we get closer to making instance expansion concurrency-safe, and remove the requirement that instPos guard instantiation. This will be cleaned up in a follow-up CL. This also fixes #47887 by causing substituted type instances to be expanded (in the old code, this could be fixed by setting instPos when substituting). For #47910 Fixes #47887 Change-Id: Ifc52a420dde76e3a46ce494fea9bd289bc8aca4c Reviewed-on: https://go-review.googlesource.com/c/go/+/349410 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
Type instantiation is currently not concurrency-safe in go/types:
See also #47729: the only reason this hasn't triggered test failures due to data races is that we lack test coverage for concurrent use in go/types, and x/tools is not yet exercising type instantiation.
CC @griesemer
The text was updated successfully, but these errors were encountered: