<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go.git/src/reflect, branch dev.cc</title>
<subtitle>code.google.com: Obsolete (use go-git)
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/'/>
<entry>
<title>[dev.cc] all: merge default (8d42099cdc23) into dev.cc</title>
<updated>2014-12-05T16:18:10+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2014-12-05T16:18:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=6d3ba1914e289ed223f7bb69f34604c0e2ae5384'/>
<id>6d3ba1914e289ed223f7bb69f34604c0e2ae5384</id>
<content type='text'>
TBR=austin
CC=golang-codereviews
https://codereview.appspot.com/178700044
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
TBR=austin
CC=golang-codereviews
https://codereview.appspot.com/178700044
</pre>
</div>
</content>
</entry>
<entry>
<title>reflect: Fix reflect.funcLayout.  The GC bitmap has two bits per</title>
<updated>2014-12-01T15:52:09+00:00</updated>
<author>
<name>Keith Randall</name>
<email>khr@golang.org</email>
</author>
<published>2014-12-01T15:52:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=ae637f5f9923cb1b798695597cdd0d0f4dea9464'/>
<id>ae637f5f9923cb1b798695597cdd0d0f4dea9464</id>
<content type='text'>
pointer, not one.

Fixes issue 9179

LGTM=iant, rsc
R=golang-codereviews, iant, rsc
CC=golang-codereviews
https://codereview.appspot.com/182160043
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pointer, not one.

Fixes issue 9179

LGTM=iant, rsc
R=golang-codereviews, iant, rsc
CC=golang-codereviews
https://codereview.appspot.com/182160043
</pre>
</div>
</content>
</entry>
<entry>
<title>[dev.cc] all: merge dev.power64 (7667e41f3ced) into dev.cc</title>
<updated>2014-11-14T17:10:52+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2014-11-14T17:10:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=6b31cfd20257f4d7226d5c4e95c67ed9b48ab58c'/>
<id>6b31cfd20257f4d7226d5c4e95c67ed9b48ab58c</id>
<content type='text'>
This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes.

These are the files that had merge conflicts and have been edited by hand:
        malloc.go
        mem_linux.go
        mgc.go
        os1_linux.go
        proc1.go
        panic1.go
        runtime1.go

LGTM=austin
R=austin
CC=golang-codereviews
https://codereview.appspot.com/174180043
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes.

These are the files that had merge conflicts and have been edited by hand:
        malloc.go
        mem_linux.go
        mgc.go
        os1_linux.go
        proc1.go
        panic1.go
        runtime1.go

LGTM=austin
R=austin
CC=golang-codereviews
https://codereview.appspot.com/174180043
</pre>
</div>
</content>
</entry>
<entry>
<title>[dev.cc] reflect: interfaces contain only pointers</title>
<updated>2014-11-11T06:23:01+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2014-11-11T06:23:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=e4007cd213bb488118d17dc520218b96f935d9be'/>
<id>e4007cd213bb488118d17dc520218b96f935d9be</id>
<content type='text'>
[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

Adjustments for changes made in CL 169360043.
This change is already present in the dev.garbage branch.

LGTM=r
R=r
CC=austin, golang-codereviews, iant, khr
https://codereview.appspot.com/167520044
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

Adjustments for changes made in CL 169360043.
This change is already present in the dev.garbage branch.

LGTM=r
R=r
CC=austin, golang-codereviews, iant, khr
https://codereview.appspot.com/167520044
</pre>
</div>
</content>
</entry>
<entry>
<title>[dev.power64] reflect: fix asm on power64x</title>
<updated>2014-10-31T19:29:03+00:00</updated>
<author>
<name>Austin Clements</name>
<email>austin@google.com</email>
</author>
<published>2014-10-31T19:29:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=80d520fcf0ef4c98f3da5f49b45e6559fd31be11'/>
<id>80d520fcf0ef4c98f3da5f49b45e6559fd31be11</id>
<content type='text'>
reflect/asm_power64x.s was missing changes made to other
platforms for stack maps.  This CL ports those changes.  With
this fix, the reflect test passes on power64x.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://codereview.appspot.com/170870043
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
reflect/asm_power64x.s was missing changes made to other
platforms for stack maps.  This CL ports those changes.  With
this fix, the reflect test passes on power64x.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://codereview.appspot.com/170870043
</pre>
</div>
</content>
</entry>
<entry>
<title>[dev.power64] all: merge default into dev.power64</title>
<updated>2014-10-22T19:51:54+00:00</updated>
<author>
<name>Austin Clements</name>
<email>austin@google.com</email>
</author>
<published>2014-10-22T19:51:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=fc92f8a400cf3e4d053940e0b86b72d6de27d67a'/>
<id>fc92f8a400cf3e4d053940e0b86b72d6de27d67a</id>
<content type='text'>
This brings dev.power64 up-to-date with the current tip of
default.  go_bootstrap is still panicking with a bad defer
when initializing the runtime (even on amd64).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/152570049
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This brings dev.power64 up-to-date with the current tip of
default.  go_bootstrap is still panicking with a bad defer
when initializing the runtime (even on amd64).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/152570049
</pre>
</div>
</content>
</entry>
<entry>
<title>build: merge the great pkg/ rename into dev.power64</title>
<updated>2014-10-22T17:25:37+00:00</updated>
<author>
<name>Austin Clements</name>
<email>austin@google.com</email>
</author>
<published>2014-10-22T17:25:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=800a826ae560191d4dbb6c529eea15cf4349a06f'/>
<id>800a826ae560191d4dbb6c529eea15cf4349a06f</id>
<content type='text'>
This also removes pkg/runtime/traceback_lr.c, which was ported
to Go in an earlier commit and then moved to
runtime/traceback.go.

Reviewer: rsc@golang.org
          rsc: LGTM
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This also removes pkg/runtime/traceback_lr.c, which was ported
to Go in an earlier commit and then moved to
runtime/traceback.go.

Reviewer: rsc@golang.org
          rsc: LGTM
</pre>
</div>
</content>
</entry>
<entry>
<title>reflect: fix TestAllocations now that interfaces hold only pointers</title>
<updated>2014-10-20T18:10:03+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2014-10-20T18:10:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=74129b9b1293587a102d80bca378ed5b6b908644'/>
<id>74129b9b1293587a102d80bca378ed5b6b908644</id>
<content type='text'>
This test was failing but did not break the build because it
was not run when -test.short was used.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/157150043
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This test was failing but did not break the build because it
was not run when -test.short was used.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/157150043
</pre>
</div>
</content>
</entry>
<entry>
<title>reflect: allocate correct type in assignTo and cvtT2I</title>
<updated>2014-10-20T17:43:43+00:00</updated>
<author>
<name>Ian Lance Taylor</name>
<email>iant@golang.org</email>
</author>
<published>2014-10-20T17:43:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=c4ad92767af6267cb87d4a50bffefe7bf9ca1948'/>
<id>c4ad92767af6267cb87d4a50bffefe7bf9ca1948</id>
<content type='text'>
I came across this while debugging a GC problem in gccgo.
There is code in assignTo and cvtT2I that handles assignment
to all interface values.  It allocates an empty interface even
if the real type is a non-empty interface.  The fields are
then set for a non-empty interface, but the memory is recorded
as holding an empty interface.  This means that the GC has
incorrect information.

This is extremely unlikely to fail, because the code in the GC
that handles empty interfaces looks like this:

obj = nil;
typ = eface-&gt;type;
if(typ != nil) {
        if(!(typ-&gt;kind&amp;KindDirectIface) || !(typ-&gt;kind&amp;KindNoPointers))
                obj = eface-&gt;data;

In the current runtime the condition is always true--if
KindDirectIface is set, then KindNoPointers is clear--and we
always want to set obj = eface-&gt;data.  So the question is what
happens when we incorrectly store a non-empty interface value
in memory marked as an empty interface.  In that case
eface-&gt;type will not be a *rtype as we expect, but will
instead be a pointer to an Itab.  We are going to use this
pointer to look at a *rtype kind field.  The *rtype struct
starts out like this:

type rtype struct {
        size          uintptr
        hash          uint32            // hash of type; avoids computation in hash tables
        _             uint8             // unused/padding
        align         uint8             // alignment of variable with this type
        fieldAlign    uint8             // alignment of struct field with this type
        kind          uint8             // enumeration for C

An Itab always has at least two pointers, so on a
little-endian 64-bit system the kind field will be the high
byte of the second pointer.  This will normally be zero, so
the test of typ-&gt;kind will succeed, which is what we want.

On a 32-bit system it might be possible to construct a failing
case by somehow getting the Itab for an interface with one
method to be immediately followed by a word that is all ones.
The effect would be that the test would sometimes fail and the
GC would not mark obj, leading to an invalid dangling
pointer.  I have not tried to construct this test.

I noticed this in gccgo, where this error is much more likely
to cause trouble for a rather random reason: gccgo uses a
different layout of rtype, and in gccgo the kind field happens
to be the low byte of a pointer, not the high byte.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/155450044
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I came across this while debugging a GC problem in gccgo.
There is code in assignTo and cvtT2I that handles assignment
to all interface values.  It allocates an empty interface even
if the real type is a non-empty interface.  The fields are
then set for a non-empty interface, but the memory is recorded
as holding an empty interface.  This means that the GC has
incorrect information.

This is extremely unlikely to fail, because the code in the GC
that handles empty interfaces looks like this:

obj = nil;
typ = eface-&gt;type;
if(typ != nil) {
        if(!(typ-&gt;kind&amp;KindDirectIface) || !(typ-&gt;kind&amp;KindNoPointers))
                obj = eface-&gt;data;

In the current runtime the condition is always true--if
KindDirectIface is set, then KindNoPointers is clear--and we
always want to set obj = eface-&gt;data.  So the question is what
happens when we incorrectly store a non-empty interface value
in memory marked as an empty interface.  In that case
eface-&gt;type will not be a *rtype as we expect, but will
instead be a pointer to an Itab.  We are going to use this
pointer to look at a *rtype kind field.  The *rtype struct
starts out like this:

type rtype struct {
        size          uintptr
        hash          uint32            // hash of type; avoids computation in hash tables
        _             uint8             // unused/padding
        align         uint8             // alignment of variable with this type
        fieldAlign    uint8             // alignment of struct field with this type
        kind          uint8             // enumeration for C

An Itab always has at least two pointers, so on a
little-endian 64-bit system the kind field will be the high
byte of the second pointer.  This will normally be zero, so
the test of typ-&gt;kind will succeed, which is what we want.

On a 32-bit system it might be possible to construct a failing
case by somehow getting the Itab for an interface with one
method to be immediately followed by a word that is all ones.
The effect would be that the test would sometimes fail and the
GC would not mark obj, leading to an invalid dangling
pointer.  I have not tried to construct this test.

I noticed this in gccgo, where this error is much more likely
to cause trouble for a rather random reason: gccgo uses a
different layout of rtype, and in gccgo the kind field happens
to be the low byte of a pointer, not the high byte.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/155450044
</pre>
</div>
</content>
</entry>
<entry>
<title>reflect: a few microoptimizations</title>
<updated>2014-10-17T16:54:31+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2014-10-17T16:54:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/go.git/commit/?id=18c74c4b8c6104f3d2afb412650a5e62cfb58e83'/>
<id>18c74c4b8c6104f3d2afb412650a5e62cfb58e83</id>
<content type='text'>
Replace i &lt; 0 || i &gt;= x with uint(i) &gt;= uint(x).
Shorten a few other code sequences.
Move the kind bits to the bottom of the flag word, to avoid shifts.

LGTM=r
R=r, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/159020043
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace i &lt; 0 || i &gt;= x with uint(i) &gt;= uint(x).
Shorten a few other code sequences.
Move the kind bits to the bottom of the flag word, to avoid shifts.

LGTM=r
R=r, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/159020043
</pre>
</div>
</content>
</entry>
</feed>
