I have committed a patch to libgo to update it to the Go 1.5 release. As usual for libgo updates, the actual patch is too large to attach to this e-mail message. I've attached the changes to the gccgo-specific files.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. This may cause trouble on non-GNU/Linux operating systems. Please let me know about any problems you encounter. Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 229612) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -16f69a4007a1903da4055a496882b514e05f45f3 +4b6b496579225cdd897130f6d6fd18ecb100bf99 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/MERGE =================================================================== --- libgo/MERGE (revision 228306) +++ libgo/MERGE (working copy) @@ -1,4 +1,4 @@ -883bc6ed0ea815293fe6309d66f967ea60630e87 +bb03defe933c89fee44be675d7aa0fbd893ced30 The first line of this file holds the git revision number of the last merge done from the master library sources. Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (revision 228306) +++ libgo/Makefile.am (working copy) @@ -233,12 +233,15 @@ toolexeclibgogodir = $(toolexeclibgodir) 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/token.gox \ + go/types.gox toolexeclibgohashdir = $(toolexeclibgodir)/hash @@ -292,7 +295,8 @@ toolexeclibgomath_DATA = \ toolexeclibgomimedir = $(toolexeclibgodir)/mime toolexeclibgomime_DATA = \ - mime/multipart.gox + mime/multipart.gox \ + mime/quotedprintable.gox toolexeclibgonetdir = $(toolexeclibgodir)/net @@ -676,46 +680,74 @@ go_math_files = \ go/math/tanh.go \ go/math/unsafe.go +if LIBGO_IS_OPENBSD +go_mime_type_file = go/mime/type_openbsd.go +else +if LIBGO_IS_FREEBSD +go_mime_type_file = go/mime/type_freebsd.go +else +if LIBGO_IS_DRAGONFLY +go_mime_type_file = go/mime/type_dragonfly.go +else +go_mime_type_file = +endif +endif +endif + go_mime_files = \ + go/mime/encodedword.go \ go/mime/grammar.go \ go/mime/mediatype.go \ go/mime/type.go \ - go/mime/type_unix.go + go/mime/type_unix.go \ + $(go_mime_type_file) if LIBGO_IS_LINUX go_net_cgo_file = go/net/cgo_linux.go go_net_sock_file = go/net/sock_linux.go go_net_sockopt_file = go/net/sockopt_linux.go go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go +go_net_cgo_sock_file = go/net/cgo_socknew.go +go_net_cgo_res_file = go/net/cgo_resnew.go else if LIBGO_IS_IRIX go_net_cgo_file = go/net/cgo_linux.go go_net_sock_file = go/net/sock_linux.go go_net_sockopt_file = go/net/sockopt_linux.go go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go +go_net_cgo_sock_file = go/net/cgo_socknew.go +go_net_cgo_res_file = go/net/cgo_resnew.go else if LIBGO_IS_SOLARIS -go_net_cgo_file = go/net/cgo_linux.go +go_net_cgo_file = go/net/cgo_solaris.go go_net_sock_file = go/net/sock_stub.go go_net_sockopt_file = go/net/sockopt_solaris.go go_net_sockoptip_file = go/net/sockoptip_stub.go +go_net_cgo_sock_file = go/net/cgo_socknew.go +go_net_cgo_res_file = go/net/cgo_resnew.go else if LIBGO_IS_FREEBSD go_net_cgo_file = go/net/cgo_bsd.go go_net_sock_file = go/net/sock_bsd.go go_net_sockopt_file = go/net/sockopt_bsd.go go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go +go_net_cgo_sock_file = go/net/cgo_sockold.go +go_net_cgo_res_file = go/net/cgo_resold.go else if LIBGO_IS_NETBSD go_net_cgo_file = go/net/cgo_netbsd.go go_net_sock_file = go/net/sock_bsd.go go_net_sockopt_file = go/net/sockopt_bsd.go go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go +go_net_cgo_sock_file = go/net/cgo_sockold.go +go_net_cgo_res_file = go/net/cgo_resnew.go else go_net_cgo_file = go/net/cgo_bsd.go go_net_sock_file = go/net/sock_bsd.go go_net_sockopt_file = go/net/sockopt_bsd.go go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go +go_net_cgo_sock_file = go/net/cgo_sockold.go +go_net_cgo_res_file = go/net/cgo_resold.go endif endif endif @@ -731,10 +763,14 @@ else if LIBGO_IS_DRAGONFLY go_net_sendfile_file = go/net/sendfile_dragonfly.go else +if LIBGO_IS_SOLARIS +go_net_sendfile_file = go/net/sendfile_solaris.go +else go_net_sendfile_file = go/net/sendfile_stub.go endif endif endif +endif if LIBGO_IS_LINUX go_net_interface_file = go/net/interface_linux.go @@ -775,15 +811,22 @@ endif endif go_net_common_files = \ + go/net/addrselect.go \ $(go_net_cloexec_file) \ + go/net/conf.go \ go/net/dial.go \ go/net/dnsclient.go \ go/net/dnsclient_unix.go \ go/net/dnsconfig_unix.go \ go/net/dnsmsg.go \ go/net/fd_mutex.go \ + go/net/fd_posix.go \ go/net/fd_unix.go \ + go/net/file.go \ go/net/file_unix.go \ + go/net/hook.go \ + go/net/hook_cloexec.go \ + go/net/hook_unix.go \ go/net/hosts.go \ go/net/interface.go \ $(go_net_interface_file) \ @@ -796,6 +839,7 @@ go_net_common_files = \ go/net/lookup_unix.go \ go/net/mac.go \ go/net/net.go \ + go/net/nss.go \ go/net/parse.go \ go/net/pipe.go \ go/net/fd_poll_runtime.go \ @@ -803,7 +847,6 @@ go_net_common_files = \ go/net/port_unix.go \ go/net/race0.go \ $(go_net_sendfile_file) \ - go/net/singleflight.go \ go/net/sock_posix.go \ $(go_net_sock_file) \ go/net/sockopt_posix.go \ @@ -821,6 +864,8 @@ go_net_common_files = \ go_net_files = \ go/net/cgo_unix.go \ $(go_net_cgo_file) \ + $(go_net_cgo_res_file) \ + $(go_net_cgo_sock_file) \ $(go_net_common_files) go_netgo_files = \ @@ -919,6 +964,32 @@ else go_os_pipe_file = go/os/pipe_bsd.go endif +if LIBGO_IS_DARWIN +go_os_sticky_file = go/os/sticky_bsd.go +else +if LIBGO_IS_DRAGONFLY +go_os_sticky_file = go/os/sticky_bsd.go +else +if LIBGO_IS_FREEBSD +go_os_sticky_file = go/os/sticky_bsd.go +else +if LIBGO_IS_NETBSD +go_os_sticky_file = go/os/sticky_bsd.go +else +if LIBGO_IS_OPENBSD +go_os_sticky_file = go/os/sticky_bsd.go +else +if LIBGO_IS_SOLARIS +go_os_sticky_file = go/os/sticky_bsd.go +else +go_os_sticky_file = go/os/sticky_notbsd.go +endif +endif +endif +endif +endif +endif + go_os_files = \ $(go_os_dir_file) \ go/os/dir.go \ @@ -939,6 +1010,7 @@ go_os_files = \ $(go_os_pipe_file) \ go/os/proc.go \ $(go_os_stat_file) \ + $(go_os_sticky_file) \ go/os/str.go \ $(go_os_sys_file) \ $(go_os_cloexec_file) \ @@ -959,6 +1031,7 @@ go_reflect_makefunc_c_file = \ go/reflect/makefunc_ffi_c.c go_regexp_files = \ + go/regexp/backtrack.go \ go/regexp/exec.go \ go/regexp/onepass.go \ go/regexp/regexp.go @@ -974,7 +1047,6 @@ go_runtime_files = \ go/runtime/error.go \ go/runtime/extern.go \ go/runtime/mem.go \ - go/runtime/softfloat64.go \ version.go version.go: s-version; @true @@ -1012,6 +1084,7 @@ go_strconv_files = \ go/strconv/atof.go \ go/strconv/atoi.go \ go/strconv/decimal.go \ + go/strconv/doc.go \ go/strconv/extfloat.go \ go/strconv/ftoa.go \ go/strconv/isprint.go \ @@ -1019,6 +1092,7 @@ go_strconv_files = \ go/strconv/quote.go go_strings_files = \ + go/strings/compare.go \ go/strings/reader.go \ go/strings/replace.go \ go/strings/search.go \ @@ -1048,6 +1122,7 @@ endif endif go_log_syslog_files = \ + go/log/syslog/doc.go \ go/log/syslog/syslog.go \ $(go_syslog_file) go_syslog_c_files = \ @@ -1186,6 +1261,7 @@ crypto_rand_file = endif go_crypto_rand_files = \ + go/crypto/rand/eagain.go \ go/crypto/rand/rand.go \ go/crypto/rand/rand_unix.go \ $(crypto_rand_file) \ @@ -1222,6 +1298,37 @@ go_crypto_tls_files = \ go/crypto/tls/prf.go \ go/crypto/tls/ticket.go \ go/crypto/tls/tls.go + +if LIBGO_IS_LINUX +go_crypto_x509_root_file = go/crypto/x509/root_linux.go +else +if LIBGO_IS_SOLARIS +go_crypto_x509_root_file = go/crypto/x509/root_solaris.go +else +if LIBGO_IS_DRAGONFLY +go_crypto_x509_root_file = go/crypto/x509/root_bsd.go +else +if LIBGO_IS_FREEBSD +go_crypto_x509_root_file = go/crypto/x509/root_bsd.go +else +if LIBGO_IS_NETBSD +go_crypto_x509_root_file = go/crypto/x509/root_bsd.go +else +if LIBGO_IS_OPENBSD +go_crypto_x509_root_file = go/crypto/x509/root_bsd.go +else +if LIBGO_IS_DARWIN +go_crypto_x509_root_file = go/crypto/x509/root_darwin.go +else +go_crypto_x509_root_file = +endif +endif +endif +endif +endif +endif +endif + go_crypto_x509_files = \ go/crypto/x509/cert_pool.go \ go/crypto/x509/pem_decrypt.go \ @@ -1229,6 +1336,7 @@ go_crypto_x509_files = \ go/crypto/x509/pkcs8.go \ go/crypto/x509/root.go \ go/crypto/x509/root_unix.go \ + $(go_crypto_x509_root_file) \ go/crypto/x509/sec1.go \ go/crypto/x509/verify.go \ go/crypto/x509/x509.go @@ -1246,6 +1354,7 @@ go_database_sql_driver_files = \ go_debug_dwarf_files = \ go/debug/dwarf/buf.go \ + go/debug/dwarf/class_string.go \ go/debug/dwarf/const.go \ go/debug/dwarf/entry.go \ go/debug/dwarf/line.go \ @@ -1337,6 +1446,9 @@ go_go_build_files = \ go/go/build/doc.go \ go/go/build/read.go \ go/go/build/syslist.go +go_go_constant_files = \ + go/go/constant/go14.go \ + go/go/constant/value.go go_go_doc_files = \ go/go/doc/comment.go \ go/go/doc/doc.go \ @@ -1347,6 +1459,8 @@ go_go_doc_files = \ go/go/doc/synopsis.go go_go_format_files = \ go/go/format/format.go +go_go_importer_files = \ + go/go/importer/importer.go go_go_parser_files = \ go/go/parser/interface.go \ go/go/parser/parser.go @@ -1360,6 +1474,47 @@ go_go_token_files = \ go/go/token/position.go \ go/go/token/serialize.go \ go/go/token/token.go +go_go_types_files = \ + go/go/types/api.go \ + go/go/types/assignments.go \ + go/go/types/builtins.go \ + go/go/types/call.go \ + go/go/types/check.go \ + go/go/types/conversions.go \ + go/go/types/decl.go \ + go/go/types/errors.go \ + go/go/types/eval.go \ + go/go/types/expr.go \ + go/go/types/exprstring.go \ + go/go/types/go12.go \ + go/go/types/initorder.go \ + go/go/types/labels.go \ + go/go/types/lookup.go \ + go/go/types/methodset.go \ + go/go/types/object.go \ + go/go/types/objset.go \ + go/go/types/operand.go \ + go/go/types/ordering.go \ + go/go/types/package.go \ + go/go/types/predicates.go \ + go/go/types/resolver.go \ + go/go/types/return.go \ + go/go/types/scope.go \ + go/go/types/selection.go \ + go/go/types/stmt.go \ + go/go/types/sizes.go \ + go/go/types/type.go \ + go/go/types/typestring.go \ + go/go/types/typexpr.go \ + go/go/types/universe.go + +go_go_internal_gcimporter_files = \ + go/go/internal/gcimporter/exportdata.go \ + go/go/internal/gcimporter/gcimporter.go +go_go_internal_gccgoimporter_files = \ + go/go/internal/gccgoimporter/gccgoinstallation.go \ + go/go/internal/gccgoimporter/importer.go \ + go/go/internal/gccgoimporter/parser.go go_hash_adler32_files = \ go/hash/adler32/adler32.go @@ -1399,6 +1554,10 @@ go_image_gif_files = \ go/image/gif/reader.go \ go/image/gif/writer.go +go_image_internal_imageutil_files = \ + go/image/internal/imageutil/imageutil.go \ + go/image/internal/imageutil/impl.go + go_image_jpeg_files = \ go/image/jpeg/fdct.go \ go/image/jpeg/huffman.go \ @@ -1416,15 +1575,46 @@ go_index_suffixarray_files = \ go/index/suffixarray/qsufsort.go \ go/index/suffixarray/suffixarray.go +go_internal_format_files = \ + go/internal/format/format.go +go_internal_singleflight_files = \ + go/internal/singleflight/singleflight.go + +if LIBGO_IS_LINUX +internal_syscall_unix_getrandom_file = go/internal/syscall/unix/getrandom_linux.go +else +internal_syscall_unix_getrandom_file = +endif + +go_internal_syscall_unix_files = \ + go/internal/syscall/unix/dummy.go \ + $(internal_syscall_unix_getrandom_file) + +go_internal_testenv_files = \ + go/internal/testenv/testenv.go +go_internal_trace_files = \ + go/internal/trace/goroutines.go \ + go/internal/trace/parser.go + go_io_ioutil_files = \ go/io/ioutil/ioutil.go \ go/io/ioutil/tempfile.go go_math_big_files = \ + go/math/big/accuracy_string.go \ go/math/big/arith.go \ + go/math/big/arith_decl_pure.go \ + go/math/big/decimal.go \ + go/math/big/float.go \ + go/math/big/floatconv.go \ + go/math/big/ftoa.go \ go/math/big/int.go \ + go/math/big/intconv.go \ go/math/big/nat.go \ - go/math/big/rat.go + go/math/big/natconv.go \ + go/math/big/rat.go \ + go/math/big/ratconv.go \ + go/math/big/roundingmode_string.go go_math_cmplx_files = \ go/math/cmplx/abs.go \ go/math/cmplx/asin.go \ @@ -1450,9 +1640,12 @@ go_math_rand_files = \ go_mime_multipart_files = \ go/mime/multipart/formdata.go \ go/mime/multipart/multipart.go \ - go/mime/multipart/quotedprintable.go \ go/mime/multipart/writer.go +go_mime_quotedprintable_files = \ + go/mime/quotedprintable/reader.go \ + go/mime/quotedprintable/writer.go + go_net_http_files = \ go/net/http/client.go \ go/net/http/cookie.go \ @@ -1504,6 +1697,23 @@ go_net_http_httputil_files = \ go_net_http_internal_files = \ go/net/http/internal/chunked.go +if LIBGO_IS_LINUX +go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go +else +if LIBGO_IS_FREEBSD +go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go +else +go_net_internal_socktest_sys = +endif +endif + +go_net_internal_socktest_files = \ + go/net/internal/socktest/switch.go \ + go/net/internal/socktest/switch_posix.go \ + go/net/internal/socktest/switch_unix.go \ + go/net/internal/socktest/sys_unix.go \ + $(go_net_internal_socktest_sys) + go_old_regexp_files = \ go/old/regexp/regexp.go go_old_template_files = \ @@ -1514,6 +1724,7 @@ go_old_template_files = \ go_os_exec_files = \ go/os/exec/exec.go \ + go/os/exec/exec_posix.go \ go/os/exec/lp_unix.go go_os_signal_files = \ @@ -1565,6 +1776,7 @@ go_text_template_files = \ go/text/template/exec.go \ go/text/template/funcs.go \ go/text/template/helper.go \ + go/text/template/option.go \ go/text/template/template.go go_text_template_parse_files = \ go/text/template/parse/lex.go \ @@ -1767,6 +1979,12 @@ else syscall_creds_test_file = endif +if LIBGO_IS_LINUX +syscall_exec_test_file = go/syscall/exec_linux_test.go go/syscall/syscall_linux_test.go +else +syscall_exec_test_file = +endif + go_base_syscall_files = \ go/syscall/env_unix.go \ go/syscall/syscall_errno.go \ @@ -1810,21 +2028,14 @@ go_syscall_c_files = \ go_syscall_test_files = \ $(syscall_creds_test_file) \ + $(syscall_exec_test_file) \ + go/syscall/exec_unix_test.go \ go/syscall/export_test.go \ + go/syscall/export_unix_test.go \ go/syscall/mmap_unix_test.go \ go/syscall/syscall_test.go \ go/syscall/syscall_unix_test.go -if LIBGO_IS_LINUX -internal_syscall_getrandom_file = go/internal/syscall/getrandom_linux.go -else -internal_syscall_getrandom_file = -endif - -go_internal_syscall_files = \ - go/internal/syscall/dummy.go \ - $(internal_syscall_getrandom_file) - libcalls.go: s-libcalls; @true s-libcalls: libcalls-list go/syscall/mksyscall.awk $(go_base_syscall_files) rm -f libcalls.go.tmp @@ -1978,12 +2189,17 @@ libgo_go_objs = \ html/template.lo \ go/ast.lo \ go/build.lo \ + go/constant.lo \ go/doc.lo \ go/format.lo \ + go/importer.lo \ + go/internal/gcimporter.lo \ + go/internal/gccgoimporter.lo \ go/parser.lo \ go/printer.lo \ go/scanner.lo \ go/token.lo \ + go/types.lo \ hash/adler32.lo \ hash/crc32.lo \ hash/crc64.lo \ @@ -1999,10 +2215,15 @@ libgo_go_objs = \ image/color/palette.lo \ image/draw.lo \ image/gif.lo \ + image/internal/imageutil.lo \ image/jpeg.lo \ image/png.lo \ index/suffixarray.lo \ - internal/syscall.lo \ + internal/format.lo \ + internal/singleflight.lo \ + internal/syscall/unix.lo \ + internal/testenv.lo \ + internal/trace.lo \ io/ioutil.lo \ log/syslog.lo \ log/syslog/syslog_c.lo \ @@ -2010,7 +2231,9 @@ libgo_go_objs = \ math/cmplx.lo \ math/rand.lo \ mime/multipart.lo \ + mime/quotedprintable.lo \ net/http.lo \ + net/internal/socktest.lo \ net/mail.lo \ net/rpc.lo \ net/smtp.lo \ @@ -2121,11 +2344,11 @@ CHECK = \ $(MKDIR_P) $(@D); \ rm -f $@-testsum $@-testlog; \ if test "$(USE_DEJAGNU)" = "yes"; then \ - $(SHELL) $(srcdir)/testsuite/gotest --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ + $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ elif test "$(GOBENCH)" != ""; then \ - $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ + $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ else \ - if $(SHELL) $(srcdir)/testsuite/gotest --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \ + if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --goarch="$(GOARCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \ echo "PASS: $(@D)" >> $@-testlog; \ echo "PASS: $(@D)"; \ echo "PASS: $(@D)" > $@-testsum; \ @@ -2910,6 +3133,15 @@ go/build/check: $(CHECK_DEPS) @$(CHECK) .PHONY: go/build/check +@go_include@ go/constant.lo.dep +go/constant.lo.dep: $(go_go_constant_files) + $(BUILDDEPS) +go/constant.lo: $(go_go_constant_files) + $(BUILDPACKAGE) +go/constant/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: go/constant/check + @go_include@ go/doc.lo.dep go/doc.lo.dep: $(go_go_doc_files) $(BUILDDEPS) @@ -2928,6 +3160,15 @@ go/format/check: $(CHECK_DEPS) @$(CHECK) .PHONY: go/format/check +@go_include@ go/importer.lo.dep +go/importer.lo.dep: $(go_go_importer_files) + $(BUILDDEPS) +go/importer.lo: $(go_go_importer_files) + $(BUILDPACKAGE) +go/importer/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: go/importer/check + @go_include@ go/parser.lo.dep go/parser.lo.dep: $(go_go_parser_files) $(BUILDDEPS) @@ -2964,6 +3205,33 @@ go/token/check: $(CHECK_DEPS) @$(CHECK) .PHONY: go/token/check +@go_include@ go/types.lo.dep +go/types.lo.dep: $(go_go_types_files) + $(BUILDDEPS) +go/types.lo: $(go_go_types_files) + $(BUILDPACKAGE) +go/types/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: go/types/check + +@go_include@ go/internal/gcimporter.lo.dep +go/internal/gcimporter.lo.dep: $(go_go_internal_gcimporter_files) + $(BUILDDEPS) +go/internal/gcimporter.lo: $(go_go_internal_gcimporter_files) + $(BUILDPACKAGE) +go/internal/gcimporter/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: go/internal/gcimporter/check + +@go_include@ go/internal/gccgoimporter.lo.dep +go/internal/gccgoimporter.lo.dep: $(go_go_internal_gccgoimporter_files) + $(BUILDDEPS) +go/internal/gccgoimporter.lo: $(go_go_internal_gccgoimporter_files) + $(BUILDPACKAGE) +go/internal/gccgoimporter/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: go/internal/gccgoimporter/check + @go_include@ hash/adler32.lo.dep hash/adler32.lo.dep: $(go_hash_adler32_files) $(BUILDDEPS) @@ -3036,6 +3304,15 @@ image/gif/check: $(CHECK_DEPS) @$(CHECK) .PHONY: image/gif/check +@go_include@ image/internal/imageutil.lo.dep +image/internal/imageutil.lo.dep: $(go_image_internal_imageutil_files) + $(BUILDDEPS) +image/internal/imageutil.lo: $(go_image_internal_imageutil_files) + $(BUILDPACKAGE) +image/internal/imageutil/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: image/internal/imageutil/check + @go_include@ image/jpeg.lo.dep image/jpeg.lo.dep: $(go_image_jpeg_files) $(BUILDDEPS) @@ -3063,6 +3340,51 @@ index/suffixarray/check: $(CHECK_DEPS) @$(CHECK) .PHONY: index/suffixarray/check +@go_include@ internal/format.lo.dep +internal/format.lo.dep: $(go_internal_format_files) + $(BUILDDEPS) +internal/format.lo: $(go_internal_format_files) + $(BUILDPACKAGE) +internal/format/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: internal/format/check + +@go_include@ internal/singleflight.lo.dep +internal/singleflight.lo.dep: $(go_internal_singleflight_files) + $(BUILDDEPS) +internal/singleflight.lo: $(go_internal_singleflight_files) + $(BUILDPACKAGE) +internal/singleflight/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: internal/singleflight/check + +@go_include@ internal/syscall/unix.lo.dep +internal/syscall/unix.lo.dep: $(go_internal_syscall_unix_files) + $(BUILDDEPS) +internal/syscall/unix.lo: $(go_internal_syscall_unix_files) + $(BUILDPACKAGE) +internal/syscall/unix/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: internal/syscall/unix/check + +@go_include@ internal/testenv.lo.dep +internal/testenv.lo.dep: $(go_internal_testenv_files) + $(BUILDDEPS) +internal/testenv.lo: $(go_internal_testenv_files) + $(BUILDPACKAGE) +internal/testenv/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: internal/testenv/check + +@go_include@ internal/trace.lo.dep +internal/trace.lo.dep: $(go_internal_trace_files) + $(BUILDDEPS) +internal/trace.lo: $(go_internal_trace_files) + $(BUILDPACKAGE) +internal/trace/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: internal/trace/check + @go_include@ io/ioutil.lo.dep io/ioutil.lo.dep: $(go_io_ioutil_files) $(BUILDDEPS) @@ -3120,6 +3442,15 @@ mime/multipart/check: $(CHECK_DEPS) @$(CHECK) .PHONY: mime/multipart/check +@go_include@ mime/quotedprintable.lo.dep +mime/quotedprintable.lo.dep: $(go_mime_quotedprintable_files) + $(BUILDDEPS) +mime/quotedprintable.lo: $(go_mime_quotedprintable_files) + $(BUILDPACKAGE) +mime/quotedprintable/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: mime/quotedprintable/check + @go_include@ net/http.lo.dep net/http.lo.dep: $(go_net_http_files) $(BUILDDEPS) @@ -3237,6 +3568,15 @@ net/http/pprof/check: $(CHECK_DEPS) @$(CHECK) .PHONY: net/http/pprof/check +@go_include@ net/internal/socktest.lo.dep +net/internal/socktest.lo.dep: $(go_net_internal_socktest_files) + $(BUILDDEPS) +net/internal/socktest.lo: $(go_net_internal_socktest_files) + $(BUILDPACKAGE) +net/internal/socktest/check: $(CHECK_DEPS) + @$(CHECK) +.PHONY: net/internal/socktest/check + @go_include@ net/rpc/jsonrpc.lo.dep net/rpc/jsonrpc.lo.dep: $(go_net_rpc_jsonrpc_files) $(BUILDDEPS) @@ -3432,15 +3772,6 @@ syscall/check: $(CHECK_DEPS) @$(CHECK) .PHONY: syscall/check -@go_include@ internal/syscall.lo.dep -internal/syscall.lo.dep: $(go_internal_syscall_files) - $(BUILDDEPS) -internal/syscall.lo: $(go_internal_syscall_files) - $(BUILDPACKAGE) -internal/syscall/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/syscall/check - # How to build a .gox file from a .lo file. BUILDGOX = \ f=`echo $< | sed -e 's/.lo$$/.o/'`; \ @@ -3620,10 +3951,14 @@ go/ast.gox: go/ast.lo $(BUILDGOX) go/build.gox: go/build.lo $(BUILDGOX) +go/constant.gox: go/constant.lo + $(BUILDGOX) go/doc.gox: go/doc.lo $(BUILDGOX) go/format.gox: go/format.lo $(BUILDGOX) +go/importer.gox: go/importer.lo + $(BUILDGOX) go/parser.gox: go/parser.lo $(BUILDGOX) go/printer.gox: go/printer.lo @@ -3632,6 +3967,13 @@ go/scanner.gox: go/scanner.lo $(BUILDGOX) go/token.gox: go/token.lo $(BUILDGOX) +go/types.gox: go/types.lo + $(BUILDGOX) + +go/internal/gcimporter.gox: go/internal/gcimporter.lo + $(BUILDGOX) +go/internal/gccgoimporter.gox: go/internal/gccgoimporter.lo + $(BUILDGOX) hash/adler32.gox: hash/adler32.lo $(BUILDGOX) @@ -3648,6 +3990,8 @@ image/draw.gox: image/draw.lo $(BUILDGOX) image/gif.gox: image/gif.lo $(BUILDGOX) +image/internal/imageutil.gox: image/internal/imageutil.lo + $(BUILDGOX) image/jpeg.gox: image/jpeg.lo $(BUILDGOX) image/png.gox: image/png.lo @@ -3659,6 +4003,17 @@ image/color/palette.gox: image/color/pal index/suffixarray.gox: index/suffixarray.lo $(BUILDGOX) +internal/format.gox: internal/format.lo + $(BUILDGOX) +internal/singleflight.gox: internal/singleflight.lo + $(BUILDGOX) +internal/syscall/unix.gox: internal/syscall/unix.lo + $(BUILDGOX) +internal/testenv.gox: internal/testenv.lo + $(BUILDGOX) +internal/trace.gox: internal/trace.lo + $(BUILDGOX) + io/ioutil.gox: io/ioutil.lo $(BUILDGOX) @@ -3674,6 +4029,8 @@ math/rand.gox: math/rand.lo mime/multipart.gox: mime/multipart.lo $(BUILDGOX) +mime/quotedprintable.gox: mime/quotedprintable.lo + $(BUILDGOX) net/http.gox: net/http.lo $(BUILDGOX) @@ -3704,6 +4061,9 @@ net/http/pprof.gox: net/http/pprof.lo net/http/internal.gox: net/http/internal.lo $(BUILDGOX) +net/internal/socktest.gox: net/internal/socktest.lo + $(BUILDGOX) + net/rpc/jsonrpc.gox: net/rpc/jsonrpc.lo $(BUILDGOX) @@ -3733,9 +4093,6 @@ runtime/pprof.gox: runtime/pprof.lo sync/atomic.gox: sync/atomic.lo $(BUILDGOX) -internal/syscall.gox: internal/syscall.lo - $(BUILDGOX) - text/scanner.gox: text/scanner.lo $(BUILDGOX) text/tabwriter.gox: text/tabwriter.lo @@ -3830,13 +4187,17 @@ TEST_PACKAGES = \ exp/terminal/check \ html/template/check \ go/ast/check \ - $(go_build_check_omitted_since_it_calls_6g) \ + 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 \ hash/adler32/check \ hash/crc32/check \ hash/crc64/check \ @@ -3846,12 +4207,15 @@ TEST_PACKAGES = \ image/jpeg/check \ image/png/check \ index/suffixarray/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 \ @@ -3859,6 +4223,7 @@ TEST_PACKAGES = \ net/http/httptest/check \ net/http/httputil/check \ net/http/internal/check \ + net/internal/socktest/check \ net/mail/check \ net/rpc/check \ net/smtp/check \ Index: libgo/VERSION =================================================================== --- libgo/VERSION (revision 228306) +++ libgo/VERSION (working copy) @@ -1 +1 @@ -go1.4.2 \ No newline at end of file +go1.5 \ No newline at end of file Index: libgo/merge.sh =================================================================== --- libgo/merge.sh (revision 228306) +++ libgo/merge.sh (working copy) @@ -8,7 +8,7 @@ # into the libgo library. This does the easy stuff; the hard stuff is # left to the user. -# The file MERGE should hold the Mercurial revision number of the last +# The file MERGE should hold the Git revision number of the last # revision which was merged into these sources. Given that, and given # the current sources, we can run the usual diff3 algorithm to merge # all changes into our sources. @@ -30,7 +30,7 @@ case $# in 1) ;; 2) rev=$2 ;; *) - echo 1>&2 "merge.sh: Usage: merge.sh mercurial-repository [revision]" + echo 1>&2 "merge.sh: Usage: merge.sh git-repository [revision]" exit 1 ;; esac @@ -66,7 +66,7 @@ merge() { else echo "merge.sh: ${name}: REMOVED" rm -f ${libgo} - hg rm ${libgo} + git rm ${libgo} fi elif test -f ${old}; then # The file exists in the old version. @@ -97,7 +97,6 @@ merge() { 1) echo "merge.sh: $name: CONFLICTS" mv ${libgo}.tmp ${libgo} - hg resolve -u ${libgo} ;; *) echo 1>&2 "merge.sh: $name: diff3 failure" @@ -118,7 +117,7 @@ merge() { mkdir -p ${dir} fi cp ${new} ${libgo} - hg add ${libgo} + git add ${libgo} fi fi } @@ -174,35 +173,6 @@ done done done -cmdlist="cgo go gofmt" -for c in $cmdlist; do - (cd ${NEWDIR}/src/cmd/$c && find . -name '*.go' -print) | while read f; do - oldfile=${OLDDIR}/src/cmd/$c/$f - newfile=${NEWDIR}/src/cmd/$c/$f - libgofile=go/cmd/$c/$f - merge $f ${oldfile} ${newfile} ${libgofile} - done - - (cd ${NEWDIR}/src/cmd/$c && find . -name testdata -print) | while read d; do - oldtd=${OLDDIR}/src/cmd/$c/$d - newtd=${NEWDIR}/src/cmd/$c/$d - libgotd=go/cmd/$c/$d - if ! test -d ${oldtd}; then - continue - fi - (cd ${oldtd} && git ls-files .) | while read f; do - if test "`basename $f`" = ".gitignore"; then - continue - fi - name=$d/$f - oldfile=${oldtd}/$f - newfile=${newtd}/$f - libgofile=${libgotd}/$f - merge ${name} ${oldfile} ${newfile} ${libgofile} - done - done -done - runtime="chan.goc chan.h cpuprof.goc env_posix.c heapdump.c lock_futex.c lfstack.goc lock_sema.c mcache.c mcentral.c mfixalloc.c mgc0.c mgc0.h mheap.c msize.c netpoll.goc netpoll_epoll.c netpoll_kqueue.c netpoll_stub.c panic.c print.c proc.c race.h rdebug.goc runtime.c runtime.h signal_unix.c signal_unix.h malloc.h malloc.goc mprof.goc parfor.c runtime1.goc sema.goc sigqueue.goc string.goc time.goc" for f in $runtime; do # merge_c $f $f @@ -224,7 +194,7 @@ done fi echo "merge.sh: ${libgofile}: REMOVED" rm -f ${libgofile} - hg rm ${libgofile} + git rm ${libgofile} done (echo ${new_rev}; sed -ne '2,$p' MERGE) > MERGE.tmp Index: libgo/mksysinfo.sh =================================================================== --- libgo/mksysinfo.sh (revision 228306) +++ libgo/mksysinfo.sh (working copy) @@ -875,11 +875,13 @@ grep '^type _addrinfo ' gen-sysinfo.go | -e 's/ ai_/ Ai_/g' \ >> ${OUT} -# The addrinfo flags and errors. +# The addrinfo and nameinfo flags and errors. grep '^const _AI_' gen-sysinfo.go | \ sed -e 's/^\(const \)_\(AI_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} grep '^const _EAI_' gen-sysinfo.go | \ sed -e 's/^\(const \)_\(EAI_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} +grep '^const _NI_' gen-sysinfo.go | \ + sed -e 's/^\(const \)_\(NI_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} # The passwd struct. grep '^type _passwd ' gen-sysinfo.go | \ Index: libgo/testsuite/gotest =================================================================== --- libgo/testsuite/gotest (revision 228306) +++ libgo/testsuite/gotest (working copy) @@ -26,7 +26,9 @@ NM=${NM:-nm} # gofiles are the test files. pkgfiles are the source files. srcdir=. basedir=. +goarch="" gofiles="" +goos="" pkgfiles="" loop=true keep=false @@ -58,6 +60,24 @@ while $loop; do basedir=`echo $1 | sed -e 's/^--basedir=//'` shift ;; + x--goarch) + goarch=$2 + shift + shift + ;; + x--goarch=*) + goarch=`echo $1 | sed -e 's/^--goarch=//'` + shift + ;; + x--goos) + goos=$2 + shift + shift + ;; + x--goos=*) + goos=`echo $1 | sed -e 's/^--goos=//'` + shift + ;; x--pkgpath) pkgpath=$2 shift @@ -268,7 +288,96 @@ mkdir _test case "x$gofiles" in x) - gofiles=`ls *_test.go 2>/dev/null` + for f in `ls *_test.go`; do + tag1=`echo $f | sed -e 's/^.*_\([^_]*\)_test.go$/\1/'` + tag2=`echo $f | sed -e 's/^.*_\([^_]*\)_[^_]*_test.go$/\1/'` + if test x$tag1 = x$f; then + tag1= + fi + if test x$tag2 = x$f; then + tag2= + fi + + case "$tag1" in + "") ;; + $goarch) ;; + $goos) ;; + android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) + tag1=nonmatchingtag + ;; + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64) + tag1=nonmatchingtag + ;; + esac + + case "$tag2" in + "") ;; + $goarch) ;; + $goos) ;; + android | darwin | dragonfly | freebsd | linux | nacl | netbsd | openbsd | plan9 | solaris | windows) + tag2=nonmatchingtag + ;; + 386 | amd64 | amd64p32 | arm | armbe | arm64 | arm64be | alpha | m68k | ppc64 | ppc64le | mips | mipsle | mips64 | mips64le | mips64p32 | mips64p32le | mipso32 | mipsn32 | mipsn64 | mipso64 | ppc | s390 | s390x | sparc | sparc64) + tag2=nonmatchingtag + ;; + esac + + if test x$tag1 != xnonmatchingtag -a x$tag2 != xnonmatchingtag; then + taglines=`sed '/^package /q' < $f | fgrep '// +build '` + if test "$taglines" = ""; then + omatch=true + else + omatch=false + fi + for tags in $taglines; do + match=false + for tag in $tags; do + reverse=false + case $tag in + "!"*) + reverse=true + tag=`echo $tag | sed -e 's/^!//'` + ;; + esac + + case $tag in + "//" | "+build") + ;; + $goos | $goarch | cgo) + match=true + ;; + *,*) + match=true + for ctag in `echo $tag | sed -e 's/,/ /g'`; do + case $ctag in + $goos | $goarch | cgo) + ;; + *) + match=false + ;; + esac + done + ;; + esac + + if test "$reverse" = true; then + if test "$match" = true; then + match=false + else + match=true + fi + fi + done + if test "$match" = "true"; then + omatch=true + fi + done + + if test "$omatch" = "true"; then + gofiles="$gofiles $f" + fi + fi + done ;; *) xgofiles=$gofiles Index: libgo/runtime/env_posix.c =================================================================== --- libgo/runtime/env_posix.c (revision 228306) +++ libgo/runtime/env_posix.c (working copy) @@ -11,7 +11,7 @@ extern Slice envs; -const byte* +String runtime_getenv(const char *s) { int32 i, j; @@ -19,6 +19,7 @@ runtime_getenv(const char *s) const byte *v, *bs; String* envv; int32 envc; + String ret; bs = (const byte*)s; len = runtime_findnull(bs); @@ -33,8 +34,12 @@ runtime_getenv(const char *s) goto nomatch; if(v[len] != '=') goto nomatch; - return v+len+1; + ret.str = v+len+1; + ret.len = envv[i].len-len-1; + return ret; nomatch:; } - return nil; + ret.str = nil; + ret.len = 0; + return ret; } Index: libgo/runtime/go-varargs.c =================================================================== --- libgo/runtime/go-varargs.c (revision 228576) +++ libgo/runtime/go-varargs.c (working copy) @@ -10,6 +10,7 @@ #include <stdint.h> #include <sys/types.h> #include <fcntl.h> +#include <sys/ioctl.h> /* The syscall package calls C functions. The Go compiler can not represent a C varargs functions. On some systems it's important @@ -56,6 +57,18 @@ __go_fcntl_uintptr (uintptr_t fd, uintpt return ret; } +int +__go_ioctl (int d, int request, int arg) +{ + return ioctl (d, request, arg); +} + +int +__go_ioctl_ptr (int d, int request, void *arg) +{ + return ioctl (d, request, arg); +} + #ifdef HAVE_OPEN64 int Index: libgo/runtime/malloc.h =================================================================== --- libgo/runtime/malloc.h (revision 228306) +++ libgo/runtime/malloc.h (working copy) @@ -263,7 +263,9 @@ struct MStats uint64 last_gc; // last GC (in absolute time) uint64 pause_total_ns; uint64 pause_ns[256]; + uint64 pause_end[256]; uint32 numgc; + float64 gc_cpu_fraction; bool enablegc; bool debuggc; Index: libgo/runtime/mgc0.c =================================================================== --- libgo/runtime/mgc0.c (revision 228306) +++ libgo/runtime/mgc0.c (working copy) @@ -1368,6 +1368,8 @@ markroot(ParFor *desc, uint32 i) scanblock(wbuf, false); } +static const FuncVal markroot_funcval = { (void *) markroot }; + // Get an empty work buffer off the work.empty list, // allocating new buffers as needed. static Workbuf* @@ -2102,14 +2104,16 @@ static void mgc(G *gp); static int32 readgogc(void) { + String s; const byte *p; - p = runtime_getenv("GOGC"); - if(p == nil || p[0] == '\0') + s = runtime_getenv("GOGC"); + if(s.len == 0) return 100; - if(runtime_strcmp((const char *)p, "off") == 0) + p = s.str; + if(s.len == 3 && runtime_strcmp((const char *)p, "off") == 0) return -1; - return runtime_atoi(p); + return runtime_atoi(p, s.len); } // force = 1 - do GC regardless of current heap usage @@ -2252,7 +2256,7 @@ gc(struct gc_args *args) work.nwait = 0; work.ndone = 0; work.nproc = runtime_gcprocs(); - runtime_parforsetup(work.markfor, work.nproc, RootCount + runtime_allglen, nil, false, markroot); + runtime_parforsetup(work.markfor, work.nproc, RootCount + runtime_allglen, false, &markroot_funcval); if(work.nproc > 1) { runtime_noteclear(&work.alldone); runtime_helpgc(work.nproc); @@ -2285,6 +2289,7 @@ gc(struct gc_args *args) t4 = runtime_nanotime(); mstats.last_gc = runtime_unixnanotime(); // must be Unix time to make sense to user mstats.pause_ns[mstats.numgc%nelem(mstats.pause_ns)] = t4 - t0; + mstats.pause_end[mstats.numgc%nelem(mstats.pause_end)] = mstats.last_gc; mstats.pause_total_ns += t4 - t0; mstats.numgc++; if(mstats.debuggc) @@ -2749,3 +2754,38 @@ runtime_MHeap_MapBits(MHeap *h) runtime_SysMap(h->arena_start - n, n - h->bitmap_mapped, h->arena_reserved, &mstats.gc_sys); h->bitmap_mapped = n; } + +// typedmemmove copies a value of type t to dst from src. + +extern void typedmemmove(const Type* td, void *dst, const void *src) + __asm__ (GOSYM_PREFIX "reflect.typedmemmove"); + +void +typedmemmove(const Type* td, void *dst, const void *src) +{ + runtime_memmove(dst, src, td->__size); +} + +// typedslicecopy copies a slice of elemType values from src to dst, +// returning the number of elements copied. + +extern intgo typedslicecopy(const Type* elem, Slice dst, Slice src) + __asm__ (GOSYM_PREFIX "reflect.typedslicecopy"); + +intgo +typedslicecopy(const Type* elem, Slice dst, Slice src) +{ + intgo n; + void *dstp; + void *srcp; + + n = dst.__count; + if (n > src.__count) + n = src.__count; + if (n == 0) + return 0; + dstp = dst.__values; + srcp = src.__values; + memmove(dstp, srcp, (uintptr_t)n * elem->__size); + return n; +} Index: libgo/runtime/parfor.c =================================================================== --- libgo/runtime/parfor.c (revision 228306) +++ libgo/runtime/parfor.c (working copy) @@ -34,7 +34,7 @@ runtime_parforalloc(uint32 nthrmax) } void -runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32)) +runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, bool wait, const FuncVal *body) { uint32 i, begin, end; uint64 *pos; @@ -49,7 +49,6 @@ runtime_parforsetup(ParFor *desc, uint32 desc->nthr = nthr; desc->thrseq = 0; desc->cnt = n; - desc->ctx = ctx; desc->wait = wait; desc->nsteal = 0; desc->nstealcnt = 0; @@ -72,7 +71,8 @@ runtime_parfordo(ParFor *desc) ParForThread *me; uint32 tid, begin, end, begin2, try, victim, i; uint64 *mypos, *victimpos, pos, newpos; - void (*body)(ParFor*, uint32); + const FuncVal *body; + void (*bodyfn)(ParFor*, uint32); bool idle; // Obtain 0-based thread index. @@ -82,14 +82,16 @@ runtime_parfordo(ParFor *desc) runtime_throw("parfor: invalid tid"); } + body = desc->body; + bodyfn = (void (*)(ParFor*, uint32))(void*)body->fn; + // If single-threaded, just execute the for serially. if(desc->nthr==1) { for(i=0; i<desc->cnt; i++) - desc->body(desc, i); + __builtin_call_with_static_chain (bodyfn(desc, i), body); return; } - body = desc->body; me = &desc->thr[tid]; mypos = &me->pos; for(;;) { @@ -100,7 +102,7 @@ runtime_parfordo(ParFor *desc) begin = (uint32)pos-1; end = (uint32)(pos>>32); if(begin < end) { - body(desc, begin); + __builtin_call_with_static_chain(bodyfn(desc, begin), body); continue; } break; Index: libgo/runtime/proc.c =================================================================== --- libgo/runtime/proc.c (revision 229546) +++ libgo/runtime/proc.c (working copy) @@ -443,6 +443,7 @@ void runtime_schedinit(void) { int32 n, procs; + String s; const byte *p; Eface i; @@ -477,8 +478,9 @@ runtime_schedinit(void) runtime_sched.lastpoll = runtime_nanotime(); procs = 1; - p = runtime_getenv("GOMAXPROCS"); - if(p != nil && (n = runtime_atoi(p)) > 0) { + s = runtime_getenv("GOMAXPROCS"); + p = s.str; + if(p != nil && (n = runtime_atoi(p, s.len)) > 0) { if(n > MaxGomaxprocs) n = MaxGomaxprocs; procs = n; @@ -2268,19 +2270,19 @@ runtime_malg(int32 stacksize, byte** ret // are available sequentially after &fn; they would not be // copied if a stack split occurred. It's OK for this to call // functions that split the stack. -void runtime_testing_entersyscall(void) +void runtime_testing_entersyscall(int32) __asm__ (GOSYM_PREFIX "runtime.entersyscall"); void -runtime_testing_entersyscall() +runtime_testing_entersyscall(int32 dummy __attribute__ ((unused))) { runtime_entersyscall(); } -void runtime_testing_exitsyscall(void) +void runtime_testing_exitsyscall(int32) __asm__ (GOSYM_PREFIX "runtime.exitsyscall"); void -runtime_testing_exitsyscall() +runtime_testing_exitsyscall(int32 dummy __attribute__ ((unused))) { runtime_exitsyscall(); } @@ -3429,3 +3431,54 @@ runtime_gcwaiting(void) { return runtime_sched.gcwaiting; } + +// os_beforeExit is called from os.Exit(0). +//go:linkname os_beforeExit os.runtime_beforeExit + +extern void os_beforeExit() __asm__ (GOSYM_PREFIX "os.runtime_beforeExit"); + +void +os_beforeExit() +{ +} + +// Active spinning for sync.Mutex. +//go:linkname sync_runtime_canSpin sync.runtime_canSpin + +enum +{ + ACTIVE_SPIN = 4, + ACTIVE_SPIN_CNT = 30, +}; + +extern _Bool sync_runtime_canSpin(intgo i) + __asm__ (GOSYM_PREFIX "sync.runtime_canSpin"); + +_Bool +sync_runtime_canSpin(intgo i) +{ + P *p; + + // sync.Mutex is cooperative, so we are conservative with spinning. + // Spin only few times and only if running on a multicore machine and + // GOMAXPROCS>1 and there is at least one other running P and local runq is empty. + // As opposed to runtime mutex we don't do passive spinning here, + // because there can be work on global runq on on other Ps. + if (i >= ACTIVE_SPIN || runtime_ncpu <= 1 || runtime_gomaxprocs <= (int32)(runtime_sched.npidle+runtime_sched.nmspinning)+1) { + return false; + } + p = m->p; + return p != nil && p->runqhead == p->runqtail; +} + +//go:linkname sync_runtime_doSpin sync.runtime_doSpin +//go:nosplit + +extern void sync_runtime_doSpin(void) + __asm__ (GOSYM_PREFIX "sync.runtime_doSpin"); + +void +sync_runtime_doSpin() +{ + runtime_procyield(ACTIVE_SPIN_CNT); +} Index: libgo/runtime/runtime.c =================================================================== --- libgo/runtime/runtime.c (revision 228306) +++ libgo/runtime/runtime.c (working copy) @@ -35,6 +35,7 @@ extern volatile intgo runtime_MemProfile int32 runtime_gotraceback(bool *crash) { + String s; const byte *p; uint32 x; @@ -44,15 +45,14 @@ runtime_gotraceback(bool *crash) return runtime_m()->traceback; x = runtime_atomicload(&traceback_cache); if(x == ~(uint32)0) { - p = runtime_getenv("GOTRACEBACK"); - if(p == nil) - p = (const byte*)""; - if(p[0] == '\0') + s = runtime_getenv("GOTRACEBACK"); + p = s.str; + if(s.len == 0) x = 1<<1; - else if(runtime_strcmp((const char *)p, "crash") == 0) + else if(s.len == 5 && runtime_strcmp((const char *)p, "crash") == 0) x = (2<<1) | 1; else - x = runtime_atoi(p)<<1; + x = runtime_atoi(p, s.len)<<1; runtime_atomicstore(&traceback_cache, x); } if(crash != nil) @@ -136,13 +136,15 @@ os_runtime_args() } int32 -runtime_atoi(const byte *p) +runtime_atoi(const byte *p, intgo len) { int32 n; n = 0; - while('0' <= *p && *p <= '9') + while(len > 0 && '0' <= *p && *p <= '9') { n = n*10 + *p++ - '0'; + len--; + } return n; } @@ -339,7 +341,9 @@ static struct { void runtime_parsedebugvars(void) { - const byte *p; + String s; + const byte *p, *pn; + intgo len; intgo i, n; bool tmp; @@ -352,24 +356,27 @@ runtime_parsedebugvars(void) traceback_cache = ~(uint32)0; runtime_gotraceback(&tmp); - p = runtime_getenv("GODEBUG"); - if(p == nil) + s = runtime_getenv("GODEBUG"); + if(s.len == 0) return; + p = s.str; + len = s.len; for(;;) { for(i=0; i<(intgo)nelem(dbgvar); i++) { n = runtime_findnull((const byte*)dbgvar[i].name); - if(runtime_mcmp(p, "memprofilerate", n) == 0 && p[n] == '=') + if(len > n && runtime_mcmp(p, "memprofilerate", n) == 0 && p[n] == '=') // Set the MemProfileRate directly since it // is an int, not int32, and should only lbe // set here if specified by GODEBUG - runtime_MemProfileRate = runtime_atoi(p+n+1); - else if(runtime_mcmp(p, dbgvar[i].name, n) == 0 && p[n] == '=') - *dbgvar[i].value = runtime_atoi(p+n+1); + runtime_MemProfileRate = runtime_atoi(p+n+1, len-(n+1)); + else if(len > n && runtime_mcmp(p, dbgvar[i].name, n) == 0 && p[n] == '=') + *dbgvar[i].value = runtime_atoi(p+n+1, len-(n+1)); } - p = (const byte *)runtime_strstr((const char *)p, ","); - if(p == nil) + pn = (const byte *)runtime_strstr((const char *)p, ","); + if(pn == nil || pn - p >= len) break; - p++; + len -= (pn - p) - 1; + p = pn + 1; } } Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 228306) +++ libgo/runtime/runtime.h (working copy) @@ -421,17 +421,15 @@ struct LFNode // Parallel for descriptor. struct ParFor { - void (*body)(ParFor*, uint32); // executed for each element + const FuncVal *body; // executed for each element uint32 done; // number of idle threads uint32 nthr; // total number of threads uint32 nthrmax; // maximum number of threads uint32 thrseq; // thread id sequencer uint32 cnt; // iteration space [0, cnt) - void *ctx; // arbitrary user context bool wait; // if true, wait while all threads finish processing, // otherwise parfor may return while other threads are still working ParForThread *thr; // array of thread descriptors - uint32 pad; // to align ParForThread.pos for 64-bit atomic operations // stats uint64 nsteal; uint64 nstealcnt; @@ -544,6 +542,7 @@ void runtime_schedinit(void); void runtime_initsig(void); void runtime_sigenable(uint32 sig); void runtime_sigdisable(uint32 sig); +void runtime_sigignore(uint32 sig); int32 runtime_gotraceback(bool *crash); void runtime_goroutineheader(G*); void runtime_printtrace(Location*, int32, bool); @@ -552,8 +551,8 @@ void runtime_printtrace(Location*, int32 #define runtime_write(d, v, n) write((d), (v), (n)) #define runtime_close(d) close(d) void runtime_ready(G*); -const byte* runtime_getenv(const char*); -int32 runtime_atoi(const byte*); +String runtime_getenv(const char*); +int32 runtime_atoi(const byte*, intgo); void* runtime_mstart(void*); G* runtime_malg(int32, byte**, size_t*); void runtime_mpreinit(M*); @@ -713,12 +712,11 @@ LFNode* runtime_lfstackpop(uint64 *head) * Parallel for over [0, n). * body() is executed for each iteration. * nthr - total number of worker threads. - * ctx - arbitrary user context. * if wait=true, threads return from parfor() when all work is done; * otherwise, threads can return while other threads are still finishing processing. */ ParFor* runtime_parforalloc(uint32 nthrmax); -void runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, void *ctx, bool wait, void (*body)(ParFor*, uint32)); +void runtime_parforsetup(ParFor *desc, uint32 nthr, uint32 n, bool wait, const FuncVal *body); void runtime_parfordo(ParFor *desc); void runtime_parforiters(ParFor*, uintptr, uintptr*, uintptr*); Index: libgo/runtime/runtime1.goc =================================================================== --- libgo/runtime/runtime1.goc (revision 228306) +++ libgo/runtime/runtime1.goc (working copy) @@ -27,8 +27,8 @@ func newParFor(nthrmax uint32) (desc *Pa desc = runtime_parforalloc(nthrmax); } -func parForSetup(desc *ParFor, nthr uint32, n uint32, ctx *byte, wait bool, body *byte) { - runtime_parforsetup(desc, nthr, n, ctx, wait, *(void(**)(ParFor*, uint32))body); +func parForSetup(desc *ParFor, nthr uint32, n uint32, wait bool, body *byte) { + runtime_parforsetup(desc, nthr, n, wait, (const FuncVal*) body); } func parForDo(desc *ParFor) { @@ -52,10 +52,7 @@ func NumGoroutine() (ret int) { } func getgoroot() (out String) { - const byte *p; - - p = runtime_getenv("GOROOT"); - out = runtime_gostringnocopy(p); + out = runtime_getenv("GOROOT"); } func runtime_pprof.runtime_cyclesPerSecond() (res int64) { @@ -87,3 +84,13 @@ func sync_atomic.runtime_procPin() (p in func sync_atomic.runtime_procUnpin() { runtime_m()->locks--; } + +extern Slice envs; + +func envs() (s Slice) { + s = envs; +} + +func setenvs(e Slice) { + envs = e; +} Index: libgo/runtime/signal_unix.c =================================================================== --- libgo/runtime/signal_unix.c (revision 228306) +++ libgo/runtime/signal_unix.c (working copy) @@ -93,6 +93,29 @@ runtime_sigdisable(uint32 sig) } void +runtime_sigignore(uint32 sig) +{ + int32 i; + SigTab *t; + + t = nil; + for(i = 0; runtime_sigtab[i].sig != -1; i++) { + if(runtime_sigtab[i].sig == (int32)sig) { + t = &runtime_sigtab[i]; + break; + } + } + + if(t == nil) + return; + + if((t->flags & SigNotify) != 0) { + t->flags &= ~SigHandling; + runtime_setsig(i, GO_SIG_IGN, true); + } +} + +void runtime_resetcpuprofiler(int32 hz) { struct itimerval it; Index: libgo/runtime/sigqueue.goc =================================================================== --- libgo/runtime/sigqueue.goc (revision 228306) +++ libgo/runtime/sigqueue.goc (working copy) @@ -156,6 +156,14 @@ func signal_disable(s uint32) { runtime_sigdisable(s); } +// Must only be called from a single goroutine at a time. +func signal_ignore(s uint32) { + if (s >= nelem(sig.wanted)*32) + return; + sig.wanted[s/32] &= ~(1U<<(s&31)); + runtime_sigignore(s); +} + // This runs on a foreign stack, without an m or a g. No stack split. void runtime_badsignal(int sig)