Age | Commit message (Collapse) | Author | Files | Lines |
|
This matches the gc compiler.
The test case was sent for the master repo as
https://golang.org/cl/91138.
Fixes golang/go#23620
Reviewed-on: https://go-review.googlesource.com/91139
From-SVN: r257300
|
|
Otherwise on a 64-bit system we will read the 32-bit value as a 64-bit
value. Since getaddrinfo returns negative numbers as error values,
these will be interpreted as numbers like 0xfffffffe rather than -2,
and the comparisons with values like syscall.EAI_NONAME will fail.
Fixes golang/go#23645
Reviewed-on: https://go-review.googlesource.com/91296
From-SVN: r257299
|
|
We already dereference the pointer to copy the value, but if the
method does not use the value then the pointer dereference may be
optimized away. Do an explicit nil check so that we get the panic
that is required.
Fixes golang/go#19806
Reviewed-on: https://go-review.googlesource.com/91275
* go.go-torture/execute/printnil.go: New test.
From-SVN: r257280
|
|
Ensure that array types with complicated length expressions are
handled correctly by lowering expression types in the lowering pass.
This required some adjustment of constant expression types to not
report too many errors for circular constant expressions. We now
record error types in the Named_constant type. If we find the
circularity due to lowering the Named_constant, we use that location
for the error message; this retains the error location we used to use.
Fixes golang/go#23545
Reviewed-on: https://go-review.googlesource.com/91035
From-SVN: r257250
|
|
I forgot to update the name of the map[string]bool type descriptor
used in go-fieldtrack.c. This didn't cause any errors because it's a
weak symbol, and the current testsuite has no field tracking tests.
Reviewed-on: https://go-review.googlesource.com/91096
From-SVN: r257249
|
|
On AIX nm displays symbols with a leading dot; don't discard such
symbols.
While we're here stop doing fgrep -v '$', symbol names no longer
contain '$' anyhow.
Reviewed-on: https://go-review.googlesource.com/91095
From-SVN: r257247
|
|
On ppc64 gotest treats data variables whose names begin with "Test" as
tests to run. This is to support the function descriptors used for
ppc64 ELF ABI v1. This causes gotest to think that TestAddr6 is a
test, when it is actually a variable. For a simple fix until we can
figure out how to write gotest properly, rename the variable.
Fixes golang/go#23623
Reviewed-on: https://go-review.googlesource.com/90995
From-SVN: r257235
|
|
* go-gcc.cc (Gcc_backend::convert_tree): New private method.
(Gcc_backend::constructor_expression): Call it.
(Gcc_backend::assignment_statement): Likewise.
(Gcc_backend::temporary_variable): Likewise.
Fixes https://golang.org/issue/#23606
From-SVN: r257218
|
|
Function_type and Backend_function_type have different backend
representations, so they should not be identical. Otherwise it
confuses Type::type_btypes map.
Reviewed-on: https://go-review.googlesource.com/90975
From-SVN: r257216
|
|
CL 84555 added support for the SuperH architecture, but didn't add the
randomTrap definition to be used for the getrandom syscall on Linux.
Add it now.
Reviewed-on: https://go-review.googlesource.com/90535
From-SVN: r257171
|
|
The compiler skips the escape analysis pass if it has seen any errors.
The write barrier pass, especially the check-escapes portion, relies
on escape analysis running. So don't run this pass if there have been
any errors, as it may cause further unreliable error reports.
Reviewed-on: https://go-review.googlesource.com/90575
From-SVN: r257163
|
|
Reviewed-on: https://go-review.googlesource.com/90295
From-SVN: r257126
|
|
Call message_name when printing a variable for an escape analysis
message. This implies changing the AST dumps, which is fine.
Reviewed-on: https://go-review.googlesource.com/90296
From-SVN: r257113
|
|
Add a Type::is_alias method to remove some existing loops and avoid
adding a new one.
Test case is https://golang.org/cl/89935.
Fixes golang/go#23489
Reviewed-on: https://go-review.googlesource.com/89975
From-SVN: r257069
|
|
This was the original intent, as reflected in the long comment at the
start of names.cc, but I forgot to implement it.
Also, remove a leading ".0" from the final name. That could occur for
a method whose receiver type starts with 'u', as in that case we
prepend a space to the mangled name, to avoid confusion with the
Unicode mangling, and the space turns into ".0".
Also, if the Unicode encoding would cause the final to start with
"..u" or "..U", add a leading underscore.
Patch gotest to not get fooled by some names.
The result of these changes is that all symbols start with a letter or
an underscore.
Reviewed-on: https://go-review.googlesource.com/90015
From-SVN: r257068
|
|
The top three region number bits must be masked out before
right-shifting the address bits into place, otherwise they will be
copied down into the lower always-zero address bits.
Reviewed-on: https://go-review.googlesource.com/84535
From-SVN: r257061
|
|
Reviewed-on: https://go-review.googlesource.com/89815
From-SVN: r257049
|
|
Encode all external symbol names using only ASCII alphanumeric
characters, underscore, and dot. Use a scheme that can be reliably
demangled to a somewhat readable version as described in the long
comment in names.cc.
A minor cleanup discovered during this was that we were treating
function types as different if one had a NULL parameters_ field and
another has a non-NULL parameters_ field that has no parameters. This
worked because we mangled them slightly differently. We now mangle
them the same, so we treat them as equal, as we should anyhow.
Reviewed-on: https://go-review.googlesource.com/89555
* go.go-torture/execute/names-1.go: New test.
From-SVN: r257033
|
|
Reviewed-on: https://go-review.googlesource.com/88935
From-SVN: r256971
|
|
This makes no difference on most systems, because <sys/resource.h>
renames the type appropriately anyhow, but apparently it makes a
difference on AIX.
Reviewed-on: https://go-review.googlesource.com/88076
From-SVN: r256877
|
|
Solaris 10 uses int32 for the Pw_uid and Pw_gid fields of Passwd,
but most systems, including Solaris 11, use uint32. Force uint32
for consistency and to fix the build.
Reviewed-on: https://go-review.googlesource.com/88195
From-SVN: r256875
|
|
Reviewed-on: https://go-review.googlesource.com/88236
From-SVN: r256874
|
|
Reviewed-on: https://go-review.googlesource.com/88275
From-SVN: r256873
|
|
Patch by Rainer Orth.
Reviewed-on: https://go-review.googlesource.com/88376
From-SVN: r256872
|
|
update)
PR go/83787
compiler: pass int to makechan, call makechan64 when appropriate
The update to 1.10beta1 changed makechan to take int instead of int64,
and added a makechan64 call for large values. Since the size is the
last argument to makechan, the old compiler which always passed a
64-bit int worked fine on 64-bit systems and little-endian 32-bit
systems, but broke on big-endian 32-bit systems. This CL fixes the
compiler to use the appropriate types.
This fixes GCC PR 83787.
Reviewed-on: https://go-review.googlesource.com/88077
From-SVN: r256835
|
|
The runtime package was hard-coded non-escape, and the escape
analysis was not run for the runtime package. This CL removes
the hard-code, and lets the escape analysis decide. It is not
allowed for local variables and closures in the runtime to be
heap allocated. This CL adds the check that make sure that they
indeed do not escape.
The escape analysis is always run when compiling the runtime
now.
Fixes golang/go#17431
Reviewed-on: https://go-review.googlesource.com/86246
From-SVN: r256820
|
|
Reviewed-on: https://go-review.googlesource.com/87198
From-SVN: r256810
|
|
Reviewed-on: https://go-review.googlesource.com/87897
From-SVN: r256794
|
|
Reclaim the memory of escape analysis Nodes before kicking off
the backend, as they are not needed in get_backend.
Reviewed-on: https://go-review.googlesource.com/86243
From-SVN: r256707
|
|
Local variables captured by the deferred closure need to be live
until the function finishes, especially when the deferred
function runs. In Function::build, for function that has a defer,
we wrap the function body in a try block. So the backend sees
the local variables only live in the try block, without knowing
that they are needed also in the finally block where we invoke
the deferred function. Fix this by creating top-level
declarations for non-escaping address-taken locals when there
is a defer.
An example of miscompilation without this CL:
func F(fn func()) {
didPanic := true
defer func() {
println(didPanic)
}()
fn()
didPanic = false
}
With escape analysis turned on, at optimization level -O1 or -O2,
the store "didPanic = false" is elided by the backend's
optimizer, presumably because it thinks "didPanic" is not live
after the store, so the store is useless.
Reviewed-on: https://go-review.googlesource.com/86241
From-SVN: r256706
|
|
Move the architecture-specific settings out of configure.ac into a new
shell script goarch.sh. Use the new script to collect the values for
all architectures to make them available in go/types.
Also fix cmd/vet to pass the right compiler when it calls SizesFor.
This fixes cmd/vet for systems that are not implemented in the gc
toolchain, such as alpha and ia64.
Reviewed-on: https://go-review.googlesource.com/87635
From-SVN: r256655
|
|
PR go/83794
misc/cgo/test: avoid endless loop when we can't parse notes
Reviewed-on: https://go-review.googlesource.com/87416
From-SVN: r256553
|
|
No test as the only system I know that uses 64-bit DWARF is AIX.
Backport of https://golang.org/cl/84379, which will be in Go 1.11.
Backporting now for AIX support in gccgo.
Reviewed-on: https://go-review.googlesource.com/87296
From-SVN: r256474
|
|
Reviewed-on: https://go-review.googlesource.com/87197
From-SVN: r256450
|
|
Reviewed-on: https://go-review.googlesource.com/84555
From-SVN: r256446
|
|
obsolescent)
PR c/82922
runtime, syscall: use full prototypes in C code
Based on patch by Martin Sebor.
Reviewed-on: https://go-review.googlesource.com/86815
From-SVN: r256437
|
|
The exp/proxy package was removed from the master library in
https://golang.org/cl/6461056 (August, 2012).
The exp/terminal package was removed from the master library in
https://golang.org/cl/5970044 (March, 2012).
I'm not sure why they lingered in the gofrontend copy, but let's
finally remove them now.
Reviewed-on: https://go-review.googlesource.com/87138
From-SVN: r256435
|
|
GCC always recognizes the -fsplit-stack option, but then tests whether
it is supported by the selected target. If not, it reports
cc1: error: ‘-fsplit-stack’ is not supported by this compiler configuration
Check for that error message when deciding whether a compiler option works.
Reviewed-on: https://go-review.googlesource.com/87137
From-SVN: r256433
|
|
The signature of makemap changed with the update to 1.10beta1,
but I forgot to update the call from C code.
Reviewed-on: https://go-review.googlesource.com/87135
From-SVN: r256431
|
|
When compiling runtime, it is not allowed for local variables
and closures to be heap allocated. In one test, there is a go
statement with a closure. In the gc compiler, it distinguishes
capturing variable by value vs. by address, and rewrites it to
passing the captured values as arguments. Currently we don't
have this, and the escape analysis decides to heap allocate the
closure and also the captured variables, which is not allowed.
Work around it by passing the variables explicitly.
This is in preparation of turning on escape analysis for the
runtime.
Reviewed-on: https://go-review.googlesource.com/86245
From-SVN: r256419
|
|
This is in preparation of turning on escape analysis for the
runtime.
- In gccgo, systemstack is implemented with mcall, which is not
go:noescape. Wrap the closure in noescape so the escape analysis
does not think it escapes.
- Mark some C functions go:noescape. They do not leak arguments.
- Use noescape function to make a few local variables' addresses
not escape. The escape analysis cannot figure out because they
are assigned to pointer indirections.
Reviewed-on: https://go-review.googlesource.com/86244
From-SVN: r256418
|
|
For gccgo code avoid --whole-archive and -(. Use -blibpath instead of
-rpath.
Reviewed-on: https://go-review.googlesource.com/86956
From-SVN: r256417
|
|
Reviewed-on: https://go-review.googlesource.com/86936
From-SVN: r256416
|
|
Currently, allocation expression that can be allocated on stack
is implemented with __builtin_alloca, which turns into
__morestack_allocate_stack_space, which may call C malloc. This
may be slow. Also if this happens during certain runtime
functions (e.g. write barrier), bad things might happen (when
the escape analysis is enabled for the runtime). Make a temporary
variable on stack for the allocation instead.
Also remove the write barrier in the assignment in building heap
expression when it is stack allocated.
Reviewed-on: https://go-review.googlesource.com/86242
From-SVN: r256412
|
|
The escape analysis models closures by flowing captured variable
address to the closure node. However, the escape state for the
address expressions remained unset as ESCAPE_UNKNOWN. This
caused later passes to conclude that the address escapes. Fix this by
setting its escape state to ESCAPE_NONE first. If it escapes
(because the closure escapes), the flood phase will set its
escape state properly.
Reviewed-on: https://go-review.googlesource.com/86240
From-SVN: r256411
|
|
Defer statement may need to allocate a thunk. When it is not
inside a loop, this can be stack allocated, as it runs before
the function finishes.
Reviewed-on: https://go-review.googlesource.com/85639
From-SVN: r256410
|
|
Bound_method_expression needs a closure. Stack allocate the
closure when it does not escape.
Reviewed-on: https://go-review.googlesource.com/85638
From-SVN: r256407
|
|
Move some check of escape state earlier, from get_backend to
Mark_address_taken. So we can reclaim escape analysis Nodes
before kicking off the backend (not done in this CL). Also it
makes it easier to check variables and closures do not escape
when the escape analysis is run for the runtime package (also
not done in this CL).
Reviewed-on: https://go-review.googlesource.com/85735
From-SVN: r256406
|
|
CL 83876 added support of go:noescape pragma, but it only works
for functions called from the same package. The pragma did not
take effect for exported functions that are not called from
the same package. The reason is that top level function
declarations are not traversed, and only reached from calls
from other functions. This CL adds this support. The Traverse
class is extended with a mode to traverse function declarations.
Reviewed-on: https://go-review.googlesource.com/85637
From-SVN: r256405
|
|
If we're making a slice of constant size that does not need to
escape, allocate it on stack.
In lower, do not create temporaries for constant size makeslice,
so that it is easier to detect the slice is constant size later.
Reviewed-on: https://go-review.googlesource.com/85636
From-SVN: r256404
|