-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/ssa: Adds datastructures for function instantiation.
Adds [unexported] fields to Function for Origin, TypeParams, and TypeArguments. Populates TypeParameters for package level functions and methods. Adds datastructures for creating function instantiations. Tracking unique instantiations on Program. Adds map for canonicalizing lists of types. Updates golang/go#48525 Change-Id: I9cb01f2ed24a9cacf3a515444d0cc0474333e417 Reviewed-on: https://go-review.googlesource.com/c/tools/+/397714 Reviewed-by: Robert Findley <rfindley@google.com> Trust: Tim King <taking@google.com> Run-TryBot: Tim King <taking@google.com> gopls-CI: kokoro <noreply+kokoro@google.com>
- Loading branch information
1 parent
ee2bc8b
commit 7dd9f20
Showing
13 changed files
with
596 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Package b contains declarations of generic functions. | ||
package b | ||
|
||
import "unsafe" | ||
|
||
type Pointer[T any] struct { | ||
v unsafe.Pointer | ||
} | ||
|
||
func (x *Pointer[T]) Load() *T { | ||
return (*T)(LoadPointer(&x.v)) | ||
} | ||
|
||
func Load[T any](x *Pointer[T]) *T { | ||
return x.Load() | ||
} | ||
|
||
func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) | ||
|
||
// TODO(taking): Add calls from non-generic functions to instantiations of generic functions. | ||
// TODO(taking): Add globals with types that are instantiations of generic functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Package c is to test buildssa importing packages. | ||
package c | ||
|
||
import ( | ||
"a" | ||
"b" | ||
"unsafe" | ||
) | ||
|
||
func A() { | ||
_ = a.Fib(10) | ||
} | ||
|
||
func B() { | ||
var x int | ||
ptr := unsafe.Pointer(&x) | ||
_ = b.LoadPointer(&ptr) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.