mirror of
https://github.com/golang/go
synced 2024-11-24 06:30:22 -07:00
cmd/compile: use canonical stringslice/ representations in abiutils
A chunk of code in abiutils was synthesizing the internals of a Go string type as "struct { unsafe.Pointer, uintptr }" instead of the more canonical representation "struct { *uint8, int }" used elsewhere in the compiler. The abiutils type was being pulled into the code during late call expansion, which resulted in two different entries in the SSA named value table for the same variable piece, each with different types; this then confused DWARF location list generation. This patch changes the abiutils synthesized type to be consistent with other parts of the back end, and makes a similar change for synthesized slice types (use "struct { *uint8, int, int }"). Fixes #47354. Change-Id: If789031cdc7abaf215bc75ee6eb863defbe530be Reviewed-on: https://go-review.googlesource.com/c/go/+/362715 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
79e03a9281
commit
c49627e81b
@ -715,19 +715,20 @@ func setup() {
|
||||
synthOnce.Do(func() {
|
||||
fname := types.BuiltinPkg.Lookup
|
||||
nxp := src.NoXPos
|
||||
unsp := types.Types[types.TUNSAFEPTR]
|
||||
ui := types.Types[types.TUINTPTR]
|
||||
bp := types.NewPtr(types.Types[types.TUINT8])
|
||||
it := types.Types[types.TINT]
|
||||
synthSlice = types.NewStruct(types.NoPkg, []*types.Field{
|
||||
types.NewField(nxp, fname("ptr"), unsp),
|
||||
types.NewField(nxp, fname("len"), ui),
|
||||
types.NewField(nxp, fname("cap"), ui),
|
||||
types.NewField(nxp, fname("ptr"), bp),
|
||||
types.NewField(nxp, fname("len"), it),
|
||||
types.NewField(nxp, fname("cap"), it),
|
||||
})
|
||||
types.CalcStructSize(synthSlice)
|
||||
synthString = types.NewStruct(types.NoPkg, []*types.Field{
|
||||
types.NewField(nxp, fname("data"), unsp),
|
||||
types.NewField(nxp, fname("len"), ui),
|
||||
types.NewField(nxp, fname("data"), bp),
|
||||
types.NewField(nxp, fname("len"), it),
|
||||
})
|
||||
types.CalcStructSize(synthString)
|
||||
unsp := types.Types[types.TUNSAFEPTR]
|
||||
synthIface = types.NewStruct(types.NoPkg, []*types.Field{
|
||||
types.NewField(nxp, fname("f1"), unsp),
|
||||
types.NewField(nxp, fname("f2"), unsp),
|
||||
|
Loading…
Reference in New Issue
Block a user