Skip to content

runtime: holes in FUNCDATA value space waste text segment memory #8604

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

Closed
mdempsky opened this issue Aug 27, 2014 · 3 comments
Closed

runtime: holes in FUNCDATA value space waste text segment memory #8604

mdempsky opened this issue Aug 27, 2014 · 3 comments

Comments

@mdempsky
Copy link
Contributor

In pkg/runtime/funcdata.h, we currently have:

#define PCDATA_ArgSize 0 /* argument size at CALL instruction */
#define PCDATA_StackMapIndex 1

#define FUNCDATA_ArgsPointerMaps 2 /* garbage collector blocks */
#define FUNCDATA_LocalsPointerMaps 3
#define FUNCDATA_DeadValueMaps 4

However, PCDATA and FUNCDATA values live in logically distinct spaces, so there appears
to be no reason to not number the FUNCDATA values 0,1,2 instead of 2,3,4.  Further,
because the FUNCDATA values are used to index into a flat vector, not using the 0 and 1
entries means we leave holes in each function's pclntab entry.

On linux/amd64, changing the FUNCDATA values to 0,1,2 reduces the text segment size (as
reported by the binutils "size" utility) for "go" by ~104kB, for
"gofmt" by ~45kB, and for "camlistored" by ~208kB:

Before:
$ size go gofmt camlistored 
   text    data     bss     dec     hex filename
6506842  136996  105784 6749622  66fdb6 go
2376046   85232   90984 2552262  26f1c6 gofmt
17051050     190256  130320 17371626    10911ea camlistored

After:
$ size go gofmt camlistored 
   text    data     bss     dec     hex filename
6403034  136996  105784 6645814  656836 go
2331118   85232   90984 2507334  264246 gofmt
16842586     190256  130320 17163162    105e39a camlistored
@gopherbot
Copy link
Contributor

Comment 1:

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

@ianlancetaylor
Copy link
Member

Comment 2:

Labels changed: added repo-main, release-none.

@ianlancetaylor
Copy link
Member

Comment 3:

This issue was closed by revision 3d128db.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Shrinks the text segment size by about 1.5% for the "go", "gofmt",
and "camlistored" commands on linux/amd64.

Before:
$ size go gofmt camlistored
   text	   data	    bss	    dec	    hex	filename
6506842	 136996	 105784	6749622	 66fdb6	go
2376046	  85232	  90984	2552262	 26f1c6	gofmt
17051050	 190256	 130320	17371626	10911ea	camlistored

After:
$ size go gofmt camlistored
   text	   data	    bss	    dec	    hex	filename
6403034	 136996	 105784	6645814	 656836	go
2331118	  85232	  90984	2507334	 264246	gofmt
16842586	 190256	 130320	17163162	105e39a	camlistored

Fixes golang#8604.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/137790043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Shrinks the text segment size by about 1.5% for the "go", "gofmt",
and "camlistored" commands on linux/amd64.

Before:
$ size go gofmt camlistored
   text	   data	    bss	    dec	    hex	filename
6506842	 136996	 105784	6749622	 66fdb6	go
2376046	  85232	  90984	2552262	 26f1c6	gofmt
17051050	 190256	 130320	17371626	10911ea	camlistored

After:
$ size go gofmt camlistored
   text	   data	    bss	    dec	    hex	filename
6403034	 136996	 105784	6645814	 656836	go
2331118	  85232	  90984	2507334	 264246	gofmt
16842586	 190256	 130320	17163162	105e39a	camlistored

Fixes golang#8604.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/137790043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants