For #37475
Change-Id: I09fa1344051088ce37727176d9ec6b38891d1a9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/357955
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Use ".fslckout" or "_FOSSIL_" files to correctly identify the root of
Fossil checkout directories.
Previously, Go has assumed VCS checkouts are indicated by a dot-file
named after the VCS command (eg, .git, .hg, .fossil). This is not
normally true for Fossil, but has worked so far since Go downloads
repositories into a ".fossil" file before opening (checking out).
Using the incorrect path prevents Go identifying Fossil checkouts and
correctly tagging with -buildvcs (to be added in a follow up CL).
Change-Id: I3c030a0b600dfe7f4b3fcf1551b1d7cb84629b81
Reviewed-on: https://go-review.googlesource.com/c/go/+/357954
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
A cgo file with "//export" declarations is not permitted to have function
definitions in the cgo comments.
Fixes#49188
Change-Id: I5c24b62b259871473ee984cea96a0edd7d42d23a
Reviewed-on: https://go-review.googlesource.com/c/go/+/359195
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Currently, for stack traces (e.g. at panic or when runtime.Stack
is called), we print argument values from the stack. With register
ABI, we may never store the argument to stack therefore the
argument value on stack may be meaningless. This causes confusion.
This CL makes the compiler keep trace of which argument stack
slots are meaningful. If it is meaningful, it will be printed in
stack traces as before. If it may not be meaningful, it will be
printed as the stack value with a question mark ("?"). In general,
the value could be meaningful on some code paths but not others
depending on the execution, and the compiler couldn't know
statically, so we still print the stack value, instead of not
printing it at all. Also note that if the argument variable is
updated in the function body the printed value may be stale (like
before register ABI) but still considered meaningful.
Arguments passed on stack are always meaningful therefore always
printed without a question mark. Results are never printed, as
before.
(Due to a bug in the compiler we sometimes don't spill args into
their dedicated spill slots (as we should), causing it having
fewer meaningful values than it should be.)
This increases binary sizes a bit:
old new
hello 1129760 1142080 +1.09%
cmd/go 13932320 14088016 +1.12%
cmd/link 6267696 6329168 +0.98%
Fixes#45728.
Change-Id: I308a0402e5c5ab94ca0953f8bd85a56acd28f58c
Reviewed-on: https://go-review.googlesource.com/c/go/+/352057
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Rename structuralType to singleType throughout. This reflects
more closely what the function does: if a type set consists of
exactly one type term, singleType returns the corresponding type.
Rename singleUnder to structure. The structure function returns
the "type structure" of a type, either its underlying type for
a non-type parameter, or the single underlying type (if it exists)
for a type parameter.
Change constraint type inference to use the structure type for
inference, unless the structure type is the underlying type of
a single defined type, in which case it uses the latter. This
preserves existing behavior while making constraint type inference
slightly more flexible.
Change-Id: I38ee89ffdabd12bfeaa0be2ad6af8fb373c11fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/359015
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The position computation was needed for type list support.
With that gone, we don't need this code anymore.
Change-Id: I3f36b3d108a1fae9947fd259d4892e0287cb78ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/358701
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
isNamed(t) is easily confused with asNamed(t) != nil (e.g., we
have isPointer(t) that is defined as asPointer(t) != nil).
This rename also helped clarifying a couple of places in the
assignability rules where it makes sense to simply look for
types that have names.
Change-Id: Ie995908613a26883ffe0562343d297a1e981e9ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/358621
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This CL renames the toT converters back to their asT names.
Change-Id: If4bda5a78525f9722f044f5544f400fa8bb6f437
Reviewed-on: https://go-review.googlesource.com/c/go/+/358774
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This CL changes the convenience converters asT to use under instead
of optype. To make sure the effect is well understood, in a first
step, all asT functions are renamed to toT so that we can see which
call sites are affected. In almost all places, the change is what we
want. In some places we may get more conservative behavior (which is
easy to relax if need be). In some places (function calls through a
type parameter, append built-in) we now use singleUnder instead, for
a more general behavior, matching other primary expressions or built-
ins.
This change removes the last use of optype and thus also theTop and
top, all of which have been deleted from the code.
The next CL renames the toT converters back to their asT form.
Change-Id: I35d1ad866ce46de175a055b36ef577d99bb9de22
Reviewed-on: https://go-review.googlesource.com/c/go/+/358597
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Similar to conversions, handle ordinary cases first, followed by
type-by-type assignability tests in case of type parameters with
specific types in their type sets.
Add a new class of type checker tests, in testdata/spec, which
I hope we can populate over time with tests following the spec
organization. Moved the conversions.go2 tests in the same dir.
Change-Id: Iac253ae375c08022bdc39e92e3951ec3f509e432
Reviewed-on: https://go-review.googlesource.com/c/go/+/357917
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
The behavior of is/underIs was murky with the presence of a top type term
(corresponding to a type set that is not constrained by any types, yet the
function argument f of is/underIs was called with that term).
Change is/underIs to call f explicitly for existing specific type terms,
otherwise return the result of f(nil). Review all uses of is/underIs and
variants.
This makes the conversion code slightly more complicated because we need
to explicitly exclude type parameters without specific types; but the
code is clearer now.
Change-Id: I6115cb46f7f2a8d0f54799aafff9a67c4cca5e30
Reviewed-on: https://go-review.googlesource.com/c/go/+/358594
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
It never worked in module mode (or with a read-only GOROOT).
A proposal to drop it was filed (and approved) in
https://golang.org/issue/47788.
Fixes#47788
Change-Id: I0c12f38eb0c5dfe9384fbdb49ed202301fa4273d
Reviewed-on: https://go-review.googlesource.com/c/go/+/359096
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
The message is now a single line, but I couldn't get '\n?' to work.
(This test does not run in short mode.)
Change-Id: I3d7033f78ac2bf41db7fdfe96cbb988c4533d834
Reviewed-on: https://go-review.googlesource.com/c/go/+/359095
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Previously, the worker would attempt to deflake
an input that was reported to have caused new
coverage. The chances of a flake causing new
coverage seem pretty low to me, and even if it
was a flake that caused it, adding that input to
the cache doesn't seem like a bad thing. The
input is already going to be deflaked during
minimization anyway. If by some off-chance the
code is causing a lot of flaky coverage
increases, and the user doesn't want minimization
to occur, then setting -fuzzminimizetime=1x will
deflake in the way they want without minimizing.
This can be documented as needed.
This fixes a bug where the mem.header().count
could have been one too large if an unrecoverable
crash occured while deflaking an input that
caused code coverage.
Fixes#49047
Change-Id: Ibdf893d7a89a46dd700702afb09e35623615390e
Reviewed-on: https://go-review.googlesource.com/c/go/+/358094
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
and fix/cleanup lowering of the SSA operator created by the pass.
Change-Id: I7e6153194fd16013e3b24da8aa40683adafa3d15
Reviewed-on: https://go-review.googlesource.com/c/go/+/344573
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Clean up a comment that was deleted in types2 in CL 353135.
Change-Id: If339efa133e2a3d1eaa3b1e69458471677018261
Reviewed-on: https://go-review.googlesource.com/c/go/+/358517
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
cmd/go is not subject to all the same restrictions as most of cmd.
In particular it need not be buildable with the bootstrap toolchain.
So it is better to keep as little code shared between cmd/go and
cmd/compile, cmd/link, cmd/cgo as possible.
cmd/internal/str started as cmd/go/internal/str but was moved
to cmd/internal in order to make use of the quoted string code.
Move that code to cmd/internal/quoted and then move the rest of
cmd/internal/str back to cmd/go/internal/str.
Change-Id: I3a98f754d545cc3af7e9a32c2b77a5a035ea7b9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/355010
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Fixes#49173.
Change-Id: I71270b4ff7e9ede3cdfa5946b73142a731752adf
Reviewed-on: https://go-review.googlesource.com/c/go/+/358901
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Updates #48968 and CL 358114
Change-Id: Ic68b4c5420c1c32f78b56874b53d717fa9af1f74
Reviewed-on: https://go-review.googlesource.com/c/go/+/358734
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Use dup3(oldfd, newfd, O_CLOEXEC) to atomically duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.
The dup3 syscall was added in NetBSD 6.0.
Change-Id: I01a4f8c62bfa8fb7f9f3166070380dd2002bb564
Reviewed-on: https://go-review.googlesource.com/c/go/+/358755
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
For base generic type that is written to export file, we need to mark
all of its methods, include exported+unexported methods, as reachable,
so they can be available for instantiation if necessary. But markType
only looks for exported methods, thus causing the crash in #49143.
To fix this, we introduce new method p.markGeneric, to mark all methods
of the base generic type.
This issue has happend for a while (maybe since we add generic
import/export during go1.18 cycle), and was un-intentionally "fixed" in
CL 356254, when we agresssively call p.markEmbed(t). CL 357232 fixed
that wrong agressive behavior, thus reproduce the bug on tip.
Fixes#49143
Change-Id: Ie64574a05fffb282e9dcc8739df4378c5b6b0468
Reviewed-on: https://go-review.googlesource.com/c/go/+/358814
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
The gofrontend code mishandled this case, so add it to the test.
Change-Id: I183b8fab57552320b04c4826c590b7c6d36b6548
Reviewed-on: https://go-review.googlesource.com/c/go/+/358836
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Const strings can be marked readonly. This is particularly
important for this relatively large table (88kb).
This is a follow-up to CL 315189.
The generation script is a bit awkward. It needs access to crypto/elliptic
internals, but also needs to be package main. Work around this by
exporting those internals with the "tablegen" build tag.
This requires changing the function signature at the Go-asm bridge.
As long as we're here, shrink the point argument type as well;
the net result is three fewer words of params.
Performance impact is probably noise.
name old time/op new time/op delta
ScalarBaseMult/P256-8 11.4µs ± 2% 11.3µs ± 1% -1.32% (p=0.000 n=19+16)
ScalarBaseMult/P224-8 579µs ± 1% 577µs ± 0% -0.30% (p=0.024 n=19+20)
ScalarBaseMult/P384-8 2.31ms ± 4% 2.34ms ± 4% +1.25% (p=0.033 n=20+20)
ScalarBaseMult/P521-8 1.33ms ± 0% 1.33ms ± 1% ~ (p=0.173 n=18+17)
ScalarMult/P256-8 42.7µs ± 0% 42.7µs ± 2% ~ (p=0.989 n=20+20)
ScalarMult/P224-8 579µs ± 0% 579µs ± 0% ~ (p=0.538 n=19+18)
ScalarMult/P384-8 2.32ms ± 3% 2.34ms ± 5% ~ (p=0.235 n=19+20)
ScalarMult/P521-8 1.33ms ± 1% 1.34ms ± 2% ~ (p=0.141 n=17+20)
Change-Id: I3bee56df34ae61ca8829791d2e67e058ecc8ddbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/339591
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Make the input match gofmt's output,
to make our lives easier as we phase out
old style build tags.
Change-Id: I95dc5a77058bf17cb02e289703f60784616db006
Reviewed-on: https://go-review.googlesource.com/c/go/+/358934
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
If we receive an async signal while running in the VDSO, such as a
SIGABRT or SIGSEGV sent from another process, we fail to print the
stacktrace with "runtime: unknown pc <vdso PC>".
We already have machinery to handle SIGPROF in the VDSO, but it isn't
hooked up for other signals. Add it to the general signal traceback
path.
This case is covered by TestSegv by making the test more strict w.r.t.
accepted output.
Fixes#47537
Change-Id: I755585f70e0c23e207e135bc6bd2aa68298e5d24
Reviewed-on: https://go-review.googlesource.com/c/go/+/339990
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
CL 64070 removed lockOSThread from the cgocall path, but didn't update
the signal-in-cgo detection in sighandler. As a result, signals that
arrive during a cgo call are treated like they arrived during Go
execution, breaking the traceback.
Update the cgo detection to fix the backtrace.
Fixes#47522
Change-Id: I61d77ba6465f55e3e6187246d79675ba8467ec23
Reviewed-on: https://go-review.googlesource.com/c/go/+/339989
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Unlike what the comment says, the GC can see this pointer.
Might as well make it a real pointer, even though ^uintptr(0)
isn't currently causing problems.
Removed the comment about GC not seeing the pointer.
Change-Id: I04bc1fd4848698bec6afb79bd5fda671dfc9a073
Reviewed-on: https://go-review.googlesource.com/c/go/+/241661
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Colin Arnott <colin@urandom.co.uk>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Keith Randall <khr@golang.org>
_g_, _p_, and _m_ are primarily vestiges of the C version of the
runtime, while today we prefer Go-style variable names (generally gp,
pp, and mp).
This change replaces all remaining uses of _m_ with mp. There are very
few remaining and all replacements are trivial.
[git-generate]
cd src/runtime
rf 'mv canpanic._m_ canpanic.mp'
GOOS=solaris \
rf 'mv semasleep._m_ semasleep.mp'
GOOS=aix GOARCH=ppc64 \
rf 'mv semasleep._m_ semasleep.mp'
Change-Id: I83690f7b4d4dc57557963100e9a2560ff343f3e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/307813
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
There were two main outer switch statements in node() that can just be
combined. Also, for simplicity, changed an IsCmp() conditional into just
another case in the switch statement.
Also, the inner OCALL switch statement had a bunch of fairly duplicate
cases. Combined the cases that all had no special semantics, into a
single default case calling transformCall().
In the OCALL case in dictPass(), got rid of a check for OFUNCINST (which
will always have been removed by this point). Also, eliminated an assert
that could cause unneded failures. transformCall() should always be
called if the node op is still OCALL, so no need to assert on the ops of
call.X.
Added an extra test in issue47078.go, to explicitly check for case where
the X argument of a call is a DOTTYPE.
Change-Id: Ifb3f812ce12820a4ce08afe2887f00f7fc00cd2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/358596
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Only Git and Mercurial are supported for now.
This CL also:
- Skips tagging "revision" and "committime" for empty repositories.
- Stores the full Mercurial changeset ID instead of the short form.
Fixes#37475
Change-Id: I62ab7a986d1ddb2a0e7166a6404b5aa80c2ee387
Reviewed-on: https://go-review.googlesource.com/c/go/+/356251
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Update the documentation in iexport.go to use the word 'Constraint'
rather than 'Bound', and to account for recent changes to the export
format.
Change-Id: I83fbcd336d5f865af804bc8bef4f5d997cd9f325
Reviewed-on: https://go-review.googlesource.com/c/go/+/358547
Trust: Robert Findley <rfindley@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Pull in CL 358034 (and some more changes with passing tests) with:
go get -d golang.org/x/tools@f916b54
go mod tidy
go mod vendor
This teaches x/tools/cmd/bundle and the package loader it uses about
the new export data version.
Fixes#49159.
Change-Id: Icc36e77e602b1cd2da03708f20d05a66fcf693cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/358620
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
CR bits and CR fields should be treated separately. Some instructions
modify an entire CR, a CR field, or a single CR bit.
Add a new argument class for CR bits, and teach the assembler the
recognize them as names like CR0LT or CR2SO, and update the CR
bit logic instructions to use them. They will no longer accept
register field (CRn) type arguments.
Fixes#46422
Change-Id: Iaba127d88abada0c2a49b8d3b07a976180565ae4
Reviewed-on: https://go-review.googlesource.com/c/go/+/357774
Run-TryBot: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Add utimensat as a wrapper around the libc function of the same name.
utimensat was added in macOS 10.13 which is the minimum supported
release since Go 1.17 dropped support for macOS 10.12.
This also allows to drop the fallback to setattrlistTimes which was
used to set timestamps with nanosecond resolution before utimensat could
be used, see #22528 and CL 74952.
Updates #22528
Change-Id: I87b6a76acf1d642ceede9254f7d9d06dddc3fd71
Reviewed-on: https://go-review.googlesource.com/c/go/+/358274
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.
Illumos implements dup3 like this in libc.
Change-Id: I9782bce553ffb832e9b1a12bbf3c0a40c821f56e
Reviewed-on: https://go-review.googlesource.com/c/go/+/358374
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
These are the runtime support functions for letting Go code interoperate
with the C/C++ address sanitizer. Calls to asanread/asanwrite are now
inserted by the compiler with the -asan option. Calls to
asanunpoison/asanpoison will be from other runtime functions in a
subsequent CL.
Updates #44853.
Change-Id: I9e8fc0ce937828bc7f4a8b6637453ddc3862c47b
Reviewed-on: https://go-review.googlesource.com/c/go/+/298613
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The -asan option compiles Go code to use the address sanitizer. This is
intended for use when linking with C/C++ code compiled with -fsanitize=address.
When memory blocks are passed back and forth between C/C++ and Go, code in
both languages will agree as to whether the memory is validly allocated or not,
and will report errors for any use of invalid memory.
Updates #44853.
Change-Id: I0209002ef795cc1c823daae557fb80c906158db3
Reviewed-on: https://go-review.googlesource.com/c/go/+/298612
Trust: fannie zhang <Fannie.Zhang@arm.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
For MOVK/MOVN/MOVZ instructions, the assembler does not accept zero
shifts, and the CL 275812 added the error check. This CL adds this
restriction to the document.
Change-Id: I8818d76ca2f11dade2307f3678ca521f4e64d164
Reviewed-on: https://go-review.googlesource.com/c/go/+/312210
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Remove a unnecessary statement in the test function, the variables
aren't checked afterwards. Also remove return statements in helper
functions and remove the declaration that a the helper function return a
value. The return value isn't used in the current state of code
Change-Id: I5bc384104c1002c4138e0894938778ae9710ce4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/358714
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
When adding a large constant to a register we generate two adds,
we may generate two ADD instructions if the constant does not fit
in one ADD but does fit in two. This is generally fine except that
if the target register is SP (such as in function prologues or
epilogues for functions with large frames), this creates an
intermediate state that the SP is not 0 nor the full frame size.
For signal safety (preemption signal and profiling signal) we
require that the frame is either not created at all or fully
created, meaning that the SP must be written in a single
instruction. Splitting to two adds breaks the requirement. So not
splitting it.
(We could mark such instructions not async-preemptible. But
profiling signal can still cause problems.)
(We could generate "ADD $c1, SP, Rtmp; ADD $c2; Rtmp; SP" to save
an instruction if that is desired, while still ensuring that SP
is written in a single instruction.)
May fix flaky failures like https://build.golang.org/log/11537ec020a902b0ec0fc065f61161b729eb9880
Change-Id: I5cf38a6a028afe01aa3b6eeb163487bbd504b64f
Reviewed-on: https://go-review.googlesource.com/c/go/+/358436
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Bump the export version to a new value iexportVersionGo1_18 (2). This
will give a better error message when old compilers/tools encounter the
new export format (that includes parameterized types and functions).
We are also making a breaking change in the format:
- a 'kind' byte is added to constant values
Also updated tinter() to pass the implicit bit through during type
substitution.
Tested that all tests still pass if the iexportVersionCurrent is changed
back to 1 in typecheck/iexport.go, iimporter/iimport.go, and
gcimporter/iimport.go
Updates #47654
Change-Id: I1dbeb167a97f6c7e0b7e0c011d6bada5db312b36
Reviewed-on: https://go-review.googlesource.com/c/go/+/357049
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Dan Scales <danscales@google.com>
The -asan option causes the compiler to add instrumentation for the
C/C++ address sanitizer. Every memory read/write will be replaced
by a call to asanread/asanwrite.
This CL also inserts asan instrumentation during SSA building.
This CL passes tests but is not usable by itself. The actual
implementation of asanread/asanwrite in the runtime package, and
support for -asan in the go tool and tests, will follow in subsequent
CLs.
Updates #44853.
Change-Id: Ia18c9c5d5c351857420d2f6835f0daec2ad31096
Reviewed-on: https://go-review.googlesource.com/c/go/+/298611
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
We want to set a finalizer on splicePipe, so make it large enough to
not use the tiny allocator. Otherwise the finalizer will not run until
the rest of the tiny allocation can be freed. This only matters on
32-bit systems.
Fixes#48968
Change-Id: I8eb3c9f48fdccab7dc79c5b918d4257b6151ee91
Reviewed-on: https://go-review.googlesource.com/c/go/+/358114
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Generic function symbols sometimes have % in them, like:
main.B2[%2eshape.string_0].m2·f
Which confuses this code because it doesn't esacpe % when
using this string as a format string, instead of a format argument.
Or could we get rid of the . -> %2e rewrite somehow?
I think it comes from LinkString.
Change-Id: I3275501f44cf30485e9d4577e0dfa77996d4939e
Reviewed-on: https://go-review.googlesource.com/c/go/+/357837
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
The method of using references to dictionaries to hold methods
live during linker deadcode elimination wasn't working very well.
I implemented a new scheme in the CL below this, so this CL strips
out the old method.
The new method has the added benefit of having 0 runtime overhead
(unlike the stuff we're ripping out here, which does have a small overhead).
Update #48047
Change-Id: I68ac57119792d53c58f1480f407de6ab2bb53211
Reviewed-on: https://go-review.googlesource.com/c/go/+/357836
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>