From: Dmitry Vyukov Date: Wed, 28 Jan 2015 14:28:50 +0000 (+0300) Subject: cmd/gc: fix condition for fast pathed interface conversions X-Git-Tag: go1.5beta1~2246 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=fd85a6c64057402d809a15eb5ec0af8dba8b1256;p=gostls13.git cmd/gc: fix condition for fast pathed interface conversions For some reason the current conditions require the type to be "uintptr-shaped". This cuts off structs and arrays with a pointer. isdirectiface and width==widthptr is sufficient condition to enable the fast paths. Change-Id: I11842531e7941365413606cfd6c34c202aa14786 Reviewed-on: https://go-review.googlesource.com/3414 Reviewed-by: Russ Cox --- diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index c5901b799e..b1622ae177 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -883,8 +883,8 @@ walkexpr(Node **np, NodeList **init) case OCONVIFACE: walkexpr(&n->left, init); - // Optimize convT2E as a two-word copy when T is uintptr-shaped. - if(isnilinter(n->type) && isdirectiface(n->left->type) && n->left->type->width == widthptr && isint[simsimtype(n->left->type)]) { + // Optimize convT2E as a two-word copy when T is pointer-shaped. + if(isnilinter(n->type) && isdirectiface(n->left->type)) { l = nod(OEFACE, typename(n->left->type), n->left); l->type = n->type; l->typecheck = n->typecheck; @@ -927,7 +927,7 @@ walkexpr(Node **np, NodeList **init) l->addable = 1; ll = list(ll, l); - if(isdirectiface(n->left->type) && n->left->type->width == widthptr && isint[simsimtype(n->left->type)]) { + if(isdirectiface(n->left->type)) { /* For pointer types, we can make a special form of optimization * * These statements are put onto the expression init list: