aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
AgeCommit message (Collapse)AuthorFilesLines
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
2019-08-19runtime: be more strict in GCIan Lance Taylor1-1/+1
With CL 190599, along with what we do in greyobject, we ensure that we only mark allocated heap objects. As a result we can be more strict in GC: - Enable "sweep increased allocation count" check, which checks that the number of mark bits set are no more than the number of allocation bits. - Enable invalid pointer check on heap scan. We only trace allocated heap objects, which should not contain invalid pointer. This also makes the libgo runtime more convergent with the gc runtime. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190797 From-SVN: r274678
2019-08-17compiler: support new numeric literal syntaxIan Lance Taylor3-65/+224
Support 0b, 0o, and hex floats. Tested against test/literal2.go in the gc repo. Updates golang/go#12711 Updates golang/go#19308 Updates golang/go#28493 Updates golang/go#29008 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/189718 From-SVN: r274614
2019-08-17compiler, runtime: allocate defer records on the stackIan Lance Taylor4-5/+62
When a defer is executed at most once in a function body, we can allocate the defer record for it on the stack instead of on the heap. This should make defers like this (which are very common) faster. This is a port of CL 171758 from the gc repo. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190410 From-SVN: r274613
2019-08-17runtime: scan write barrier buffer conservativelyIan Lance Taylor1-1/+1
In gccgo, we insert the write barriers in the frontend, and so we cannot completely prevent write barriers on stack writes. So it is possible for a bad pointer appearing in the write barrier buffer. When flushing the write barrier, treat it the same as sacnning the stack. In particular, don't mark a pointer if it does not point to an allocated object. We already have similar logic in greyobject. With this, hopefully, we can prevent an unallocated object from being marked completely. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190599 From-SVN: r274598
2019-08-16compiler: print runtime.hex in hexIan Lance Taylor3-2/+11
The gc compiler recognizes the type runtime.hex and prints values in this type as hex. Do the same here. This makes debugging runtime crashes slightly better. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/190597 From-SVN: r274591
2019-08-10Assorted ChangeLog cleanups.Jakub Jelinek1-5/+5
From-SVN: r274250
2019-07-23compiler: use correct value type in 2-case select sendIan Lance Taylor2-3/+4
In the channel-send case, the value to be sent may needs an (implicit) type conversion to the channel element type. This CL ensures that we use the correct value type for the send. Fixes golang/go#33235. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/187177 From-SVN: r273743
2019-07-23compiler: follow-on fix for finalizing imported methodsIan Lance Taylor2-7/+9
This patch is a revision to CL 185518, which added code to perform finalization of methods on types created by the importer and not directly reachable until inlining is done. The original fix invoked the finalization code at the end of Import::read_types(), but it turns out this doesn't handle the case where a type with methods is read in due to a reference from something later in the export data (a function or variable). The fix is to move the import finalization call to the end of Import::import(). Testcase for this bug is in CL 187057. Fixes golang/go#33219. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/187058 From-SVN: r273713
2019-07-19compiler: don't export bodies for functions marked "go:noinline"Ian Lance Taylor2-1/+5
The current Mark_inline_candidates helper looks only at budget when deciding to mark a function or method as inline (with the proviso that IR constructs not yet supported by the inliner are given artificially high cost). This patch changes the helper to also look at whether a function has the "go:noinline" pragma; if it does have the pragma there is no point putting it into the export data (it will just make the export data bigger). Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/186923 From-SVN: r273611
2019-07-18compiler: fix bug in importing blocks from inline functionsIan Lance Taylor4-9/+38
This patch fixes a buglet in the function body importer. Add hooks for keeping a stack of blocks corresponding to the block nesting in the imported function. This ensures that local variables and temps wind up correctly scoped and don't introduce collisions. New test case for this problem in CL 186717. Fixes golang/go#33158. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/186757 From-SVN: r273577
2019-07-18compiler: fix bug in handling of unordered set during exportingIan Lance Taylor4-43/+63
In CL 183850 a change was made to combine tracking/discovery of exported types and imported packages during export data generation. As a result of this refactoring a bug was introduced: the new code can potentially insert items into the exports set (an unordered_set) while iterating through the same set, which is illegal according to the spec for std::unordered_set. This patch fixes the problem by changing the type discovery phase to iterate through a separate list of sorted exports, as opposed to iterating through the main unordered set. Also included is a change to fix the code that looks for variables that are referenced from inlined routine bodies (this code wasn't scanning all of the function that it needed to scan). New test case for this problem in CL 186697. Updates golang/go#33020. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185977 From-SVN: r273564
2019-07-15runtime: expose the g variableIan Lance Taylor1-1/+1
Currently, getg is implemented in C, which loads the thread-local g variable. The g variable is declared static in C. This CL exposes the g variable, so it can be accessed from the Go side. This allows the Go compiler to inline getg calls to direct access of g. Currently, the actual inlining is only implemented in the gollvm compiler. The g variable is thread-local and the compiler backend may choose to cache the TLS address in a register or on stack. If a thread switch happens the cache may become invalid. I don't know how to disable the TLS address cache in gccgo, therefore the inlining of getg is not implemented. In the future gccgo may gain this if we know how to do it safely. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/186238 From-SVN: r273499
2019-07-11compiler: ensure evaluation order in type hash/eq functionsIan Lance Taylor5-1/+35
The type hash and equality functions are generated after the order_evaluations pass. They may contain shortcut operators and Set_and_use_temporary_expressions (e.g. from lowering a Binary_exprssion) that need to be ordered. Run order_evaluations and remove_shortcuts on these functions. (The hash functions may be fine, but to be on the safe side we run on them anyway. We do need to run on the equality functions.) A Set_and_use_temporary_expression is effectively an assignment, so it needs to be ordered. Otherwise if we insert a temporary statement before it, we may get wrong evaluation order. A test case is CL 185818. Fixes golang/go#33062. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185817 From-SVN: r273425
2019-07-10compiler: finalize methods when importing typesIan Lance Taylor5-22/+65
This patch changes the compiler to be more aggressive about finalizing methods on imported types, to avoid problems with interface types that are imported but remain unreachable until a later stage in the compilation. The normal pattern prior to this change was that the import process would leave imported interface types alone, and rely on Gogo::finalize_methods to locate and finalize all interface types at a later point. This way of doing things was not working in all cases due to the fact that we can import an interface type that is only reachable from the body of an inlinable function, meaning that we can't "find" the type during the methods finalize phase. The importer's Import::read_types() now makes a pass over all imported types to finalize methods on any newly imported type, which takes care of the issue. New test case for this problem in CL 185517. Fixes golang/go#33013 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185518 From-SVN: r273364
2019-07-10compiler: add break label in 1,2-case select statement loweringIan Lance Taylor2-1/+9
CL 184998 added optimizations for one- and two-case select statements. But it didn't handle break statement in the select case correctly. Specifically, it didn't add the label definition, so it could result in a dangling goto. This CL fixes this, by adding the label definition. A test case is CL 185520. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/185519 From-SVN: r273359
2019-07-04compiler: optimize 0,1,2-case select statementIan Lance Taylor5-5/+285
For a select statement with zero-, one-, or two-case with a default case, we can generate simpler code instead of calling the generic selectgo. A zero-case select is just blocking the execution. A one-case select is mostly just executing the case. A two-case select with a default case is a non-blocking send or receive. We add these special cases for lowering a select statement. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184998 From-SVN: r273034
2019-07-04compiler: fix indentation of select statement AST dumpIan Lance Taylor2-1/+2
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184997 From-SVN: r273032
2019-07-03compiler: set varargs lowered for imported call expressionsIan Lance Taylor2-2/+2
Fix compiler buglet: varargs lowering happens before inlinable function bodies are written out to export data, so set the "varargs lowered" flag on call expressions that we import. Fixes golang/go#32922 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184919 From-SVN: r273026
2019-07-03compiler: include transitive imports in the type descriptor listIan Lance Taylor5-18/+80
In CL 179598, we were using Gogo::packages_, when compiling the main package, as the list of packages of which we need to register the type descriptors. This is not complete. It only includes main's direct import and one-level indirect imports. It does not include all the packages transitively imported. To fix that, we need to track all the transitive imports. We have almost already done that, for init functions. However, there may be packages that don't need init functions but do need to register type descriptors. For them, we add a dummy init function to its export data. So when we compile the main package we will see all the transitive imports. The dummy init functions are not real functions and are not called. Fixes golang/go#32901. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184717 From-SVN: r273009
2019-07-03compiler: rework type and package tracking in exporterIan Lance Taylor5-290/+384
Revamps the way the exporter tracks exported types and imported packages that need to be mentioned in the export data. The previous implementation wasn't properly handling the case where an exported non-inlinable function refers to an imported type whose method set includes an inlinable function whose body makes a call to a function in another package that's not directly used in the original package. This patch integrates together two existing traversal helper classes, "Collect_references_from_inline" and "Find_types_to_prepare" into a single helper "Collect_export_references", so as to have common/shared code that looks for indirectly imported packages. Fixes golang/go#32778 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183850 From-SVN: r272955
2019-07-02compiler: use builtin memset for non-pointer memclrCherry Zhang6-15/+40
For zeroing a range of memory that doesn't contain pointer, we can use builtin memset directly. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184438 * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_memset. From-SVN: r272944
2019-07-02compiler: refactoring in Export class to encapsulate type refs mapIan Lance Taylor3-22/+35
Convert the Export::type_refs map from a static object to a field contained (indirectly, via an impl class) in Export itself, for better encapsulation and to be able to reclaim its memory when exporting is done. No change in compiler functionality. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/184170 From-SVN: r272919
2019-06-26libgo/testsuite: ignore symbols with a leading dot in symtogoIan Lance Taylor1-1/+1
On AIX, a function has two symbols, a text symbol (with a leading dot) and a data one (without it). As the tests must be run only once, only the data symbol can be used to retrieve the final go symbol. Therefore, all symbols beginning with a dot are ignored by symtogo. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/177837 From-SVN: r272666
2019-06-26cmd/go: silence ar with D flag failuresIan Lance Taylor1-1/+1
The first call of ar must not show its output in order to avoid useless error messages about D flag. The corresponding Go toolchain patch is CL 182077. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183817 From-SVN: r272661
2019-06-25runtime: mark memequal and memclrNoHeapPointers nosplitIan Lance Taylor1-1/+1
They are wrappers of libc functions that use no stack. Mark them nosplit so the linker won't patch it to call __morestack_non_split. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183629 From-SVN: r272633
2019-06-24compiler: open code string equalityIan Lance Taylor3-15/+52
Open code string equality with builtin memcmp. This allows further optimizations in the backend. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183538 From-SVN: r272624
2019-06-24compiler: use builtin memcmp directlyIan Lance Taylor3-3/+4
Instead of going through a C function __go_memcmp, we can just use __builtin_memcmp directly. This allows more optimizations in the compiler backend. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183537 From-SVN: r272620
2019-06-23compiler: edit error messages to avoid -Wformat-diag warningsIan Lance Taylor10-35/+38
GCC recently introduced -Wformat-diag to scrutinize GCC error messages. It reports a number of warnings about gofrontend code, such as: ../../trunk/gcc/go/gofrontend/import.cc: In member function ‘Type* Import::type_for_index(int, const string&, size_t, bool*)’: ../../trunk/gcc/go/gofrontend/import.cc:1129:48: warning: unquoted operator ‘>=’ in format [-Wformat-diag] 1129 | "error in %s at %lu: bad type index %d >= %d", | ^~ ../../trunk/gcc/go/gofrontend/ast-dump.cc: In member function ‘void Ast_dump_context::dump(Gogo*, const char*)’: ../../trunk/gcc/go/gofrontend/ast-dump.cc:203:25: warning: unquoted option name ‘-fgo-dump-ast’ in format [-Wformat-diag] 203 | "cannot open %s:%m, -fgo-dump-ast ignored", dumpname.c_str()); | ^~~~~~~~~~~~~ ../../trunk/gcc/go/gofrontend/expressions.cc: In static member function ‘static Bexpression* Func_expression::get_code_pointer(Gogo*, Named_object*, Location)’: ../../trunk/gcc/go/gofrontend/expressions.cc:1350:29: warning: misspelled term ‘builtin function’ in format; use ‘built-in function’ instead [-Wformat-diag] 1350 | "invalid use of special builtin function %qs; must be called", | ^~~~~~~~~~~~~~~~ ../../trunk/gcc/go/gofrontend/gogo.cc: In member function ‘void Gogo::add_linkname(const string&, bool, const string&, Location)’: ../../trunk/gcc/go/gofrontend/gogo.cc:2527:4: warning: unquoted sequence of 2 consecutive punctuation characters ‘//’ in format [-Wformat-diag] 2527 | ("%s is not a function; " | ~^~~~~~~~~~~~~~~~~~~~~~~~ 2528 | "//go:linkname is only supported for functions"), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This CL edits error messages to avoid these warnings. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183497 * go.test/test/blank1.go: Update for diagnostic message changes. From-SVN: r272608
2019-06-23compiler: add go_debug and use it for debug messagesIan Lance Taylor6-103/+137
GCC recently added a new warning -Wformat-diag which does a lot of rigorous checks on GCC diagnostic messages. This produces a number of unnecessary diagnostics on gofrontend diagnostic output, such as ../../trunk/gcc/go/gofrontend/escape.cc: In member function ‘virtual int Escape_analysis_assign::statement(Block*, size_t*, Statement*)’: ../../trunk/gcc/go/gofrontend/escape.cc:1336:33: warning: spurious leading punctuation sequence ‘[’ in format [-Wformat-diag] 1336 | go_inform(s->location(), "[%d] %s esc: %s", | ^ ../../trunk/gcc/go/gofrontend/escape.cc: In member function ‘void Escape_analysis_assign::call(Call_expression*)’: ../../trunk/gcc/go/gofrontend/escape.cc:1964:17: warning: unquoted operator ‘::’ in format [-Wformat-diag] 1964 | "esccall:: indirect call <- %s, untracked", | ^~ ../../trunk/gcc/go/gofrontend/escape.cc:1964:34: warning: unbalanced punctuation character ‘<’ in format [-Wformat-diag] 1964 | "esccall:: indirect call <- %s, untracked", | ^ Avoid these messages by adding a new function go_debug that uses only printf formatting, not GCC diagnostic formatting, and change all the optimization debugging messages to use it. None of the debugging messages used the GCC diagnostic formatting specifiers anyhow. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183437 From-SVN: r272607
2019-06-21compiler: intrinsify some math/bits functionsCherry Zhang6-9/+192
Let the Go frontend recognize some math/bits functions and turn them into intrinsics. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183266 * go-gcc.cc (Gcc_backend::Gcc_backend): Define math/bits builtins. From-SVN: r272579
2019-06-21runtime: inline and remove eqtypeIan Lance Taylor1-1/+1
Now that type equality is just a pointer equality, write it inlined and remove the eqtype function. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182978 From-SVN: r272578
2019-06-21compiler: open code some type assertionsIan Lance Taylor6-38/+41
Now that type equality is just simple pointer equality, we can open code some type assertions instead of making runtime calls. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182977 From-SVN: r272577
2019-06-21compiler: omit write barrier for assignment to *(convert(&local))Ian Lance Taylor2-1/+21
Assignments to local variables don't need a write barrier. But currently the compiler inserts a write barrier if the LHS is a local variable with type converted, as *(convert(&local)). Let the compiler recognize this pattern and omit the write barrier. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182541 From-SVN: r272550
2019-06-21compiler: open code string slice expressionsIan Lance Taylor5-22/+74
Currently a string slice expression is implemented with a runtime call __go_string_slice. Change it to open code it, which is more efficient, and allows the backend to further optimize it. Also omit the write barrier for length-only update (i.e. s = s[:n]). Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182540 From-SVN: r272549
2019-06-19compiler: optimize string concatenationsIan Lance Taylor3-62/+20
runtime.concatstring{2,3,4,5} are just wrappers of concatstrings. These wrappers don't provide any benefit, at least in the C calling convention we use, where passing arrays by value isn't an efficient thing. Change it to always use concatstrings. Also, the cap field of the slice passed to concatstrings is not necessary. So change it to pass a pointer and a length directly, which is more efficient than passing a slice header by value. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182539 From-SVN: r272476
2019-06-19compiler: stack allocate a buffer for non-escaping string opsIan Lance Taylor3-18/+101
For string concatenation, string to/from byte or rune slice conversion, and int to string conversion, if the result does not escape, we can allocate a small (32-element, or 4-byte for int to string) buffer on stack, and pass it to the runtime function. If the result fits in the buffer, it doesn't need to do a heap allocation. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182538 From-SVN: r272468
2019-06-18compiler: avoid copy for string([]byte) conversion used in string concatenationCherry Zhang2-1/+21
If a string([]byte) conversion is used immediately in a string concatenation, we don't need to copy the backing store of the byte slice, as the runtime function doesn't hold any reference to it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/182437 * go.dg/concatstring.go: New test. From-SVN: r272460