Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: CL 36170 caused some .a archives to grow #18895

Closed
mdempsky opened this issue Feb 2, 2017 · 3 comments
Closed

cmd/compile: CL 36170 caused some .a archives to grow #18895

mdempsky opened this issue Feb 2, 2017 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mdempsky
Copy link
Member

mdempsky commented Feb 2, 2017

CL 36170 changed the exporter code's logic for identifying which objects need to be reexported. Most packages shrunk a little from this (0.08% geometric mean reduction), but a couple packages grew. Most notably, compress/zlib.a grew by 200 bytes.

The growth shouldn't be problematic, but it's somewhat unexpected. Seems worth double checking the cause.

I'm guessing it just caused objects to be exported in a different order, and some commonly referenced object ended up with a longer varint-encoded ID.

@mdempsky mdempsky added this to the Go1.9 milestone Feb 2, 2017
@bradfitz bradfitz added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 14, 2017
@bradfitz bradfitz modified the milestones: Go1.9Maybe, Go1.9 Jun 14, 2017
@bradfitz
Copy link
Contributor

Ping @mdempsky.

@mdempsky
Copy link
Member Author

zlib.a grew in size because after CL 36170, cmd/compile is no longer inlining (*adler32.digest).Reset into (*zlib.reader).Reset:

$ go build -a -toolexec=toolstash -gcflags=-m compress/zlib 2>&1 | grep 'compress/zlib/reader.go:175: inlining'
compress/zlib/reader.go:175: inlining call to adler32.New
compress/zlib/reader.go:175: inlining call to adler32.(*adler32.digest).Reset
$ go build -a -gcflags=-m compress/zlib 2>&1 | grep 'compress/zlib/reader.go:175: inlining'
compress/zlib/reader.go:175: inlining call to adler32.New

That's in turn because CL 36170 caused hash/adler32 to not export any of adler32.digest's method bodies. The cause is we now don't discover that we need to export adler32.digest until we're already writing out the adler32.New function body.

It looks like the problem is "for i, f := range p.funcList" in bexport.go. It needs to be changed to a non-range-based loop because funcList can now grow.

@gopherbot
Copy link

CL https://golang.org/cl/45817 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants