diff options
author | hopehook <hopehook.com@gmail.com> | 2022-02-12 17:03:19 +0800 |
---|---|---|
committer | Emmanuel Odeke <emmanuel@orijtech.com> | 2022-04-04 04:04:18 +0000 |
commit | 884e75fa53529321352a18538fe9e02fd485c49a (patch) | |
tree | 212d1ab18bab6c996329d8f8c5cf062c4ab450e5 /src/reflect/value.go | |
parent | a92ca515077e5cf54673eb8c5c2d9db4824330db (diff) | |
download | go-884e75fa53529321352a18538fe9e02fd485c49a.tar.gz go-884e75fa53529321352a18538fe9e02fd485c49a.zip |
reflect: fix the collision of variable name and package name
The return value "abi" of func "funcLayout" is the same as package
"internal/abi", which currently works fine, but it is more reliable to
avoid conflicts.
Change-Id: I83715dd79beff7cb3fc25747fef186dc0e2dfa8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/385414
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Diffstat (limited to 'src/reflect/value.go')
-rw-r--r-- | src/reflect/value.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/reflect/value.go b/src/reflect/value.go index 7a20b6bd23..8410dfc30a 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -453,7 +453,7 @@ func (v Value) call(op string, in []Value) []Value { var regArgs abi.RegArgs // Compute frame type. - frametype, framePool, abi := funcLayout(t, rcvrtype) + frametype, framePool, abid := funcLayout(t, rcvrtype) // Allocate a chunk of memory for frame if needed. var stackArgs unsafe.Pointer @@ -470,7 +470,7 @@ func (v Value) call(op string, in []Value) []Value { if debugReflectCall { println("reflect.call", t.String()) - abi.dump() + abid.dump() } // Copy inputs into args. @@ -481,7 +481,7 @@ func (v Value) call(op string, in []Value) []Value { // Guaranteed to only be one word in size, // so it will only take up exactly 1 abiStep (either // in a register or on the stack). - switch st := abi.call.steps[0]; st.kind { + switch st := abid.call.steps[0]; st.kind { case abiStepStack: storeRcvr(rcvr, stackArgs) case abiStepIntReg, abiStepPointer: @@ -507,7 +507,7 @@ func (v Value) call(op string, in []Value) []Value { // was possible to use space in the argument frame. v = v.assignTo("reflect.Value.Call", targ, nil) stepsLoop: - for _, st := range abi.call.stepsForValue(i + inStart) { + for _, st := range abid.call.stepsForValue(i + inStart) { switch st.kind { case abiStepStack: // Copy values to the "stack." @@ -552,10 +552,10 @@ func (v Value) call(op string, in []Value) []Value { // TODO(mknyszek): Remove this when we no longer have // caller reserved spill space. frameSize = align(frameSize, goarch.PtrSize) - frameSize += abi.spill + frameSize += abid.spill // Mark pointers in registers for the return path. - regArgs.ReturnIsPtr = abi.outRegPtrs + regArgs.ReturnIsPtr = abid.outRegPtrs if debugReflectCall { regArgs.Dump() @@ -567,7 +567,7 @@ func (v Value) call(op string, in []Value) []Value { } // Call. - call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abi.retOffset), uint32(frameSize), ®Args) + call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abid.retOffset), uint32(frameSize), ®Args) // For testing; see TestCallMethodJump. if callGC { @@ -585,7 +585,7 @@ func (v Value) call(op string, in []Value) []Value { // Zero the now unused input area of args, // because the Values returned by this function contain pointers to the args object, // and will thus keep the args object alive indefinitely. - typedmemclrpartial(frametype, stackArgs, 0, abi.retOffset) + typedmemclrpartial(frametype, stackArgs, 0, abid.retOffset) } // Wrap Values around return values in args. @@ -598,7 +598,7 @@ func (v Value) call(op string, in []Value) []Value { ret[i] = Zero(tv) continue } - steps := abi.ret.stepsForValue(i) + steps := abid.ret.stepsForValue(i) if st := steps[0]; st.kind == abiStepStack { // This value is on the stack. If part of a value is stack // allocated, the entire value is according to the ABI. So @@ -690,7 +690,7 @@ func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer, retValid *bool, regs ftyp := ctxt.ftyp f := ctxt.fn - _, _, abi := funcLayout(ftyp, nil) + _, _, abid := funcLayout(ftyp, nil) // Copy arguments into Values. ptr := frame @@ -701,7 +701,7 @@ func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer, retValid *bool, regs continue } v := Value{typ, nil, flag(typ.Kind())} - steps := abi.call.stepsForValue(i) + steps := abid.call.stepsForValue(i) if st := steps[0]; st.kind == abiStepStack { if ifaceIndir(typ) { // value cannot be inlined in interface data. @@ -791,7 +791,7 @@ func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer, retValid *bool, regs // target location used as scratch space. See issue 39541. v = v.assignTo("reflect.MakeFunc", typ, nil) stepsLoop: - for _, st := range abi.ret.stepsForValue(i) { + for _, st := range abid.ret.stepsForValue(i) { switch st.kind { case abiStepStack: // Copy values to the "stack." |