Commit graph

2249 commits

Author SHA1 Message Date
Russ Cox 292ad59291 cmd/compile: do not emit args_stackmap for func _
Fixes #11699.

Change-Id: I01bf506d76260bcdf828bbde52791e328aa441a5
Reviewed-on: https://go-review.googlesource.com/16921
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-16 20:38:52 +00:00
Russ Cox 247959d9b8 cmd/compile: reject identifiers beginning with non-ASCII digit
Fixes #11359.

Change-Id: I0fdfa410939f7e42020cbb19d74a67e1cc3cd610
Reviewed-on: https://go-review.googlesource.com/16919
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-16 20:38:42 +00:00
Robert Griesemer b569b87ca1 cmd/compile/internal/gc: recursive-descent parser
This is a translation of the yacc-based parser with adjustements
to make the grammar work for a recursive-descent parser followed
by cleanups and simplifications.

The yacc actions were mostly literally copied for correctness
with better temporary names.

A few of the syntax tests were adjusted for slightly different
error messages (it is very difficult to match the yacc-based
error messages in all cases, and sometimes the new parser could
produce better errors).

The new parser is enabled by default.
To switch back to the yacc-based parser, set -oldparser.
To hardwire the switch back, uncomment "oldparser = 1" in lex.go.

- passes all.bash
- ~18% reduced parse time per file on average for make.bash
- ~3% reduced compile time for building cmd/compile

Change-Id: Icb5651bb9d8b9f66261762d2c94a03793050d4ce
Reviewed-on: https://go-review.googlesource.com/16665
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-13 14:53:57 +00:00
Michael Hudson-Doyle c1b6e392f5 cmd/internal/obj, cmd/link, runtime: increase stack limit to accommodate larger frames on ppc64x
Larger stack frames mean nosplit functions use more stack and so the limit
needs to increase.

The change to test/nosplit.go is a bit ugly but I can't really think of a
way to make it nicer.

Change-Id: I2616b58015f0b62abbd62951575fcd0d2d8643c2
Reviewed-on: https://go-review.googlesource.com/16504
Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-12 22:32:16 +00:00
Austin Clements a9ca2137aa test: really force heap profile update in heapsampling.go
The heap profile is only guaranteed to be up-to-date after two GC
cycles, so force two GCs instead of just one.

Updates #13098.

Change-Id: I4fb9287b698f4a3b90b8af9fc6a2efb3b082bfe5
Reviewed-on: https://go-review.googlesource.com/16848
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-11-12 18:32:13 +00:00
Austin Clements b5a0c67fcc test: force heap profile update in heapsampling.go test
The heapsampling.go test occasionally fails on some architectures
because it finds zero heap samples in main.alloc. This happens because
the byte and object counts are only updated at a GC. Hence, if a GC
happens part way through allocInterleaved, but then doesn't happen
after we start calling main.alloc, checkAllocations will see buckets
for the lines in main.alloc (which are created eagerly), but the
object and byte counts will be zero.

Fix this by forcing a GC to update the profile before we collect it.

Fixes #13098.

Change-Id: Ia7a9918eea6399307f10499dd7abefd4f6d13cf6
Reviewed-on: https://go-review.googlesource.com/16846
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-11-12 16:58:52 +00:00
Yao Zhang 15676b51a5 test: fix nosplit.go, fixedbugs/issue11656.go and skip two tests for mips64{,le}
Skip fixedbugs/issue10607.go because external linking is not supported
yet.

Skip nilptr3.go because of issue #9058 (same as ppc64).

Change-Id: Ib3dfbd9a03ee4052871cf57c74b3cc5e745e1f80
Reviewed-on: https://go-review.googlesource.com/14461
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-12 04:52:31 +00:00
Keith Randall e410a527b2 runtime: simplify chan ops, take 2
This change is the same as CL #9345 which was reverted,
except for a small bug fix.

The only change is to the body of sendDirect and its callsite.
Also added a test.

The problem was during a channel send operation.  The target
of the send was a sleeping goroutine waiting to receive.  We
basically do:
1) Read the destination pointer out of the sudog structure
2) Copy the value we're sending to that destination pointer
Unfortunately, the previous change had a goroutine suspend
point between 1 & 2 (the call to sendDirect).  At that point
the destination goroutine's stack could be copied (shrunk).
The pointer we read in step 1 is no longer valid for step 2.

Fixed by not allowing any suspension points between 1 & 2.
I suspect the old code worked correctly basically by accident.

Fixes #13169

The original 9345:

This change removes the retry mechanism we use for buffered channels.
Instead, any sender waking up a receiver or vice versa completes the
full protocol with its counterpart.  This means the counterpart does
not need to relock the channel when it wakes up.  (Currently
buffered channels need to relock on wakeup.)

For sends on a channel with waiting receivers, this change replaces
two copies (sender->queue, queue->receiver) with one (sender->receiver).
For receives on channels with a waiting sender, two copies are still required.

This change unifies to a large degree the algorithm for buffered
and unbuffered channels, simplifying the overall implementation.

Fixes #11506

Change-Id: I57dfa3fc219cffa4d48301ee15fe5479299efa09
Reviewed-on: https://go-review.googlesource.com/16740
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-08 23:20:25 +00:00
Keith Randall 4b7d5f0b94 runtime: memmove/memclr pointers atomically
Make sure that we're moving or zeroing pointers atomically.
Anything that is a multiple of pointer size and at least
pointer aligned might have pointers in it.  All the code looks
ok except for the 1-pointer-sized moves.

Fixes #13160
Update #12552

Change-Id: Ib97d9b918fa9f4cc5c56c67ed90255b7fdfb7b45
Reviewed-on: https://go-review.googlesource.com/16668
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-07 02:42:12 +00:00
Keith Randall ffb20631fc runtime: teach peephole optimizer that duffcopy clobbers X0
Duffcopy now uses X0, as of 5cf281a.  Teach the peephole
optimizer that duffcopy clobbers X0 so that it does not
rename registers use X0 across the duffcopy instruction.

Fixes #13171

Change-Id: I389cbf1982cb6eb2f51e6152ac96736a8589f085
Reviewed-on: https://go-review.googlesource.com/16715
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2015-11-06 15:11:42 +00:00
Michael Hudson-Doyle 10c0753761 cmd/internal/obj/ppc64: fix assembly of SRADCC with immediate
sradi and sradi. hide the top bit of their immediate argument apart from the
rest of it, but the code only handled the sradi case.

I'm pretty sure this is the only instruction missing (a couple of the rotate
instructions encode their immediate the same way but their handling looks OK).

This fixes the failure of "GOARCH=amd64 ~/go/bin/go install -v runtime" as
reported in the bug.

Fixes #11987

Change-Id: I0cdefcd7a04e0e8fce45827e7054ffde9a83f589
Reviewed-on: https://go-review.googlesource.com/16710
Reviewed-by: Minux Ma <minux@golang.org>
2015-11-05 22:54:21 +00:00
Dmitry Vyukov bf606094ee runtime: fix finalization and profiling of tiny allocations
Handling of special records for tiny allocations has two problems:
1. Once we queue a finalizer we mark the object. As the result any
   subsequent finalizers for the same object will not be queued
   during this GC cycle. If we have 16 finalizers setup (the worst case),
   finalization will take 16 GC cycles. This is what caused misbehave
   of tinyfin.go. The actual flakiness was caused by the fact that fing
   is asynchronous and don't always run before the check.
2. If a tiny block has both finalizer and profile specials,
   it is possible that we both queue finalizer, preserve the object live
   and free the profile record. As the result heap profile can be skewed.

Fix both issues by analyzing all special records for a single object at once.

Also, make tinyfin test stricter and remove reliance on real time.

Also, add a test for the problem 2. Currently heap profile missed about
a half of live memory.

Fixes #13100

Change-Id: I9ae4dc1c44893724138a4565ca5cae29f2e97544
Reviewed-on: https://go-review.googlesource.com/16591
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
2015-11-03 18:57:18 +00:00
Todd Neal e3e0122ae2 test: use go:noinline consistently
Replace various implementations of inlining prevention with
"go:noinline"

Change-Id: Iac90895c3a62d6f4b7a6c72e11e165d15a0abfa4
Reviewed-on: https://go-review.googlesource.com/16510
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-03 02:01:34 +00:00
Brad Fitzpatrick d2fa937a21 test: update tinyfin test
* use new(int32) to be pedantic about documented SetFinalizer rules:
  "The argument x must be a pointer to an object allocated by calling
  new or by taking the address of a composite literal"

* remove the amd64-only restriction. The GC is fully precise everywhere
  now, even on 32-bit. (keep the gccgo restriction, though)

* remove a data race (perhaps the actual bug) and use atomic.LoadInt32
  for the final check. The race detector is now happy, too.

Updates #13100

Change-Id: I8d05c0ac4f046af9ba05701ad709c57984b34893
Reviewed-on: https://go-review.googlesource.com/16535
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-02 16:08:33 +00:00
Ian Lance Taylor a4fb8c13db test: add gcc6798, valid code that caused gccgo to crash
Change-Id: I288bd3091ea81db7b616747cbec8958a31d98b7e
Reviewed-on: https://go-review.googlesource.com/16532
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-01 21:17:01 +00:00
Brad Fitzpatrick 7c167f2708 test: disable flaky heapsampling test for now
Flaky tests do more harm than good.

Updates #13098

Change-Id: I179ed810b49bbb96c8df462bfa20b70231b26772
Reviewed-on: https://go-review.googlesource.com/16521
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-30 20:48:03 +00:00
Todd Neal a92543e1a1 cmd/compile: add support for a go:noinline directive
Some tests need to disable inlining of a function.  It's currently done
in one of a few ways (adding a function call, an empty switch, or a
defer).  Add support for a less fragile 'go:noinline' directive that
prevents inlining.

Fixes #12312

Change-Id: Ife444e13361b4a927709d81aa41e448f32eec8d4
Reviewed-on: https://go-review.googlesource.com/13911
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-10-29 23:16:27 +00:00
acanino b60c8203ea cmd/compile: "invalid variable name x in type switch", where x is a name of a constant
Small fix: looks like a short variable declaration with a type switch
checks to make sure the variable used had valid shape (ONAME, OTYPE, or
ONONAME) and rejects everything else. Then a new variable is declared.
If the symbol contained in the declaration was a named OLITERAL (still a
valid identifier obviously) it would be rejected, even though a new
variable would have been declared.

Fix adds this case to the check.

Added a test case from issue12413.

Fixes #12413

Change-Id: I150dadafa8ee5612c867d58031027f2dca8c6ebc
Reviewed-on: https://go-review.googlesource.com/15760
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-21 04:21:16 +00:00
Robert Griesemer 76285213b8 cmd/compile/internal/gc: there are no -0 floating-point constants
Fixes #12577.

Change-Id: Id469cd92f5f9436b0ef948ee1a252ed1842bc7aa
Reviewed-on: https://go-review.googlesource.com/16133
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2015-10-20 22:11:11 +00:00
Matthew Dempsky 67722fea50 cmd/compile/internal/gc: reject invalid unsafe.Sizeof([0]byte{}[0])
Apply static bounds checking logic during type checking even to
zero-element arrays, but skip synthesized OINDEX nodes that the
compiler has asserted are within bounds (such as the ones generated
while desugaring ORANGE nodes).  This matches the logic in walkexpr
that also skips static bounds checking when Bounded is true.

Passes toolstash/buildall.

Fixes #12944.

Change-Id: I14ba03d71c002bf969d69783bec8d1a8e10e7d75
Reviewed-on: https://go-review.googlesource.com/15902
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-15 20:56:58 +00:00
Didier Spezia cb0e98b833 cmd/compile: fix some C to Go translation leftovers
Following the C to Go translation, some useless variables
were left in the code. In fmt.go, this was harmless.
In lex.go, it broke the error message related to
non-canonical import paths.

Fix it, and remove the useless variables.

The added test case is ignored in the go/types tests, since
the behavior of the non-canonical import path check seems
to be different.

Fixes #11362

Change-Id: Ic9129139ede90357dc79ebf167af638cf44536fa
Reviewed-on: https://go-review.googlesource.com/15580
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-08 01:51:24 +00:00
Ian Lance Taylor 449cc06e98 test: adjust gccgo expected import errors
Update two tests for the recently submitted gccgo change
https://golang.org/cl/14259.

Change-Id: Ib18bc87ea512074aa91fd4096d0874b72e2243e5
Reviewed-on: https://go-review.googlesource.com/15493
Reviewed-by: Chris Manghane <cmang@golang.org>
2015-10-07 14:37:44 +00:00
Shenghou Ma 48b1e6bc97 test: gofmt fixedbugs/issue10975.go
Change-Id: I772d1bc3e394cdd707f210f2aaff77100d299e24
Reviewed-on: https://go-review.googlesource.com/15380
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-06 06:56:11 +00:00
Michael Hudson-Doyle 710b9ad617 cmd/compile/internal/ppc64: fix the epilogue for non-leaf generated methods
This lets us re-enable duffzero.

Fixes #12108

