Age | Commit message (Collapse) | Author | Files | Lines |
|
Previously, each time we do an interface conversion for which the
method table is not known at compile time, we allocate a new
method table.
This CL ports the mechanism of itab caching from the gc runtime,
adapted to our itab representation and method finding mechanism.
With the cache, we reuse the same itab for the same (interface,
concrete) type pair. This reduces allocations in interface
conversions.
Unlike the gc runtime, we don't prepopulate the cache with
statically allocated itabs, as currently we don't have a way to
find them. This means we don't deduplicate run-time allocated
itabs with compile-time allocated ones. But that is not too bad
-- it is just a cache anyway.
As now itabs are never freed, it is also possible to drop the
write barrier for writing the first word of an interface header.
I'll leave this optimization for the future.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/171617
From-SVN: r270778
|
|
This avoids a compiler crash on invalid code.
Fixes https://gcc.gnu.org/PR90272
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/174377
From-SVN: r270658
|
|
AIX doesn't allow to mmap an address range which is already mmap.
Therefore, once the region has been allocated, it must munmap before
being able to play with it.
The corresponding Go Toolchain patch is CL 174059.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/174138
From-SVN: r270615
|
|
Fix a problem with Function_declaration::import_function relating to
how no-name or "sink" parameters are handled. In Gogo::start_function
(for the non-inline case) when parameter bindings are being added,
parameters with empty/sink names are renamed to synthesized "r.%d" /
"p.%d" names so as to avoid collisions. This same handling needs to be
present when creating the bindings for an inline function that's being
instantiated after being read from export data.
Fixes golang/go#31637.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/173538
From-SVN: r270564
|
|
PR target/89093
runtime: mark unwind functions general-regs-only on ARM
For https://gcc.gnu.org/PR89093.
Change-Id: Ic426b43d633c77104bda01d4e7835bc9ab4695ef
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/173657
Reviewed-by: Ian Lance Taylor <iant@golang.org>
From-SVN: r270542
|
|
This patch is required in order to build golang.org/x/net. The
corresponding Go Toolchain patch is CL 170537.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/172898
From-SVN: r270458
|
|
PR go/90110
compiler: use temporary to avoid early destruction
The code was passing a substr directly to strtol, and then checking
the *end value returned by strtol. But the substr could be destroyed
as soon as strtol returns, making the test of *end invalid.
Also fix an incorrect test of the string index rather than the value.
Fixes https://gcc.gnu.org/PR90110
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/172663
From-SVN: r270434
|
|
Resolve a small problem with concatenation of string constants: in a
string concat X + Y where X has named type and Y has abstract string
type, insure that the result has X's type, and disable folding if the
both sides have a concrete type that does not match.
Fixes golang/go#31412.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/171797
From-SVN: r270336
|
|
We can have multiple packages with the same name, so also sort by pkgpath.
To avoid an inconsistent sort, sort by symbol and pointer address if
we somehow get two different packages with the same name and pkgpath.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/171032
From-SVN: r270220
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170706
From-SVN: r270214
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168408
From-SVN: r269841
|
|
In the C calling convention, on AMD64, and probably a number of
other architectures, a 3-word struct argument is passed on stack.
This is less efficient than passing in three registers. Further,
this may affect the code generation in other part of the program,
even if the function is not actually called.
Slices are common in Go and append is a common slice operation,
which calls growslice in the growing path. To improve the code
generation, pass the slice header's three fields as separate
values, instead of a struct, to growslice.
The drawback is that this makes the runtime implementation
slightly diverges from the gc runtime.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/168277
From-SVN: r269811
|
|
Since aix/ppc64 has been added to GC toolchain, a mix between new and
old files were created in gcc toolchain.
This commit corrects this merge for aix/ppc64 and aix/ppc.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167658
From-SVN: r269797
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167749
From-SVN: r269780
|
|
When an inline function (with body) is imported from another package,
make that the "nointerface" property (if set) is preserved.
Fixes golang/go#30862.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167742
From-SVN: r269713
|
|
Fixes bootstrap with a C++98 compiler.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/167762
From-SVN: r269710
|
|
The compiler generates two array index expressions when lowering
an append expression. Currently they generate bound checks.
Bound checks are not necessary in this case, as we know the slice
has, or will grow to, enough length and capacity. Eliminate them.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/166817
From-SVN: r269699
|
|
This change fixes a bug in which two interface types were being
incorrectly commoned (considered identical) in the initial stages of
writing out types to export data. The indexer does a walk to collect
candidates for export, inserting types into a table to eliminate
duplicates; as part of this process a local interface type T1 was
being commoned with a different interface type T2. This caused a cycle
in the exported type graph due to the way embedded interfaces are
handled.
The fix was to add a new flag to the Type::is_identical utility
routine to request that interface type comparison be done by examining
the original parse methods, as opposed to the expanded method set,
then use the new flag when creating the hash map for the exporter.
Fixes golang/go#30659.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/166638
From-SVN: r269634
|
|
Add a new debugging utility routine debug_go_type(), intended to
display the contents of a Type object in a way useful to debugging
a run of the compiler. Prior to this the only useful alternative
for debugging types was invoking the mangled_name() method, which
has problems (for example, won't work on interface types prior
to finalizing of methods).
This is a "deep" dump, meaning that all types reachable from the
type passed to debug_go_type() will be printed out. Example:
(gdb) print debug_go_type(t1)
T0 0x535f300 'net/http.Header' -> T1
T1 0x535d3d0 map ['string' -> string] T4
T2 0x5304bb0 'string' -> string
T3 0x331f900 string
T4 0x535d370 array [] 'string' -> string
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/166637
From-SVN: r269633
|
|
PR go/89447
syscall, internal/syscall: adjust use of largefile functions
Consistently call __go_openat for openat. Use fstatat64, creat64,
sendfile64, and getdents64 where needed.
Based on patch by Rainer Orth.
Fixes https://gcc.gnu.org/PR89447
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/166420
From-SVN: r269521
|
|
can't restore toc; recompile with -fPIC")
PR go/89227
* go-gcc.cc (Gcc_backend::function): Set TREE_PUBLIC for an
only-inline function.
From-SVN: r269449
|
|
In Array_type::do_export, when emitting a concrete array length,
evaluate the length expression to an integer constant and emit that
constant, instead of calling the more general method for emitting
expressions. This is to avoid the possibility that we will need
to emit a conversion, which could confuse the gccgoimporter.
Fixes golang/go#30628.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165741
From-SVN: r269443
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165737
From-SVN: r269424
|
|
PR go/89598
compiler: use GMP_RNDN rather than MPFR_RNDN
Missed one last time around. This fixes the build with mpfr 2.4.2.
Fixes https://gcc.gnu.org/PR89598
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165420
From-SVN: r269411
|
|
In the runtime there are bad pointer checks that currently don't
work with the concervative collector. With stack maps, the GC is
precise and the checks should work. Enable them.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/153871
From-SVN: r269406
|
|
On aix/ppc64, ar tool must always have -X64 argument if it aims to
create 64 bits archives.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165317
From-SVN: r269404
|
|
If there is no f_flags field in statfs_t then rename one of the
f_spare fields, as happened in Linux kernel version 2.6.36. This
fixes the build on CentOS 5.11. The CentOS kernel will hopefully not
fill in the f_spare field, so the resulting flags will be zero.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165417
From-SVN: r269401
|
|
PR go/89598
compiler: use GMP_RNDN rather than MPFR_RNDN
This fixes the build with mpfr 2.4.2.
Fixes https://gcc.gnu.org/PR89598
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/165418
From-SVN: r269399
|
|
PR go/89406
go/internal/gccgoimporter: remove temporary directories in test
Backport of https://golang.org/cl/164862.
Updates https://gcc.gnu.org/PR89406
Reviewed-on: https://go-review.googlesource.com/c/164863
From-SVN: r269338
|
|
This restores part of https://golang.org/cl/45695 that was
accidentally lost in https://golang.org/cl/158019 (the update to
Go1.12beta2).
Reviewed-on: https://go-review.googlesource.com/c/164737
From-SVN: r269333
|
|
Interpreting auxv as []uintptr is incorrect on 64-bit big-endian,
as auxv alternates a 32-bit int with a 64-bit pointer.
Patch from Rainer Orth.
Reviewed-on: https://go-review.googlesource.com/c/164739
From-SVN: r269315
|
|
When using the go tool with gccgo, this changes the default
compilation to use -O2. The -gccgoflags option can be used to
override this default. I think this change better corresponds to what
people expect when using the go tool.
Reviewed-on: https://go-review.googlesource.com/c/164378
From-SVN: r269299
|
|
gotest: avoid using echo inside $()
The handling of newlines is not portable between bash and ksh.
Reviewed-on: https://go-review.googlesource.com/c/164597
From-SVN: r269298
|
|
On Darwin, the section name is prefixed with the segment name, __GNU_GO.
Reviewed-on: https://go-review.googlesource.com/c/151097
From-SVN: r269271
|
|
PR go/89172
internal/cpu, runtime, runtime/pprof: handle function descriptors
When using PPC64 ELF ABI v1 a function address is not a PC, but is the
address of a function descriptor. The first field in the function
descriptor is the actual PC (see
http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-DES).
The libbacktrace library knows about this, and libgo uses actual PC
values consistently except for the helper function funcPC that appears
in both runtime and runtime/pprof.
This patch fixes funcPC by recording, in the internal/cpu package,
whether function descriptors are being used. We have to check for
function descriptors using a C compiler check, because GCC can be
configured using --with-abi to select the ELF ABI to use.
Fixes https://gcc.gnu.org/PR89172
Reviewed-on: https://go-review.googlesource.com/c/162978
From-SVN: r269266
|
|
Backport of upstream https://golang.org/cl/163859.
This fixes various failures on 32-bit SPARC.
Patch from Eric Boctazou.
Reviewed-on: https://go-review.googlesource.com/c/163860
From-SVN: r269258
|
|
Updates golang/go#28104
Reviewed-on: https://go-review.googlesource.com/c/162882
From-SVN: r269242
|
|
Fixes golang/go#25302.
Reviewed-on: https://go-review.googlesource.com/c/163298
From-SVN: r269241
|
|
Reviewed-on: https://go-review.googlesource.com/c/158838
From-SVN: r269240
|
|
Reviewed-on: https://go-review.googlesource.com/c/163742
From-SVN: r269216
|
|
7.3.0 fails)
PR go/86535
runtime: always declare nanotime in Go
For libgo it's always defined in C.
Updates https://gcc.gnu.org/PR86535
Reviewed-on: https://go-review.googlesource.com/c/163743
From-SVN: r269214
|
|
Reviewed-on: https://go-review.googlesource.com/c/162881
From-SVN: r269202
|
|
PR go/89406
net: remove unixgram test sockets
Backport https://golang.org/cl/163277 from the master library.
Updates https://gcc.gnu.org/PR89406
Reviewed-on: https://go-review.googlesource.com/c/163200
From-SVN: r269087
|
|
Backport https://golang.org/cl/163237 from the master library:
Ensure that cmd/go consistently calls base.Exit rather than os.Exit,
so that we don't incorrectly leave the work directory around on exit.
Test this by modifying the testsuite to run all the tests with TMPDIR
set to a temporary directory, and then check that no files are left
behind in that temporary directory. Adjust a couple of tests to make
this approach work.
Updates https://gcc.gnu.org/PR89406
Reviewed-on: https://go-review.googlesource.com/c/163198
From-SVN: r269086
|
|
PR go/89407
internal/cpu: use #ifdef __s390x__ in C code
Patch by Jakub Jelinek.
Fixes https://gcc.gnu.org/PR89407
Reviewed-on: https://go-review.googlesource.com/c/163297
From-SVN: r269063
|
|
Reviewed-on: https://go-review.googlesource.com/c/163097
From-SVN: r269049
|
|
Introduce a set debug_go_* global functions that can be used to emit
AST dumps for Go statements and expressions from within GDB (for use
by people developing gccgo).
Reviewed-on: https://go-review.googlesource.com/c/162903
From-SVN: r269027
|
|
PR go/89169
internal/cpu: do not require POWER8
Although the gc toolchain requires POWER8, the gccgo toolchain does not.
Fixes https://gcc.gnu.org/PR89169
Reviewed-on: https://go-review.googlesource.com/c/162979
From-SVN: r269019
|
|
In signal-triggered stack scan, if the signal is delivered at
certain bad time (e.g. in vdso, or in the middle of setcontext?),
the unwinder may not be able to unwind the whole stack, while it
still reports _URC_END_OF_STACK. So we cannot rely on _URC_END_OF_STACK
to tell if it successfully scanned the stack. Instead, we check
the last Go frame to see it actually reached the end of the stack.
For Go-created stack, this is runtime.kickoff. For C-created
stack, we need to record the outermost Go frame when it enters
the Go side.
Also we cannot unwind the stack if the signal is delivered in the
middle of runtime.gogo, halfway through a goroutine switch, where
the g and the stack don't match. Give up in this case as well.
Reviewed-on: https://go-review.googlesource.com/c/159098
From-SVN: r269018
|
|
Currently, the compiler lowers runtime.getcallersp to
__builtin_frame_address(1). In the C side of the runtime,
getcallersp is defined as __builtin_frame_address(0). They don't
match. Further, neither of them actually returns the caller's SP.
On AMD64, __builtin_frame_address(0) just returns the frame
pointer. __builtin_frame_address(1) returns the memory content
where the frame pointer points to, which is typically the
caller's frame pointer but can also be garbage if the frame
pointer is not enabled.
This CL changes it to use __builtin_dwarf_cfa(), which returns
the caller's SP at the call site. This matches the SP we get
from unwinding the stack.
Currently getcallersp is not used for anything real. It will be
used for precise stack scan (a new version of CL 159098).
Reviewed-on: https://go-review.googlesource.com/c/162905
* go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_dwarf_cfa
instead of __builtin_frame_address.
From-SVN: r268952
|