gcc/libgo/Makefile.am

1431 lines
38 KiB
Makefile
Raw Normal View History

# Makefile.am -- Go library Makefile.
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Process this file with autoreconf to produce Makefile.in.
# Go support.
SUFFIXES = .c .go .gox .o .obj .lo .a
if LIBGO_IS_RTEMS
subdirs = testsuite
endif
SUBDIRS = ${subdirs}
gcc_version := $(shell $(GOC) -dumpversion)
MAINT_CHARSET = latin1
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
toolexecdir = $(glibgo_toolexecdir)
toolexeclibdir = $(glibgo_toolexeclibdir)
toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias)
libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version)
LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBATOMIC = @LIBATOMIC@
WARN_CFLAGS = $(WARN_FLAGS) $(WERROR)
# -I/-D flags to pass when compiling.
AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
ACLOCAL_AMFLAGS = -I ./config -I ../config
AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \
$(SPLIT_STACK) $(WARN_CFLAGS) \
$(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
-I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
-I $(MULTIBUILDTOP)../../gcc/include
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
AM_LDFLAGS =
if USING_SPLIT_STACK
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
endif
if LIBGO_IS_AIX
# Using an import file for libgo avoid requiring to use the -brtl flag
# when builing a go program
AM_LDFLAGS += -Wl,-bbigtoc -Wl,-bI:$(srcdir)/libgo.imp
EXTRA_libgo_la_DEPENDENCIES = libgo.imp
endif
# Multilib support.
MAKEOVERRIDES=
# Work around what appears to be a GNU make handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \
"GOC=$(GOC)" \
"GOCFLAGS=$(GOCFLAGS)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"includedir=$(includedir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"gxx_include_dir=$(gxx_include_dir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"LD=$(LD)" \
"RANLIB=$(RANLIB)" \
"NM=$(NM)" \
"NM_FOR_BUILD=$(NM_FOR_BUILD)" \
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
"DESTDIR=$(DESTDIR)" \
"WERROR=$(WERROR)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
if GOC_IS_LLGO
toolexeclib_LTLIBRARIES = libgo-llgo.la
toolexeclib_LIBRARIES = libgobegin-llgo.a
else
toolexeclib_LTLIBRARIES = libgo.la
toolexeclib_LIBRARIES = libgobegin.a libgolibbegin.a
endif
toolexeclibgo_DATA = \
bufio.gox \
bytes.gox \
context.gox \
crypto.gox \
encoding.gox \
errors.gox \
expvar.gox \
flag.gox \
fmt.gox \
hash.gox \
html.gox \
image.gox \
io.gox \
log.gox \
math.gox \
mime.gox \
net.gox \
os.gox \
path.gox \
reflect.gox \
regexp.gox \
runtime.gox \
sort.gox \
strconv.gox \
strings.gox \
sync.gox \
syscall.gox \
testing.gox \
time.gox \
unicode.gox
toolexeclibgoarchivedir = $(toolexeclibgodir)/archive
toolexeclibgoarchive_DATA = \
archive/tar.gox \
archive/zip.gox
toolexeclibgocompressdir = $(toolexeclibgodir)/compress
toolexeclibgocompress_DATA = \
compress/bzip2.gox \
compress/flate.gox \
compress/gzip.gox \
compress/lzw.gox \
compress/zlib.gox
toolexeclibgocontainerdir = $(toolexeclibgodir)/container
toolexeclibgocontainer_DATA = \
container/heap.gox \
container/list.gox \
container/ring.gox
toolexeclibgocryptodir = $(toolexeclibgodir)/crypto
toolexeclibgocrypto_DATA = \
crypto/aes.gox \
crypto/cipher.gox \
crypto/des.gox \
crypto/dsa.gox \
crypto/ecdsa.gox \
crypto/elliptic.gox \
crypto/hmac.gox \
crypto/md5.gox \
crypto/rand.gox \
crypto/rc4.gox \
crypto/rsa.gox \
crypto/sha1.gox \
crypto/sha256.gox \
crypto/sha512.gox \
crypto/subtle.gox \
crypto/tls.gox \
crypto/x509.gox
toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509
toolexeclibgocryptox509_DATA = \
crypto/x509/pkix.gox
toolexeclibgodatabasedir = $(toolexeclibgodir)/database
toolexeclibgodatabase_DATA = \
database/sql.gox
toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql
toolexeclibgodatabasesql_DATA = \
database/sql/driver.gox
toolexeclibgodebugdir = $(toolexeclibgodir)/debug
toolexeclibgodebug_DATA = \
debug/dwarf.gox \
debug/elf.gox \
debug/gosym.gox \
debug/macho.gox \
debug/pe.gox \
debug/plan9obj.gox
toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding
toolexeclibgoencoding_DATA = \
encoding/ascii85.gox \
encoding/asn1.gox \
encoding/base32.gox \
encoding/base64.gox \
encoding/binary.gox \
encoding/csv.gox \
encoding/gob.gox \
encoding/hex.gox \
encoding/json.gox \
encoding/pem.gox \
encoding/xml.gox
toolexeclibgoexpdir = $(toolexeclibgodir)/exp
toolexeclibgoexp_DATA = \
exp/proxy.gox \
exp/terminal.gox
toolexeclibgogodir = $(toolexeclibgodir)/go
toolexeclibgogo_DATA = \
go/ast.gox \
go/build.gox \
go/constant.gox \
go/doc.gox \
go/format.gox \
go/importer.gox \
go/parser.gox \
go/printer.gox \
go/scanner.gox \
go/token.gox \
go/types.gox
toolexeclibgohashdir = $(toolexeclibgodir)/hash
toolexeclibgohash_DATA = \
hash/adler32.gox \
hash/crc32.gox \
hash/crc64.gox \
hash/fnv.gox
toolexeclibgohtmldir = $(toolexeclibgodir)/html
toolexeclibgohtml_DATA = \
html/template.gox
toolexeclibgoimagedir = $(toolexeclibgodir)/image
toolexeclibgoimage_DATA = \
image/color.gox \
image/draw.gox \
image/gif.gox \
image/jpeg.gox \
image/png.gox
toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color
toolexeclibgoimagecolor_DATA = \
image/color/palette.gox
toolexeclibgoindexdir = $(toolexeclibgodir)/index
toolexeclibgoindex_DATA = \
index/suffixarray.gox
toolexeclibgoiodir = $(toolexeclibgodir)/io
toolexeclibgoio_DATA = \
io/ioutil.gox
toolexeclibgologdir = $(toolexeclibgodir)/log
toolexeclibgolog_DATA = \
log/syslog.gox
toolexeclibgomathdir = $(toolexeclibgodir)/math
toolexeclibgomath_DATA = \
math/big.gox \
math/cmplx.gox \
math/rand.gox
toolexeclibgomimedir = $(toolexeclibgodir)/mime
toolexeclibgomime_DATA = \
mime/multipart.gox \
mime/quotedprintable.gox
toolexeclibgonetdir = $(toolexeclibgodir)/net
toolexeclibgonet_DATA = \
net/http.gox \
net/mail.gox \
net/rpc.gox \
net/smtp.gox \
net/textproto.gox \
net/url.gox
toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http
toolexeclibgonethttp_DATA = \
net/http/cgi.gox \
net/http/cookiejar.gox \
net/http/fcgi.gox \
net/http/httptest.gox \
net/http/httptrace.gox \
net/http/httputil.gox \
net/http/pprof.gox
toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc
toolexeclibgonetrpc_DATA = \
net/rpc/jsonrpc.gox
toolexeclibgoosdir = $(toolexeclibgodir)/os
toolexeclibgoos_DATA = \
os/exec.gox \
os/signal.gox \
os/user.gox
toolexeclibgopathdir = $(toolexeclibgodir)/path
toolexeclibgopath_DATA = \
path/filepath.gox
toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp
toolexeclibgoregexp_DATA = \
regexp/syntax.gox
toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime
toolexeclibgoruntime_DATA = \
runtime/debug.gox \
runtime/pprof.gox \
runtime/trace.gox
toolexeclibgosyncdir = $(toolexeclibgodir)/sync
toolexeclibgosync_DATA = \
sync/atomic.gox
toolexeclibgotestingdir = $(toolexeclibgodir)/testing
toolexeclibgotesting_DATA = \
testing/iotest.gox \
testing/quick.gox
toolexeclibgotestinginternaldir = $(toolexeclibgotestingdir)/internal
toolexeclibgotestinginternal_DATA = \
testing/internal/testdeps.gox
toolexeclibgotextdir = $(toolexeclibgodir)/text
toolexeclibgotext_DATA = \
text/scanner.gox \
text/tabwriter.gox \
text/template.gox
toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template
toolexeclibgotexttemplate_DATA = \
text/template/parse.gox
toolexeclibgounicodedir = $(toolexeclibgodir)/unicode
toolexeclibgounicode_DATA = \
unicode/utf16.gox \
unicode/utf8.gox
if LIBGO_IS_RTEMS
rtems_task_variable_add_file = runtime/rtems-task-variable-add.c
else
rtems_task_variable_add_file =
endif
if LIBGO_IS_LINUX
runtime_thread_files = runtime/thread-linux.c
else
runtime_thread_files = runtime/thread-sema.c
endif
if LIBGO_IS_LINUX
runtime_getncpu_file = runtime/getncpu-linux.c
else
if LIBGO_IS_DARWIN
runtime_getncpu_file = runtime/getncpu-bsd.c
else
if LIBGO_IS_IRIX
runtime_getncpu_file = runtime/getncpu-irix.c
else
if LIBGO_IS_SOLARIS
runtime_getncpu_file = runtime/getncpu-solaris.c
else
if LIBGO_IS_FREEBSD
runtime_getncpu_file = runtime/getncpu-bsd.c
else
if LIBGO_IS_NETBSD
runtime_getncpu_file = runtime/getncpu-bsd.c
else
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
if LIBGO_IS_AIX
runtime_getncpu_file = runtime/getncpu-aix.c
else
runtime_getncpu_file = runtime/getncpu-none.c
endif
endif
endif
endif
endif
endif
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
endif
runtime_files = \
runtime/aeshash.c \
runtime/go-assert.c \
runtime/go-caller.c \
runtime/go-callers.c \
runtime/go-cdiv.c \
runtime/go-cgo.c \
runtime/go-construct-map.c \
runtime/go-ffi.c \
runtime/go-fieldtrack.c \
runtime/go-matherr.c \
compiler, runtime: replace hashmap code with Go 1.7 hashmap This change removes the gccgo-specific hashmap code and replaces it with the hashmap code from the Go 1.7 runtime. The Go 1.7 hashmap code is more efficient, does a better job on details like when to update a key, and provides some support against denial-of-service attacks. The compiler is changed to call the new hashmap functions instead of the old ones. The compiler now tracks which types are reflexive and which require updating when used as a map key, and records the information in map type descriptors. Map_index_expression is simplified. The special case for a map index on the right hand side of a tuple expression has been unnecessary for some time, and is removed. The support for specially marking a map index as an lvalue is removed, in favor of lowering an assignment to a map index into a function call. The long-obsolete support for a map index of a pointer to a map is removed. The __go_new_map_big function (known to the compiler as Runtime::MAKEMAPBIG) is no longer needed, as the new runtime.makemap function takes an int64 hint argument. The old map descriptor type and supporting expression is removed. The compiler was still supporting the long-obsolete syntax `m[k] = 0, false` to delete a value from a map. That is now removed, requiring a change to one of the gccgo-specific tests. The builtin len function applied to a map or channel p is now compiled as `p == nil ? 0 : *(*int)(p)`. The __go_chan_len function (known to the compiler as Runtime::CHAN_LEN) is removed. Support for a shared zero value for maps to large value types is introduced, along the lines of the gc compiler. The zero value is handled as a common variable. The hash function is changed to take a seed argument, changing the runtime hash functions and the compiler-generated hash functions. Unlike the gc compiler, both the hash and equal functions continue to take the type length. Types that can not be compared now store nil for the hash and equal functions, rather than pointing to functions that throw. Interface hash and comparison functions now check explicitly for nil. This matches the gc compiler and permits a simple implementation for ismapkey. The compiler is changed to permit marking struct and array types as incomparable, meaning that they have no hash or equal function. We use this for thunk types, removing the existing special code to avoid generating hash/equal functions for them. The C runtime code adds memclr, memequal, and memmove functions. The hashmap code uses go:linkname comments to make the functions visible, as otherwise the compiler would discard them. The hashmap code comments out the unused reference to the address of the first parameter in the race code, as otherwise the compiler thinks that the parameter escapes and copies it onto the heap. This is probably not needed when we enable escape analysis. Several runtime map tests that ere previously skipped for gccgo are now run. The Go runtime picks up type kind information and stubs. The type kind information causes the generated runtime header file to define some constants, including `empty`, and the C code is adjusted accordingly. A Go-callable version of runtime.throw, that takes a Go string, is added to be called from the hashmap code. Reviewed-on: https://go-review.googlesource.com/29447 * go.go-torture/execute/map-1.go: Replace old map deletion syntax with call to builtin delete function. From-SVN: r240334
2016-09-21 22:58:51 +02:00
runtime/go-memclr.c \
runtime/go-memcmp.c \
compiler, runtime: replace hashmap code with Go 1.7 hashmap This change removes the gccgo-specific hashmap code and replaces it with the hashmap code from the Go 1.7 runtime. The Go 1.7 hashmap code is more efficient, does a better job on details like when to update a key, and provides some support against denial-of-service attacks. The compiler is changed to call the new hashmap functions instead of the old ones. The compiler now tracks which types are reflexive and which require updating when used as a map key, and records the information in map type descriptors. Map_index_expression is simplified. The special case for a map index on the right hand side of a tuple expression has been unnecessary for some time, and is removed. The support for specially marking a map index as an lvalue is removed, in favor of lowering an assignment to a map index into a function call. The long-obsolete support for a map index of a pointer to a map is removed. The __go_new_map_big function (known to the compiler as Runtime::MAKEMAPBIG) is no longer needed, as the new runtime.makemap function takes an int64 hint argument. The old map descriptor type and supporting expression is removed. The compiler was still supporting the long-obsolete syntax `m[k] = 0, false` to delete a value from a map. That is now removed, requiring a change to one of the gccgo-specific tests. The builtin len function applied to a map or channel p is now compiled as `p == nil ? 0 : *(*int)(p)`. The __go_chan_len function (known to the compiler as Runtime::CHAN_LEN) is removed. Support for a shared zero value for maps to large value types is introduced, along the lines of the gc compiler. The zero value is handled as a common variable. The hash function is changed to take a seed argument, changing the runtime hash functions and the compiler-generated hash functions. Unlike the gc compiler, both the hash and equal functions continue to take the type length. Types that can not be compared now store nil for the hash and equal functions, rather than pointing to functions that throw. Interface hash and comparison functions now check explicitly for nil. This matches the gc compiler and permits a simple implementation for ismapkey. The compiler is changed to permit marking struct and array types as incomparable, meaning that they have no hash or equal function. We use this for thunk types, removing the existing special code to avoid generating hash/equal functions for them. The C runtime code adds memclr, memequal, and memmove functions. The hashmap code uses go:linkname comments to make the functions visible, as otherwise the compiler would discard them. The hashmap code comments out the unused reference to the address of the first parameter in the race code, as otherwise the compiler thinks that the parameter escapes and copies it onto the heap. This is probably not needed when we enable escape analysis. Several runtime map tests that ere previously skipped for gccgo are now run. The Go runtime picks up type kind information and stubs. The type kind information causes the generated runtime header file to define some constants, including `empty`, and the C code is adjusted accordingly. A Go-callable version of runtime.throw, that takes a Go string, is added to be called from the hashmap code. Reviewed-on: https://go-review.googlesource.com/29447 * go.go-torture/execute/map-1.go: Replace old map deletion syntax with call to builtin delete function. From-SVN: r240334
2016-09-21 22:58:51 +02:00
runtime/go-memequal.c \
runtime/go-memmove.c \
runtime/go-nanotime.c \
runtime/go-now.c \
runtime/go-nosys.c \
runtime/go-reflect-call.c \
runtime/go-runtime-error.c \
runtime/go-setenv.c \
runtime/go-signal.c \
runtime/go-strslice.c \
runtime/go-typedesc-equal.c \
runtime/go-unsafe-pointer.c \
runtime/go-unsetenv.c \
runtime/go-unwind.c \
runtime/go-varargs.c \
runtime/env_posix.c \
runtime/panic.c \
runtime/print.c \
runtime/proc.c \
runtime/runtime_c.c \
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
runtime/stack.c \
runtime/thread.c \
$(runtime_thread_files) \
runtime/yield.c \
$(rtems_task_variable_add_file) \
$(runtime_getncpu_file)
version.go: s-version; @true
s-version: Makefile
rm -f version.go.tmp
echo "package sys" > version.go.tmp
echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
echo 'const Goexperiment = ``' >> version.go.tmp
echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
echo >> version.go.tmp
echo "type ArchFamilyType int" >> version.go.tmp
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
for a in $(ALLGOARCHFAMILY); do \
echo " $${a}" >> version.go.tmp; \
done
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOARCH); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOARCH)"; then \
echo "const Goarch$${n} = 1" >> version.go.tmp; \
else \
echo "const Goarch$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOOS); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOOS)"; then \
echo "const Goos$${n} = 1" >> version.go.tmp; \
else \
echo "const Goos$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "type Uintreg uintptr" >> version.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
$(STAMP) $@
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
runtime_sysinfo.go: s-runtime_sysinfo; @true
s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
$(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go
$(STAMP) $@
sigtab.go: s-sigtab; @true
s-sigtab: $(srcdir)/mksigtab.sh gen-sysinfo.go
GOOS=$(GOOS) $(SHELL) $(srcdir)/mksigtab.sh > tmp-sigtab.go
$(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
$(STAMP) $@
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
# _Complex_lock and _Reader_lock are Go translations of some AIX system
# types and should not be exported back to C
# sigset conflicts with system type sigset on AIX, so we need to rename it
runtime.inc: s-runtime-inc; @true
s-runtime-inc: runtime.lo Makefile
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
rm -f runtime.inc.tmp2 runtime.inc.tmp3
grep -v "#define _" runtime.inc.tmp | grep -v "#define [cm][01234] " | grep -v "#define empty " > runtime.inc.tmp2
for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
done
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
for TYPE in _Complex_lock _Reader_lock; do \
sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
mv runtime.inc.tmp3 runtime.inc.tmp2; \
done
sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
$(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
rm -f runtime.inc.tmp2 runtime.inc.tmp3
$(STAMP) $@
noinst_DATA = zstdpkglist.go
# Generate the list of go std packages that were included in libgo
zstdpkglist.go: s-zstdpkglist; @true
s-zstdpkglist: Makefile
rm -f zstdpkglist.go.tmp
echo 'package main' > zstdpkglist.go.tmp
echo "" >> zstdpkglist.go.tmp
echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's|[a-z0-9_/]*_c\.lo||g' | sed 's|\([a-z0-9_/]*\)\.lo|"\1": true,|g' >> zstdpkglist.go.tmp
echo '}' >> zstdpkglist.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
$(STAMP) $@
if LIBGO_IS_LINUX
syscall_epoll_file = epoll.go
else
syscall_epoll_file =
endif
libcalls.go: s-libcalls; @true
s-libcalls: libcalls-list go/syscall/mksyscall.awk $(srcdir)/go/syscall/*.go
rm -f libcalls.go.tmp
$(AWK) -f $(srcdir)/go/syscall/mksyscall.awk `cat libcalls-list` > libcalls.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go
$(STAMP) $@
libcalls-list: s-libcalls-list; @true
s-libcalls-list: Makefile $(srcdir)/go/syscall/*.go
rm -f libcalls-list.tmp
$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/syscall $(matchargs_syscall) > libcalls-list.tmp
$(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list
$(STAMP) $@
syscall_arch.go: s-syscall_arch; @true
s-syscall_arch: Makefile
rm -f syscall_arch.go.tmp
echo "package syscall" > syscall_arch.go.tmp
echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp
echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go
$(STAMP) $@
SYSINFO_FLAGS = \
$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(OSCFLAGS) -O
gen-sysinfo.go: s-gen-sysinfo; @true
s-gen-sysinfo: $(srcdir)/sysinfo.c config.h
$(CC) $(SYSINFO_FLAGS) -fdump-go-spec=tmp-gen-sysinfo.go -std=gnu99 -S -o sysinfo.s $(srcdir)/sysinfo.c
rm -f sysinfo.s
$(SHELL) $(srcdir)/mvifdiff.sh tmp-gen-sysinfo.go gen-sysinfo.go
$(STAMP) $@
errno.i: s-errno; @true
s-errno:
echo '#include <errno.h>' | $(CC) $(SYSINFO_FLAGS) -x c - -E -dM > tmp-errno.i
$(SHELL) $(srcdir)/mvifdiff.sh tmp-errno.i errno.i
$(STAMP) $@
sysinfo.go: s-sysinfo; @true
s-sysinfo: $(srcdir)/mksysinfo.sh gen-sysinfo.go errno.i
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
GOOS=$(GOOS) $(SHELL) $(srcdir)/mksysinfo.sh
$(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
$(STAMP) $@
# The epoll struct has an embedded union and is packed on x86_64,
# which is too complicated for mksysinfo.sh. We find the offset of
# the only field we care about in configure.ac, and generate the
# struct here.
epoll.go: s-epoll; @true
s-epoll: Makefile
rm -f epoll.go.tmp
echo 'package syscall' > epoll.go.tmp
echo 'type EpollEvent struct {' >> epoll.go.tmp
echo ' Events uint32' >> epoll.go.tmp
case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
exit 1; ;; \
8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
12,4) echo ' Fd int32' >> epoll.go.tmp; \
echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
echo ' Fd int32' >> epoll.go.tmp; ;; \
16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
echo ' Fd int32' >> epoll.go.tmp; \
echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
*) echo 1>&2 "*** struct epoll_event unsupported"; \
exit 1; ;; \
esac
echo '}' >> epoll.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go
$(STAMP) $@
if LIBGO_IS_LINUX
syscall_lib_clone_lo = syscall/clone_linux.lo
else
syscall_lib_clone_lo =
endif
PACKAGES = \
archive/tar \
archive/zip \
bufio \
bytes \
cmd/internal/browser \
compress/bzip2 \
compress/flate \
compress/gzip \
compress/lzw \
compress/zlib \
container/heap \
container/list \
container/ring \
context \
crypto \
crypto/aes \
crypto/cipher \
crypto/des \
crypto/dsa \
crypto/ecdsa \
crypto/elliptic \
crypto/hmac \
crypto/internal/cipherhw \
crypto/md5 \
crypto/rand \
crypto/rc4 \
crypto/rsa \
crypto/sha1 \
crypto/sha256 \
crypto/sha512 \
crypto/subtle \
crypto/tls \
crypto/x509 \
crypto/x509/pkix \
database/sql \
database/sql/driver \
debug/dwarf \
debug/elf \
debug/gosym \
debug/macho \
debug/pe \
debug/plan9obj \
encoding \
encoding/ascii85 \
encoding/asn1 \
encoding/base32 \
encoding/base64 \
encoding/binary \
encoding/csv \
encoding/gob \
encoding/hex \
encoding/json \
encoding/pem \
encoding/xml \
errors \
exp/proxy \
exp/terminal \
expvar \
flag \
fmt \
go/ast \
go/build \
go/constant \
go/doc \
go/format \
go/importer \
go/internal/gccgoimporter \
go/internal/gcimporter \
go/parser \
go/printer \
go/scanner \
go/token \
go/types \
golang_org/x/crypto/chacha20poly1305 \
golang_org/x/crypto/chacha20poly1305/internal/chacha20 \
golang_org/x/crypto/curve25519 \
golang_org/x/crypto/poly1305 \
golang_org/x/net/http2/hpack \
golang_org/x/net/idna \
golang_org/x/net/lex/httplex \
golang_org/x/text/transform \
golang_org/x/text/unicode/norm \
golang_org/x/text/width \
hash \
hash/adler32 \
hash/crc32 \
hash/crc64 \
hash/fnv \
html \
html/template \
image \
image/color \
image/color/palette \
image/draw \
image/gif \
image/internal/imageutil \
image/jpeg \
image/png \
index/suffixarray \
internal/nettrace \
internal/pprof/profile \
internal/race \
internal/singleflight \
internal/syscall/unix \
internal/testenv \
internal/trace \
io \
io/ioutil \
log \
log/syslog \
math \
math/big \
math/cmplx \
math/rand \
mime \
mime/multipart \
mime/quotedprintable \
net \
net/http \
net/http/cgi \
net/http/cookiejar \
net/http/fcgi \
net/http/httptest \
net/http/httptrace \
net/http/httputil \
net/http/internal \
net/http/pprof \
net/internal/socktest \
net/mail \
net/rpc \
net/rpc/jsonrpc \
net/smtp \
net/textproto \
net/url \
os \
os/exec \
os/signal \
os/user \
path \
path/filepath \
reflect \
regexp \
regexp/syntax \
runtime \
runtime/debug \
runtime/internal/atomic \
runtime/internal/sys \
runtime/pprof \
runtime/pprof/internal/protopprof \
runtime/trace \
sort \
strconv \
strings \
sync \
sync/atomic \
syscall \
testing \
testing/internal/testdeps \
testing/iotest \
testing/quick \
text/scanner \
text/tabwriter \
text/template \
text/template/parse \
time \
unicode \
unicode/utf16 \
unicode/utf8
libgo_go_objs = \
$(addsuffix .lo,$(PACKAGES)) \
bytes/index.lo \
reflect/makefunc_ffi_c.lo \
strings/index.lo \
$(syscall_lib_clone_lo) \
syscall/errno.lo \
syscall/signame.lo \
syscall/wait.lo \
$(golang_org_x_net_lif_lo) \
$(golang_org_x_net_route_lo) \
log/syslog/syslog_c.lo \
$(os_lib_inotify_lo) \
runtime/internal/atomic_c.lo \
sync/atomic_c.lo
libgo_ldflags = \
-version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS)
libgo_libadd = \
$(libgo_go_objs) ../libbacktrace/libbacktrace.la \
$(LIBATOMIC) $(LIBFFI) $(PTHREAD_LIBS) $(MATH_LIBS) $(NET_LIBS)
libgo_la_SOURCES = $(runtime_files)
libgo_la_LDFLAGS = $(libgo_ldflags)
libgo_la_LIBADD = $(libgo_libadd)
libgo_llgo_la_SOURCES = $(runtime_files)
libgo_llgo_la_LDFLAGS = $(libgo_ldflags)
libgo_llgo_la_LIBADD = $(libgo_libadd)
libgobegin_a_SOURCES = \
runtime/go-main.c
libgobegin_llgo_a_SOURCES = \
runtime/go-main.c
# Use -fPIC for libgobegin so that it can be put in a PIE.
libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
libgolibbegin_a_SOURCES = \
runtime/go-libmain.c
libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
# Make sure runtime.inc is built before compiling any .c file.
$(libgo_la_OBJECTS): runtime.inc
$(libgo_llgo_la_OBJECTS): runtime.inc
$(libgobegin_a_OBJECTS): runtime.inc
$(libgobegin_llgo_a_OBJECTS): runtime.inc
$(libgolibbegin_a_OBJECTS): runtime.inc
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
GOCFLAGS = $(CFLAGS)
AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
$(AM_GOCFLAGS) $(GOCFLAGS)
GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \
$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@
# Build the dependencies for a Go package.
BUILDDEPS = \
$(MKDIR_P) $(@D); \
dir=`echo $@ | sed -e 's/.lo.dep$$//'`; \
files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$$dir --extrafiles="$(extra_go_files_$(subst /,_,$(subst .lo.dep,,$@)))" $(matchargs_$(subst /,_,$(subst .lo.dep,,$@)))`; \
$(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $$files > $@.tmp; \
if ! cmp $@.tmp $@ >/dev/null 2>/dev/null; then \
rm -f `echo $@ | sed -e 's/\.dep$$//'`; \
fi; \
mv -f $@.tmp $@
# Build the .go files for a package, generating a .lo file.
BUILDPACKAGE = \
$(MKDIR_P) $(@D); \
files=`echo $^ | sed -e 's/[^ ]*\.gox//g' -e 's/[^ ]*\.dep//'`; \
$(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//'` $($(subst -,_,$(subst .,_,$(subst /,_,$@)))_GOCFLAGS) -o $@ $$files
# How to build a .gox file from a .lo file.
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
# Matching .o file can either be in the same directory as the .lo (non-PIC
# object) or in the .libs directory (PIC object).
BUILDGOX = \
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
f="$(basename $<).o"; \
if test ! -f $$f; then \
f="$(basename $(<D)/.libs/$(<F)).o"; \
fi; \
$(OBJCOPY) -j .go_export $$f $@.tmp; \
$(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
GOTESTFLAGS =
GOBENCH =
# Check a package.
CHECK = \
GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
export GC; \
GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \
export GOLIBS; \
RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
export RUNTESTFLAGS; \
MAKE="$(MAKE)"; \
export MAKE; \
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
NM="$(NM)"; \
export NM; \
libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
export LD_LIBRARY_PATH; \
$(MKDIR_P) $(@D); \
rm -f $@-testsum $@-testlog; \
files=`$(SHELL) $(srcdir)/match.sh --goarch=$(GOARCH) --goos=$(GOOS) --srcdir=$(srcdir)/go/$(@D) --extrafiles="$(extra_go_files_$(subst /,_,$(@D)))" $(matchargs_$(subst /,_,$(@D)))`; \
if test "$(USE_DEJAGNU)" = "yes"; then \
$(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --testname="$(@D)" $(GOTESTFLAGS); \
elif test "$(GOBENCH)" != ""; then \
$(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" --bench="$(GOBENCH)" $(GOTESTFLAGS); \
else \
if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$$files" $(GOTESTFLAGS) >>$@-testlog 2>&1; then \
echo "PASS: $(@D)" >> $@-testlog; \
echo "PASS: $(@D)"; \
echo "PASS: $(@D)" > $@-testsum; \
else \
echo "FAIL: $(@D)" >> $@-testlog; \
cat $@-testlog; \
echo "FAIL: $(@D)" > $@-testsum; \
exit 1; \
fi; \
fi
# Build all packages before checking any.
CHECK_DEPS = \
$(toolexeclibgo_DATA) \
$(toolexeclibgoarchive_DATA) \
$(toolexeclibgocompress_DATA) \
$(toolexeclibgocontainer_DATA) \
$(toolexeclibgocrypto_DATA) \
$(toolexeclibgodebug_DATA) \
$(toolexeclibgoencoding_DATA) \
$(toolexeclibgoexp_DATA) \
$(toolexeclibgogo_DATA) \
$(toolexeclibgohash_DATA) \
$(toolexeclibgoimage_DATA) \
$(toolexeclibgoindex_DATA) \
$(toolexeclibgoio_DATA) \
$(toolexeclibgolog_DATA) \
$(toolexeclibgomath_DATA) \
$(toolexeclibgomime_DATA) \
$(toolexeclibgonet_DATA) \
$(toolexeclibgonethttp_DATA) \
$(toolexeclibgoos_DATA) \
$(toolexeclibgopath_DATA) \
$(toolexeclibgorpc_DATA) \
$(toolexeclibgoruntime_DATA) \
$(toolexeclibgosync_DATA) \
$(toolexeclibgotesting_DATA) \
$(toolexeclibgotext_DATA) \
$(toolexeclibgotexttemplate_DATA) \
$(toolexeclibgounicode_DATA)
if GOC_IS_LLGO
CHECK_DEPS += libgo-llgo.la libgobegin-llgo.a
else
CHECK_DEPS += libgo.la libgobegin.a
endif
# PACKAGE_template defines the rules for each package.
# For example, for the package bufio, it produces:
#
# @go_include@ bufio.lo.dep
# bufio.lo.dep: $(srcdir)/go/bufio/*.go
# $(BUILDDEPS)
# bufio.lo:
# $(BUILDPACKAGE)
# bufio/check: $(CHECK_DEPS)
# @$(CHECK)
# .PHONY: bufio/check
#
# This is invoked with $(1) set to a package, which is a directory name,
# such as "bufio" or "archive/tar".
define PACKAGE_template
@go_include@ $(1).lo.dep
$(1).lo.dep: $(srcdir)/go/$(1)/*.go
$$(BUILDDEPS)
$(1).lo:
$$(BUILDPACKAGE)
$(1)/check: $$(CHECK_DEPS)
@$$(CHECK)
.PHONY: $(1)/check
$(1).gox: $(1).s-gox; @true
$(1).s-gox: $(1).lo
$$(BUILDGOX)
$$(STAMP) $$@
endef
# This line expands PACKAGE_template once for each package name listed
# in $(PACKAGES).
$(foreach package,$(PACKAGES),$(eval $(call PACKAGE_template,$(package))))
# Pass -ffp-contract=off, or 386-specific options, when building the
# math package. MATH_FLAG is defined in configure.ac.
math_lo_GOCFLAGS = $(MATH_FLAG)
# Add the generated file runtime_sysinfo.go to the runtime package.
extra_go_files_runtime = runtime_sysinfo.go sigtab.go
runtime.lo.dep: $(extra_go_files_runtime)
# Add generated files to the syscall package.
extra_go_files_syscall = \
libcalls.go \
sysinfo.go \
syscall_arch.go \
$(syscall_epoll_file)
syscall.lo.dep: $(extra_go_files_syscall)
# Pass -fgo-compiling-runtime when compiling the runtime package.
runtime_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
runtime_check_GOCFLAGS = -fgo-compiling-runtime
runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
runtime_internal_atomic_lo_check_GOCFLAGS = -fgo-compiling-runtime
runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
runtime_internal_sys_lo_check_GOCFLAGS = -fgo-compiling-runtime
# If libffi is supported (the normal case) use the ffi build tag for
# the runtime package.
if USE_LIBFFI
matchargs_runtime = --tag=libffi
else
matchargs_runtime =
endif
# At least for now, we need -static-libgo for this test, because
# otherwise we can't get the line numbers.
# Also use -fno-inline to get better results from the memory profiler.
runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
extra_go_files_runtime_internal_sys = version.go
runtime/internal/sys.lo.dep: $(extra_go_files_runtime_internal_sys)
# FIXME: The following C files may as well move to the runtime
# directory and be treated like other C files.
# Use C code to speed up {bytes,strings}.IndexByte and friends.
bytes/index.lo: go/bytes/indexbyte.c runtime.inc
@$(MKDIR_P) bytes
$(LTCOMPILE) -c -o $@ $(srcdir)/go/bytes/indexbyte.c
strings/index.lo: go/strings/indexbyte.c runtime.inc
@$(MKDIR_P) strings
$(LTCOMPILE) -c -o $@ $(srcdir)/go/strings/indexbyte.c
# Use a C function with a fixed number of arguments to call a C
# varargs function.
log/syslog/syslog_c.lo: go/log/syslog/syslog_c.c runtime.inc
@$(MKDIR_P) log/syslog
$(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c
# The interface to libffi from the reflect package is written in C.
reflect/makefunc_ffi_c.lo: go/reflect/makefunc_ffi_c.c runtime.inc
@$(MKDIR_P) reflect
$(LTCOMPILE) -c -o $@ $(srcdir)/go/reflect/makefunc_ffi_c.c
# The atomic functions are written in C.
runtime/internal/atomic_c.lo: go/runtime/internal/atomic/atomic.c runtime.inc
@$(MKDIR_P) runtime/internal
$(LTCOMPILE) -c -o $@ $(srcdir)/go/runtime/internal/atomic/atomic.c
sync/atomic_c.lo: go/sync/atomic/atomic.c runtime.inc
@$(MKDIR_P) sync
$(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c
# A few syscall functions are written in C.
syscall/clone_linux.lo: go/syscall/clone_linux.c runtime.inc
@$(MKDIR_P) syscall
$(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/clone_linux.c
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
syscall/errno.lo: go/syscall/errno.c runtime.inc
@$(MKDIR_P) syscall
$(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/errno.c
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
syscall/signame.lo: go/syscall/signame.c runtime.inc
@$(MKDIR_P) syscall
$(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/signame.c
runtime: use -fgo-c-header to build C header file Use the new -fgo-c-header option to build a header file for the Go runtime code in libgo/go/runtime, and use the new header file in the C runtime code in libgo/runtime. This will ensure that the Go code and C code share the same data structures as we convert the runtime from C to Go. The new file libgo/go/runtime/runtime2.go is copied from the Go 1.7 release, and then edited to remove unnecessary data structures and modify others for use with libgo. The new file libgo/go/runtime/mcache.go is an initial version of the same files in the Go 1.7 release, and will be replaced by the Go 1.7 file when we convert to the new memory allocator. The new file libgo/go/runtime/type.go describes the gccgo version of the reflection data structures, and replaces the Go 1.7 runtime file which describes the gc version of those structures. Using the new header file means changing a number of struct fields to use Go naming conventions (that is, no underscores) and to rename constants to have a leading underscore so that they are not exported from the Go package. These names were updated in the C code. The C code was also changed to drop the thread-local variable m, as was done some time ago in the gc sources. Now the m field is always accessed using g->m, where g is the single remaining thread-local variable. This in turn required some adjustments to set g->m correctly in all cases. Also pass the new -fgo-compiling-runtime option when compiling the runtime package, although that option doesn't do anything yet. Reviewed-on: https://go-review.googlesource.com/28051 From-SVN: r239872
2016-08-30 23:07:47 +02:00
syscall/wait.lo: go/syscall/wait.c runtime.inc
@$(MKDIR_P) syscall
$(LTCOMPILE) -c -o $@ $(srcdir)/go/syscall/wait.c
# Solaris 12 changed the type of fields in struct stat.
# Use a build tag, based on a configure check, to cope.
if LIBGO_IS_SOLARIS
if HAVE_STAT_TIMESPEC
matchargs_os = --tag=solaristag
else
matchargs_os =
endif
else
matchargs_os =
endif
if LIBGO_IS_BSD
# Build golang_org/x/net/route only on BSD systems.
$(eval $(call PACKAGE_template,golang_org/x/net/route))
golang_org_x_net_route_lo = \
golang_org/x/net/route.lo
golang_org_x_net_route_check = \
golang_org/x/net/route/check
endif
if LIBGO_IS_SOLARIS
# Build golang_org/x/net/lif only on Solaris systems.
$(eval $(call PACKAGE_template,golang_org/x/net/lif))
golang_org_x_net_lif_lo = \
golang_org/x/net/lif.lo
golang_org_x_net_lif_check = \
golang_org/x/net/lif/check
endif
TEST_PACKAGES = \
bufio/check \
bytes/check \
context/check \
errors/check \
expvar/check \
flag/check \
fmt/check \
html/check \
image/check \
io/check \
log/check \
math/check \
mime/check \
net/check \
os/check \
path/check \
reflect/check \
regexp/check \
runtime/check \
sort/check \
strconv/check \
strings/check \
sync/check \
syscall/check \
time/check \
unicode/check \
archive/tar/check \
archive/zip/check \
compress/bzip2/check \
compress/flate/check \
compress/gzip/check \
compress/lzw/check \
compress/zlib/check \
container/heap/check \
container/list/check \
container/ring/check \
crypto/aes/check \
crypto/cipher/check \
crypto/des/check \
crypto/dsa/check \
crypto/ecdsa/check \
crypto/elliptic/check \
crypto/hmac/check \
crypto/md5/check \
crypto/rand/check \
crypto/rc4/check \
crypto/rsa/check \
crypto/sha1/check \
crypto/sha256/check \
crypto/sha512/check \
crypto/subtle/check \
crypto/tls/check \
crypto/x509/check \
database/sql/check \
database/sql/driver/check \
debug/dwarf/check \
debug/elf/check \
debug/macho/check \
debug/pe/check \
debug/plan9obj/check \
encoding/ascii85/check \
encoding/asn1/check \
encoding/base32/check \
encoding/base64/check \
encoding/binary/check \
encoding/csv/check \
encoding/gob/check \
encoding/hex/check \
encoding/json/check \
encoding/pem/check \
encoding/xml/check \
exp/proxy/check \
exp/terminal/check \
html/template/check \
go/ast/check \
go/build/check \
go/constant/check \
go/doc/check \
go/format/check \
go/internal/gcimporter/check \
go/internal/gccgoimporter/check \
go/parser/check \
go/printer/check \
go/scanner/check \
go/token/check \
go/types/check \
golang_org/x/crypto/chacha20poly1305/check \
golang_org/x/crypto/chacha20poly1305/internal/chacha20/check \
golang_org/x/crypto/curve25519/check \
golang_org/x/crypto/poly1305/check \
golang_org/x/net/http2/hpack/check \
golang_org/x/net/idna/check \
golang_org/x/net/lex/httplex/check \
$(golang_org_x_net_lif_check) \
$(golang_org_x_net_route_check) \
hash/adler32/check \
hash/crc32/check \
hash/crc64/check \
hash/fnv/check \
image/color/check \
image/draw/check \
image/jpeg/check \
image/png/check \
index/suffixarray/check \
internal/pprof/profile/check \
internal/singleflight/check \
internal/trace/check \
io/ioutil/check \
log/syslog/check \
math/big/check \
math/cmplx/check \
math/rand/check \
mime/multipart/check \
mime/quotedprintable/check \
net/http/check \
net/http/cgi/check \
net/http/cookiejar/check \
net/http/fcgi/check \
net/http/httptest/check \
net/http/httptrace/check \
net/http/httputil/check \
net/http/internal/check \
net/internal/socktest/check \
net/mail/check \
net/rpc/check \
net/smtp/check \
net/textproto/check \
net/url/check \
net/rpc/jsonrpc/check \
os/exec/check \
os/signal/check \
os/user/check \
path/filepath/check \
regexp/syntax/check \
runtime/debug/check \
runtime/internal/atomic/check \
runtime/internal/sys/check \
runtime/pprof/check \
runtime/pprof/internal/protopprof/check \
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
runtime/trace/check \
sync/atomic/check \
text/scanner/check \
text/tabwriter/check \
text/template/check \
text/template/parse/check \
testing/quick/check \
unicode/utf16/check \
unicode/utf8/check
check: check-tail
check-recursive: check-head
check-head:
@echo "Test Run By $${USER} on `date`" > libgo.head
@echo "Native configuration is $(host_triplet)" >> libgo.head
@echo >> libgo.head
@echo " === libgo tests ===" >> libgo.head
@echo >> libgo.head
check-tail: check-recursive check-multi
@if test "$(USE_DEJAGNU)" = "yes"; then \
exit 0; \
fi; \
lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
for dir in . $(MULTIDIRS); do \
mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
done; \
mv libgo.head libgo.sum; \
cp libgo.sum libgo.log; \
echo "Schedule of variations:" >> libgo.sum; \
for dir in . $(MULTIDIRS); do \
multidir=../$${dir}/$${lib}; \
multivar=`cat $${multidir}/libgo.var`; \
echo " $${multivar}" >> libgo.sum; \
done; \
echo >> libgo.sum; \
pass=0; fail=0; untested=0; \
for dir in . $(MULTIDIRS); do \
multidir=../$${dir}/$${lib}; \
multivar=`cat $${multidir}/libgo.var`; \
echo "Running target $${multivar}" >> libgo.sum; \
echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
cat $${multidir}/libgo.sum.sep >> libgo.sum; \
cat $${multidir}/libgo.log.sep >> libgo.log; \
if test -n "${MULTIDIRS}"; then \
echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \
echo >> libgo.sum; \
fi; \
p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
pass=`expr $$pass + $$p`; \
if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
echo "# of expected passes $$p" >> libgo.sum; \
fi; \
p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
fail=`expr $$fail + $$p`; \
if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
echo "# of unexpected failures $$p" >> libgo.sum; \
fi; \
p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
untested=`expr $$untested + $$p`; \
if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
echo "# of untested testcases $$p" >> libgo.sum; \
fi; \
done; \
echo >> libgo.sum; \
echo " === libgo Summary ===" >> libgo.sum; \
echo >> libgo.sum; \
if test "$$pass" -ne "0"; then \
echo "# of expected passes $$pass" >> libgo.sum; \
fi; \
if test "$$fail" -ne "0"; then \
echo "# of unexpected failures $$fail" >> libgo.sum; \
fi; \
if test "$$untested" -ne "0"; then \
echo "# of untested testcases $$untested" >> libgo.sum; \
fi; \
echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
echo >> libgo.log; \
echo "runtest completed at `date`" >> libgo.log; \
if test "$$fail" -ne "0"; then \
status=1; \
else \
status=0; \
fi; \
exit $$status
check-am:
@rm -f libgo.sum libgo.log libgo.tail
@multivar="unix"; \
[ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
echo "$${multivar}" > libgo.var
@for f in $(TEST_PACKAGES); do \
rm -f $$f-testsum $$f-testlog; \
done
-@$(MAKE) -k $(TEST_PACKAGES)
@for f in $(TEST_PACKAGES); do \
if test -f $$f-testsum; then \
cat $$f-testsum >> libgo.sum; \
fi; \
if test -f $$f-testlog; then \
cat $$f-testlog >> libgo.log; \
fi; \
done
check-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
bench:
-@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=.
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
MOSTLYCLEANFILES = \
s-runtime_sysinfo s-sigtab s-runtime-inc s-zstdpkglist \
s-libcalls s-libcalls-list s-syscall_arch s-gen-sysinfo s-sysinfo \
s-errno s-epoll \
libgo.head libgo.sum.sep libgo.log.sep libgo.var \
libcalls-list runtime.inc runtime.inc.tmp2 runtime.inc.tmp3
mostlyclean-local:
find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f
find . -name '*.$(OBJEXT)' -print | xargs rm -f
find . -name '*-testsum' -print | xargs rm -f
find . -name '*-testlog' -print | xargs rm -f
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
CLEANFILES = *.go *.c s-version libgo.sum libgo.log runtime.inc
clean-local:
find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f
find . -name '*.a' -print | xargs rm -f
Big merge of changes to gofrontend repo that were postponed due to the GCC release freeze. * go-backend.c: Include "go-c.h". * go-gcc.cc (Gcc_backend::write_export_data): New method. * go-gcc.cc (Gcc_backend::Gcc_backend): Declare __builtin_prefetch. * Make-lang.in (GO_OBJS): Add go/wb.o. commit 884c9f2cafb3fc1decaca70f1817ae269e4c6889 Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:07:07 2017 -0500 compiler: insert additional conversion for type desc ptr expr Change the method Type::type_descriptor_pointer to apply an additional type conversion to its result Bexpression, to avoid type clashes in the back end. The backend expression for a given type descriptor var is given a type of "_type", however the virtual calls that create the variable use types derived from _type, hence the need to force a conversion. Reviewed-on: https://go-review.googlesource.com/35506 commit 5f0647c71e3b29eddcd0eecc44e7ba44ae7fc8dd Author: Than McIntosh <thanm@google.com> Date: Mon Jan 23 15:22:26 2017 -0500 compiler: insure tree integrity in Call_expression::set_result Depending on the back end, it can be problematic to reuse Bexpressions (passing the same Bexpression to more than one Backend call to create additional Bexpressions or Bstatements). The Call_expression::set_result method was reusing its Bexpression input in more than one tree context; the fix is to pass in an Expression instead and generate multiple Bexpression references to it within the method. Reviewed-on: https://go-review.googlesource.com/35505 commit 7a8e49870885af898c3c790275e513d1764a2828 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Jan 24 21:19:06 2017 -0800 runtime: copy more of the scheduler from the Go 1.8 runtime Copies mstart, newm, m0, g0, and friends. Reviewed-on: https://go-review.googlesource.com/35645 commit 3546e2f002d0277d805ec59c5403bc1d4eda4ed9 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 19:47:37 2017 -0800 runtime: remove a few C functions that are no longer used Reviewed-on: https://go-review.googlesource.com/35849 commit a71b835254f6d3164a0e6beaf54f2b175d1a6a92 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Jan 26 16:51:16 2017 -0800 runtime: copy over more of the Go 1.8 scheduler In particular __go_go (aka newproc) and goexit[01]. Reviewed-on: https://go-review.googlesource.com/35847 commit c3ffff725adbe54d8283c373b6aa7dc95d6fc27f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 16:58:20 2017 -0800 runtime: copy syscall handling from Go 1.8 runtime Entering a syscall still has to start in C, to save the registers. Fix entersyscallblock to save them more reliably. This copies over the tracing code for syscalls, which we previously weren't doing, and lets us turn on runtime/trace/check. Reviewed-on: https://go-review.googlesource.com/35912 commit d5b921de4a28b04000fc4c8dac7f529a4a624dfc Author: Ian Lance Taylor <iant@golang.org> Date: Fri Jan 27 18:34:11 2017 -0800 runtime: copy SIGPROF handling from Go 1.8 runtime Also copy over Breakpoint. Fix Func.Name and Func.Entry to not crash on a nil Func. Reviewed-on: https://go-review.googlesource.com/35913 commit cc60235e55aef14b15c3d2114030245beb3adfef Author: Than McIntosh <thanm@google.com> Date: Mon Feb 6 11:12:12 2017 -0500 compiler: convert go_write_export_data to Backend method. Convert the helper function 'go_write_export_data' into a Backend class method, to allow for an implementation of this function that needs to access backend state. Reviewed-on: https://go-review.googlesource.com/36357 commit e387439bfd24d5e142874b8e68e7039f74c744d7 Author: Than McIntosh <thanm@google.com> Date: Wed Feb 8 11:13:46 2017 -0500 compiler: insert backend conversion in temporary statement init Insert an additional type conversion in Temporary_statement::do_get_backend when assigning a Bexpression initializer to the temporary variable, to avoid potential clashes in the back end. This can come up when assigning something of concrete pointer-to-function type to a variable of generic pointer-to-function type. Reviewed-on: https://go-review.googlesource.com/36591 commit c5acf0ce09e61ff623847a35a99da465b8571609 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:57:53 2017 +0100 libgo: build tags for aix Build tags for the libgo source files required to build libgo on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37633 commit 67ed19616898ea18a101ec9325b82d028cd395d9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 2 15:41:31 2017 +0100 libgo: handle AIX tag in match.sh and gotest Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37638 commit 83ea2d694c10b2dd83fc8620c43da13d20db754e Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 1 17:48:16 2017 +0100 libgo: add AIX support in configure and Makefile - support for GOOS=aix - CFLAGS/GOCFLAGS/LDFLAGS for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37632 commit 35d577fe22ffa16a3ccaadf5dae9f6f425c8ec8c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 15:00:15 2017 +0100 runtime: adapt memory management to AIX mmap On AIX: * mmap does not allow to map an already mapped range, * mmap range start at 0x30000000 for 32 bits processes, * mmap range start at 0x70000000_00000000 for 64 bits processes Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37845 commit 4e49e56a5fd4072b4ca7fcefe4158d6885d9ee62 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 13:42:26 2017 +0100 runtime: add getproccount implementation for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37844 commit ff626470294237ac664127894826614edc46a3d0 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 17:31:21 2017 +0100 runtime: handle ERESTART errno with AIX's wait4 On AIX, wait4 may return with errno set to ERESTART, which causes unexepected behavior (for instance, go build may exit with the message "wait: restart system call" after running a command, even if it was successfull). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37846 commit 37daabbfc83d533b826ef9ab10e2dee7406e7198 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Mon Mar 6 11:02:58 2017 +0100 runtime: support for AIX's procfs tree On AIX, the process executable file is available under /proc/<pid>/object/a.out Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37842 commit a0275c039d56acf4bf48151978c1a4ec5758cc2c Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 8 07:00:05 2017 -0800 libgo/Makefile.am: don't use nonportable \n or \t in sed expression The resulting zstdpktlist.go is less pretty, but it works. Reviewed-on: https://go-review.googlesource.com/37940 commit 29b190f76105aafa2b50b48249afdafecc97a4be Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 16:02:34 2017 +0100 runtime: netpoll and semaphores for AIX semaphore implementation based on Solaris implementation in libgo/go/runtime/os_solaris.go netpoll is just a stub to avoid build failure on AIX. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37966 commit 55ca6d3f3cddf0ff9ccb074b2694da9fc54de7ec Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 9 15:38:30 2017 +0100 libmain: ensure initfn is called when loading a go library AIX does not support .init_array. The alterative is to export the __go_init function and tell the linker it is an init function with the -Wl,-binitfini:__go_init option. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37965 commit 349a30d17d880ac8bc1a35e1a2ffee6d6e870ae9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 10 11:15:08 2017 +0100 libgo: use an import list for missing symbols libgo depends on symbols provided by Go programs at runtime. On AIX, this requires either to build libgo with -Wl,-berok linker option and the programs with -Wl,-brtl, or to provide a list of imported symbols when building libgo. The second options seems preferable, to avoid requiring an additional option for every Go program. There are also some symbols that are specific to GNU ld and do not exist when linking with AIX ld (__data_start, __edata, __etext and __bss_start). Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37969 commit 91db0ea1ff068ca1d97b9c99612100ea5b96ddb2 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 8 15:34:45 2017 +0100 crypto/x509: add certificate files locations for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/37952 commit 92e521c854e91709b949548c47e267377850f26a Author: Ian Lance Taylor <iant@golang.org> Date: Fri Mar 10 14:10:11 2017 -0800 compiler: fix check for pointer in Temporary_reference_expression The check for an unrepresentable pointer in Temporary_reference_expression::do_get_backend was incorrectly translated from C to Go in https://golang.org/cl/14346043. Fix the check to use points_to rather than has_pointer and deref. This should not make any difference in practice as either way the condition will only be true for a pointer to void, but points_to is correct and more efficient. Reviewed-on: https://go-review.googlesource.com/38009 commit 9a0b676e59e7171a630c48fdc3d4de6712bad0ca Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 16:51:53 2017 +0100 libgo: add missing _arpcom struct to *sysinfo.go This struct is filtered due to having a field of type _in6_addr, but other types exported to *sysinfo.go are depending on it. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38251 commit 61262a757bdd3d9a595ab6a90f68c0c4ebed7bc1 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:27:46 2017 +0100 syscall: raw_ptrace stub for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38253 commit 8029632b50880fd9b5e39299c738b38e3386595f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: adapt runtime.inc to AIX * Two AIX types are wrongfully exported to runtime.inc as their names make them look like a Go type. * The sigset go type conflicts with a system sigset type. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38192 commit 25f3a90d14bc268479369ecc0eada72791612f86 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 15 16:58:37 2017 +0100 libgo: update Makefile.in, accidentally omitted from last change Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38310 commit d52b4895616b66f93b460366527e74336829aaa5 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:39:26 2017 +0100 syscall: TIOCSCTTY does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38254 commit ff1ec3847a4472008e5d53a98b6694b1e54ca322 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 16 18:07:34 2017 +0100 syscall: syscall does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38252 commit c1ee60dabf0b243a0b0286215481a5d326c34596 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:18:18 2017 +0100 net: EAI_OVERFLOW does not exist on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38266 commit ad4ad29aed9f70b14b39b488bfeb9ee745382ec4 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:23:56 2017 +0100 net: sockopt/sockoptip stubs for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38267 commit 5d7db2d7542fe7082f426d42f8c2ce14aad6df55 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 16:35:05 2017 +0100 os/user: add listgroups stub for AIX This is required to build os/user. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38263 commit 4e57a7973e9fa4cb5ab977c6d792e62a8f7c5795 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 11:11:30 2017 +0100 os: fix readdirnames for AIX Largefile implementation should be used on AIX. readdir64_r function returns 9 and sets result to NULL when reaching end of directory, so this return code should not always be considered as an error. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38359 commit b34036967d1ec57b25e3debe077439b4210a1d4a Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Mar 17 17:39:31 2017 +0100 libgo: adapt sigtab.go to AIX On AIX, _NSIG is not directly defined to its integer value in gen-sysinfo.go. The real value is _SIGMAX32+1 or _SIGMAX64+1, depending if we are building a 32bit ligbo or a 64bit libgo, so we need to read one of those constants to set nsig value in mksigtab.sh This change also ensures that all signal numbers from 0 to nsig-1 are referenced in sigtable. Reviewed-on: https://go-review.googlesource.com/38268 commit 20991c32671a183ec859b4f285df37fdd4634247 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:28:09 2017 +0100 syscall: missing import in socket_bsd.go Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38369 commit c34754bd9adf5496c4c26257eaa50793553c11e8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 22 17:57:01 2017 +0100 sycall: WCOREDUMP macro is not defined on AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38363 commit 4f38813482227b12ea0ac6ac1b981ff9ef9853ef Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:44:43 2017 +0100 libgo: additional build tags for AIX Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38510 commit d117ede6ff5a7083e9c40eba28a0f94f3535d773 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 23 17:48:46 2017 +0100 go/build: add AIX to "go build" command known OS Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38511 commit 7b0ddaa6a6a71f9eb1c374122d29775b13c2cac5 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Mar 23 09:57:01 2017 -0700 compiler: don't crash if imported package imports this one When building a test it's OK if test code imports a package that imports this one. The go tool is supposed to catch cases where this creates an impossible initialization order. The compiler already has code to permit this in Gogo::add_import_init_fn. This CL avoids a compiler crash on a similar case when writing out the export data. I have no test case for this. Basically it pushes a compiler crash into an error reported elsewhere. Problem was reported by Tony Reix. Reviewed-on: https://go-review.googlesource.com/38462 commit 925636975d075e3e3353823b09db3f933f23cb03 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Mar 29 14:14:18 2017 -0700 runtime: copy finalizer support from Go 1.8 runtime Reviewed-on: https://go-review.googlesource.com/38794 commit 1ccb22b96cb3b1011db0e427877d9ddecb577fa9 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Mar 30 15:21:06 2017 +0200 runtime: initcontext and setcontext stubs for AIX Further investigations are required to understand the clobbering issue and implement a proper fix. Until then, those stubs are required to allow the build to complete. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38930 commit 27db481f369b54256063c72b911d22390c59199c Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 18:07:25 2017 +0200 os: fix Readlink failure on AIX AIX readlink routine returns an error if the link is longer than the buffer, instead of truncating the link. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38700 commit c93babbf48eddd0bc34d4179ffb302dc60087299 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:26:35 2017 +0200 compiler: implement support for reading AIX big archives This is required to read go export from a Go library. Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38698 commit 930dd53482bdee3a9074850d168d0b9d7819c135 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 18:50:11 2017 -0700 compiler: fix whether conversions are static initializers The compiler was incorrectly treating type conversions from string to int or vice-versa as static initializers. That doesn't work, as those conversions are implemented via a function call. This case may never actually arise but it seems like the right thing to do. Reviewed-on: https://go-review.googlesource.com/39872 commit f02691e4195728dbf06f4dde0853c6bccc922183 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 17:24:08 2017 -0700 compiler, runtime: don't let slices point past end of memory block When Go code uses a slice expression like [:len(str)] or [:cap(slice)], it's natural for the resulting pointer to point just past the end of the memory block. If the next memory block is not live, we now have a live pointer to a dead block, which will unnecessarily keep the block alive. That wastes space, and with the new Go 1.8 GC (not yet committed) will trigger an error when using GODEBUG=gccheckmark=1. This changes the implementation of slice expressions to not move the pointer if the resulting string length or slice capacity is 0. When the length/capacity is zero, the pointer is never used anyhow. Reviewed-on: https://go-review.googlesource.com/39870 commit 17527c35b027e1afcc318faf5563909e1e9d44a6 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 15:30:11 2017 -0700 compiler: emit write barriers The Go 1.8 concurrent GC requires optional write barriers for all assignments that may change pointer values in the heap or in a global variable. For details see https://blog.golang.org/go15gc. This changes the gofrontend code to emit write barriers as needed. This is in preparation for future changes. At the moment the write barriers will do nothing. They test runtime.writeBarrier.enabled, which will never be non-zero. They call simple functions which just do a move without doing any of the other operations required by the write barrier. Reviewed-on: https://go-review.googlesource.com/39852 commit c0b00f072bf34b2c288e1271ec8118b88c4f6f6f Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 17:47:29 2017 +0200 libgo: allow building gox files from PIC objects libtool builds non-PIC objects in the same directory as .lo files and PIC objects in a .libs subdirectory. BUILDGOX rule uses the non-PIC objects to build the gox files, but on AIX only the PIC objects are built. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40355 commit ea0f3da174c5503a209043f14ddda34871cfec52 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 6 19:06:14 2017 -0700 compiler: add code to generate a ptrmask for a type The Go 1.8 garbage collector uses a ptrmask for all types below a certain size. A ptrmask is simply a bit vector with a single bit for each pointer-sized word in the value. The bit is 1 if the type has a pointer in that position, 0 if it does not. This change adds code to the compiler to generate a ptrmask. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. The new Array_type::int_length method, and the new memory_size methods, will also be used by other patches coming later. Reviewed-on: https://go-review.googlesource.com/39873 commit 3029e1df3be3614d196a03c15e50e68ff850aa4c Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 7 10:31:39 2017 -0700 compiler: add code to generate a gcprog for a type The Go 1.8 garbage collector uses a gcprog for all types above a certain size. A gcprog describes where the pointers are in the type, using a simple bytecode machine that supports repeating bits. The effect is to permit using much less space to describe arrays. The format is described in runtime/mbitmap.go in the docs for runGCProg. This is not yet added to the gofrontend, but can be seen in the gc sources. This change adds code to the compiler to generate a gcprog. The code is not used by anything yet, it is just compiled. It will be used when we switch over to the Go 1.8 garbage collector. Reviewed-on: https://go-review.googlesource.com/39923 commit 8b01ef1e9176d20f4c9e667972fe031069a4d057 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 13 07:00:35 2017 -0700 compiler: add ptrdata computations and expressions For the upcoming Go 1.8 GC we need to compute the "ptrdata" of a type: the number of bytes in the type that can contain pointers. For types that do not contain pointers this number is zero. For many types it is a number larger than zero but smaller than the total size of the type. The Go 1.8 GC uses this number to make loops looking for pointers run faster by not scanning the suffix of a value that can not contain a pointer. Unfortunately there are two subtly different definitions of ptrdata, and we need both. The first is the simple one: the prefix that can contain pointers. The second is the number of bytes described by the gcprog for the type. Recall that we describe the exact position of pointers in a type using either a ptrmask or a gcprog. The ptrmask is simpler, the gcprog uses less space. We use the gcprog for large types, currently defined as types that are more than 2048 bytes. When the Go 1.8 runtime expands a gcprog, it verifies that the gcprog describes exactly the same number of bytes as the ptrdata field in the type descriptor. If the last pointer-containing portion of a type is an array, and if the elements of the array have a ptrdata that is less than the size of the element type, then the simple definition of the ptrdata will not include the final non-pointer-containing bytes of the last element of the array. However, the gcprog will define the array using a repeat count, and will therefore include the full size of the last element of the array. So for a type that needs a gcprog, the ptrdata field in the type descriptor must be the size of the data described by the gcprog, and that is not necessarily the same as the simple ptrdata. It might seem that we can always use the gcprog version of the ptrdata calculation, since that is what will appear in a type descriptor, but it turns out that for global variables we always use a ptrmask, not a gcprog, even if the global variable is large. This is because gcprogs are handled by expanding them into a ptrmask at runtime, and for a global variable there is no natural place to put the ptrmask. Simpler to always use the ptrmask. That means that we need to describe the size of the ptrmask, and that means that we need an expression for the simple form of the ptrdata. This CL implements the ptrdata calculation. This code is not actually used yet. It will be used later when the Go 1.8 GC is committed. Reviewed-on: https://go-review.googlesource.com/40573 commit 7a37331303b572412179a08141f1dd35339d40c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 06:55:48 2017 -0700 compiler: zero length arrays never contain pointers Reviewed-on: https://go-review.googlesource.com/40696 commit c242f0508a64d3d74a28d498cbaeda785ff76258 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 07:26:54 2017 -0700 bytes: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and this test will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40700 commit 0dc369f1d63376a36bfb0999a1b0377fd444bfab Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:22:38 2017 +0200 os: alternative way to find executable path, using Args[0] AIX does not provide a proper way to find the original executable path from procfs, which contains just an hardlink. Executable path can be found using Args[0], Getcwd and $PATH. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40353 commit f9bad1342569b338e3b2ea9f12ffc6d3d3fa3028 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 08:01:19 2017 -0700 compiler: don't write struct with multiple sink fields to C header file When writing a struct to the C header file used by the C runtime code, a single sink field is fine: it will be called "_", which is valid C. There are structs with single sink fields that we want to write out, such as finblock. As it happens, though, the Go 1.8 runtime has a struct with two sink fields, gcControllerState, which will produce a C definition with two fields named "_", which will fail. Since we don't need to know that struct in C, rather than fix the general case, just punt if the struct has multiple sink fields. After the conversion to the Go 1.8 GC, we may be able to get rid of the C header file anyhow. I'm not sure yet. Reviewed-on: https://go-review.googlesource.com/40701 commit cfc28901a572aeb15b2f10a38f79eec04c64dfb2 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:07:23 2017 -0700 runtime: disable allocations test on gccgo It turns out that testing.AllocsPerRun has not been producing correct results with the current gccgo memory allocator. When we update to the Go 1.8 memory allocator, testing.AllocsPerRun will work again, and these tests will fail due to lack of escape analysis. Reviewed-on: https://go-review.googlesource.com/40703 commit 36fedd76edaa48b9ec09709a70d9e4abaddf0caf Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:47:06 2017 -0700 runtime: remove unused size argument from hash/equal fns The size argument was removed from hash and equal functions in CL 34983. Somehow I missed removing them from three of the predefined functions. Reviewed-on: https://go-review.googlesource.com/40770 commit 90f6accb48d2e78cad8955b9292933f6ce3fe4c8 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:23:05 2017 -0700 runtime: remove unused stack.go We're never going to use stack.go for gccgo. Although a build tag keeps it from being built, even having it around can be confusing. Remove it. Reviewed-on: https://go-review.googlesource.com/40774 commit befa71603fc66a214e01ac219f2bba36e19f136f Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 13:18:34 2017 -0700 runtime: build fastlog Take out the build tags which were preventing fastlog2 from being built. It's used by the upcoming Go 1.8 GC. Reviewed-on: https://go-review.googlesource.com/40773 commit b7e19e9be4ab4c3cd8f4c9506d79a8cd56bace40 Author: Ian Lance Taylor <iant@golang.org> Date: Fri Apr 14 10:04:23 2017 -0700 runtime: add tests from Go 1.8 Some runtime package tests never made it into the gofrontend repo for some reason. Add them now. Reviewed-on: https://go-review.googlesource.com/40869 commit 1feef185aebd71bc2a09b9a04287461806096610 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 16:26:11 2017 -0700 runtime: change mcall to take a Go function value For future work in bringing in the Go 1.8 GC, change the mcall function to take a Go function value, which means that mcall can take a closure rather than just a straight C function pointer. As part of this change move kickoff from C to Go, which we want to do anyhow so that we run the write barriers that it generates. Reviewed-on: https://go-review.googlesource.com/40935 commit c3db34f4efc2d610f74a01dd2ad7775f48889b29 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Tue Apr 11 16:11:26 2017 +0200 runtime: netpoll implementation for AIX Code courtesy of Damien Bergamini from Atos Infogérance. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/40352 commit f5634dff40e53ad9ce61afd67fd07334e3af9d1f Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 22:06:07 2017 -0700 runtime: move mstart from Go to C The assignments done in mstart must be done without write barriers, as mstart is running without an m or p. In the gc toolchain the equivalent code to intialize g and g->m is written in assembler; on GNU/Linux, it's in the clone function. Reviewed-on: https://go-review.googlesource.com/40989 commit 671d7c74592f4b6fe3665af279482ba0ea47ca2d Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:47:28 2017 -0700 compiler: varargs slices do not escape in runtime Also, don't try to allocate an empty slice on the stack, as it will confuse the GCC backend. Also add a few trivial style, code formatting, and debug output fixes. Updates golang/go#17431 Reviewed-on: https://go-review.googlesource.com/40983 commit 94699d25f31353bf03419eda56b15993a39f3275 Author: Ian Lance Taylor <iant@golang.org> Date: Tue Apr 18 17:30:09 2017 -0700 compiler: add Ptrmask_symbol_expression Add an expression to evaluate to the ptrmask for a type. This will be used for global variables, which always use a ptrmask no matter how large they are. Reviewed-on: https://go-review.googlesource.com/40981 commit bfff1654eac5b9288fa6c431e66cba8c9da6a660 Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 17 10:51:16 2017 -0700 runtime: change g's in systemstack The systemstack function in the gc toolchain changes to a different g. This is often used to get more stack space; the gofrontend uses a different stack growth mechanism that does not require changing g's, so we've been running with a version of systemstack that keeps the same g. However, the garbage collector has various tests to verify that it is running on g0 rather than on a normal g. For simplicity, change the gofrontend version of systemstack to change to a different g just as the gc toolchain does. This permits us to uncomment some sanity checks in notetsleep. Doing that requires us to fix up a couple of places where C code calls {start,stop}TheWorldWithSema while not on g0. Note that this does slow down some code in the runtime package unnecessarily. It may be useful to find some places where the runtime calls systemstack only to get more stack space and change it to use some other function. That other function would act like systemstack in the gc toolchain but simply call the argument in the gofrontend. Reviewed-on: https://go-review.googlesource.com/40973 commit b2ccc7601ce71a7c5732154cf9b2eeea64681469 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 10:36:12 2017 -0700 compiler, runtime: include ptrmask in GC roots Change the list of registered GC roots to include a ptrmask, and change the data structures to be easily used from Go code. The new ptrmask will be used by the Go 1.8 GC to only scan pointers. Tweak the current GC to use the new structures, but ignore the new ptrmask information for now. The new GC root data includes the size of the variable. The size is not currently used, but will be used later by the cgo checking code. Reviewed-on: https://go-review.googlesource.com/41075 commit 9e065149970bc180e4ca83bb99c74d9c4f43b47b Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 12:23:16 2017 -0700 compiler, runtime: don't pass size to __go_new There is no reason to pass the size to __go_new, as the type descriptor includes the size anyhow. This makes the function correspond to the Go 1.8 function runtime.newobject, which is what we will use when we update to the Go 1.8 memory allocator. Reviewed-on: https://go-review.googlesource.com/41080 commit c321de7b738c4a3387c1842919c9305acfa04c57 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 13:13:56 2017 -0700 compiler, runtime, reflect: make type descriptors more like Go 1.8 Change the type descriptor structure to be more like the one in the Go 1.8 runtime. Specifically we add the ptrdata field, rename the gc field to gcdata and change the type to *byte, and rearrange a few of the fields. The structure is still not identical to the Go 1.8 structure--we don't use any of the tricks to reduce overall executable size--but it is more similar. For now we don't use the new ptrdata field, and the gcdata field is still the old format rather than the new Go 1.8 ptrmask/gcprog format. Reviewed-on: https://go-review.googlesource.com/41081 commit 7b70c52cddeebea9ebeac003f8c6aad59497e5f0 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:54:29 2017 -0700 reflect: make sure to clear unusable hash/equal function Otherwise we wind up copying the one from the prototype, which is wrong. Also rewrite the hash/equal functions to look like the ones in Go 1.8, mainly a matter of changing names and using arrayAt. Reviewed-on: https://go-review.googlesource.com/41133 commit 84d26f467f7de8bdbb0d230458135fe1b6b2a99d Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 14:59:13 2017 -0700 runtime: remove duplicate declarations of SetFinalizer/KeepAlive These should have been removed in CL 38794. It's a bug that the compiler even permits these duplicate declarations. Reviewed-on: https://go-review.googlesource.com/41134 commit f85ff7e64c24031f6d0bd7c9c426b6176cb95160 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 15:56:32 2017 -0700 runtime: don't crash if panicstring called with no m It's possible for runtime_panicstring to be called with no m if a signal handler, or scheduler innards, do something wrong. If that happens carry on with the panic rather than crashing. Reviewed-on: https://go-review.googlesource.com/41137 commit 5b362b04f642afb8b20715930416fc3b7d91bb12 Author: Than McIntosh <thanm@google.com> Date: Fri Mar 31 14:35:48 2017 -0400 compiler: fix for expr sharing introduced by Order_eval::statement. When processing an expression statement with a top-level call that returns multiple results, Order_eval::statement can wind up creating a tree that has multiple references to the same call, which results in a confusing AST dump. Change the implementation to avoid introducing this unwanted sharing. Reviewed-on: https://go-review.googlesource.com/39210 commit b05b4260a68695bf9c9cc29e14ae86ca2699458a Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:00:28 2017 -0700 runtime: restore correct m in gtraceback If gtraceback is used to get a stack trace of a g running in the same m, as can happen if we collect a stack trace from a g0, then restore the old m value, don't clear it. Reviewed-on: https://go-review.googlesource.com/41138 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit ca8bbf4dfac19b3f4f7ce21a688b96a418c75031 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 16:03:24 2017 -0700 runtime: set startpc field when starting a new goroutine This puts the right value in a trace--previously it was always zero. Reviewed-on: https://go-review.googlesource.com/41139 commit 887690dce42d7bf8f711f8ea082e4928fb70f2a5 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:06:11 2017 -0700 runtime: add prefetch functions The Go 1.8 GC uses prefetch functions. Add versions for gccgo that call __builtin_prefetch. Uncomment the test for them in testAtomic64. Don't force the check function to return early, as now taking the address of a local variable in the runtime package does not force it onto the heap. Reviewed-on: https://go-review.googlesource.com/41144 commit 4269db69f9184e5a45c54aaee7352425a1f88bff Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 17:55:21 2017 -0700 runtime: split up ticks to get correct alignment On 32-bit x86 a uint64 variable by itself is aligned to an 8-byte boundary. A uint64 field in a struct is aligned to a 4-byte boundary. The runtime.ticks variable has a uint64 field that must be aligned to an 8-byte boundary. Rather than rely on luck, split up the struct into separate vars so that the required alignment happens reliably. It would be much nicer if issue golang/go#19057 were fixed somehow, but that is for another day. Reviewed-on: https://go-review.googlesource.com/41143 commit 66926cabdbdbf3431b4f172f7756e195c1c6c513 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 17:15:38 2017 +0200 libgo: fix bad value for O_CLOEXEC on AIX 7.1 On AIX 7.1, O_CLOEXEC is defined as 0x0000001000000000, which creates an integer constant overflow error when building libgo. This affects only 7.1, O_CLOEXEC is not defined on 6.1 (and defaults to O in sysinfo.go) and is defined as 0x00800000 on AIX 7.2. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41214 commit af288ff10aeafc47651f5def327ed56425d5be19 Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:15:02 2017 -0700 runtime: preserve stack context in tracebackothers The tracebackothers function works by saving the current stack context in the goroutine's context field and then calling gogo to switch to a new goroutine. The new goroutine will collect its own stack trace and then call gogo to switch back to the original goroutine. This works fine, but if the original goroutine was called by mcall then the contents of its context field are needed to return from the mcall. Fix this by saving the stack context across the calls to the other goroutines. Reviewed-on: https://go-review.googlesource.com/41293 commit 43101e5956e793f1b4de05c15d7738c785e927df Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 21 10:58:52 2017 +0200 os/user: use _posix_* libc functions libc getpwnam_r function has a different signature, we must use _posix_getpwnam_r instead (by default, the pwd.h system include file defines getpwnam_r as a static function calling _posix_getpwnam_r, so a C program calling getpwnam_r will indeed reference the _posix_getpwnam_r symbol). Idem for getpwuid_r, getgrnam_r and getgrgid_r. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41334 commit 71e1fec4d2a536591ea6657a06916a17b5127071 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Apr 19 21:24:48 2017 -0700 runtime: don't use pointers in g_ucontext_t or stackcontext The g_ucontext_t type holds registers saved for a goroutine. We have to scan it for pointers, but since registers don't necessarily hold pointers we have to scan it conservatively. That means that it should not have a pointer type, since the GC will always scan pointers. Instead it needs special treatment to be scanned conservatively. The current GC doesn't care when a pointer type holds a non-pointer, but the Go 1.8 GC does. For the current GC this means we have to explicitly scan the g_ucontext_t values in a G. While we're at it change stackcontext to be uintptr too. The entries in stackcontext never hold pointers that the Go GC cares about. Reviewed-on: https://go-review.googlesource.com/41270 commit eab2960aee91d3e3a6baa5b1bce01262d24c714f Author: Ian Lance Taylor <iant@golang.org> Date: Thu Apr 20 17:08:19 2017 -0700 runtime/internal/sys: define Goexperiment The gc toolchain defines Goexperiment based on the environment variable GOEXPERIMENT when the toolchain is built. We just always set Goexperiment to the empty string. Reviewed-on: https://go-review.googlesource.com/41292 commit be4a751943265c0637da859d15a4faf162f5c478 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Thu Apr 20 14:04:35 2017 +0200 net: sockopt implementation for AIX This is a copy of the Linux implementation, it allows to run some simple client/server applications on AIX, while the current sockopt stubs don't. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41213 commit 46a669c4ca5b80fd6f6a0a42095804d9f704611d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Mar 29 17:55:06 2017 +0200 math: fix sign for atan/expm1/log1p(-0) AIX libc returns +0 for atan(-0), expm1(-0) and log1p(-0), while matching Go functions must return -0. Code courtesy of Tony Reix. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/38699 commit 53b0e809130038a46f0a3d2870e3905f44ab888d Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 17:29:22 2017 +0200 runtime: fix context clobbering on AIX On AIX 64-bits, r13 is a pointer to thread data. setcontext() overwrites r13 with the value saved by getcontext(). So, when a goroutine is scheduled on a new thread, r13 will point to the old thread data after calling setcontext(). Code courtesy of Damien Bergamini. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41854 commit f8d5ebd71c71e6e777200530d8204b92619157f8 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Wed Apr 26 18:01:19 2017 +0200 runtime: fix wrong time calculation in semasleep tv_nsec is added twice when calculating the sleep end time. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/41855 commit ef56097f4ea848d48fbf61eba1c757fe7fce99d3 Author: Matthieu Sarter <matthieu.sarter.external@atos.net> Date: Fri Apr 28 10:27:32 2017 +0200 libgo: pass $(NM) value when running benchmarks On AIX, we need to use "nm -B" instead of "nm", to have the epxected output format, so the configured $(NM) value from the Makefile should be exported before running gotest, which defaults to "nm" if $NM is not set. Issue golang/go#19200 Reviewed-on: https://go-review.googlesource.com/42051 commit 0fb550083ae474fb964435927b899ec8e4b62771 Author: Ian Lance Taylor <iant@golang.org> Date: Wed Nov 16 21:12:53 2016 -0800 runtime: copy garbage collector from Go 1.8 runtime This giant patch replaces the old Go 1.4 memory allocator and garbage collector with the new Go 1.8 code. The memory allocator is fairly similar, though now written in Go rather than C. The garbage collector is completely different. It now uses ptrmask and gcprog information, which requires changes in the compiler and the reflect package as well as the runtime. And, of course, the garbage collector now runs concurrently with program execution. In the gc toolchain the garbage collector is strict and precise at all levels. In the gofrontend we do not have stack maps, so stacks, and register values, are collected conservatively. That means that an old, no longer used, pointer on a stack or in a register can cause a memory object to live longer than it should. That in turns means that we must disable some checks for invalid pointers in the garbage collection code. Not only can we get an invalid pointer on the stack; the concurrent nature of the collector means that we can in effect resurrect a block that was already unmarked but that the collector had not yet gotten around to freeing, and that block can in turn point to other blocks that the collector had managed to already free. So we must disable pointer checks in general. In effect we are relying on the fact that the strict pointer checks in the gc toolchain ensure that the garbage collector is correct, and we just assume that it is correct for the gofrontend since we are using the same code. Reviewed-on: https://go-review.googlesource.com/41307 commit a95078d501175240d095500a8c5fbfb21bec65cb Author: Ian Lance Taylor <iant@golang.org> Date: Mon Apr 24 16:33:47 2017 -0700 libgo/Makefile: clean more files Fix up the mostlyclean, clean, and distclean targets to better follow https://www.gnu.org/prep/standards/html_node/Standard-Targets.html. Reviewed-on: https://go-review.googlesource.com/41625 commit 5956bf1055451cf4239cdfeca259c23b1ded54d8 Author: Ian Lance Taylor <iant@golang.org> Date: Mon May 8 13:35:11 2017 -0700 libgo: delete goc2c The last .goc file has been removed, so remove goc2c. The goc2c program was my first contribution to the gc repository that was more than 100 lines: https://github.com/golang/go/commit/2b57a1124e87b0dc8bc1ff6899297b4d7d6e74f2 The program was used in gc for a few years under various guises but was finally removed in https://golang.org/cl/132680043. Now we can remove it from gofrontend as well. Reviewed-on: https://go-review.googlesource.com/42911 commit a222e35d041de0cd42506b61c93b8209e07702b9 Author: Than McIntosh <thanm@google.com> Date: Tue May 9 10:33:10 2017 -0400 compiler: set "need_init_fn" when adding gc root Variables that back slice initializers in certain cases have to be added to the gc roots list, since they can be modified at runtime. The code that was doing this addition did not update the flag that tracks whether the package being compiled needs an initializer function, which resulted in the call in question being left out of the final generated code in certain cases. Fix is to change Gogo::add_gc_root() to update the "needs init" flag. Reviewed-on: https://go-review.googlesource.com/43030 commit 822ab419bf7d1c705cdce1c12133e7a11f56be2e Author: Than McIntosh <thanm@google.com> Date: Tue May 9 11:36:51 2017 -0400 compiler: fix variable context nit in write barrier generation Update the write barrier generation code to insure that the "lvalue context" tag on the space var expression is set only in the case where the expr feeds directly into an assignment. This is somewhat counter-intuitive, but needed in the case where the backend looks at context tags. Reviewed-on: https://go-review.googlesource.com/43031 From-SVN: r247848
2017-05-10 19:26:09 +02:00
find . -name '*.gox' -print | xargs rm -f
find . -name '*.s-gox' -print | xargs rm -f
distclean-local:
find . -name '*.lo.dep' -print | xargs rm -f