Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(397)

Issue 83410044: code review 83410044: cmd/gc, runtime: make GODEBUG=gcdead=1 mode work with l... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by rsc
Modified:
11 years, 1 month ago
Reviewers:
aram2, gobot, khr, 0intro, khr1
CC:
khr, golang-codereviews
Visibility:
Public.

Description

cmd/gc, runtime: make GODEBUG=gcdead=1 mode work with liveness Trying to make GODEBUG=gcdead=1 work with liveness and in particular ambiguously live variables. 1. In the liveness computation, mark all ambiguously live variables as live for the entire function, except the entry. They are zeroed directly after entry, and we need them not to be poisoned thereafter. 2. In the liveness computation, compute liveness (and deadness) for all parameters, not just pointer-containing parameters. Otherwise gcdead poisons untracked scalar parameters and results. 3. Fix liveness debugging print for -live=2 to use correct bitmaps. (Was not updated for compaction during compaction CL.) 4. Correct varkill during map literal initialization. Was killing the map itself instead of the inserted value temp. 5. Disable aggressive varkill cleanup for call arguments if the call appears in a defer or go statement. 6. In the garbage collector, avoid bug scanning empty strings. An empty string is two zeros. The multiword code only looked at the first zero and then interpreted the next two bits in the bitmap as an ordinary word bitmap. For a string the bits are 11 00, so if a live string was zero length with a 0 base pointer, the poisoning code treated the length as an ordinary word with code 00, meaning it needed poisoning, turning the string into a poison-length string with base pointer 0. By the same logic I believe that a live nil slice (bits 11 01 00) will have its cap poisoned. Always scan full multiword struct. 7. In the runtime, treat both poison words (PoisonGC and PoisonStack) as invalid pointers that warrant crashes. Manual testing as follows: - Create a script called gcdead on your PATH containing: #!/bin/bash GODEBUG=gcdead=1 GOGC=10 GOTRACEBACK=2 exec "$@" - Now you can build a test and then run 'gcdead ./foo.test'. - More importantly, you can run 'go test -short -exec gcdead std' to run all the tests. Fixes issue 7676. While here, enable the precise scanning of slices, since that was disabled due to bugs like these. That now works, both with and without gcdead. Fixes issue 7549.

Patch Set 1 #

Patch Set 2 : diff -r 423f84bbb31e https://code.google.com/p/go/ #

Patch Set 3 : diff -r 423f84bbb31e https://code.google.com/p/go/ #

Patch Set 4 : diff -r 97ba656ccd5d https://code.google.com/p/go/ #

Patch Set 5 : diff -r 97ba656ccd5d https://code.google.com/p/go/ #

Patch Set 6 : diff -r ddfee9dfca20 https://code.google.com/p/go/ #

Patch Set 7 : diff -r ddfee9dfca20 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 8 : diff -r 5943000dd5ba https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -74 lines) Patch
M src/cmd/gc/esc.c View 1 2 3 4 7 chunks +19 lines, -19 lines 0 comments Download
M src/cmd/gc/plive.c View 1 2 3 4 5 6 7 14 chunks +43 lines, -22 lines 0 comments Download
M src/cmd/gc/sinit.c View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/malloc.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 4 5 6 7 3 chunks +34 lines, -22 lines 0 comments Download
M src/pkg/runtime/stack.c View 1 2 3 1 chunk +3 lines, -3 lines 0 comments Download
M test/live.go View 1 2 3 4 2 chunks +33 lines, -6 lines 0 comments Download

Messages

