]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.garbage] cmd/gc: emit pointer write barriers
authorRuss Cox <rsc@golang.org>
Wed, 5 Nov 2014 20:43:41 +0000 (15:43 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 5 Nov 2014 20:43:41 +0000 (15:43 -0500)
This got lost in the change that added the writebarrierfat variants.

LGTM=rlh
R=rlh
CC=golang-codereviews
https://golang.org/cl/165510043

src/cmd/gc/walk.c

index 38bed1e22f7091165f2086a3650e6a73e0eebeda..37bd62dead35c206d5b598ec6990f3ed190a10d9 100644 (file)
@@ -2015,6 +2015,8 @@ applywritebarrier(Node *n, NodeList **init)
                l = nod(OADDR, n->left, N);
                l->etype = 1; // addr does not escape
                if(t->width == widthptr) {
+                       n = mkcall1(writebarrierfn("writebarrierptr", t, n->right->type), T, init,
+                               l, n->right);
                } else if(t->etype == TSTRING) {
                        n = mkcall1(writebarrierfn("writebarrierstring", t, n->right->type), T, init,
                                l, n->right);
@@ -2037,6 +2039,8 @@ applywritebarrier(Node *n, NodeList **init)
                        if(BitsPointer != (1<<PtrBit))
                                fatal("wrong PtrBit");
                        switch(t->width/widthptr) {
+                       default:
+                               fatal("found writebarrierfat for %d-byte object of type %T", (int)t->width, t);
                        case 2:
                                snprint(name, sizeof name, "writebarrierfat%d%d",
                                        bvget(bv, PtrBit), bvget(bv, BitsPerPointer+PtrBit));