This implements a LineReader for line tables that parallels the
existing Reader for debug entries.
This code is partly based on the debug subrepo's fork of dwarf, but it
is a more complete (and, I believe, correct) implementation of the
spec and exposes a more general API. While the debug subrepo's
implementation exposed only a PC-to-line function, this version
exposes the line table rows to the caller. This way the caller can
make its own trade-offs when implementing PC-to-line (or line-to-PC),
such as whether or not to build an index for fast lookup.
Change-Id: Ie157bc817f55e940b6f2e1ae010c5a4e1f29c5c8
Reviewed-on: https://go-review.googlesource.com/6734
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This factors out the code for finding which unit contains an offset in
the "info" section. The new code also replaces linear search with a
binary search. The line table reader will also need this
functionality.
Change-Id: I2076e4fc6719b6f06fd2796cbbc7548ec1876cb3
Reviewed-on: https://go-review.googlesource.com/6733
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: Ia6f9bd77a3d4250339dcb054edc76942864dd358
Reviewed-on: https://go-review.googlesource.com/6781
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Previously, different DWARF sections had relocations applied in very
different ways. .debug_info was relocated, but only on x86-64 and 386
and using hard-coded relocation section names instead of relocation
links. .debug_abbrev and .debug_str were never relocated (which is
excusable because they shouldn't need it). .debug_types sections were
relocated on all architectures and found their relocation section
using a relocation link because section names could be ambiguous.
Simplify all of this so that every DWARF section that has a linked
relocation section gets those relocations applied.
This prepares this code to load .debug_line sections without the need
for yet more ad hoc relocation logic.
Change-Id: Ia00ac8e656b22f22bb31a5f6ef9b0f23cda64d19
Reviewed-on: https://go-review.googlesource.com/6780
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Convert Node.Isddd to a boolean and simplify usage.
- Node.Isddd converted to bool
- Type.Isddd converted to bool
- mkinlcall converted to take isddd as a bool
- typecheckaste converted to take isddd as a bool
- ascompatte converted to take isddd as a bool
Change-Id: I52586145619c44182bb0c2c5d80a0a3fe3e50a07
Reviewed-on: https://go-review.googlesource.com/7172
Reviewed-by: Keith Randall <khr@golang.org>
Removes a potential data race between os.Setenv and runtime.GOROOT,
along with a bug where os.Setenv would only sometimes change the
value of runtime.GOROOT.
Change-Id: I7d2a905115c667ea6e73f349f3784a1d3e8f810d
Reviewed-on: https://go-review.googlesource.com/6611
Reviewed-by: Keith Randall <khr@golang.org>
Updates #7338.
Change-Id: I859a73543352dbdd13ec05efb23a95aecbcc628a
Reviewed-on: https://go-review.googlesource.com/7164
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The struct XMLName sets the default namespace, but
that's not good enough for nested tags, because an
earlier tag can set the implicit parents of a subsequent
tag. This change makes sure that we always explicitly set the
namespace on a tag when possible.
See https://go-review.googlesource.com/#/c/5910/4/src/encoding/xml/marshal_test.go@628
for discussion.
Change-Id: If1afc536471c0be83e5dd80381b598476ea3f44d
Reviewed-on: https://go-review.googlesource.com/6927
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
More Node cleanups, these ones touch go.y.
- convert Node.Implicit to bool
- convert Node.Used to bool
Change-Id: I85c7ff9e66cee7122b560adedc995166c874f2f2
Reviewed-on: https://go-review.googlesource.com/7124
Reviewed-by: Keith Randall <khr@golang.org>
Updates #10119
Temporarily disable cgo by default to get the freebsd/arm
builder running again.
Change-Id: I4de1f896fcac650184df77c692b102ea6fb73bba
Reviewed-on: https://go-review.googlesource.com/7125
Reviewed-by: Andrew Gerrand <adg@golang.org>
Fix the build.
This reverts commit e73981512f.
Change-Id: I979e138991c06b3295be08212d3ce80b30c2381b
Reviewed-on: https://go-review.googlesource.com/7160
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
Somehow, terribly embarrassingly, I lost part of the "re-enable
-shared on amd64" patch when rebasing before it got submitted.
This restores it and also fixes the addend to be the necessary -4.
Change-Id: If71a09121d911a863bc07f1828ef76e3a54c1074
Reviewed-on: https://go-review.googlesource.com/6802
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The unix and windows getaddrinfo calls return a zone with IPv6
addresses. IPv6 link-local addresses returned are only valid on the
given zone. When the zone is dropped, connections to the address
will fail. This patch replaces IP with IPAddr in several internal
resolver functions, and plumbs through the zone.
Change-Id: Ifea891654f586f15b76988464f82e04a42ccff6d
Reviewed-on: https://go-review.googlesource.com/5851
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
some x86 instructions (e.g. PINSRW) might store memory address in Prog.From3,
so we must also rewrite Prog.From3 on nacl.
Change-Id: I2a0da0f692ba321eba17fbc454d68aaafa133515
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7074
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Also fixed a stack corruption bug for nacl/amd64p32.
Change-Id: I64b821b16999c296a159137d971af3870053c621
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7073
Reviewed-by: Dave Cheney <dave@cheney.net>
- make paramoutheap return a bool
- convert Node.Assigned to a bool
- convert Node.Captured to a bool
- convert Node.Byval to a bool
- convert Node.Dupok to a bool
- convert Node.Wrapper to a bool
- convert Node.Reslice to a bool
Change-Id: I5b57c019f936c31d53db4db14459fb2b0aa72305
Reviewed-on: https://go-review.googlesource.com/7030
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
Change-Id: Ia5115b15a79e1b2b53036646f1ed4b08225b220f
Reviewed-on: https://go-review.googlesource.com/7051
Run-TryBot: Chris Manghane <cmang@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The test used to import ../callback. I forget why that ever worked,
but it probably had something to do with the shared libraries we used
to use with SWIG. It doesn't work today.
Change-Id: Ib83d6c398aa46bf2fc66320b47b6e6d9897ee0b7
Reviewed-on: https://go-review.googlesource.com/7004
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Node.Addrtaken is treated as a bool, so make it a bool.
I'll start to batch these changes if they are simple.
Change-Id: I02a3d1131efc4e12b78b83372c1b50f8b160c194
Reviewed-on: https://go-review.googlesource.com/6911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Node.Hasbreak was treated like a bool, so declare it as bool.
Change-Id: Ied238356dce4da896834bd1412cc21ea56d35e1d
Reviewed-on: https://go-review.googlesource.com/6807
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Convert Node.Readonly to a bool.
Change-Id: Ide9f6f657f498d70d7b9544a38046325d7c82dc8
Reviewed-on: https://go-review.googlesource.com/6809
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Node.Builtin was occasionally set to 1, but never read.
Change-Id: Ia8a76bccc79b0f211296d50bd419860b13077ba5
Reviewed-on: https://go-review.googlesource.com/6808
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This fixes SWIG to work again. It requires SWIG 3.0.6 or later.
Earlier versions of SWIG will not work because they generate a .c file
to be compiled by [568]c, which no longer exist. As of SWIG 3.0.6
SWIG supports a -cgo option that tells it to generate files that
import "C" and can be used with the cgo tool. With luck this will
means that future versions of SWIG will not require changes for future
versions of Go.
Change-Id: Iad7beb196ba9dcd3e3f684196d50e5d51ed98204
Reviewed-on: https://go-review.googlesource.com/6851
Reviewed-by: Russ Cox <rsc@golang.org>
This is a pure code move without any semantic change.
Change-Id: I2c18efc858955d07949b1241e793232f2cf1deb9
Reviewed-on: https://go-review.googlesource.com/6821
Reviewed-by: Alan Donovan <adonovan@google.com>
Note: for simplicity, this CL changes the identifiers assigned to
gclocals.* objects; e.g., on amd64, gclocals.ABCDEFGHIJKLMNOP is now
gclocals.HGFEDCBAPONMLKJI. However, since Go requires all packages to
be built with the same toolchain version anyway, this should be a
non-issue.
Similarly, type hashes change somewhat, but don't seem to be exposed
to users in any detectable manner.
Change-Id: Iadb3bce472af9b022b88d52b3c4c5e4113cda330
Reviewed-on: https://go-review.googlesource.com/6232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This was inserted by c2go to turn each enum { ... } into one const ( ... ) block,
but it is fragile and was never intended as a long-term thing.
Change-Id: I8de8e0984b130456da70e4d59891276dfef7ac27
Reviewed-on: https://go-review.googlesource.com/6932
Reviewed-by: Rob Pike <r@golang.org>
It appears that c2go dropped comments inside struct { ... } and enum { ... }.
Restore them.
Identified missing comments by checking for comments present
in the C code but not the Go code, made a list, and then reapplied
with some mechanical help.
Missing comment finder: http://play.golang.org/p/g6qNUAo1Y0
Change-Id: I323ab45c7ef9d51e28eab3b699eb14bee1eef66b
Reviewed-on: https://go-review.googlesource.com/6899
Reviewed-by: Rob Pike <r@golang.org>
Minor comments added. More to come.
Change-Id: I97511db54d59e1009ef934da38f306a2dc83a6e9
Reviewed-on: https://go-review.googlesource.com/6898
Reviewed-by: Rob Pike <r@golang.org>
Starting it lazily causes a memory allocation (for the goroutine) during GC.
First use of channels for runtime implementation.
Change-Id: I9cd24dcadbbf0ee5070ee6d0ed7ea415504f316c
Reviewed-on: https://go-review.googlesource.com/6960
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Previously, gc would compile code like
func foo() { ... }
var bar = foo
by emitting a static closure to wrap "foo", but then emitting runtime
initialization code to assign the closure to "bar". This CL changes
gc to instead statically initialize "bar".
Notably, this change shrinks the "go" tool's text segment by ~7.4kB on
linux/amd64 while only increasing the data segment by ~100B:
text data bss dec hex filename
7237819 122412 215616 7575847 739927 go.before
7230398 122540 215232 7568170 737b2a go.after
Fixes issue #10081.
Change-Id: If5e26cf46b323393ba6f2199a82a06e9e4baf411
Reviewed-on: https://go-review.googlesource.com/6880
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Remove the per-achitecture formatter for Prog and replace it with
a global String method. Clean up and regularize the output. Update
tests affected by the format; some tests are made correct now when
they were broken before (and known to be).
Also, related: Change the encoding of the (R1+R2) syntax on ppc64
to be equivalent to (R1)(R2*1), which means it needs no special
handling.
Delete the now unused STRINGSZ constant.
Change-Id: I7f6654d11f80065f3914a3f19353f2f12edfe310
Reviewed-on: https://go-review.googlesource.com/6931
Reviewed-by: Russ Cox <rsc@golang.org>
Use optimized formatBits function to format mantissa and exponent.
Add benchmark for binary exponent float format.
on darwin/386
benchmark old ns/op new ns/op delta
BenchmarkAppendFloatBinaryExp 520 122 -76.54%
on darwin/amd64
benchmark old ns/op new ns/op delta
BenchmarkAppendFloatBinaryExp 76.9 84.3 +9.62%
Change-Id: If543552f1960e1655bed3a4130914e5eaa3aac69
Reviewed-on: https://go-review.googlesource.com/5600
Reviewed-by: Robert Griesemer <gri@golang.org>
I asked for this in CL 3742 and it was ignored.
Change-Id: I30ad05f87c7d9eccb11df7e19288e3ed2c7e2e3f
Reviewed-on: https://go-review.googlesource.com/6930
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
With the new unificiation, the flag must be TYPE_CONST to print
properly.
Change-Id: I7cd1c56355724f08cbe9afc6ab7a66904031adc9
Reviewed-on: https://go-review.googlesource.com/6903
Reviewed-by: Russ Cox <rsc@golang.org>
This was in i386 but not in x86 and was missed during the merge.
Needed for linux/386.
Change-Id: Ia6e495c044f53bcb98f3bb03e20d8f6d35a8f8ff
Reviewed-on: https://go-review.googlesource.com/6902
Reviewed-by: Rob Pike <r@golang.org>