Change-Id: Iefd24d26eaa56067caa2c29ff99cd20a42d8714a
Reviewed-on: https://go-review.googlesource.com/14937
Reviewed-by: Keith Randall <khr@golang.org>
2015-10-06 03:34:13 +00:00
Raul Silvera 27ee719fb3 pprof: improve sampling for heap profiling
The current heap sampling introduces some bias that interferes
with unsampling, producing unexpected heap profiles.
The solution is to use a Poisson process to generate the
sampling points, using the formulas described at
https://en.wikipedia.org/wiki/Poisson_process

This fixes #12620

Change-Id: If2400809ed3c41de504dd6cff06be14e476ff96c
Reviewed-on: https://go-review.googlesource.com/14590
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-05 08:15:09 +00:00
David Chase f7a39a54e9 cmd/compile: escape analysis, don't always escape variadic args
Turns out the summary information for the ... args was
already correctly computed, all that lacked was to make
use of it and correct tests that documented our prior
deficiencies.

Fixes #12006

Change-Id: Ie8adfab7547f179391d470679598f0904aabf9f7
Reviewed-on: https://go-review.googlesource.com/15200
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-10-04 20:45:35 +00:00
acanino acc90c53e8 cmd/compile: Fix internal compiler: getinarg: not a func when returning invalid interface.
Internal error arose from calling methodfunc on a invalid interface
field during the implements check. int obviously isn't a function,
and errors on getinarg...

for im := iface.Type; im != nil; im = im.Down {
  imtype = methodfunc(im.Type, nil)
  // ...
}

Fix handles the internal compiler error, but does not throw an
additional error, i.e. the following code will error on the I
interface, but type A will pass the implements check since
'Read(string) string' is implemented and 'int' is skipped

type I interface {
  Read(string) string
  int
}

type A struct {
}

func (a *A) Read(s string) string {
  return s
}

func New() I {
  return new(A)
}

Fixes #10975

Change-Id: I4b54013afb2814db3f315515f0c742d8631ca500
Reviewed-on: https://go-review.googlesource.com/13747
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-03 15:32:46 +00:00
David Chase 745cdc3ad7 cmd/compile: repair escape analysis of range &fixedArray
The existing test did not take into account the implicit
dereference of &fixedArray and thus heap-escaped when it
was not necessary.

Also added a detailed test for this and related cases.

Fixes #12588

Change-Id: I951e9684a093082ccdca47710f69f4366bd6b3cf
Reviewed-on: https://go-review.googlesource.com/15130
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-10-01 18:49:18 +00:00
Joel Sing 82a9d90eda tests/fixedbugs: make test for issue11656 run known instruction
As detailed in #11910, the current implementation attempts to execute an area
of memory with unknown content. If the memory is executable, the result is
unpredictable - instead, make the test deterministic by attempting to execute
an instruction that is known to trigger a trap on the given architecture.

The new implementation is written by iant@ and provided via #11910.

Update issue #11910

Change-Id: Ia698c36e0dd98a9d9d16a701f60f6748c6faf896
Reviewed-on: https://go-review.googlesource.com/15058
Run-TryBot: Joel Sing <jsing@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-28 04:23:33 +00:00
Robert Griesemer 7b7f85534c test/fixedbugs: update overly restrictive test case
See discussion in https://go-review.googlesource.com/14830 .

Change-Id: I94f25f92b8cdaa509d2c335865a645228425804d
Reviewed-on: https://go-review.googlesource.com/14837
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-22 17:54:01 +00:00
Robert Griesemer c396c047c6 src/cmd/compile/internal/gc: remove now unnecessary restriction on float exponent parsing
https://go-review.googlesource.com/#/c/13778/ fixed this issue in math/big.
Remove restriction in compiler.

Fixes #11326.

Change-Id: I1429d0dd0d79431706c65616413373fff58f081e
Reviewed-on: https://go-review.googlesource.com/14830
Reviewed-by: Rob Pike <r@golang.org>
2015-09-22 00:22:49 +00:00
Michael Hudson-Doyle 955b4caa48 test: move allocation before munmap in recover4
recover4 allocates 16 pages of memory via mmap, makes a 4 page hole in it with
munmap, allocates another 16 pages of memory via normal allocation and then
tries to copy from one to the other. For some reason on arm64 (but no other
platform I have tested) the second allocation sometimes causes the runtime to
ask the kernel for 4 additional pages of memory -- which the kernel satisfies
by remapping the pages that were just unmapped!

Moving the second allocation before the munmap fixes this behaviour, I can run
recover4 tens of thousands of times without failure with this fix vs a failure
rate of ~0.5% before.

Fixes #12549

Change-Id: I490b895b606897e4f7f25b1b51f5d485a366fffb
Reviewed-on: https://go-review.googlesource.com/14632
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-16 08:51:48 +00:00
Dave Cheney dab0dac01a cmd/compile: convert typecheck_stack to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I4d041b343952f4a31f3150fd70669e08fcaa74f8
Reviewed-on: https://go-review.googlesource.com/14305
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-06 23:50:51 +00:00
Dave Cheney 703bd83623 cmd/compile: use []*Node instead of NodeList in sinit
This is a first of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Iad10b75e42b5b24e1694407841282fa3bab2dc9f
Reviewed-on: https://go-review.googlesource.com/14232
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-05 02:25:01 +00:00
Ulrich Kunitz 6ec1809b83 cmd/compile: fix register allocation for == operator
The issue 12226 has been caused by the allocation of the same register
for the equality check of two byte values. The code in cgen.go freed the
register for the second operand before the allocation of the register
for the first operand.

Fixes #12226

Change-Id: Ie4dc33a488bd48a17f8ae9b497fd63c1ae390555
Reviewed-on: https://go-review.googlesource.com/13771
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-25 18:10:14 +00:00
Alberto Donizetti 85de30e72f cmd/compile: allow huge rsh in constants arithmetic
Currently an expression like

var v = 0 >> 1000

is rejected by gc with a "stupid shift" error, while gotype
compiles it successfully.

As suggested by gri on the issue tracker, allow an rsh right
operand to be any valid uint value.

Fixes #11328

Change-Id: I6ccb3b7f842338d91fd26ae37dd4fa279d7fc440
Reviewed-on: https://go-review.googlesource.com/13777
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-08-21 20:27:22 +00:00
Keith Randall e97ab0a0ac cmd/compile: remove stale register use array
The reg[] array in .../gc is where truth lies.  The copy in .../ARCH
is incorrect as it is mostly not updated to reflect regalloc decisions.

This bug was introduced in the rewrite
https://go-review.googlesource.com/#/c/7853/.  The new reg[] array was
introduced in .../gc but not all of the uses were removed in the
.../ARCH directories.

Fixes #12133

Change-Id: I6364fc403cdab92d802d17f2913ba1607734037c
Reviewed-on: https://go-review.googlesource.com/13630
Reviewed-by: Russ Cox <rsc@golang.org>
2015-08-15 17:37:14 +00:00
Mikio Hara fd179afb56 test/bench/shootout: fix build
Change-Id: Ic8ff6c28ec899cf5e01553b83110eb6262870995
Reviewed-on: https://go-review.googlesource.com/12918
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-31 17:37:58 +00:00
Andrew Gerrand b63fb59de8 test/bench/shootout: clean up binaries after run
Update #11943

Change-Id: I3e6592876bf16d2f9129995b723ecf69c069653d
Reviewed-on: https://go-review.googlesource.com/12913
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-31 02:50:43 +00:00
David Chase 6f6bcadc17 cmd/compile: add case for ODOTTYPE to escwalk
ODOTTYPE should be treated a whole lot like ODOT,
but it was missing completely from the switch in
escwalk and thus escape status did not propagate
to fields.

Since interfaces are required to trigger this bug,
the test was added to escape_iface.go.

Fixes #11931.

Change-Id: Id0383981cc4b1a160f6ad447192a112eed084538
Reviewed-on: https://go-review.googlesource.com/12921
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30 17:39:44 +00:00
Russ Cox b2dfacf35e runtime: change arm software div/mod call sequence not to modify stack
Instead of pushing the denominator argument on the stack,
the denominator is now passed in m.

This fixes a variety of bugs related to trying to take stack traces
backwards from the middle of the software div/mod routines.
Some of those bugs have been kludged around in the past,
but others have not. Instead of trying to patch up after breaking
the stack, this CL stops breaking the stack.

This is an update of https://golang.org/cl/19810043,
which was rolled back in https://golang.org/cl/20350043.

The problem in the original CL was that there were divisions
at bad times, when m was not available. These were divisions
by constant denominators, either in C code or in assembly.
The Go compiler knows how to generate division by multiplication
for constant denominators, but the C compiler did not.
There is no longer any C code, so that's taken care of.
There was one problematic DIV in runtime.usleep (assembly)
but https://golang.org/cl/12898 took care of that one.
So now this approach is safe.

Reject DIV/MOD in NOSPLIT functions to keep them from
coming back.

Fixes #6681.
Fixes #6699.
Fixes #10486.

Change-Id: I09a13c76ad08ba75b3bd5d46a3eb78e66a84ab38
Reviewed-on: https://go-review.googlesource.com/12899
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-30 16:14:05 +00:00
Russ Cox 034a10d44c cmd/internal/obj/arm64: reject misaligned stack frames, except empty frames
The layout code has to date insisted on stack frames that are 16-aligned
including the saved LR, and it ensured this by growing the frame itself.
This breaks code that refers to values near the top of the frame by positive
offset from SP, and in general it's too magical: if you see TEXT xxx, $N,
you expect that the frame size is actually N, not sometimes N and sometimes N+8.

This led to a serious bug in the compiler where ambiguously live values
were not being zeroed correctly, which in turn triggered an assertion
in the GC about finding only valid pointers. The compiler has been
fixed to always emit aligned frames, and the hand-written assembly
has also been fixed.

Now that everything is aligned, make unaligned an error instead of
something to "fix" silently.

For #9880.

Change-Id: I05f01a9df174d64b37fa19b36a6b6c5f18d5ba2d
Reviewed-on: https://go-review.googlesource.com/12848
Reviewed-by: Austin Clements <austin@google.com>
2015-07-29 21:37:12 +00:00
David du Colombier 68117a91ae runtime: fix x86 stack trace for call to heap memory on Plan 9
Russ Cox fixed this issue for other systems
in CL 12026, but the Plan 9 part was forgotten.

Fixes #11656.

Change-Id: I91c033687987ba43d13ad8f42e3fe4c7a78e6075
Reviewed-on: https://go-review.googlesource.com/12762
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-28 19:01:41 +00:00
Ian Lance Taylor 2fc2f8ddc2 test: don't run fixedbugs/issue11656.go on netbsd/386
The netbsd/386 builder reports a failure at
http://build.golang.org/log/c21c45a4fc6f4845868aa3ebde0f5bb3f167f3a3

I'm assuming that this is similar to the unknown openbsd failure.

Update #11910.

Change-Id: I9cdfefa23dc7cda3849f14814b3ce531f1d39e93
Reviewed-on: https://go-review.googlesource.com/12777
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-28 16:36:46 +00:00
Ian Lance Taylor 92e2252b21 test: don't run issue10607.go on ppc64
This is a reprise of https://golang.org/cl/12623.  In that a CL I made
a suggestion which forgot that the +build constraints in the test
directory are not the same as those supported by the go tool: in the
test directory, if a single +build line fails, the test is skipped.
(In my defense, the code I was commenting on was also wrong.)

Change-Id: I8f29392a80b1983027f9a33043c803578409d678
Reviewed-on: https://go-review.googlesource.com/12776
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-28 15:22:56 +00:00
Russ Cox a2cf0568e8 Revert "test: do not run external linking test on ppc64le"
Broke most builders.

This reverts commit a60c5366f9.

Change-Id: Iae952cfcc73ef5da621616a0b3d586b60d1ce9c9
Reviewed-on: https://go-review.googlesource.com/12684
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-27 16:53:41 +00:00
Michael Hudson-Doyle a60c5366f9 test: do not run external linking test on ppc64le
Change-Id: I9b8a6ac1ff6bef3b7f1e033bfd029f2a59e30297
Reviewed-on: https://go-review.googlesource.com/12623
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-27 16:22:12 +00:00
David Chase 731dcdae6d cmd/compile: prepend captured args to called-closure params
Old code appended, did not play well with a closure
with a ... param.

Fixes #11075.

Change-Id: Ib7c8590c5c4e576e798837e7499e00f3494efb4a
Reviewed-on: https://go-review.googlesource.com/12580
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-07-23 19:02:19 +00:00
David Chase 2584974d16 cmd/compile: adjust annotation of implicit operations.
Limit probe to ODOT/OIND/ODOTPTR for now; that works.

Fixes #11790

Change-Id: I411271e702c5fe6ceb880ca47c7dacc37ffcbb6a
Reviewed-on: https://go-review.googlesource.com/12532
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 14:19:07 +00:00
Ian Lance Taylor e9fcd6ed2b cmd/link: if -B option was used, pass it to the external linker
Fixes #10607.

Change-Id: Ib294cf65b07103b60f62b86b21ff2d07b25136fe
Reviewed-on: https://go-review.googlesource.com/12242
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-21 03:57:55 +00:00