The above program reports at run-time "panic: interface conversion: interface { T() go.shape.int_0 } is nil, not int".
I think the correct error is "panic: interface conversion: interface { T() int } is nil, not int".
The problem is the call to s.reflectType(src) in ssagen/ssa.go. This is too late to do dictionary lookups, so we end up using the *runtime._type for the shape type, rather than the user type.
We should push all the reflectdata.TypePtr / reflectdata.TypeLinksym calls earlier into the frontend, so they can be replaced with dictionary accesses when appropriate. Same applies to reflectdata.ITabAddr and reflectdata.ITabLSym.
These two tests fail with the 1.18 compiler frontend, because of
incomplete dictionary support. This CL adds the tests for Unified IR,
which currently handles them correctly, to make sure it doesn't repeat
the same errors.
Updates #53276.
Updates #53328.
Change-Id: I9f436495d28f2bc5707a17bd2527c86abacf91f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/411695
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
This CL adds alternate code paths for the frontend to plumb through
rtypes to package ssagen, so the latter doesn't have to use
reflectType (which in general will only have access to shape types).
Note: This CL doesn't yet plumb through the rtypes for variables that
escape to the heap. However, those rtypes are only used for calling
runtime.newobject, and the status quo as of Go 1.18 is already to use
shape rtypes for most runtime.newobject calls. (Longer term though, I
would like to get rid of shape rtypes altogether.)
Passes toolstash -cmp.
Updates #53276.
Change-Id: I76a281eca8300de2e701fbac89ead32f8568a5f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/413357
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
https://go.dev/play/p/3Ru8nGnvTQY
The above program reports at run-time "panic: interface conversion: interface { T() go.shape.int_0 } is nil, not int".
I think the correct error is "panic: interface conversion: interface { T() int } is nil, not int".
The problem is the call to
s.reflectType(src)
in ssagen/ssa.go. This is too late to do dictionary lookups, so we end up using the *runtime._type for the shape type, rather than the user type.We should push all the
reflectdata.TypePtr
/reflectdata.TypeLinksym
calls earlier into the frontend, so they can be replaced with dictionary accesses when appropriate. Same applies toreflectdata.ITabAddr
andreflectdata.ITabLSym
./cc @randall77 @dr2chase @cuonglm
The text was updated successfully, but these errors were encountered: