1
0
mirror of https://github.com/golang/go synced 2024-11-12 13:00:57 -07:00
Commit Graph

10505 Commits

Author SHA1 Message Date
Alex Brainman
a9257b6b69 cmd/link: delete shNames
Change-Id: Ie5d12ba4105fec17551637d066d0dffd508f74a4
Reviewed-on: https://go-review.googlesource.com/55261
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-16 05:13:18 +00:00
Alex Brainman
6aa386686c cmd/link: delete addpesection
Change-Id: Iee9db172d28d4d372fa617907078a494e764bf12
Reviewed-on: https://go-review.googlesource.com/55260
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-16 05:12:11 +00:00
Alex Brainman
babc5b1dd6 cmd/link: use peSection everywhere
Change-Id: I4d4e8452b9b9e628f3ea8b2b727ad63ec2a1dd31
Reviewed-on: https://go-review.googlesource.com/55259
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-16 05:11:09 +00:00
Alex Brainman
2c2b172377 cmd/link: add peSection
Change-Id: Id3aeeaeaacf5f079fb2ddad579f2f209b7fc0e06
Reviewed-on: https://go-review.googlesource.com/55258
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-16 05:10:22 +00:00
Alex Brainman
20832e6d4b cmd/link: introduce and use peFile and peStringTable
Change-Id: Icd13b32d35cde474c9292227471f916a64af88eb
Reviewed-on: https://go-review.googlesource.com/55257
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-16 05:09:08 +00:00
Josh Bleecher Snyder
a14a8a3eb9 cmd/compile: collapse runs of string constants in walkprint
This reduces the code footprint of code like:

println("foo=", foo, "bar=", bar)

which is fairly common in the runtime.

Prior to this change, this makes function calls to print each of:

"foo=", " ", foo, " ", "bar=", " ", bar, "\n"

After this change, this prints:

"foo= ", foo, " bar= ", bar, "\n"

This shrinks the hello world binary by 0.4%.
More importantly, this improves the instruction
density of important runtime routines.

Change-Id: I8971bdf5382fbaaf4a82bad4442f9da07c28d395
Reviewed-on: https://go-review.googlesource.com/55098
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-15 21:54:48 +00:00
Josh Bleecher Snyder
9de7990054 cmd/compile: insert ' ' and \n at beginning of walkprint
Rather than emitting spaces and newlines for println
as we walk the expression, construct it all up front.
This enables further optimizations.

This requires using printstring instead of print in
the implementation of printsp and printnl,
on pain of infinite recursion.
That's ok; it's more efficient anyway, and just as simple.
While we're here, do it for other print routines as well.

Change-Id: I61d7df143810e00710c4d4d948d904007a7fd190
Reviewed-on: https://go-review.googlesource.com/55097
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-15 21:54:30 +00:00
Josh Bleecher Snyder
385ca9ae9a cmd/compile: further simplify walkprint
Passes toolstash-check.

Change-Id: I6386a37a35221de8d3944253beee668927810f17
Reviewed-on: https://go-review.googlesource.com/55096
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-15 21:54:20 +00:00
Josh Bleecher Snyder
8b68fafd1f cmd/compile: simplify walkprint
Superficial simplifications: reduce variable scope,
eliminate pointless temporaries, use a switch statement.

Passes toolstash-check.

Change-Id: I6450493a0583a6ce8ec0461b66954cf1445a754f
Reviewed-on: https://go-review.googlesource.com/55095
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-15 21:53:43 +00:00
Keith Randall
89d74f5416 cmd/compile: set itab function pointers at compile time
I noticed that we don't set an itab's function pointers at compile
time. Instead, we currently do it at executable startup.

Set the function pointers at compile time instead. This shortens
startup time. It has no effect on normal binary size. Object files
will have more relocations, but that isn't a big deal.

For PIE there are additional pointers that will need to be adjusted at
load time. There are already other pointers in an itab that need to be
adjusted, so the cache line will already be paged in. There might be
some binary size overhead to mark these pointers. The "go test -c
-buildmode=pie net/http" binary is 0.18% bigger.

Update #20505

Change-Id: I267c82489915b509ff66e512fc7319b2dd79b8f7
Reviewed-on: https://go-review.googlesource.com/44341
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-15 19:00:03 +00:00
fanzha02
6e8b10397b cmd/internal/obj/arm64: fix assemble stxr/stxrw/stxrb/stxrh bug
The stxr/stxrw/stxrb/stxrh instructions belong to STLXR-like instructions
set and they require special handling. The current code has no special
handling for those instructions.

The fix adds the special handling for those instructions.

Uncomment stxr/stxrw/stxrb/stxrh test cases.

Fixes #21397
Change-Id: I31cee29dd6b30b1c25badd5c7574dda7a01bf016
Reviewed-on: https://go-review.googlesource.com/54951
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-15 14:05:29 +00:00
ph
4282ba0a65 cmd/internal/obj/arm64: improve arm64 wrapper prologue
Improve static branch prediction in arm64 wrapper prologue
by making the unusual case branch forwards. (Most other
architectures implement this optimization.)

Additionally, replace a CMP+BNE pair with a CBNZ
to save one instruction.

Change-Id: Id970038b34b4aaec18c101d62e2ee00f3e32a761
Reviewed-on: https://go-review.googlesource.com/54070
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-15 14:01:54 +00:00
philhofer
c59b495963 cmd/compile: add support for arm64 bit-test instructions
Add support for generating TBZ/TBNZ instructions.

The bit-test-and-branch pattern shows up in a number of
important places, including the runtime (gc bitmaps).

Before this change, there were 3 TB[N]?Z instructions in the Go tool,
all of which were in hand-written assembly. After this change, there
are 285. Also, the go1 benchmark binary gets about 4.5kB smaller.

Fixes #21361

Change-Id: I170c138b852754b9b8df149966ca5e62e6dfa771
Reviewed-on: https://go-review.googlesource.com/54470
Run-TryBot: Philip Hofer <phofer@umich.edu>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-15 13:39:11 +00:00
David du Colombier
583a941d4e cmd/link: skip TestSizes on Plan 9
TestSizes has been added in CL 55551. This test is
failing on Plan 9 because executables don't have
a DWARF symbol table.

Fixes #21453.

Change-Id: I560611b49aea5417e8c5ac0cec6c7882bd9f8335
Reviewed-on: https://go-review.googlesource.com/55692
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-08-15 10:10:42 +00:00
Martin Möhrmann
8a6e51aede cmd/compile: generate makechan calls with int arguments
Where possible generate calls to runtime makechan with int arguments
during compile time instead of makechan with int64 arguments.

This eliminates converting arguments for calls to makechan with
int64 arguments for platforms where int64 values do not fit into
arguments of type int.

A similar optimization for makeslice was introduced in CL
golang.org/cl/27851.

386:
name                old time/op  new time/op  delta
MakeChan/Byte       52.4ns ± 6%  45.0ns ± 1%  -14.14%  (p=0.000 n=10+10)
MakeChan/Int        54.5ns ± 1%  49.1ns ± 1%   -9.87%  (p=0.000 n=10+10)
MakeChan/Ptr         150ns ± 1%   143ns ± 0%   -4.38%  (p=0.000 n=9+7)
MakeChan/Struct/0   49.2ns ± 2%  43.2ns ± 2%  -12.27%  (p=0.000 n=10+10)
MakeChan/Struct/32  81.7ns ± 2%  76.2ns ± 1%   -6.71%  (p=0.000 n=10+10)
MakeChan/Struct/40  88.4ns ± 2%  82.5ns ± 2%   -6.60%  (p=0.000 n=10+10)

AMD64:
name                old time/op  new time/op  delta
MakeChan/Byte       83.4ns ± 8%  80.8ns ± 3%    ~     (p=0.171 n=10+10)
MakeChan/Int         101ns ± 3%   101ns ± 2%    ~     (p=0.412 n=10+10)
MakeChan/Ptr         128ns ± 1%   128ns ± 1%    ~     (p=0.191 n=10+10)
MakeChan/Struct/0   67.6ns ± 3%  68.7ns ± 4%    ~     (p=0.224 n=10+10)
MakeChan/Struct/32   138ns ± 1%   139ns ± 1%    ~     (p=0.185 n=10+9)
MakeChan/Struct/40   154ns ± 1%   154ns ± 1%  -0.55%  (p=0.027 n=10+9)

