Commit c88893a0 by Ian Lance Taylor

runtime: correct runtime structfield type to match reflect

    
    The offset field in structfield has changed to offsetAnon, and now
    requires a shift to get the actual offset value.
    
    Fixes golang/go#23391
    
    Reviewed-on: https://go-review.googlesource.com/92275

From-SVN: r257413
parent 43fbc2e9
c02c71187c9794b50444e2858c582e66a3442ee8 1927b40e59e7c2067ecb03384b331d1be3cb5eea
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -189,7 +189,7 @@ func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) { ...@@ -189,7 +189,7 @@ func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) {
return return
} }
for _, f := range st.fields { for _, f := range st.fields {
cgoCheckArg(f.typ, add(p, f.offset), true, top, msg) cgoCheckArg(f.typ, add(p, f.offset()), true, top, msg)
} }
case kindPtr, kindUnsafePointer: case kindPtr, kindUnsafePointer:
if indir { if indir {
......
...@@ -117,7 +117,15 @@ type structfield struct { ...@@ -117,7 +117,15 @@ type structfield struct {
pkgPath *string // nil for exported Names; otherwise import path pkgPath *string // nil for exported Names; otherwise import path
typ *_type // type of field typ *_type // type of field
tag *string // nil if no tag tag *string // nil if no tag
offset uintptr // byte offset of field within struct offsetAnon uintptr // byte offset of field<<1 | isAnonymous
}
func (f *structfield) offset() uintptr {
return f.offsetAnon >> 1
}
func (f *structfield) anon() bool {
return f.offsetAnon&1 != 0
} }
type structtype struct { type structtype struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment