aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
2019-10-14compiler: revise exportdata fix for processing constant typesIan Lance Taylor2-2/+2
This patch is an addendum to the fix for issue 34577, which was not sufficiently general. During export data processing, when looking at the types of constants mentioned in inlinable function bodies, include both locally defined constants and constant imported from other packages. Testcase for this bug is in CL 201017. Fixes golang/go#34852. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201018 From-SVN: r276976
2019-10-14runtime: correct facilities names in s390 CPU supportIan Lance Taylor1-1/+1
Patch from Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201038 From-SVN: r276964
2019-10-14internal/cpu: define kdsaQuery for s390Ian Lance Taylor1-1/+1
Patch from Andreas Krebbel. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201037 From-SVN: r276962
2019-10-12compiler: mangle dots in pkgpathIan Lance Taylor4-3/+25
We need to mangle dots to avoid problems with -fgo-pkgpath=a.0. That will confuse the name mangling, which assumes that names entering the mangling cannot contain arbitrary dot characters. We don't need to mangle other characters; go_encode_id will handle them. Fixes golang/go#33871 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/200838 From-SVN: r276913
2019-10-04compiler: include selected constant types during export processingIan Lance Taylor4-1/+31
The machinery that collects types referenced by expressions that are part of inlinable function bodies was missing the types of local named constants in certain cases. This patch updates the Collect_export_references::expression() hook to look for references to local named constants and include their types in the exported set. Fixes golang/go#34577. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198017 From-SVN: r276594
2019-10-04compiler: adjust code to avoid shadowing local variablesIan Lance Taylor8-91/+85
Also add a couple of missing calls to free after mpz_get_str. This should make the code clean with respect to -Wshadow=local. Based on patch by Bernd Edlinger. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198837 From-SVN: r276579
2019-10-02runtime: mark go-context.S as no-executable-stack and split-stack supportedIan Lance Taylor1-1/+1
The .note.GNU-stack section tells the linker that this object does not require an executable stack. The .note.GNU-split-stack section tells the linker that functions in this object can be called directly by split-stack functions, without require a large stack. The .note.GNU-no-split-stack section tells the linker that functions in this object do not have a split-stack prologue. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/198440 From-SVN: r276488
2019-09-30compiler: change escape maps to hash tablesIan Lance Taylor3-31/+31
Also use just one table lookup, not two. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197759 From-SVN: r276382
2019-09-28compiler: resolve importing ambiguity for more complex function callsIan Lance Taylor2-1/+6
Tweak the exporter for inlinable function bodies to work around a problem with importing of function calls whose function expressions are not simple function names. In the bug in question, the function body exporter was writing out a function call of the form (*(*FuncTyp)(var))(arg) which produced an export data representation of *$convert(<type 5>, var)(x) which is hard to parse unambiguously. Fix: change the export data emitter to introduce parens around the function expression for more complex calls. Testcase for this bug is in CL 197217. Fixes golang/go#34503. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197122 From-SVN: r276228
2019-09-27compiler: don't read known type, simplify Import::finalize_methodsIan Lance Taylor3-23/+23
With the current export format, if we already know the type, we don't have to read and parse the definition. We only use the finalizer in Import::finalize_methods, so make it a local variable. To match Finalize_methods::type, only put struct types into real_for_named. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197700 From-SVN: r276188
2019-09-27compiler: only check whether struct or array types are bigIan Lance Taylor2-6/+18
Fetching the size of a type typically involves a hash table lookup, and is generally non-trivial. The escape analysis code calls is_big more than one might expect. So only fetch the size if we need it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197699 From-SVN: r276187
2019-09-27compiler: fix brace formattingIan Lance Taylor2-7/+8
Just happened to notice this one. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197698 From-SVN: r276186
2019-09-19libgo: support gollvm build on arm64 linuxIan Lance Taylor1-1/+1
This CL serves as part of an initial change for enabling gollvm building on arm64 linux, the rest of the change will be covered by another one to the gollvm repo. Incorporate type definition of 'uint128' to 'runtime' and 'syscall' packges, the change is not specific to arm64 linux but made available for all platforms. Verified by building and unit-testing gollvm on linux x86-64 and arm64. Verified by building and checking gccgo on linux x86-64 and arm64. Fixes golang/go#33711 Change-Id: I4720c7d810cfd4ef720962fb4104c5641b2459c0 From-SVN: r275919
2019-09-17runtime: for FFI, treat directIface types as pointersIan Lance Taylor1-1/+1
This only matters on systems that pass a struct with a single pointer field differently than passing a single pointer. I noticed it on 32-bit PPC, where the reflect package TestDirectIfaceMethod failed. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195878 From-SVN: r275814
2019-09-17re PR go/91781 (r275691 breaks go test "reflect")Ian Lance Taylor1-1/+1
PR go/91781 reflect: promote integer closure return to full word The libffi library expects an integer return type to be promoted to a full word. Implement that when returning from a closure written in Go. This only matters on big-endian systems when returning an integer smaller than the pointer size, which is why we didn't notice it until now. Fixes https://gcc.gnu.org/PR91781. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195858 From-SVN: r275813
2019-09-17reflect: unexport FFICallbackGo; use go:linkname insteadIan Lance Taylor1-1/+1
The function was always intended to be internal-only, but was exported so that C code could call it. Now that have go:linkname for that, use it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195857 From-SVN: r275809
2019-09-16compiler: fix quoting of //go:linkname in error messageIan Lance Taylor2-2/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195718 From-SVN: r275758
2019-09-13libgo: don't use \? in grep patternIan Lance Taylor1-1/+1
It's not supported by Solaris grep. Just use * instead; it matches more but it shouldn't matter. Fixes https://gcc.gnu.org/PR91764 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195238 From-SVN: r275700
2019-09-12libgo: update to Go1.13Ian Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194698 From-SVN: r275691
2019-09-11compiler: suppress type descriptor generation for aliasesIan Lance Taylor2-2/+8
Change Named_object::get_backend to ignore aliases when creating type descriptors for types, to be consistent with Type::needs_specific_type_functions and the Specific_type_functions traversal class. For example, when compiling a package that creates an alias to an an externally defined type, e.g. import "foo" type MyFoo = foo.Foo it makes sense to skip the alias (not try to generate type specific functions for it) and let the normal mechanisms take care of the alias target, depending on whether the target is defined locally or defined elsewhere. Testcase for this problen can be found in CL 193261. Fixes golang/go#33866. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191961 From-SVN: r275651
2019-09-11golang.org/x/sys/cpu: define doinit when neededIan Lance Taylor1-1/+1
Should fix the build on riscv64 and other systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194641 From-SVN: r275650
2019-09-11gotest: force test package to be imported firstIan Lance Taylor1-1/+1
When compiling the x_test package, force the test package to be imported first. That ensures that we will see the types defined in the test package before the types defined in the non-test version of the package. This matters if the types differ in some way, such as by adding a new method. This avoids a failure in internal/poll on Solaris, in which the test package adds a method to a type (FD.EOFError). I think it was Solaris- specific because files are sorted in a different order by default. The go tool handles this kind of thing correctly, by rebuilding dependent packages. This is just a hack sufficient to run the libgo testsuite without using the go tool. Fixes https://gcc.gnu.org/PR91712 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194637 From-SVN: r275648
2019-09-10libgo: Solaris and x/sys/cpu compatibility fixesIan Lance Taylor1-1/+1
Restore Solaris compatibility fixes lost when internal/x/net/lif moved to golang.org/x/net/lif. Also fix the Makefile for x/net/lif and x/net/route. Change x/sys/cpu to get the cache line size from goarch.sh as the gofrontend version of internal/cpu does. Partially based on work by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194438 From-SVN: r275611
2019-09-10re PR go/91621 (libgo/mksysinfo.sh: please avoid test ==)Ian Lance Taylor1-1/+1
PR go/91621 mksysinfo: change test == to test = Fixes https://gcc.gnu.org/PR91621 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194569 From-SVN: r275608
2019-09-10go/internal/gccgoimporter: support embedded field in pointer loopIan Lance Taylor1-1/+1
Backport of https://golang.org/cl/194440. Original description: If an embedded field refers to a type via a pointer, the parser needs to know the name of the embedded field. It is possible that the pointer type is not yet resolved. This CL fixes the parser to handle that case by setting the pointer element type to the unresolved named type while the pointer is being resolved. Updates golang/go#34182 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194562 From-SVN: r275606
2019-09-10cmd/go: look for tool build ID before hashing entire fileIan Lance Taylor1-1/+1
Also fix the key used to store the ID. This is a significant speedup in cmd/go run time. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194257 From-SVN: r275559
2019-09-10compiler: permit inlining constant expressions and expression statementsIan Lance Taylor4-1/+24
This relatively minor change increases the number of inlinable functions/methods in the standard library from 983 to 2179. In particular it permits inlining math/bits/RotateLeftNN. This restores the speed of crypto/sha256 back to what it was before the update to 1.13beta1. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194340 From-SVN: r275558
2019-09-09misc/cgo/testcshared: restore gofrontend-local changesIan Lance Taylor1-1/+1
They were lost when the files were moved in the update to Go1.13beta1. These changes should be made in the master repo for the 1.14 release, as riscv64 support is added there. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194343 From-SVN: r275551
2019-09-09libgo: only build x/sys/cpu/cpu_gccgo.c on x86 systemsIan Lance Taylor1-1/+1
The C file has a build tag, but the procedure we use for building C files ignores build tags. This should fix the libgo build on non-x86 systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194378 From-SVN: r275544
2019-09-09compiler: don't use predeclared location for implicit runtime importIan Lance Taylor2-3/+5
For the main package we add an implicit import of the runtime package, to ensure that it is initialized. That import used the predeclared location, which caused various tests, notably Named_type::is_builtin, to treat these imported names as builtin. Start using a real location, so that those tests do the right thing. By the way, this implicit import is a partial cause of golang/go#19773. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194337 From-SVN: r275540
2019-09-09compiler: traverse types of constant expressionsIan Lance Taylor3-1/+71
We forgot to ever traverse types of constant expressions. This rarely makes a difference--evidently, since nobody noticed--but it does matter when we inline constant expressions: we need to ensure that the type is visible to the importing code. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194317 From-SVN: r275539
2019-09-06libgo: update to Go 1.13beta1 releaseIan Lance Taylor1-1/+1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
2019-09-05re PR tree-optimization/91663 (split function can be re-inlined, leaving bad ↵Ian Lance Taylor2-0/+11
stack trace) PR tree-optimization/91663 * go-lang.c (go_langhook_post_options): Clear flag_partial_inlining. From-SVN: r275396
2019-09-03compiler: only import variable into . if same packageIan Lance Taylor2-2/+2
If we dot-import a package, we should only add an imported variable to the package bindings if the variable is in the package being imported. A test case for this is the 1.13 os package, in which ErrClosed and friends are defined both locally and in the imported internal/oserror package. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192718 From-SVN: r275358
2019-08-31compiler: check for notinheap struct at each struct fieldIan Lance Taylor2-26/+26
When generating write barriers, we were only checking for a notinheap struct at the outermost struct. That mishandled the case of setting a pointer to a notinheap struct as a field of another struct that is not notinheap. This caused an invalid write barrier error when building the 1.13 version of the runtime. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192279 From-SVN: r275240
2019-08-31compiler, runtime: support and use single argument go:linknameIan Lance Taylor5-9/+38
The gc compiler has started permitting go:linkname comments with a single argument to mean that a function should be externally visible outside the package. Implement this in the Go frontend. Change the libgo runtime package to use it, rather than repeating the name just to export a function. Remove a couple of unnecessary go:linkname comments on declarations. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192197 From-SVN: r275239
2019-08-31compiler: don't report runtime escapes if we've seen errorsIan Lance Taylor2-2/+4
If we get errors during compilation, we skip the escape analysis pass. If we are compiling the runtime package, we report an error if a bound method expression escapes. The effect is that if we get an error while compiling the runtime package, we would report confusing and meaningless errors about bound method expressions escaping. This CL stops doing that. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192720 From-SVN: r275238
2019-08-31runtime: always build panic32.goIan Lance Taylor1-1/+1
Avoids problems with arm64 ILP32 mode. We might want to handle that mode better in general, but always building panic32.go is simple and fixes the build. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192723 From-SVN: r275237
2019-08-30compile, runtime: permit anonymous and empty fields in C headerIan Lance Taylor3-5/+12
Permit putting structs with anonymous and empty fields in the C header file runtime.inc that is used to build the C runtime code. This is required for upcoming 1.13 support, as the m struct has picked up an anonymous field. Doing this lets the C header contain all the type descriptor structs, so start using those in the C code. This cuts the number of copies of type descriptor definitions from 3 to 2. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192343 From-SVN: r275227
2019-08-28runtime: move osinit to GoIan Lance Taylor1-1/+1
This is a step toward updating libgo to 1.13. This adds the 1.13 version of the osinit function to Go code, and removes the corresponding code from the C runtime. This should simplify future updates. Some additional 1.13 code was brought in to simplify this change. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191717 From-SVN: r275010
2019-08-28compiler: handle unsafe conversion expression in escape analysisIan Lance Taylor2-1/+10
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192037 From-SVN: r275000
2019-08-28compiler, runtime: provide index information on bounds check failureIan Lance Taylor6-190/+381
This implements https://golang.org/cl/161477 in the gofrontend. Updates golang/go#30116 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191881 From-SVN: r274998
2019-08-27libgo: rebuild runtime.inc if mkruntimeinc.sh changesIan Lance Taylor1-1/+1
The Makefile was missing a dependency. Also remove runtime.inc.raw in mostlyclean. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191958 From-SVN: r274956
2019-08-26compiler: generalize cleanup of unresolved placeholder pointer typesIan Lance Taylor3-10/+11
This change extends the work in https://golang.org/cl/51131 to include placeholder pointer types created for Go function types, which can also be left dangling/unresolved in some instances. This fixes an assert in Llvm_backend::materializeComposite. Test case can be found in https://golang.org/cl/191743. Updates golang/go#33020. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191744 From-SVN: r274935
2019-08-23compiler: record pointer var values to remove write barriersIan Lance Taylor4-27/+101
Record when a local pointer variable is set to a value such that indirecting through the pointer does not require a write barrier. Use that to eliminate write barriers when indirecting through that local pointer variable. Only keep this information per-block, so it's not all that applicable. This reduces the number of write barriers generated when compiling the runtime package from 553 to 524. The point of this is to eliminate a bad write barrier in the bytes function in runtime/print.go. Mark that function nowritebarrier so that the problem does not recur. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191581 From-SVN: r274890
2019-08-23re PR middle-end/91283 (gcc.dg/torture/c99-contract-1.c FAILs)Jakub Jelinek2-2/+8
PR middle-end/91283 * common.opt (fexcess-precision=): Add Optimization flag. Use flag_excess_precision variable instead of flag_excess_precision_cmdline. * flags.h (class target_flag_state): Remove x_flag_excess_precision member. (flag_excess_precision): Don't define. * langhooks.c (lhd_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. * opts.c (set_fast_math_flags): Use frontend_set_flag_excess_precision and x_flag_excess_precision instead of frontend_set_flag_excess_precision_cmdline and x_flag_excess_precision_cmdline. (fast_math_flags_set_p): Use x_flag_excess_precision instead of x_flag_excess_precision_cmdline. * toplev.c (init_excess_precision): Remove. (lang_dependent_init_target): Don't call it. ada/ * gcc-interface/misc.c (gnat_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. brig/ * brig-lang.c (brig_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. c-family/ * c-common.c (c_ts18661_flt_eval_method): Use flag_excess_precision instead of flag_excess_precision_cmdline. * c-cppbuiltin.c (c_cpp_flt_eval_method_iec_559): Likewise. * c-opts.c (c_common_post_options): Likewise. d/ * d-lang.cc (d_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. fortran/ * options.c (gfc_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. go/ * go-lang.c (go_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. lto/ * lto-lang.c (lto_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. From-SVN: r274850
2019-08-21compiler: don't use pkgpath for fieldtrack of unexported fieldIan Lance Taylor2-2/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191040 From-SVN: r274803
2019-08-21compiler: if hidden function referenced by inline, don't hide descriptorIan Lance Taylor3-2/+11
Fixes golang/go#33739 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/191037 From-SVN: r274800
2019-08-20compiler, runtime: implement shifts by signed amountsIan Lance Taylor3-6/+27
Shifting by signed types is a new language feature in Go 1.13. This requires a patch to the testsuite. Updates golang/go#19113 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190977 * go.test/test/fixedbugs/bug073.go: Update for language changes. From-SVN: r274755
2019-08-19compiler: new debugging output methods/functionsIan Lance Taylor3-1/+116
Add new hooks for dumping named objects, package bindings, and top level Gogo package list. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190877 From-SVN: r274682