aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-08-18 21:13:11 -0400
committerRuss Cox <rsc@golang.org>2014-08-18 21:13:11 -0400
commit1806a5732b373e5a9048765db533bcb33952a067 (patch)
tree5ce3a35d9de9e7f817f82a4dc3f09775bfb643d0 /src/pkg/runtime/malloc.c
parent2e2beb567cb2a59a8b54d8f2cd3fbd8eb1116013 (diff)
downloadgo-1806a5732b373e5a9048765db533bcb33952a067.tar.xz
cmd/gc, runtime: refactor interface inlining decision into compiler
We need to change the interface value representation for concurrent garbage collection, so that there is no ambiguity about whether the data word holds a pointer or scalar. This CL does NOT make any representation changes. Instead, it removes representation assumptions from various pieces of code throughout the tree. The isdirectiface function in cmd/gc/subr.c is now the only place that decides that policy. The policy propagates out from there in the reflect metadata, as a new flag in the internal kind value. A follow-up CL will change the representation by changing the isdirectiface function. If that CL causes problems, it will be easy to roll back. Update #8405. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://golang.org/cl/129090043
Diffstat (limited to 'src/pkg/runtime/malloc.c')
-rw-r--r--src/pkg/runtime/malloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/malloc.c b/src/pkg/runtime/malloc.c
index 8b9447dad6..f4143669e7 100644
--- a/src/pkg/runtime/malloc.c
+++ b/src/pkg/runtime/malloc.c
@@ -459,7 +459,7 @@ setFinalizer(Eface obj, Eface finalizer)
}
if(finalizer.type != nil) {
runtime·createfing();
- if(finalizer.type->kind != KindFunc)
+ if((finalizer.type->kind&KindMask) != KindFunc)
goto badfunc;
ft = (FuncType*)finalizer.type;
if(ft->dotdotdot || ft->in.len != 1)
@@ -467,12 +467,12 @@ setFinalizer(Eface obj, Eface finalizer)
fint = *(Type**)ft->in.array;
if(fint == obj.type) {
// ok - same type
- } else if(fint->kind == KindPtr && (fint->x == nil || fint->x->name == nil || obj.type->x == nil || obj.type->x->name == nil) && ((PtrType*)fint)->elem == ((PtrType*)obj.type)->elem) {
+ } else if((fint->kind&KindMask) == KindPtr && (fint->x == nil || fint->x->name == nil || obj.type->x == nil || obj.type->x->name == nil) && ((PtrType*)fint)->elem == ((PtrType*)obj.type)->elem) {
// ok - not same type, but both pointers,
// one or the other is unnamed, and same element type, so assignable.
- } else if(fint->kind == KindInterface && ((InterfaceType*)fint)->mhdr.len == 0) {
+ } else if((fint->kind&KindMask) == KindInterface && ((InterfaceType*)fint)->mhdr.len == 0) {
// ok - satisfies empty interface
- } else if(fint->kind == KindInterface && runtime·ifaceE2I2((InterfaceType*)fint, obj, &iface)) {
+ } else if((fint->kind&KindMask) == KindInterface && runtime·ifaceE2I2((InterfaceType*)fint, obj, &iface)) {
// ok - satisfies non-empty interface
} else
goto badfunc;