Errors have unique seq values (their index within the errors slice),
so errcmp never needs to fallback to sorting by message text.
Moreover, comparing by original index is exactly the purpose of using
a stable sort algorithm (and sort.Stable was added in Go 1.2), so we
really only need to compare by lineno.
Change-Id: I7f534b72a05d899ae9788dc7ef0541dd92a8b578
Reviewed-on: https://go-review.googlesource.com/19929
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Previously, many error messages inconsistantly used either lexlineno
and lineno. In general this works out okay because they're almost
always the same. The only exceptional case is after lexing a
multi-line raw string literal, where lineno will be the line number of
the opening quote and lexlineno is the line number of the closing
quote.
This CL makes the compiler's error message more consistent:
- Lexer error messages related to invalid byte sequences (i.e., NUL
bytes, bad UTF-8 sequences, and non-initial BOMs) are emitted at
lexlineno (i.e., the source line that contains the invalid byte
sequence).
- All other error messages (notably the parser's "syntax errors") now
use lineno. The minor change from this is that bogus input like:
package `
bogus`
will emit "syntax error: unexpected string literal, expecting name"
error at line 1, instead of line 2.
- Instead of maintaining prevlineno all the time, just record it
when/where actually needed and not already available elsewhere (which
turns out to be just one function).
- Lastly, we remove the legacy "syntax error near ..." fallback in
Yerror, now that the parser always emits more detailed syntax error
messages.
Change-Id: Iaf5f784223d0385fa3a5b09ef2b2ad447feab02f
Reviewed-on: https://go-review.googlesource.com/19925
Reviewed-by: Robert Griesemer <gri@golang.org>
REP-prefixed instructions have a large startup cost.
Avoid them like the plague.
benchmark old ns/op new ns/op delta
BenchmarkIndexByte10-8 22.4 5.34 -76.16%
Fixes#13983
Change-Id: I857e956e240fc9681d053f2584ccf24c1b272bb3
Reviewed-on: https://go-review.googlesource.com/18703
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
_Genqueue and _Gscanenqueue were introduced as part of the GC quiesce
code. The quiesce code was removed by 197aa9e, but these states and
some associated code stuck around. Remove them.
Change-Id: I69df81881602d4a431556513dac2959668d27c20
Reviewed-on: https://go-review.googlesource.com/19638
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Currently most uses of gcWork use the per-P gcWork, but there are two
places that still use a stack-based gcWork. Simplify things by making
these instead use the per-P gcWork.
Change-Id: I712d012cce9dd5757c8541824e9641ac1c2a329c
Reviewed-on: https://go-review.googlesource.com/19636
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Currently markroot uses a gcWork on the stack and disposes of it
immediately after marking one root. This used to be necessary because
markroot was called from the depths of parfor, but now that we call it
directly and have ready access to a gcWork at the call site, pass the
gcWork in, use it directly in markroot, and share it across calls to
markroot from the same P.
Change-Id: Id7c3b811bfb944153760e01873c07c8d18909be1
Reviewed-on: https://go-review.googlesource.com/19635
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
When gcWork was first introduced, the compiler's escape analysis
wasn't good enough to detect that that method receiver didn't escape,
so we had to hack around this.
Now that the compiler can figure out this for itself, remove these
hacks.
Change-Id: I9f73fab721e272410b8b6905b564e7abc03c0dfe
Reviewed-on: https://go-review.googlesource.com/19634
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The channel code must not allow stack splits between when it assigns a
potential stack pointer to sudog.elem (or sudog.selectdone) and when
it makes the sudog visible to copystack by putting it on the g.waiting
list. We do get this right everywhere, but add a comment about this
subtlety for future eyes.
Change-Id: I941da150437167acff37b0e56983c793f40fcf79
Reviewed-on: https://go-review.googlesource.com/19632
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Currently the heapBitsSweepSpan comment claims that heapBitsSweepSpan
sets the heap bitmap for the first two words to dead. In fact, it sets
the first *four* words to scalar/dead. This is important because first
two words don't actually have a dead bit, so for objects larger than
two words it *must* set a dead bit in third word to reset the object
to a "noscan" state. For example, we use this in heapBits.hasPointers
to detect that an object larger than two words is noscan.
Change-Id: Ie166a628bed5060851db083475c7377adb349d6c
Reviewed-on: https://go-review.googlesource.com/19630
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Our stack frame sizes look pretty good now. Lower the stack
guard from 1024 to 720.
Tip is currently using 720.
We could go lower (to 640 at least) except PPC doesn't like that.
Change-Id: Ie5f96c0e822435638223f1e8a2bd1a1eed68e6aa
Reviewed-on: https://go-review.googlesource.com/19922
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
go get -u all command updates all packages including standard
commands. We need to get commands evicted from their cache to
avoid loading old versions of the packages evicted from the
packages cache.
Fixes#14444
Change-Id: Icd581a26e1db34ca634aba595fed62b097094c2f
Reviewed-on: https://go-review.googlesource.com/19899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The -d compiler flag can also specify ssa phase and flag,
for example -d=ssa/generic_cse/time,ssa/generic_cse/stats
Spaces in the phase names can be specified with an
underscore. Flags currently parsed (not necessarily
recognized by the phases yet) are:
on, off, mem, time, debug, stats, and test
On, off and time are handled in the harness,
debug, stats, and test are interpreted by the phase itself.
The pass is now attached to the Func being compiled, and a
new method logStats(key, ...value) on *Func to encourage a
semi-standardized format for that output. Output fields
are separated by tabs to ease digestion by awk and
spreadsheets. For example,
if f.pass.stats > 0 {
f.logStat("CSE REWRITES", rewrites)
}
Change-Id: I16db2b5af64c50ca9a47efeb51d961147a903abc
Reviewed-on: https://go-review.googlesource.com/19885
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
This indirectly implements a small fix for runtime/pprof: it used to
look for runtime.gopanic when it should have been looking for
runtime.sigpanic.
Update #11432.
Change-Id: I5e3f5203b2ac5463efd85adf6636e64174aacb1d
Reviewed-on: https://go-review.googlesource.com/19869
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
I can't remember just how this happened to me, but I got an unfortunate
crash with some set of cmd/compile debug options and source code.
Change-Id: Ibef6129c50b68dad0594ac439466bfbc4b32a095
Reviewed-on: https://go-review.googlesource.com/19920
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Simplifies some code as ptrToThis was unreliable under dynamic
linking. Now the same type lookup is used regardless of execution
mode.
A synthetic relocation, R_USETYPE, is introduced to make sure the
linker includes *T on use of T, if *T is carrying methods.
Changes the heap dump format. Anything reading the format needs to
look at the last bool of a type of an interface value to determine
if the type should be the pointer-to type.
Reduces binary size of cmd/go by 0.2%.
For #6853.
Change-Id: I79fcb19a97402bdb0193f3c7f6d94ddf061ee7b2
Reviewed-on: https://go-review.googlesource.com/19695
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Also added a test to ensure the behavior.
Fixes#14150
Change-Id: Ib3ee9fdae59826fa594ce1be3c49b51d740b56eb
Reviewed-on: https://go-review.googlesource.com/19915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Found looking at mapaccess1_faststr.
runtime.throw never returns.
Do x+y+c with an LEA.
Change-Id: I27ea6669324242a6302397cbdc73230891d97591
Reviewed-on: https://go-review.googlesource.com/19911
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
It looks like the latest DragonFly BSD kernels, at least 4.4 and above,
have finished working on handling of shared IP control blocks. Let's
re-enbale test cases referring to IP control blocks and see what
happens.
Updates #13146.
Change-Id: Icbe2250e788f6a445a648541272c99b598c3013d
Reviewed-on: https://go-review.googlesource.com/19406
Reviewed-by: Ian Lance Taylor <iant@golang.org>
It crashes when the node under the test is shaken up.
-- FAIL: TestGoLookupIPWithResolverConfig (11.73s)
panic: interface conversion: error is nil, not *net.DNSError [recovered]
panic: interface conversion: error is nil, not *net.DNSError
goroutine 23 [running]:
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:483 +0x3f3
testing.tRunner.func1(0xc820136d80)
/go/src/testing/testing.go:467 +0x192
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:441 +0x4f6
net.TestGoLookupIPWithResolverConfig(0xc820136d80)
/go/src/net/dnsclient_unix_test.go:358 +0x7ca
testing.tRunner(0xc820136d80, 0x49ddc0)
/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
/go/src/testing/testing.go:582 +0x892
exit status 2
Change-Id: I9631f41a3c73f3269c7e30d679c025ae64d71a98
Reviewed-on: https://go-review.googlesource.com/19870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The actual values assigned to tokens was inherited from the yacc-based
grammar. With the most recent cleanups, all single-char tokens such as
commas, semis, parens, etc., that get returned from lexer.next simply
as their Unicode values are below utf8.RuneSelf (i.e., 7bit ASCII).
Lower the initial starting value for named token constants accordingly.
Change-Id: I7eb8e584dbb3bc7f9dab849d1b68a91320cffebd
Reviewed-on: https://go-review.googlesource.com/19913
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
If the parsing of an operand completes but the parser thinks there
is more to read, return an "expected end of operand" error message
instead of "expected EOF." This also removes extra "asm: " prefixes
in error strings since "asm: " is already set as the global log
prefix.
Fixes#14071
Change-Id: I7d621c1aea529a0eca3bcba032359bd25b3e1080
Reviewed-on: https://go-review.googlesource.com/19731
Reviewed-by: Rob Pike <r@golang.org>
The @ directive used to read the target block after some value
structure had already changed. I don't think it was ever really
a bug, but it's confusing.
It might fail like this:
(Foo x y) -> @v.Args[0].Block (Bar y (Baz ...))
v.Op = Bar
v.Args[0] = y
v.Args[1] = v.Args[0].Block.NewValue(Baz, ...)
That new value is allocated in the block of y, not the
block of x.
Anyway, read the destination block first so this
potential bug can't happen.
Change-Id: Ie41d2fc349b35cefaa319fa9327808bcb781b4e2
Reviewed-on: https://go-review.googlesource.com/19900
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
Only tests do this, provide them a hook to disable freeing
after flush.
Change-Id: I810c6c51414a93f476a18ba07b807e16092bf8cf
Reviewed-on: https://go-review.googlesource.com/19907
Reviewed-by: Keith Randall <khr@golang.org>
Not every Android contains the /system/framework directory, e.g. Brillo.
Test against other Android-only system files.
Fixes#14489.
Change-Id: I6d9ec1c4d4ceba3803798015e6917d59cf515de8
Reviewed-on: https://go-review.googlesource.com/19904
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Don't accumulate a massive list of Prog structs during
compilation and write them all out at the end of compilation.
Instead, convert them to code+relocs (or data+relocs) after each
function is compiled.
Track down a few other places that were keeping Progs alive
and nil them out so the Progs get GCd promptly.
Saves ~20% in peak memory usage for the compiler. Surprisingly not much
help speed-wise (only because we end up doing more GCs. With a
compensating GOGC=120, it does help a bit), but this provides a base for
more changes (e.g. reusing a cache of Progs).
Change-Id: I838e01017c228995a687a8110d0cd67bf8596407
Reviewed-on: https://go-review.googlesource.com/19867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
In CL 14408, the implementation of duffzero on amd64
was changed to replace the use of the MOVQ instructions
by MOVUPS.
However, it broke the build on plan9/amd64, since
Plan 9 doesn't allow floating point in note handler.
This change disables the use of duffzero on Plan 9.
We also take care to not use the MOVUPS instruction.
Fixes#14471.
Change-Id: I8277b485dfe65a68d7d8338e52a048c5d45069bf
Reviewed-on: https://go-review.googlesource.com/19890
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
In regalloc, make LoadReg instructions use the line number
of their *use*, not their *source*. This reduces the
tendency of debugger stepping to "jump around" the program.
Change-Id: I59e2eeac4dca9168d8af3a93effbc5bdacac2881
Reviewed-on: https://go-review.googlesource.com/19836
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Further reduces complexity of lexer.next which is now readable.
Also removes the need to initialize various local variables in
each next call even if they are not used for the current token.
No measurable performance change for `time go build -a net/http`
(best of 5 runs): difference < 0.3% (in the noise).
Change-Id: I0d74caa2768920af1ceee027e0f46595119d4210
Reviewed-on: https://go-review.googlesource.com/19865
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>