summaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/go.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/internal/obj: change Prog.From3 to RestArgs ([]Addr)isharipo2017-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes it easier to express instructions with arbitrary number of operands. Rationale: previous approach with operand "hiding" does not scale well, AVX and especially AVX512 have many instructions with 3+ operands. x86 asm backend is updated to handle up to 6 explicit operands. It also fixes issue with 4-th immediate operand type checks. All `ytab` tables are updated accordingly. Changes to non-x86 backends only include these patterns: `p.From3 = X` => `p.SetFrom3(X)` `p.From3.X = Y` => `p.GetFrom3().X = Y` Over time, other backends can adapt Prog.RestArgs and reduce the amount of workarounds. -- Performance -- x/benchmark/build: $ benchstat upstream.bench patched.bench name old time/op new time/op delta Build-48 21.7s ± 2% 21.8s ± 2% ~ (p=0.218 n=10+10) name old binary-size new binary-size delta Build-48 10.3M ± 0% 10.3M ± 0% ~ (all equal) name old build-time/op new build-time/op delta Build-48 21.7s ± 2% 21.8s ± 2% ~ (p=0.218 n=10+10) name old build-peak-RSS-bytes new build-peak-RSS-bytes delta Build-48 145MB ± 5% 148MB ± 5% ~ (p=0.218 n=10+10) name old build-user+sys-time/op new build-user+sys-time/op delta Build-48 21.0s ± 2% 21.2s ± 2% ~ (p=0.075 n=10+10) Microbenchmark shows a slight slowdown. name old time/op new time/op delta AMD64asm-4 49.5ms ± 1% 49.9ms ± 1% +0.67% (p=0.001 n=23+15) func BenchmarkAMD64asm(b *testing.B) { for i := 0; i < b.N; i++ { TestAMD64EndToEnd(nil) TestAMD64Encoder(nil) } } Change-Id: I4f1d37b5c2c966da3f2127705ccac9bff0038183 Reviewed-on: https://go-review.googlesource.com/63490 Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/internal/objabi: extract shared functionality from objMatthew Dempsky2017-04-191-72/+0
| | | | | | | | | | | | | | | | | | | | | | | Now only cmd/asm and cmd/compile depend on cmd/internal/obj. Changing the assembler backends no longer requires reinstalling cmd/link or cmd/addr2line. There's also now one canonical definition of the object file format in cmd/internal/objabi/doc.go, with a warning to update all three implementations. objabi is still something of a grab bag of unrelated code (e.g., flag and environment variable handling probably belong in a separate "tool" package), but this is still progress. Fixes #15165. Fixes #20026. Change-Id: Ic4b92fac7d0d35438e0d20c9579aad4085c5534c Reviewed-on: https://go-review.googlesource.com/40972 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* cmd/compile: insert scheduling checks on loop backedgesDavid Chase2017-01-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loop breaking with a counter. Benchmarked (see comments), eyeball checked for sanity on popular loops. This code ought to handle loops in general, and properly inserts phi functions in cases where the earlier version might not have. Includes test, plus modifications to test/run.go to deal with timeout and killing looping test. Tests broken by the addition of extra code (branch frequency and live vars) for added checks turn the check insertion off. If GOEXPERIMENT=preemptibleloops, the compiler inserts reschedule checks on every backedge of every reducible loop. Alternately, specifying GO_GCFLAGS=-d=ssa/insert_resched_checks/on will enable it for a single compilation, but because the core Go libraries contain some loops that may run long, this is less likely to have the desired effect. This is intended as a tool to help in the study and diagnosis of GC and other latency problems, now that goal STW GC latency is on the order of 100 microseconds or less. Updates #17831. Updates #10958. Change-Id: I6206c163a5b0248e3f21eb4fc65f73a179e1f639 Reviewed-on: https://go-review.googlesource.com/33910 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
* build: enable framepointer mode by defaultRuss Cox2016-05-261-4/+16
| | | | | | | | | | | | | | | | | | This has a minor performance cost, but far less than is being gained by SSA. As an experiment, enable it during the Go 1.7 beta. Having frame pointers on by default makes Linux's perf, Intel VTune, and other profilers much more useful, because it lets them gather a stack trace efficiently on profiling events. (It doesn't help us that much, since when we walk the stack we usually need to look up PC-specific information as well.) Fixes #15840. Change-Id: I4efd38412a0de4a9c87b1b6e5d11c301e63f1a2a Reviewed-on: https://go-review.googlesource.com/23451 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: move Nocache helper to arm back endDave Cheney2016-03-211-9/+0
| | | | | | | | | | The obj.Nocache helper was only used by the arm back end, move it there. Change-Id: I5c9faf995499991ead1f3d8c8ffc3b6af7346876 Reviewed-on: https://go-review.googlesource.com/20868 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: fix build breakage from making From3 a pointerBrad Fitzpatrick2015-05-291-1/+3
| | | | | | | | Change-Id: I55a7f455ebbd6b1bd6912aae82c0fcff6f43387c Reviewed-on: https://go-review.googlesource.com/10512 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: make Prog.From3 a pointerRuss Cox2015-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | It is almost never set and Addr is large, so having the full struct in the Prog wastes memory most of the time. Before (on a 64-bit system): $ sizeof -p cmd/internal/obj Addr Prog Addr 80 Prog 376 $ After: $ sizeof -p cmd/internal/obj Addr Prog Addr 80 Prog 304 $ Change-Id: I491f201241f87543964a7d0f48b85830759be9d0 Reviewed-on: https://go-review.googlesource.com/10457 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* cmd/internal/obj: cleanups from C transition and delete dead codeBrad Fitzpatrick2015-04-171-60/+4
| | | | | | | Change-Id: Id1ecad2565edd5937a764dcf56b89263353f47c2 Reviewed-on: https://go-review.googlesource.com/8947 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/5g, cmd/internal/ld, cmd/internal/obj: destutter composite literalsMatthew Dempsky2015-04-111-8/+2
| | | | | | | | | | | | | | | | While here, this changes DWAbbrev's attr field from a [30]DWAttrForm with zero-termination to a simple []DWAttrForm, and updates its users accordingly. Passes "go build -toolexec 'toolstash -cmp' -a std" on linux/amd64. Change-Id: I52b5f7a749bdb3e7588fc8ebdb8fee2cf8cab602 Reviewed-on: https://go-review.googlesource.com/8762 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
* cmd/internal/gc: move cgen, regalloc, et al to portable codeRuss Cox2015-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL moves the bulk of the code that has been copy-and-pasted since the initial 386 port back into a shared place, cutting 5 copies to 1. The motivation here is not cleanup per se but instead to reduce the cost of introducing changes in shared concepts like regalloc or general expression evaluation. For example, a change after this one will implement x.(*T) without a call into the runtime. This CL makes that followup work 5x easier. The single copy still has more special cases for architecture details than I'd like, but having them called out explicitly like this at least opens the door to generalizing the conditions and smoothing out the distinctions in the future. This is a LARGE CL. I started by trying to pull in one function at a time in a sequence of CLs and it became clear that everything was so interrelated that it had to be moved as a whole. Apologies for the size. It is not clear how many more releases this code will matter for; eventually it will be replaced by Keith's SSA work. But as noted above, the deduplication was necessary to reduce the cost of working on the current code while we have it. Passes tests on amd64, 386, arm, and ppc64le. Can build arm64 binaries but not tested there. Being able to build binaries means it is probably very close. Change-Id: I735977f04c0614f80215fb12966dfe9bbd1f5861 Reviewed-on: https://go-review.googlesource.com/7853 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* [dev.cc] cmd/5g etc: code cleanup: delay var decls and eliminate dead codeRuss Cox2015-02-231-3/+1
| | | | | | | | | | | | | | | | | Ran rsc.io/grind rev 6f0e601 on the source files. The cleanups move var declarations as close to the use as possible, splitting disjoint uses of the var into separate variables. They also remove dead code (especially in func sudoaddable), which helps with the var moving. There's more cleanup to come, but this alone cuts the time spent compiling html/template on my 2013 MacBook Pro from 3.1 seconds to 2.3 seconds. Change-Id: I4de499f47b1dd47a560c310bbcde6b08d425cfd6 Reviewed-on: https://go-review.googlesource.com/5637 Reviewed-by: Rob Pike <r@golang.org>
* [dev.cc] cmd/internal/obj, cmd/internal/gc, new6g: reconvertRuss Cox2015-02-201-7/+5
| | | | | | | | | | | | | Reconvert using rsc.io/c2go rev 27b3f59. Changes to converter: - fatal does not return, so no fallthrough after fatal in switch - many more function results and variables identified as bool - simplification of negated boolean expressions Change-Id: I3bc67da5e46cb7ee613e230cf7e9533036cc870b Reviewed-on: https://go-review.googlesource.com/5171 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* [dev.cc] cmd/internal/gc, cmd/new6g etc: convert from cmd/gc, cmd/6g etcRuss Cox2015-02-171-12/+75
| | | | | | | | First draft of converted Go compiler, using rsc.io/c2go rev 83d795a. Change-Id: I29f4c7010de07d2ff1947bbca9865879d83c32c3 Reviewed-on: https://go-review.googlesource.com/4851 Reviewed-by: Rob Pike <r@golang.org>
* [dev.cc] cmd/internal/obj: reconvert from liblinkRuss Cox2015-02-051-0/+63
| | | | | | | | | | | | | | | | | | | | | | cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256. - Brings in new, more regular Prog, Addr definitions - Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion. - Update objwriter for change in TEXT size encoding. - Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand). - Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm. They need to be updated for the changes. - Reenable verifyAsm in cmd/go. - Reenable GOOBJ=2 mode by default in liblink. All architectures build successfully again. Change-Id: I2c845c5d365aa484b570476898171bee657b626d Reviewed-on: https://go-review.googlesource.com/3963 Reviewed-by: Rob Pike <r@golang.org>
* [dev.cc] cmd/internal/obj: convert liblink C to GoRuss Cox2015-01-211-0/+21
This CL adds the real cmd/internal/obj packages. Collectively they correspond to the liblink library. The conversion was done using rsc.io/c2go's run script at rsc.io/c2go repo version 706fac7. This is not the final conversion, just the first working draft. There will be more updates, but this works well enough to use with go tool objwriter and pass all.bash. Change-Id: I9359e835425f995a392bb2fcdbebf29511477bed Reviewed-on: https://go-review.googlesource.com/3046 Reviewed-by: Ian Lance Taylor <iant@golang.org>