Total messages: 23
rsc
Hello khr (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
11 years, 2 months ago (2014-04-03 04:33:15 UTC) #1
rsc
I changed plive.c to enable recording slices as slices, not as ptr+scalar+scalar. It works. Likely ...
11 years, 2 months ago (2014-04-03 15:27:27 UTC) #2
khr
LGTM https://codereview.appspot.com/83410044/diff/90001/src/cmd/gc/plive.c File src/cmd/gc/plive.c (right): https://codereview.appspot.com/83410044/diff/90001/src/cmd/gc/plive.c#newcode1127 src/cmd/gc/plive.c:1127: bvset(bv, (*xoffset / widthptr) * BitsPerPointer + 4); ...
11 years, 2 months ago (2014-04-03 23:22:35 UTC) #3
rsc
retested all.bash and 'go test -short -exec gcdead std'. submitting. modulo undiscovered bugs, the liveness ...
11 years, 2 months ago (2014-04-04 00:26:23 UTC) #4
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=1474b280d7aa *** cmd/gc, runtime: make GODEBUG=gcdead=1 mode work with liveness Trying to ...
11 years, 2 months ago (2014-04-04 00:33:30 UTC) #5
gobot
This CL appears to have broken the freebsd-amd64 builder. See http://build.golang.org/log/2aae5bb946e02bc384584ebf2e7e44f4d2dd8d06
11 years, 2 months ago (2014-04-04 00:34:44 UTC) #6
0intro
It seems this change broke the Plan 9 build. src/pkg/math/abs.go:14: internal error: abs ~r1 (type ...
11 years, 2 months ago (2014-04-04 04:30:58 UTC) #7
0intro
It seems to be related to this change in src/cmd/gc/plive.c: switch(ll->n->class) { case PAUTO: + ...
11 years, 2 months ago (2014-04-04 04:52:28 UTC) #8
khr1
I cannot reproduce this error. Running: env GOOS=plan9 ./make.bash env GOOS=plan9 ../bin/go tool 6g -S ...
11 years, 2 months ago (2014-04-04 06:20:31 UTC) #9
0intro
> Can you try to resync the builder? I have the feeling it is in ...
11 years, 2 months ago (2014-04-04 06:27:37 UTC) #10
0intro
> I cannot reproduce this error. Running: > > env GOOS=plan9 ./make.bash > env GOOS=plan9 ...
11 years, 2 months ago (2014-04-04 06:31:16 UTC) #11
khr1
I also tried GOOS=plan9 GOARCH=386, same deal. On Thu, Apr 3, 2014 at 11:31 PM, ...
11 years, 2 months ago (2014-04-04 07:31:47 UTC) #12
0intro
> I also tried GOOS=plan9 GOARCH=386, same deal. Yes, I did the same on my ...
11 years, 2 months ago (2014-04-04 08:09:19 UTC) #13
rsc
This is going to be a bug in the Plan 9 C compiler miscompiling plive.c. ...
11 years, 2 months ago (2014-04-04 13:10:12 UTC) #14
aram2
I'm not near any Plan 9 terminal right now, could you paste the disassembly of ...
11 years, 2 months ago (2014-04-04 13:19:54 UTC) #15
0intro
> I'm not near any Plan 9 terminal right now, could you paste the > ...
11 years, 2 months ago (2014-04-04 13:46:07 UTC) #16
rsc
The problem is not in getvariables. The change to getvariables is working correctly: it enables ...
11 years, 2 months ago (2014-04-04 14:09:32 UTC) #17
0intro
The build failure is still present after reverting everything, except the getvariables change, so I ...
11 years, 2 months ago (2014-04-04 20:50:39 UTC) #18
0intro
for(j = 0; j < liveout->n; j++) { if(!bvget(liveout, j)) continue; n = *(Node**)arrayget(lv->vars, j); ...
11 years, 1 month ago (2014-04-05 09:50:23 UTC) #19
0intro
I've noticed info.flags contains the wrong value in plive.c:/^progeffects, so it takes the wrong branch ...
11 years, 1 month ago (2014-04-06 09:41:15 UTC) #20
rsc
This is not the Plan 9 C compiler's fault, at least not directly. The problem ...
11 years, 1 month ago (2014-04-06 14:22:15 UTC) #21
rsc
I submitted CL 84570045, which did in fact fix the Plan 9 build. I am ...
11 years, 1 month ago (2014-04-06 15:07:54 UTC) #22
0intro
11 years, 1 month ago (2014-04-06 16:12:24 UTC) #23
Thanks Russ!

-- 
David du Colombier
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b