]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: align function entry on arch-specific boundary
authorRuss Cox <rsc@golang.org>
Wed, 30 May 2012 20:26:38 +0000 (16:26 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 30 May 2012 20:26:38 +0000 (16:26 -0400)
16 seems pretty standard on x86 for function entry.
I don't know if ARM would benefit, so I used just 4
(single instruction alignment).

This has a minor absolute effect on the current timings.
The main hope is that it will make them more consistent from
run to run.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBinaryTree17    4222117400   4140739800   -1.93%
BenchmarkFannkuch11      3462631800   3259914400   -5.85%
BenchmarkGobDecode         20887622     20620222   -1.28%
BenchmarkGobEncode          9548772      9384886   -1.72%
BenchmarkGzip                151687       150333   -0.89%
BenchmarkGunzip                8742         8741   -0.01%
BenchmarkJSONEncode        62730560     65210990   +3.95%
BenchmarkJSONDecode       252569180    249394860   -1.26%
BenchmarkMandelbrot200      5267599      5273394   +0.11%
BenchmarkRevcomp25M       980813500    996013800   +1.55%
BenchmarkTemplate         361259100    360620840   -0.18%

R=ken2
CC=golang-dev
https://golang.org/cl/6244066

src/cmd/5l/l.h
src/cmd/6l/l.h
src/cmd/8l/l.h
src/cmd/ld/data.c

index 911f63e12f57f04084c74e9a6be825d5547f8969..9c0c4ff348a6d49d847c30cfeea5729eadb45568 100644 (file)
@@ -36,7 +36,8 @@
 enum
 {
        thechar = '5',
-       PtrSize = 4
+       PtrSize = 4,
+       FuncAlign = 4  // single-instruction alignment
 };
 
 #ifndef        EXTERN
index 5f62239a1eeebd3c58f1126f967da71aeb434ac2..b1611e016ab7b875dce282253b0019c5bd3150ea 100644 (file)
@@ -40,7 +40,8 @@
 enum
 {
        thechar = '6',
-       PtrSize = 8
+       PtrSize = 8,
+       FuncAlign = 16
 };
 
 #define        P               ((Prog*)0)
index b974f464bfa843345b32013f69bd95d318525b0f..75f1c070eadc0974fb8fc90628af20038fce7c4f 100644 (file)
@@ -40,7 +40,8 @@
 enum
 {
        thechar = '8',
-       PtrSize = 4
+       PtrSize = 4,
+       FuncAlign = 16
 };
 
 #define        P               ((Prog*)0)
index 1f64a84708d30034564d2f8fee19f5c1d3b87e8c..865f282114e489dc3d94512756a9ee0eaddf78fc 100644 (file)
@@ -1012,6 +1012,8 @@ textaddress(void)
                        continue;
                if(sym->align != 0)
                        va = rnd(va, sym->align);
+               else if(sym->text != P)
+                       va = rnd(va, FuncAlign);
                sym->value = 0;
                for(sub = sym; sub != S; sub = sub->sub) {
                        sub->value += va;