]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: clean up and improve reflect.methodValue comments
authorAustin Clements <austin@google.com>
Fri, 16 Dec 2016 16:57:25 +0000 (11:57 -0500)
committerAustin Clements <austin@google.com>
Mon, 19 Dec 2016 21:02:53 +0000 (21:02 +0000)
The runtime no longer hard-codes the offset of
reflect.methodValue.stack, so remove these obsolete comments. Also,
reflect.methodValue and runtime.reflectMethodValue must also agree
with reflect.makeFuncImpl, so update the comments on all three to
mention this.

This was pointed out by Minux on CL 31138.

Change-Id: Ic5ed1beffb65db76aca2977958da35de902e8e58
Reviewed-on: https://go-review.googlesource.com/34590
Reviewed-by: Keith Randall <khr@golang.org>
src/reflect/makefunc.go
src/runtime/traceback.go

index a7efeb8262a99b92fec548db8e0cbee7d1bb5d2d..885966db6fe92a35ebe1058e2f4e464f130b45db 100644 (file)
@@ -12,9 +12,12 @@ import (
 
 // makeFuncImpl is the closure value implementing the function
 // returned by MakeFunc.
+// The first two words of this type must be kept in sync with
+// methodValue and runtime.reflectMethodValue.
+// Any changes should be reflected in all three.
 type makeFuncImpl struct {
        code  uintptr
-       stack *bitVector // stack bitmap for args - offset known to runtime
+       stack *bitVector
        typ   *funcType
        fn    func([]Value) []Value
 }
@@ -70,11 +73,12 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
 // word in the passed-in argument frame.
 func makeFuncStub()
 
-// This type is partially duplicated as runtime.reflectMethodValue.
-// Any changes should be reflected in both.
+// The first two words of this type must be kept in sync with
+// makeFuncImpl and runtime.reflectMethodValue.
+// Any changes should be reflected in all three.
 type methodValue struct {
        fn     uintptr
-       stack  *bitVector // stack bitmap for args - offset known to runtime
+       stack  *bitVector
        method int
        rcvr   Value
 }
index 0049e82d631210d1346f736c6faa1ee53450c29f..180489fb2cfeb6165a20accf3c96df33c78dc02f 100644 (file)
@@ -546,7 +546,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
        return n
 }
 
-// reflectMethodValue is a partial duplicate of reflect.methodValue.
+// reflectMethodValue is a partial duplicate of reflect.makeFuncImpl
+// and reflect.methodValue.
 type reflectMethodValue struct {
        fn    uintptr
        stack *bitvector // args bitmap