Change-Id: Ie854cb066007232c5e9f71ea7d6fe27e81a9c050
Reviewed-on: https://go-review.googlesource.com/55140
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-15 05:54:24 +00:00
Russ Cox
ef6978b218 cmd/link: implement R_X86_64_PC64 relocations
Change-Id: I1d7bd5cff7350a4e0f78b8efc8406e79c74732d1
Reviewed-on: https://go-review.googlesource.com/55370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-15 04:20:44 +00:00
Keith Randall
04d6f982ae runtime: remove link field from itab
We don't use it any more, remove it.

Change-Id: I76ce1a4c2e7048fdd13a37d3718b5abf39ed9d26
Reviewed-on: https://go-review.googlesource.com/44474
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-15 01:52:35 +00:00
Keith Randall
98d0634b7a runtime: remove bad field from itab
Just use fun[0]==0 to indicate a bad itab.

Change-Id: I28ecb2d2d857090c1ecc40b1d1866ac24a844848
Reviewed-on: https://go-review.googlesource.com/44473
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-15 01:52:29 +00:00
Keith Randall
3d1699ea78 runtime: new itab lookup table
Keep itabs in a growable hash table.
Use a simple open-addressable hash table, quadratic probing, power
of two sized.
Synchronization gets a bit more tricky. The common read path now
has two atomic reads, one to get the table pointer and one to read
the entry out of the table.

I set the max load factor to 75%, kind of arbitrarily. There's a
space-speed tradeoff here, and I'm not sure where we should land.

Because we use open addressing the itab.link field is no longer needed.
I'll remove it in a separate CL.

Fixes #20505

Change-Id: Ifb3d9a337512d6cf968c1fceb1eeaf89559afebf
Reviewed-on: https://go-review.googlesource.com/44472
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-15 01:52:23 +00:00
Hiroshi Ioka
1ee701e857 cmd/link: improve error message
ld.SymKind and objabi.RelocType have string representations,
which is human friendly. Prefer to use it.

Change-Id: I458ee0ca5866be0db8462c36cd053561a8206c95
Reviewed-on: https://go-review.googlesource.com/55253
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-15 00:28:27 +00:00
Hiroshi Ioka
4b38200bfd cmd/go: correctly quote environment variables in -x output
This fixes the -x output so that when it reports environment variables they
are correctly quoted for later execution by the shell.
Also fix -x output to use the right path to the pack tool, and note when
we are touching a file.

Fixes #21427

Change-Id: I323ef4edf9905b08bc26944b94183d8da2fa9675
Reviewed-on: https://go-review.googlesource.com/55350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-15 00:13:56 +00:00
Hiroshi Ioka
90ffc40e4f cmd/link: correct Mach-O file flag
Only set MH_NOUNDEFS if there are no undefined symbols.
Doesn't seem to matter, but may as well do it right.

Change-Id: I6c472e000578346c28cf0e10f24f870e3a0de628
Reviewed-on: https://go-review.googlesource.com/55310
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-15 00:13:10 +00:00
Keith Randall
f4abbc0e61 cmd/link,compile: Provide size for func types
They are currently not given a size, which makes the DWARF reader
very confused. Particularly things like [4]func() get a size of -4, not 32.

Fixes #21097

Change-Id: I01e754134d82fbbe6567e3c7847a4843792a3776
Reviewed-on: https://go-review.googlesource.com/55551
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 23:53:27 +00:00
Dmitry Vyukov
1f631a2f9a cmd/go: parallelize fmt
Currently go fmt formats all files sequentially.
That's a shame. Parallelize it over files.

Reduces time of go fmt ./... in std lib
from ~6.1s to ~0.9s.

Reduces time of go fmt github.com/google/syzkaller/...
from ~5.2s to ~1.8s.

Change-Id: I3d27fc25326106b2a4781e13506a25c12d5bcdc5
Reviewed-on: https://go-review.googlesource.com/45491
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-14 19:03:12 +00:00
Hiroshi Ioka
1f8433c66a cmd/link: don't link the same dylib multiple times
Also, unexport Machoadddynlib

n=`go test -c crypto/x509 && otool -l x509.test | grep libSystem | wc -l`

Before this CL, n = 3.
After this CL, n = 1.

on my environment.

Change-Id: Ic7b8157435cc85086404860dc6c84eb0aecc5d19
Reviewed-on: https://go-review.googlesource.com/44771
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Avelino <t@avelino.xxx>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 18:48:28 +00:00
Hiroshi Ioka
b7c600d6ba cmd/go, cmd/link: enable buildmode=pie on darwin/amd64
Change some configurations to enable the feature. Also add the test.
This CL doesn't include internal linking support which is tentatively
disabled due to #18968. We could do that another day.

Fixes #21220

Change-Id: I601d2d78446d36332acc70be0d5b9461ac635208
Reviewed-on: https://go-review.googlesource.com/54790
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 18:45:21 +00:00
Alberto Donizetti
cc4aac2b9b cmd/compile/internal/syntax: fix 'delimiters' spelling
Change-Id: Iffb52a0bdc479642eda3b5a12ba5da6590d0f0ec
Reviewed-on: https://go-review.googlesource.com/55330
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-14 14:13:22 +00:00
Hiroshi Ioka
b88e532a9e cmd/cgo: use first error position instead of last one
Just like https://golang.org/cl/34783

Given cgo.go:
     1	package main
     2
     3	/*
     4	long double x = 0;
     5	*/
     6	import "C"
     7
     8	func main() {
     9		_ = C.x
    10		_ = C.x
    11	}

Before:
    ./cgo.go:10:6: unexpected: 16-byte float type - long double

After:
    ./cgo.go:9:6: unexpected: 16-byte float type - long double

The above test case is not portable. So it is tested on only amd64.

Change-Id: If0b84cf73d381a22e2ada71c8e9a6e6ec77ffd2e
Reviewed-on: https://go-review.googlesource.com/54950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-14 05:29:11 +00:00
Hiroshi Ioka
5b43bbe63b cmd/link: prefer to use constants in macho.go
We might want to replace some linker's feature by debug/macho in future.
This CL gathers information of required constants.

Change-Id: Iea14abdb32709a4f5404a17874f9c925d29ba999
Reviewed-on: https://go-review.googlesource.com/55252
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 05:28:38 +00:00
Hiroshi Ioka
6424c40c22 cmd/link: don't emit default entry symbol in some situations
Also, fix comment.

Change-Id: Ieb7ba21f34730dc51ab45a652d225e4145d4b861
Reviewed-on: https://go-review.googlesource.com/54870
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-14 05:28:22 +00:00
Hiroshi Ioka
342d25fc05 cmd/link: remove redundant switch stmt
Change-Id: I5c4f8dc1e174b3438ef4fb509fac78d6e1b292c9
Reviewed-on: https://go-review.googlesource.com/54791
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Avelino <t@avelino.xxx>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-14 04:44:35 +00:00
Rob Pike
b1fab09901 cmd/vet: fix a couple of minor word choices in README
No semantic change, just clarifying a bit by choosing better words
in a couple of places.

Change-Id: I4496062ee7909baf83d4d22d25e13ef93b358b4b
Reviewed-on: https://go-review.googlesource.com/55255
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-14 04:15:59 +00:00
Austin Clements
c8e9fd5db0 Revert "Revert "cmd/compile: discard duplicate inline method bodies""
This reverts commit f612cd704a.

Reason for revert: We thought the original change had broken the
linux/amd64 and linux/386 builders, but it turned out to be a problem
with the build infrastructure, not the change.

Change-Id: Ic3318a63464fcba8d845ac04494115a7ba620364
Reviewed-on: https://go-review.googlesource.com/55050
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-14 01:38:08 +00:00
Cholerae Hu
57bf6aca71 runtime, cmd/compile: add intrinsic getclosureptr
Intrinsic enabled on all architectures,
runtime asm implementation removed on all architectures.

Fixes #21258

Change-Id: I2cb86d460b497c2f287a5b3df5c37fdb231c23a7
Reviewed-on: https://go-review.googlesource.com/53411
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2017-08-11 18:11:22 +00:00
Alberto Donizetti
adc28cb1e0 cmd/dist: add doc file to fix go doc dist
$ go tool -h says:

  For more about each tool command, see 'go tool command -h'.

but it was suggested to change the suggestion to say:

  see 'go doc command'

In #18313.

That would work for every tool except dist, which has no doc.go.

This change adds a doc.go file to cmd/dist.

Updates #18313

Change-Id: If67a21934b87647a69359d9c14d8de3775c587b7
Reviewed-on: https://go-review.googlesource.com/54351
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-11 18:00:53 +00:00
Austin Clements
a1eec645e1 cmd/trace: don't shift trace slices to 0
Currently all trace slices get shifted to start at time 0. This makes
it very difficult to find specific points in time unless they fall in
the first slice.

For example, right now when you click "View trace
(6.005646218s-8.155419698s)" on the trace tool's main page, the trace
view puts the first event in that slice at time 0. If you're looking
for something that happened at time 7s, you have to look at time
0.9943537s in the trace view. And if you want to subtract times taken
from different slices, you have to figure out what those time really
correspond to.

Fix this by telling the trace viewer not to shift the times when it
imports the trace. In the above example, this makes the view of that
second trace slice start at time 6.005646218s, so you don't have to do
any gymnastics to find or calculate times in later slices.

Change-Id: I04e0afda60f5573fdd8ad96238c24013297ef263
Reviewed-on: https://go-review.googlesource.com/54633
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-08-11 17:53:17 +00:00
Austin Clements
55f19b8d1d cmd/trace: update HTML; expand viewer to whole window
This updates the HTML served for the trace viewer to follow the latest
revision of the example from the upstream tracing project.

The main thing this adds is CSS for the trace viewer (which was
actually in the example at the originally referenced revision, so I'm
not sure why it got dropped). In particular, this expands the trace
viewer to use the entire browser client area, which fixes several
problems with the current page:

1. The details pane gets cut off at a strange place and can get a
scroll bar even if there's plenty of room below it on the page. This
fixes the bottom of the details pane to the bottom of the window.

2. If the track view is very tall (lots of procs), there's no way to
view the top tracks and the details pane at the same time. This fixes
this problem by limiting the height of the track view to something
less than the height of the window so it gets a scroll bar of its own
if necessary.

3. Dragging the divider between the track pane and the details pane
actually moves the bottom of the details pane without moving the
divider. Fixing the height of the trace viewer fixes this problem.

Change-Id: Ia811e72a7413417ca21c45e932c9db2724974633
Reviewed-on: https://go-review.googlesource.com/54632
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-08-11 17:52:41 +00:00
Gerrit Code Review
385cd6681b Merge "Merge remote-tracking branch 'origin/dev.debug' into master" 2017-08-11 17:47:15 +00:00
Lynn Boger
0f19e24da7 cmd/compile: intrinsics for trunc, floor, ceil on ppc64x
This implements trunc, floor, and ceil in the math package
as intrinsics on ppc64x.  Significant improvement mainly due
to avoiding call overhead of args and return value.

BenchmarkCeil-16                    5.95          0.69          -88.40%
BenchmarkFloor-16                   5.95          0.69          -88.40%
BenchmarkTrunc-16                   5.82          0.69          -88.14%

Updates #21390

Change-Id: I951e182694f6e0c431da79c577272b81fb0ebad0
Reviewed-on: https://go-review.googlesource.com/54654
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
2017-08-11 16:35:49 +00:00
Austin Clements
6f6a9398e2 Merge remote-tracking branch 'origin/dev.debug' into master
Change-Id: I85df2745af666b533f4f6f1d06f7c8e137590b5b
2017-08-11 12:17:43 -04:00
Hiroshi Ioka
62f8494e1d cmd/cgo: remove unused code
Change-Id: I8d295ea32bf56adc42171947133f3e16a88664c6
Reviewed-on: https://go-review.googlesource.com/54911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-11 04:42:59 +00:00
Hiroshi Ioka
d02647242d cmd/link: check magic header
Change-Id: I84b0e1d86728a76bc6a87fee4accf6fc43d87006
Reviewed-on: https://go-review.googlesource.com/54814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-11 01:51:34 +00:00
Josh Bleecher Snyder
3b87defe4e cmd/compile: unexport gc.Sysfunc
Updates #21352

Change-Id: If21342f30be32e25840b4072b932a6d4257b420d
Reviewed-on: https://go-review.googlesource.com/54091
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Avelino <t@avelino.xxx>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-11 00:27:35 +00:00
Dave Cheney
f612cd704a Revert "cmd/compile: discard duplicate inline method bodies"
This reverts commit f0b3626904.

Reason for revert: this change caused the runtime tests on all linux/amd64 and linux/386 builders to timeout

Change-Id: Idf8cfdfc84540e21e8da403e74df5596a1d9327b
Reviewed-on: https://go-review.googlesource.com/54490
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-10 01:35:28 +00:00
Daniel Martí
3de8498b25 cmd/compile: remove some unused params in gc
Mostly node and position parameters that are no longer used.

Also remove an unnecessary node variable while at it.

Found with github.com/mvdan/unparam.

Change-Id: I88f9bd5d20bfc5b0f6f63ea81869daa246175061
Reviewed-on: https://go-review.googlesource.com/54130
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-09 22:29:19 +00:00
Matthew Dempsky
f0b3626904 cmd/compile: discard duplicate inline method bodies
If we've already imported a named type, then there's no need to
process its associated methods except to validate that the signature
matches the existing known method.

However, the current import code still creates a new function node for
each method, saves its inline body (if any), and adds the node to the
global importlist. Because of this, the duplicate methods are never
garbage collected.

This CL changes the compiler to avoid amassing uncollectable garbage
or performing any unnecessary processing.

This is particularly noticeable for protobuf-heavy code. For the
motivating Go package, this CL reduced compile max-RSS from ~12GB to
~3GB and compile time from ~65s to ~50s.

Passes toolstash -cmp for std, cmd, and k8s.io/kubernetes/cmd/....

Change-Id: Ib53ba9f2ad3212995671cf6ba220ee8a56d8d009
Reviewed-on: https://go-review.googlesource.com/51331
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2017-08-09 21:57:50 +00:00
Lynn Boger
3e7abf82e3 cmd/go,cmd/link: support buildmode c-shared on ppc64le
This change enables buildmode c-shared on ppc64le.

A bug was fixed in runtime/rt0_linux_ppc64le.s that was necessary to
make this work.  In _rt0_ppc64le_linux_lib, there is code to store
the value of r2 onto the caller's stack.  However, if this file
is compiled using a build mode that maintains the TOC address in
r2, then instructions will be inserted at the beginning of this
function to generate the r2 value for the callee, not the caller.
That means the r2 value for the callee is stored onto the caller's
stack.  If caller and callee don't have the same r2 values, then
the caller will restore the wrong r2 value after it returns.  This
situation can happen when using dlopen since the caller of this
function will be in ld64.so and will definitely have a different
TOC.

Updates #20756

Change-Id: I6e165e0d0716e73721bbbcc520e8302e4856e3ba
Reviewed-on: https://go-review.googlesource.com/53890
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-09 17:11:38 +00:00
Daniel Martí
bef0055a0a cmd/vet: check that C receivers are cgo imports
Otherwise, vet might have false positives when "C" is a variable and
we're just using a method on it. Or when an import was renamed to "C".

Add test files for both of these cases.

Fixes #20655.

Change-Id: I55fb93119444a67fcf7891ad92653678cbd4670e
Reviewed-on: https://go-review.googlesource.com/45551
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
2017-08-09 02:23:51 +00:00
Josh Bleecher Snyder
561b147e4b cmd/compile: use right shifts to eliminate bounds checks
These rules trigger a few times during make.bash.
When we eliminate boundedness checks from walk.go
we'll rely on them more heavily.

Updates #19692

Change-Id: I268c36ae2f1401c68dd685b15f2d30f5d6971176
Reviewed-on: https://go-review.googlesource.com/43775
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-09 00:21:25 +00:00
Josh Bleecher Snyder
2fe53d8d55 cmd/compile: remove gc.Sysfunc calls from 387 backend
gc.Sysfunc must not be called concurrently.
We set up runtime routines used by the backend
prior to doing any backend compilation.
I missed the 387 ones; fix that.

Sysfunc should have been unexported during 1.9.
I will rectify that in a subsequent CL.

Fixes #21352

Change-Id: I8386eaa1e05879c25c672b9c9fc693c938e9aeb6
Reviewed-on: https://go-review.googlesource.com/54090
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Avelino <t@avelino.xxx>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 00:19:58 +00:00