s/Thearch/thearch/
This reduces the amount of exported global variables,
which in turn could make it easier to refactor them later.
Also updated somewhat vague comment about ld.Thearch.
There is no need for Thearch to be exported as Archinit is
called by ld.Main.
Updates #22095
Change-Id: I266b291f6eac0165f70c51964738206e066cea08
Reviewed-on: https://go-review.googlesource.com/103878
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
No need to disambiguate if we're exporting or reexporting, because
it's obvious from the output.
Change-Id: I59053d34dc6f8b29e20749c7b03c3cb4f4d641ff
Reviewed-on: https://go-review.googlesource.com/104236
Reviewed-by: Robert Griesemer <gri@golang.org>
We used to have three Sym flags for dealing with export/reexport:
Export, Package, and Exported.
Export and Package were used to distinguish whether a symbol is
exported or package-scope (i.e., mutually exclusive), except that for
local declarations Export served double-duty as tracking whether the
symbol had been added to exportlist.
Meanwhile, imported declarations that needed reexporting could be
added to exportlist multiple times, necessitating a flag to track
whether they'd already been written out by exporter.
Simplify all of these into a single OnExportList flag so that we can
ensure symbols on exportlist are present exactly once. Merge
reexportsym into exportsym so there's a single place where we append
to exportlist.
Code that used to set Exported to prevent a symbol from being exported
can now just set OnExportList before calling declare to prevent it
from even appearing on exportlist.
Lastly, drop the IsAlias check in exportsym: we call exportsym too
early for local symbols to detect if they're an alias, and we never
reexport aliases.
Passes toolstash-check.
Change-Id: Icdea3719105dc169fcd7651606589cd08b0a80ff
Reviewed-on: https://go-review.googlesource.com/103865
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently, we reexport any package-scope constant, function, type, or
variable declarations needed by an inlineable function body. However,
now that we have an early pass to walk inlineable function bodies
(golang.org/cl/74110), we can simplify the logic for finding these
declarations.
The binary export format supports writing out type declarations
in-place at their first use. Also, it always writes out constants by
value, so their declarations never need to be reexported.
Notably, we attempted this before (golang.org/cl/36170) and had to
revert it (golang.org/cl/45911). However, this was because while
writing out inline bodies, we could discover variable/function
dependencies. By collecting variable/function dependencies during
inlineable function discovery, we avoid this problem.
While here, get rid of isInlineable. We already typecheck inlineable
function bodies during inlFlood, so it's become a no-op. Just move the
comment explaining parameter numbering to its caller.
Change-Id: Ibbfaafce793733675d3a2ad98791758583055666
Reviewed-on: https://go-review.googlesource.com/103864
Reviewed-by: Robert Griesemer <gri@golang.org>
Rather than checking for each function whether the package supports
instrumentation, check once up front.
Relatedly, tweak the logic for preventing inlining calls to runtime
functions from instrumented packages. Previously, we simply disallowed
inlining runtime functions altogether when instrumenting. With this
CL, it's only disallowed from packages that are actually being
instrumented. That is, now intra-runtime calls can be inlined.
Updates #19054.
Change-Id: I88c97b48bf70193a8a3ee18d952dcb26b0369d55
Reviewed-on: https://go-review.googlesource.com/102815
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Fixes#24645
Change-Id: I914674451b6667c3ebaf012893503d9de58991ee
Reviewed-on: https://go-review.googlesource.com/104155
Run-TryBot: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Before, if an underlying writer errored within 10 bytes (plus any gzip
header metadata), a gzip.Write would erroneously report up to 10 bytes
written that were not actually written of the input slice. This is
especially problematic when the input slice is less than 10 bytes.
The error came from counting the 10 header byte write. If writing the
header is completely successful, the 10 bytes written is overridden by
the flate write with the input slice.
This removes counting the 10 required header bytes, and also changes the
return to use zero until the slice is used.
The old Write could return one byte written when it actually was not.
This is difficult to verify because the smallest input slice is one
byte; a test checking that the input slice was the byte written would be
quite involved. Thankfully, gzip's minimum header write is 10 bytes. If
we test that two bytes are not falsely written, we indirectly cover the
one byte case.
Fixes#24625
Change-Id: I1c1f8cd791e0c4cffc22aa8acd95186582c832ba
Reviewed-on: https://go-review.googlesource.com/103861
Reviewed-by: Joe Tsai <joetsai@google.com>
Run-TryBot: Joe Tsai <joetsai@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
When test/run script was removed, these two tests
were changed to be executed by test/run.go.
Because errchk does not exit with non-zero status on
errors, they were silently failing for a while.
This change makes 2 things:
1. Compile tested packages in GOROOT/test to match older runner script
behavior (strictly required only in bug345, optional in bug248)
2. Check command output with "(?m)^BUG" regexp.
It approximates older `grep -q '^BUG' that was used before.
See referenced issue for detailed explanation.
Fixes#24629
Change-Id: Ie888dcdb4e25cdbb19d434bbc5cb03eb633e9ee8
Reviewed-on: https://go-review.googlesource.com/104095
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Eliminates an inconsistency between user functions and generated
functions.
Passes toolstash-check.
Change-Id: I946b511ca81d88a0024b5932cb50f3d8b9e808f4
Reviewed-on: https://go-review.googlesource.com/103863
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Extract all rewrite-to-OLITERAL expressions to use a single setconst
helper function.
Does not pass toolstash-check for two reasons:
1) We now consistently clear Left/Right/etc when rewriting Nodes into
OLITERALs, which results in their inlining complexity being correctly
computed. So more functions can now be inlined.
2) We preserve Pos, so PC line tables change somewhat.
Change-Id: I2b5c293bee7c69c2ccd704677f5aba4ec40e3155
Reviewed-on: https://go-review.googlesource.com/103860
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
When the flag package first begin printing nonzero defaults, the test
was against a fixed set of string representations of zero values.
This worked until the string representation of a time.Duration
changed from "0" to "0s", causing the zero Duration to register as
nonzero. The flag package then added reflect-based code that fell back
to the old test. This failed to work when a nonzero default for a flag
happened to be the string representation of one the original fixed set
of zero values in the original test. This change removes the original
test, allowing the reflect-based code to be the only deciding factor.
Fixes#23543
Change-Id: I582ce554d6729e336fdd96fb27340674c15350d8
Reviewed-on: https://go-review.googlesource.com/103867
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This reverts commit CL 103975 (a9b799a229).
Reason for revert: adds data race, breaks race builders, and Brad forgot
to run the Trybots.
Change-Id: Id227dad7069560dbb3ea978a1dcd77ce1979034e
Reviewed-on: https://go-review.googlesource.com/104015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
An application using syscall.RawConn in a particular way must take
account of the operating system or platform-dependent behavior.
This change consolidates duplicate code and improves the test coverage
for applications that use socket options.
Change-Id: Ie42340ac5373875cf1fd9123df0e99a1e7ac280f
Reviewed-on: https://go-review.googlesource.com/95335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL 38338 introduced SSA rules to optimize two types of pointer equality
tests: a pointer compared with itself, and comparison of addresses taken
of two symbols which may have the same base. This patch adds rules to
apply the same optimization to pointer inequality tests, which also ensures
that two pointers to zero-width types cannot be both equal and unequal
at the same time.
Fixes#24503.
Change-Id: Ic828aeb86ae2e680caf66c35f4c247674768a9ba
Reviewed-on: https://go-review.googlesource.com/102275
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is the first version of an introductory document that should help
developers who want to get started with this package.
I recently started poking around this part of the compiler, and was
confused by a few basic ideas such as memory arguments. I also hadn't
heard about GOSSAFUNC until another developer pointed it out. Both of
those are essential if one wants to do any non-trivial work here.
This document can of course be expanded with more pointers and tips to
better understand this package's code and behavior. Its intent is not to
cover all of its features; but it should be enough for most developers
to start playing with it without extensive compiler experience.
Change-Id: Ifd2d047fbd038ab50f4625a15c4d49932b42fd66
Reviewed-on: https://go-review.googlesource.com/99715
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Change-Id: I629d89d5065271f3b92dde8b12f0e743c9bde8f0
Reviewed-on: https://go-review.googlesource.com/103595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Fixed a broken link to a section in the documentation for the
test flags for the go command.
Change-Id: Ic4bdd4965aac7856dd13a2adda9d774b9bae4113
GitHub-Last-Rev: 15bda34067
GitHub-Pull-Request: golang/go#24613
Reviewed-on: https://go-review.googlesource.com/103835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL 40693 added concurrent backend compilation support,
and used it for user-provided functions.
Autogenerated functions were still compiled serially.
This CL brings them into the fold.
As of this CL, when requested,
no functions are compiled serially.
There generally aren't many autogenerated functions.
When there are, this CL can help a lot,
because autogenerated functions are usually short.
Many short functions is the best case scenario
for concurrent compilation; see CL 41192.
One example of such a package comes from Dave Cheney's benchjuju:
github.com/juju/govmomi/vim25/types.
It has thousands of autogenerated functions.
This CL improves performance on the entire benchmark
by around a second on my machine at c=8, or about ~5%.
Updates #15756
Change-Id: Ia21e302b2469a9ed743df02244ec7ebde55b32f3
Reviewed-on: https://go-review.googlesource.com/41503
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit allows architectures to disable optimizations that need the
Avg* and Hmul* operations.
WebAssembly has no such operations, so using them as an optimization
but then having to emulate them with multiple instructions makes no
sense, especially since the WebAssembly compiler may do the same
optimizations internally.
Updates #18892
Change-Id: If57b59e3235482a9e0ec334a7312b3e3b5fc2b61
Reviewed-on: https://go-review.googlesource.com/103256
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This is the first commit of a series that will add WebAssembly
as an architecture target. The design document can be found at
https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0_Nv3OUwjEY5qVCxCup4.
The GOARCH name "wasm" is the official abbreviation of WebAssembly.
The GOOS name "js" got chosen because initially the host environment
that executes WebAssembly bytecode will be web browsers and Node.js,
which both use JavaScript to embed WebAssembly. Other GOOS values
may be possible later, see:
https://github.com/WebAssembly/design/blob/master/NonWeb.md
Updates #18892
Change-Id: Ia25b4fa26bba8029c25923f48ad009fd3681933a
Reviewed-on: https://go-review.googlesource.com/102835
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Apply the same approach as in CL 102397.
Updates #24580
Change-Id: I65955f62a70807c87216519d03f3643a8f214dee
Reviewed-on: https://go-review.googlesource.com/103655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
And delete them from asm_test.
Change-Id: Idfe1249052d82d15b9c30b292c78656a0bf7b48d
Reviewed-on: https://go-review.googlesource.com/103315
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit adds scripts for running the WebAssembly binaries that the
Go compiler will produce.
The script go_js_wasm_exec uses Node.js to run the binaries. Adding it
to PATH will enable "go run" and "go test" to work for js/wasm
without having to manually provide the -exec flag.
See https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program
for more information.
The web page wasm_exec.html is an example on how to run the same
binaries in a web browser.
Both scripts use wasm_exec.js as a shared library.
Updates #18892
Change-Id: Ia4d9bea025957750baa0d0651243dc88f156f85d
Reviewed-on: https://go-review.googlesource.com/103255
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The ModeType constant is a bit-wise OR of several other values.
It is reasonable for this to change without breaking compatibility.
This fixes the failures introduced by https://golang.org/cl/103597
Change-Id: I817e351cf3d1e0115dce665c8efbce21bc36426c
Reviewed-on: https://go-review.googlesource.com/103616
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Map the error returned when a dial is aborted from the context package
error to the internal net package error. For example, context.Canceled
errors map to errCanceled, and context.DeadlineExceeded errors map to
poll.ErrTimeout.
Fixes#23648
Change-Id: Idf9d3d08052d540740c0b054503aaed931dc5b1e
Reviewed-on: https://go-review.googlesource.com/103518
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
There is currently no way for os.FileMode.IsRegular to report false
without being one of the following types:
ModeDir | ModeSymlink | ModeNamedPipe | ModeSocket | ModeDevice
This makes it difficult for custom implementations of os.FileInfo to return
a Mode that is explicitly not regular without resorting to setting one
of the types listed above. However, every one of the aforementioned types
are ill-suited as a general-purpose "not regular" file type.
Thus, add a ModeIrregular to serve exactly for that purpose.
The ModeIrregular type carries no information other than the fact that the
file is not regular.
Updates #22903Fixes#23878
Change-Id: I4f34d88f960bcb014816d8e7b5de8b1035077948
Reviewed-on: https://go-review.googlesource.com/94856
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Before this change, the smallest result Ldexp can handle was
ldexp(2, -1075), which is SmallestNonzeroFloat64.
There are some numbers below it should also be rounded to
SmallestNonzeroFloat64. The change fixes this.
Fixes#23407
Change-Id: I76f4cb005a6e9ccdd95b5e5c734079fd5d29e4aa
Reviewed-on: https://go-review.googlesource.com/87338
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Incorporate https://code-review.googlesource.com/#/c/re2/+/3050/ from
the re2 repository. Description of that change:
Preserve the original behaviour of \s.
Prior to Perl 5.18, \s did not match vertical tab. Bake that into
make_perl_groups.pl as an override so that perl_groups.cc retains
its current definitions when rebuilt with newer versions of Perl.
This fixes make_perl_groups.pl to generate an unchanged perl_groups.go
with perl versions 5.18 and later.
Fixes#22057
Change-Id: I9a56e9660092ed6c1ff1045b4a3847de355441a7
Reviewed-on: https://go-review.googlesource.com/103517
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This change modifies the codegen test harness driver so that it no
longer modifies the environment GOOS/GOARCH, since that seems to cause
flakiness in other concurrently-running tests.
The change also enables the codegen tests in run.go.
Fixes#24538
Change-Id: I997ac1eb38eb92054efff67fe5c4d3cccc86412b
Reviewed-on: https://go-review.googlesource.com/103455
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The existing behaviour of go generate is to pass GOPACKAGE=p
to all package files, including XTest files. This however is
incorrect as the package name for the XTest files is p_test.
Fixes#24594
Change-Id: I96b6e5777ec511cdcf1a6267a43f4d8c544c4af3
Reviewed-on: https://go-review.googlesource.com/103415
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mostly same as golang.org/cl/102156, except the parts that
deal with different data types.
Change-Id: I061b858b73898725e3bf175ed022c2e3e55fc485
Reviewed-on: https://go-review.googlesource.com/103158
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Using go test -c makes you responsible for managing and merging the
coverage profile yourself.
Fixes#24588
Change-Id: I2037a91ceb904f9f35d76c7b5e5fae6bcbed4e46
Reviewed-on: https://go-review.googlesource.com/103395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Decode AT_PAGESZ to determine physPageSize on dragonfly.
Change-Id: I7236d7cbe43433f16dffddad19c1655bc0c7f31d
Reviewed-on: https://go-review.googlesource.com/103257
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>