diff options
| author | Russ Cox <rsc@golang.org> | 2014-12-29 16:15:05 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-01-06 00:28:03 +0000 |
| commit | ccdb50931f815fdf8de16f876478d7a1d0ee6696 (patch) | |
| tree | 262efa3aa8b20bbf5278a0ae201cf6ee581f6c4d /src/runtime/malloc.go | |
| parent | e5ef657264ef9b7c0bcd9b5c437fea2d602a2030 (diff) | |
| download | go-ccdb50931f815fdf8de16f876478d7a1d0ee6696.tar.xz | |
cmd/gc, runtime: make assertI2T and variants not variadic
A side effect of this change is that when assertI2T writes to the
memory for the T being extracted, it can use typedmemmove
for write barriers.
There are other ways we could have done this, but this one
finishes a TODO in package runtime.
Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.
Change-Id: Icbc8aabfd8a9b1f00be2e421af0e3b29fa54d01e
Reviewed-on: https://go-review.googlesource.com/2279
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 35660f4f44..58e770249f 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -807,7 +807,7 @@ func SetFinalizer(obj interface{}, finalizer interface{}) { // ok - satisfies empty interface goto okarg } - if _, ok := assertE2I2(ityp, obj); ok { + if assertE2I2(ityp, obj, nil) { goto okarg } } @@ -937,7 +937,7 @@ func runfinq() { if len(ityp.mhdr) != 0 { // convert to interface with methods // this conversion is guaranteed to succeed - we checked in SetFinalizer - *(*fInterface)(frame) = assertE2I(ityp, *(*interface{})(frame)) + assertE2I(ityp, *(*interface{})(frame), (*fInterface)(frame)) } default: throw("bad kind in runfinq") |
