aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-01-28 17:28:50 +0300
committerDmitry Vyukov <dvyukov@google.com>2015-01-28 15:33:10 +0000
commitfd85a6c64057402d809a15eb5ec0af8dba8b1256 (patch)
treefc4841682d0fa3ed9b34aac3e49ca8a834c0fb50 /src
parentb581ca5956e4cf60de2e32f91b51524054efb29c (diff)
downloadgo-fd85a6c64057402d809a15eb5ec0af8dba8b1256.tar.xz
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 <rsc@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/gc/walk.c6
1 files changed, 3 insertions, 3 deletions
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: