aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorMichael Meissner <meissner@linux.vnet.ibm.com>2015-04-10 18:39:05 +0000
committerMichael Meissner <meissner@linux.vnet.ibm.com>2015-04-10 18:39:05 +0000
commitbc57afcfbb08ff10cc6fd036d580c71bfaf00ed8 (patch)
tree10f38072ae840828e4205e4f549020643cfeb678 /libgo
parent48796cb6a9ff1feb2f870a4d6bd1d49112265c12 (diff)
parent24aaa4722c67688820b40f62483a6243e552d447 (diff)
Merge up to 221977ibm/fusion3
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/fusion3@221980 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am44
-rw-r--r--libgo/Makefile.in138
-rw-r--r--libgo/go/cmd/go/build.go18
-rw-r--r--libgo/go/cmd/go/pkg.go9
-rw-r--r--libgo/go/cmd/go/test.go26
-rw-r--r--libgo/go/debug/elf/file.go45
-rw-r--r--libgo/go/debug/elf/file_test.go6
-rw-r--r--libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.objbin0 -> 2356 bytes
-rw-r--r--libgo/go/runtime/chan_test.go5
-rw-r--r--libgo/go/runtime/map_test.go7
-rwxr-xr-xlibgo/mksysinfo.sh5
-rw-r--r--libgo/runtime/chan.c1186
-rw-r--r--libgo/runtime/cpuprof.c350
-rw-r--r--libgo/runtime/lfstack.c76
14 files changed, 234 insertions, 1681 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index f6f967e22a6..00fbaabae39 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -105,7 +105,7 @@ toolexeclib_LTLIBRARIES = libgo-llgo.la
toolexeclib_LIBRARIES = libgobegin-llgo.a
else
toolexeclib_LTLIBRARIES = libgo.la
-toolexeclib_LIBRARIES = libgobegin.a
+toolexeclib_LIBRARIES = libgobegin.a libnetgo.a
endif
toolexeclibgo_DATA = \
@@ -774,9 +774,7 @@ endif
endif
endif
-go_net_files = \
- go/net/cgo_unix.go \
- $(go_net_cgo_file) \
+go_net_common_files = \
$(go_net_cloexec_file) \
go/net/dial.go \
go/net/dnsclient.go \
@@ -820,6 +818,15 @@ go_net_files = \
go/net/unixsock.go \
go/net/unixsock_posix.go
+go_net_files = \
+ go/net/cgo_unix.go \
+ $(go_net_cgo_file) \
+ $(go_net_common_files)
+
+go_netgo_files = \
+ go/net/cgo_stub.go \
+ $(go_net_common_files)
+
if LIBGO_IS_SOLARIS
if LIBGO_IS_386
go_os_dir_file = go/os/dir_largefile.go
@@ -978,6 +985,20 @@ s-version: Makefile
$(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
$(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
+ echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | sed 's/\.lo/\": true,/' | sed 's/-go//' | grep -v _c | sed 's/^/\t\"/' | sort | uniq >> zstdpkglist.go.tmp
+ echo '}' >> zstdpkglist.go.tmp
+ $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
+ $(STAMP) $@
+
go_sort_files = \
go/sort/search.go \
go/sort/sort.go
@@ -2011,6 +2032,9 @@ libgobegin_a_SOURCES = \
libgobegin_llgo_a_SOURCES = \
runtime/go-main.c
+libnetgo_a_SOURCES = $(go_netgo_files)
+libnetgo_a_LIBADD = netgo.o
+
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
GOCFLAGS = $(CFLAGS)
@@ -2035,6 +2059,12 @@ BUILDPACKAGE = \
files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
$(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files
+# Build netgo.o.
+BUILDNETGO = \
+ $(MKDIR_P) $(@D); \
+ files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
+ $(GOCOMPILE) -I . -c -fgo-pkgpath=net -o $@ $$files
+
GOTESTFLAGS =
GOBENCH =
@@ -2256,6 +2286,12 @@ net/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: net/check
+@go_include@ netgo.o.dep
+netgo.o.dep: $(go_netgo_files)
+ $(BUILDDEPS)
+netgo.o: $(go_netgo_files)
+ $(BUILDNETGO)
+
@go_include@ os.lo.dep
os.lo.dep: $(go_os_files)
$(BUILDDEPS)
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index c908869cd61..8ecc339012b 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -136,6 +136,15 @@ libgobegin_a_AR = $(AR) $(ARFLAGS)
libgobegin_a_LIBADD =
am_libgobegin_a_OBJECTS = go-main.$(OBJEXT)
libgobegin_a_OBJECTS = $(am_libgobegin_a_OBJECTS)
+libnetgo_a_AR = $(AR) $(ARFLAGS)
+libnetgo_a_DEPENDENCIES = netgo.o
+am__objects_1 =
+am__objects_2 = $(am__objects_1) $(am__objects_1) $(am__objects_1) \
+ $(am__objects_1) $(am__objects_1) $(am__objects_1) \
+ $(am__objects_1)
+am__objects_3 = $(am__objects_2)
+am_libnetgo_a_OBJECTS = $(am__objects_3)
+libnetgo_a_OBJECTS = $(am_libnetgo_a_OBJECTS)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \
@@ -183,23 +192,23 @@ am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
-@LIBGO_IS_LINUX_FALSE@am__objects_1 = lock_sema.lo thread-sema.lo
-@LIBGO_IS_LINUX_TRUE@am__objects_1 = lock_futex.lo thread-linux.lo
-@HAVE_SYS_MMAN_H_FALSE@am__objects_2 = mem_posix_memalign.lo
-@HAVE_SYS_MMAN_H_TRUE@am__objects_2 = mem.lo
-@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_3 = netpoll_kqueue.lo
-@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_3 = netpoll_select.lo
-@LIBGO_IS_LINUX_TRUE@am__objects_3 = netpoll_epoll.lo
-@LIBGO_IS_RTEMS_TRUE@am__objects_4 = rtems-task-variable-add.lo
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-none.lo
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-bsd.lo
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_5 = getncpu-bsd.lo
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_5 = getncpu-solaris.lo
-@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_5 = getncpu-irix.lo
-@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_5 = \
+@LIBGO_IS_LINUX_FALSE@am__objects_4 = lock_sema.lo thread-sema.lo
+@LIBGO_IS_LINUX_TRUE@am__objects_4 = lock_futex.lo thread-linux.lo
+@HAVE_SYS_MMAN_H_FALSE@am__objects_5 = mem_posix_memalign.lo
+@HAVE_SYS_MMAN_H_TRUE@am__objects_5 = mem.lo
+@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_6 = netpoll_kqueue.lo
+@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_6 = netpoll_select.lo
+@LIBGO_IS_LINUX_TRUE@am__objects_6 = netpoll_epoll.lo
+@LIBGO_IS_RTEMS_TRUE@am__objects_7 = rtems-task-variable-add.lo
+@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-none.lo
+@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo
+@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo
+@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_8 = getncpu-solaris.lo
+@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = getncpu-irix.lo
+@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = \
@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@ getncpu-bsd.lo
-@LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo
-am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
+@LIBGO_IS_LINUX_TRUE@am__objects_8 = getncpu-linux.lo
+am__objects_9 = go-append.lo go-assert.lo go-assert-interface.lo \
go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \
go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \
go-check-interface.lo go-construct-map.lo \
@@ -221,21 +230,21 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
go-type-string.lo go-typedesc-equal.lo go-unsafe-new.lo \
go-unsafe-newarray.lo go-unsafe-pointer.lo go-unsetenv.lo \
go-unwind.lo go-varargs.lo env_posix.lo heapdump.lo \
- $(am__objects_1) mcache.lo mcentral.lo $(am__objects_2) \
- mfixalloc.lo mgc0.lo mheap.lo msize.lo $(am__objects_3) \
+ $(am__objects_4) mcache.lo mcentral.lo $(am__objects_5) \
+ mfixalloc.lo mgc0.lo mheap.lo msize.lo $(am__objects_6) \
panic.lo parfor.lo print.lo proc.lo runtime.lo signal_unix.lo \
- thread.lo yield.lo $(am__objects_4) chan.lo cpuprof.lo \
+ thread.lo yield.lo $(am__objects_7) chan.lo cpuprof.lo \
go-iface.lo lfstack.lo malloc.lo map.lo mprof.lo netpoll.lo \
rdebug.lo reflect.lo runtime1.lo sema.lo sigqueue.lo string.lo \
- time.lo $(am__objects_5)
-am_libgo_llgo_la_OBJECTS = $(am__objects_6)
+ time.lo $(am__objects_8)
+am_libgo_llgo_la_OBJECTS = $(am__objects_9)
libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS)
libgo_llgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libgo_llgo_la_LDFLAGS) $(LDFLAGS) -o $@
@GOC_IS_LLGO_TRUE@am_libgo_llgo_la_rpath = -rpath $(toolexeclibdir)
libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
-am_libgo_la_OBJECTS = $(am__objects_6)
+am_libgo_la_OBJECTS = $(am__objects_9)
libgo_la_OBJECTS = $(am_libgo_la_OBJECTS)
libgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libgo_la_LDFLAGS) \
@@ -255,7 +264,8 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libgobegin_llgo_a_SOURCES) $(libgobegin_a_SOURCES) \
- $(libgo_llgo_la_SOURCES) $(libgo_la_SOURCES)
+ $(libnetgo_a_SOURCES) $(libgo_llgo_la_SOURCES) \
+ $(libgo_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@@ -269,23 +279,24 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
-DATA = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \
- $(toolexeclibgocompress_DATA) $(toolexeclibgocontainer_DATA) \
- $(toolexeclibgocrypto_DATA) $(toolexeclibgocryptox509_DATA) \
- $(toolexeclibgodatabase_DATA) $(toolexeclibgodatabasesql_DATA) \
- $(toolexeclibgodebug_DATA) $(toolexeclibgoencoding_DATA) \
- $(toolexeclibgoexp_DATA) $(toolexeclibgogo_DATA) \
- $(toolexeclibgohash_DATA) $(toolexeclibgohtml_DATA) \
- $(toolexeclibgoimage_DATA) $(toolexeclibgoimagecolor_DATA) \
- $(toolexeclibgoindex_DATA) $(toolexeclibgoio_DATA) \
- $(toolexeclibgolog_DATA) $(toolexeclibgomath_DATA) \
- $(toolexeclibgomime_DATA) $(toolexeclibgonet_DATA) \
- $(toolexeclibgonethttp_DATA) $(toolexeclibgonetrpc_DATA) \
- $(toolexeclibgoold_DATA) $(toolexeclibgoos_DATA) \
- $(toolexeclibgopath_DATA) $(toolexeclibgoregexp_DATA) \
- $(toolexeclibgoruntime_DATA) $(toolexeclibgosync_DATA) \
- $(toolexeclibgotesting_DATA) $(toolexeclibgotext_DATA) \
- $(toolexeclibgotexttemplate_DATA) $(toolexeclibgounicode_DATA)
+DATA = $(noinst_DATA) $(toolexeclibgo_DATA) \
+ $(toolexeclibgoarchive_DATA) $(toolexeclibgocompress_DATA) \
+ $(toolexeclibgocontainer_DATA) $(toolexeclibgocrypto_DATA) \
+ $(toolexeclibgocryptox509_DATA) $(toolexeclibgodatabase_DATA) \
+ $(toolexeclibgodatabasesql_DATA) $(toolexeclibgodebug_DATA) \
+ $(toolexeclibgoencoding_DATA) $(toolexeclibgoexp_DATA) \
+ $(toolexeclibgogo_DATA) $(toolexeclibgohash_DATA) \
+ $(toolexeclibgohtml_DATA) $(toolexeclibgoimage_DATA) \
+ $(toolexeclibgoimagecolor_DATA) $(toolexeclibgoindex_DATA) \
+ $(toolexeclibgoio_DATA) $(toolexeclibgolog_DATA) \
+ $(toolexeclibgomath_DATA) $(toolexeclibgomime_DATA) \
+ $(toolexeclibgonet_DATA) $(toolexeclibgonethttp_DATA) \
+ $(toolexeclibgonetrpc_DATA) $(toolexeclibgoold_DATA) \
+ $(toolexeclibgoos_DATA) $(toolexeclibgopath_DATA) \
+ $(toolexeclibgoregexp_DATA) $(toolexeclibgoruntime_DATA) \
+ $(toolexeclibgosync_DATA) $(toolexeclibgotesting_DATA) \
+ $(toolexeclibgotext_DATA) $(toolexeclibgotexttemplate_DATA) \
+ $(toolexeclibgounicode_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -521,7 +532,7 @@ AM_MAKEFLAGS = \
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
@GOC_IS_LLGO_FALSE@toolexeclib_LTLIBRARIES = libgo.la
@GOC_IS_LLGO_TRUE@toolexeclib_LTLIBRARIES = libgo-llgo.la
-@GOC_IS_LLGO_FALSE@toolexeclib_LIBRARIES = libgobegin.a
+@GOC_IS_LLGO_FALSE@toolexeclib_LIBRARIES = libgobegin.a libnetgo.a
@GOC_IS_LLGO_TRUE@toolexeclib_LIBRARIES = libgobegin-llgo.a
toolexeclibgo_DATA = \
bufio.gox \
@@ -1024,9 +1035,7 @@ go_mime_files = \
@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_solaris.go
@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_OPENBSD_FALSE@go_net_tcpsockopt_file = go/net/tcpsockopt_darwin.go
@LIBGO_IS_OPENBSD_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_openbsd.go
-go_net_files = \
- go/net/cgo_unix.go \
- $(go_net_cgo_file) \
+go_net_common_files = \
$(go_net_cloexec_file) \
go/net/dial.go \
go/net/dnsclient.go \
@@ -1070,6 +1079,15 @@ go_net_files = \
go/net/unixsock.go \
go/net/unixsock_posix.go
+go_net_files = \
+ go/net/cgo_unix.go \
+ $(go_net_cgo_file) \
+ $(go_net_common_files)
+
+go_netgo_files = \
+ go/net/cgo_stub.go \
+ $(go_net_common_files)
+
@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_FALSE@go_os_dir_file = go/os/dir_regfile.go
@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_TRUE@go_os_dir_file = go/os/dir_largefile.go
@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go
@@ -1154,6 +1172,7 @@ go_runtime_files = \
go/runtime/softfloat64.go \
version.go
+noinst_DATA = zstdpkglist.go
go_sort_files = \
go/sort/search.go \
go/sort/sort.go
@@ -2079,6 +2098,8 @@ libgobegin_a_SOURCES = \
libgobegin_llgo_a_SOURCES = \
runtime/go-main.c
+libnetgo_a_SOURCES = $(go_netgo_files)
+libnetgo_a_LIBADD = netgo.o
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
AM_GOCFLAGS = $(STRINGOPS_FLAG)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
@@ -2102,6 +2123,13 @@ BUILDPACKAGE = \
files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
$(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files
+
+# Build netgo.o.
+BUILDNETGO = \
+ $(MKDIR_P) $(@D); \
+ files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \
+ $(GOCOMPILE) -I . -c -fgo-pkgpath=net -o $@ $$files
+
GOTESTFLAGS =
GOBENCH =
@@ -2389,6 +2417,10 @@ libgobegin.a: $(libgobegin_a_OBJECTS) $(libgobegin_a_DEPENDENCIES)
-rm -f libgobegin.a
$(libgobegin_a_AR) libgobegin.a $(libgobegin_a_OBJECTS) $(libgobegin_a_LIBADD)
$(RANLIB) libgobegin.a
+libnetgo.a: $(libnetgo_a_OBJECTS) $(libnetgo_a_DEPENDENCIES)
+ -rm -f libnetgo.a
+ $(libnetgo_a_AR) libnetgo.a $(libnetgo_a_OBJECTS) $(libnetgo_a_LIBADD)
+ $(RANLIB) libnetgo.a
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@@ -4394,6 +4426,18 @@ s-version: Makefile
$(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
$(STAMP) $@
+# 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
+ echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | sed 's/\.lo/\": true,/' | sed 's/-go//' | grep -v _c | sed 's/^/\t\"/' | sort | uniq >> zstdpkglist.go.tmp
+ echo '}' >> zstdpkglist.go.tmp
+ $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go
+ $(STAMP) $@
+
libcalls.go: s-libcalls; @true
s-libcalls: libcalls-list go/syscall/mksyscall.awk $(go_base_syscall_files)
rm -f libcalls.go.tmp
@@ -4601,6 +4645,12 @@ net/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: net/check
+@go_include@ netgo.o.dep
+netgo.o.dep: $(go_netgo_files)
+ $(BUILDDEPS)
+netgo.o: $(go_netgo_files)
+ $(BUILDNETGO)
+
@go_include@ os.lo.dep
os.lo.dep: $(go_os_files)
$(BUILDDEPS)
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go
index 95b9804d3de..781a43b5d99 100644
--- a/libgo/go/cmd/go/build.go
+++ b/libgo/go/cmd/go/build.go
@@ -132,7 +132,8 @@ var buildLdflags []string // -ldflags flag
var buildGccgoflags []string // -gccgoflags flag
var buildRace bool // -race flag
-var reqPkgSrc bool // req src for Imports
+// Require the source for go std packages
+var reqStdPkgSrc bool
var buildContext = build.Default
var buildToolchain toolchain = noToolchain{}
@@ -187,9 +188,9 @@ func addBuildFlags(cmd *Command) {
cmd.Flag.BoolVar(&buildRace, "race", false, "")
switch build.Default.Compiler {
case "gc":
- reqPkgSrc = true
+ reqStdPkgSrc = true
case "gccgo":
- reqPkgSrc = false
+ reqStdPkgSrc = false
}
}
@@ -579,7 +580,7 @@ func (b *builder) action(mode buildMode, depMode buildMode, p *Package) *action
// are writing is not the cgo we need to use.
if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace {
- if reqPkgSrc {
+ if reqStdPkgSrc {
if len(p.CgoFiles) > 0 || p.Standard && p.ImportPath == "runtime/cgo" {
var stk importStack
p1 := loadPackage("cmd/cgo", &stk)
@@ -1920,6 +1921,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
// and all LDFLAGS from cgo dependencies.
apackagesSeen := make(map[*Package]bool)
afiles := []string{}
+ xfiles := []string{}
ldflags := b.gccArchArgs()
cgoldflags := []string{}
usesCgo := false
@@ -1935,7 +1937,12 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
if !a.p.Standard {
if a.p != nil && !apackagesSeen[a.p] {
apackagesSeen[a.p] = true
- if a.p.fake {
+ if a.p.fake && a.p.external {
+ // external _tests, if present must come before
+ // internal _tests. Store these on a seperate list
+ // and place them at the head after this loop.
+ xfiles = append(xfiles, a.target)
+ } else if a.p.fake {
// move _test files to the top of the link order
afiles = append([]string{a.target}, afiles...)
} else {
@@ -1944,6 +1951,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
}
}
}
+ afiles = append(xfiles, afiles...)
for _, a := range allactions {
if a.p != nil {
diff --git a/libgo/go/cmd/go/pkg.go b/libgo/go/cmd/go/pkg.go
index 621cb4b6083..ef440dd3b74 100644
--- a/libgo/go/cmd/go/pkg.go
+++ b/libgo/go/cmd/go/pkg.go
@@ -83,6 +83,7 @@ type Package struct {
allgofiles []string // gofiles + IgnoredGoFiles, absolute paths
target string // installed file for this package (may be executable)
fake bool // synthesized package
+ external bool // synthesized external test package
forceBuild bool // this package must be rebuilt
forceLibrary bool // this package is a library (even if named "main")
cmdline bool // defined by files listed on command line
@@ -112,7 +113,11 @@ func (p *Package) copyBuild(pp *build.Package) {
p.ConflictDir = pp.ConflictDir
// TODO? Target
p.Goroot = pp.Goroot
- p.Standard = p.Goroot && p.ImportPath != "" && !strings.Contains(p.ImportPath, ".")
+ if buildContext.Compiler == "gccgo" {
+ p.Standard = stdpkg[p.ImportPath]
+ } else {
+ p.Standard = p.Goroot && p.ImportPath != "" && !strings.Contains(p.ImportPath, ".")
+ }
p.GoFiles = pp.GoFiles
p.CgoFiles = pp.CgoFiles
p.IgnoredGoFiles = pp.IgnoredGoFiles
@@ -582,7 +587,7 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
continue
}
p1 := loadImport(path, p.Dir, stk, p.build.ImportPos[path])
- if !reqPkgSrc && p1.Root == "" {
+ if !reqStdPkgSrc && p1.Standard {
continue
}
if p1.local {
diff --git a/libgo/go/cmd/go/test.go b/libgo/go/cmd/go/test.go
index 28b46ff52bf..5cf7aaf0716 100644
--- a/libgo/go/cmd/go/test.go
+++ b/libgo/go/cmd/go/test.go
@@ -384,17 +384,18 @@ func runTest(cmd *Command, args []string) {
delete(deps, "unsafe")
all := []string{}
- if reqPkgSrc {
- for path := range deps {
- if !build.IsLocalImport(path) {
- all = append(all, path)
- }
+ for path := range deps {
+ if !build.IsLocalImport(path) {
+ all = append(all, path)
}
}
sort.Strings(all)
a := &action{}
for _, p := range packagesForBuild(all) {
+ if !reqStdPkgSrc && p.Standard {
+ continue
+ }
a.deps = append(a.deps, b.action(modeInstall, modeInstall, p))
}
b.do(a)
@@ -563,7 +564,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
stk.push(p.ImportPath + " (test)")
for _, path := range p.TestImports {
p1 := loadImport(path, p.Dir, &stk, p.build.TestImportPos[path])
- if !reqPkgSrc && p1.Root == "" {
+ if !reqStdPkgSrc && p1.Standard {
continue
}
if p1.Error != nil {
@@ -591,7 +592,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
continue
}
p1 := loadImport(path, p.Dir, &stk, p.build.XTestImportPos[path])
- if !reqPkgSrc && p1.Root == "" {
+ if !reqStdPkgSrc && p1.Standard {
continue
}
if p1.Error != nil {
@@ -691,10 +692,11 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
build: &build.Package{
ImportPos: p.build.XTestImportPos,
},
- imports: ximports,
- pkgdir: testDir,
- fake: true,
- Stale: true,
+ imports: ximports,
+ pkgdir: testDir,
+ fake: true,
+ external: true,
+ Stale: true,
}
if pxtestNeedsPtest {
pxtest.imports = append(pxtest.imports, ptest)
@@ -722,7 +724,7 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action,
pmain.imports = append(pmain.imports, ptest)
} else {
p1 := loadImport(dep, "", &stk, nil)
- if !reqPkgSrc && p1.Root == "" {
+ if !reqStdPkgSrc && p1.Standard {
continue
}
if p1.Error != nil {
diff --git a/libgo/go/debug/elf/file.go b/libgo/go/debug/elf/file.go
index 5a418d81021..0135f7f8dbf 100644
--- a/libgo/go/debug/elf/file.go
+++ b/libgo/go/debug/elf/file.go
@@ -532,6 +532,9 @@ func (f *File) applyRelocations(dst []byte, rels []byte) error {
if f.Class == ELFCLASS64 && f.Machine == EM_AARCH64 {
return f.applyRelocationsARM64(dst, rels)
}
+ if f.Class == ELFCLASS32 && f.Machine == EM_PPC {
+ return f.applyRelocationsPPC(dst, rels)
+ }
if f.Class == ELFCLASS64 && f.Machine == EM_PPC64 {
return f.applyRelocationsPPC64(dst, rels)
}
@@ -677,6 +680,46 @@ func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error {
return nil
}
+func (f *File) applyRelocationsPPC(dst []byte, rels []byte) error {
+ // 12 is the size of Rela32.
+ if len(rels)%12 != 0 {
+ return errors.New("length of relocation section is not a multiple of 12")
+ }
+
+ symbols, _, err := f.getSymbols(SHT_SYMTAB)
+ if err != nil {
+ return err
+ }
+
+ b := bytes.NewReader(rels)
+ var rela Rela32
+
+ for b.Len() > 0 {
+ binary.Read(b, f.ByteOrder, &rela)
+ symNo := rela.Info >> 8
+ t := R_PPC(rela.Info & 0xff)
+
+ if symNo == 0 || symNo > uint32(len(symbols)) {
+ continue
+ }
+ sym := &symbols[symNo-1]
+ if SymType(sym.Info&0xf) != STT_SECTION {
+ // We don't handle non-section relocations for now.
+ continue
+ }
+
+ switch t {
+ case R_PPC_ADDR32:
+ if rela.Off+4 >= uint32(len(dst)) || rela.Addend < 0 {
+ continue
+ }
+ f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend))
+ }
+ }
+
+ return nil
+}
+
func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error {
// 24 is the size of Rela64.
if len(rels)%24 != 0 {
@@ -785,7 +828,7 @@ func (f *File) DWARF() (*dwarf.Data, error) {
// If there's a relocation table for .debug_info, we have to process it
// now otherwise the data in .debug_info is invalid for x86-64 objects.
rela := f.Section(".rela.debug_info")
- if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || f.Machine == EM_AARCH64 || f.Machine == EM_PPC64 || f.Machine == EM_S390) {
+ if rela != nil && rela.Type == SHT_RELA && (f.Machine == EM_X86_64 || f.Machine == EM_AARCH64 || f.Machine == EM_PPC || f.Machine == EM_PPC64 || f.Machine == EM_S390) {
data, err := rela.Data()
if err != nil {
return nil, err
diff --git a/libgo/go/debug/elf/file_test.go b/libgo/go/debug/elf/file_test.go
index ce10da71d2b..56e2604d9d3 100644
--- a/libgo/go/debug/elf/file_test.go
+++ b/libgo/go/debug/elf/file_test.go
@@ -261,6 +261,12 @@ var relocationTests = []relocationTest{
},
},
{
+ "testdata/go-relocation-test-gcc5-ppc.obj",
+ []relocationTestEntry{
+ {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C11 5.0.0 20150116 (experimental) -Asystem=linux -Asystem=unix -Asystem=posix -g"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(12)}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test-gcc5-ppc.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: int64(0x44)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}}},
+ },
+ },
+ {
"testdata/go-relocation-test-gcc482-ppc64le.obj",
[]relocationTestEntry{
{0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -Asystem=linux -Asystem=unix -Asystem=posix -msecure-plt -mtune=power8 -mcpu=power7 -gdwarf-2 -fstack-protector"}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1)}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482-ppc64le.c"}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp"}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0)}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x24)}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0)}}}},
diff --git a/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj b/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj
new file mode 100644
index 00000000000..f4165af0982
--- /dev/null
+++ b/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj
Binary files differ
diff --git a/libgo/go/runtime/chan_test.go b/libgo/go/runtime/chan_test.go
index e689ceaed1e..4fb305c8ae3 100644
--- a/libgo/go/runtime/chan_test.go
+++ b/libgo/go/runtime/chan_test.go
@@ -202,6 +202,11 @@ func TestNonblockRecvRace(t *testing.T) {
n := 10000
if testing.Short() {
n = 100
+ } else {
+ if runtime.GOARCH == "s390" {
+ // Test uses too much address space on 31-bit S390.
+ t.Skip("skipping long test on s390")
+ }
}
for i := 0; i < n; i++ {
c := make(chan int, 1)
diff --git a/libgo/go/runtime/map_test.go b/libgo/go/runtime/map_test.go
index 7e4da902e7f..9ed183bb9d1 100644
--- a/libgo/go/runtime/map_test.go
+++ b/libgo/go/runtime/map_test.go
@@ -243,7 +243,12 @@ func TestIterGrowWithGC(t *testing.T) {
func testConcurrentReadsAfterGrowth(t *testing.T, useReflect bool) {
if runtime.GOMAXPROCS(-1) == 1 {
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(16))
+ if runtime.GOARCH == "s390" {
+ // Test uses too much address space on 31-bit S390.
+ defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(8))
+ } else {
+ defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(16))
+ }
}
numLoop := 10
numGrowStep := 250
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index a977f56937b..c2e7c24974a 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1273,4 +1273,9 @@ if ! grep 'const SizeofICMPv6Filter ' ${OUT} >/dev/null 2>&1; then
echo 'const SizeofICMPv6Filter = 32' >> ${OUT}
fi
+# The Solaris 11 Update 1 _zone_net_addr_t struct.
+grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
+ sed -e 's/_in6_addr/[16]byte/' \
+ >> ${OUT}
+
exit $?
diff --git a/libgo/runtime/chan.c b/libgo/runtime/chan.c
deleted file mode 100644
index 4559c0f2d0d..00000000000
--- a/libgo/runtime/chan.c
+++ /dev/null
@@ -1,1186 +0,0 @@
-// AUTO-GENERATED by autogen.sh; DO NOT EDIT
-
-#include "runtime.h"
-#include "arch.h"
-#include "go-type.h"
-#include "race.h"
-#include "malloc.h"
-#include "chan.h"
-
-#line 13 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-uint32 runtime_Hchansize = sizeof ( Hchan ) ;
-#line 15 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void dequeueg ( WaitQ* ) ;
-static SudoG* dequeue ( WaitQ* ) ;
-static void enqueue ( WaitQ* , SudoG* ) ;
-static void racesync ( Hchan* , SudoG* ) ;
-#line 20 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static Hchan*
-makechan ( ChanType *t , int64 hint )
-{
-Hchan *c;
-uintptr n;
-const Type *elem;
-#line 27 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-elem = t->__element_type;
-#line 30 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( elem->__size >= ( 1<<16 ) )
-runtime_throw ( "makechan: invalid channel element type" ) ;
-#line 33 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( hint < 0 || ( intgo ) hint != hint || ( elem->__size > 0 && ( uintptr ) hint > ( MaxMem - sizeof ( *c ) ) / elem->__size ) )
-runtime_panicstring ( "makechan: size out of range" ) ;
-#line 36 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-n = sizeof ( *c ) ;
-n = ROUND ( n , elem->__align ) ;
-#line 40 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-c = ( Hchan* ) runtime_mallocgc ( sizeof ( *c ) + hint*elem->__size , ( uintptr ) t | TypeInfo_Chan , 0 ) ;
-c->elemsize = elem->__size;
-c->elemtype = elem;
-c->dataqsiz = hint;
-#line 45 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "makechan: chan=%p; elemsize=%D; dataqsiz=%D\n" ,
-c , ( int64 ) elem->__size , ( int64 ) c->dataqsiz ) ;
-#line 49 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-return c;
-}
-Hchan* reflect_makechan(ChanType* t, uint64 size) __asm__ (GOSYM_PREFIX "reflect.makechan");
-Hchan* reflect_makechan(ChanType* t, uint64 size)
-{
- Hchan* c;
-#line 52 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- c = makechan(t, size);
-return c;
-}
-
-#line 56 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-Hchan*
-__go_new_channel ( ChanType *t , uintptr hint )
-{
-return makechan ( t , hint ) ;
-}
-#line 62 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-Hchan*
-__go_new_channel_big ( ChanType *t , uint64 hint )
-{
-return makechan ( t , hint ) ;
-}
-#line 82 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static bool
-chansend ( ChanType *t , Hchan *c , byte *ep , bool block , void *pc )
-{
-SudoG *sg;
-SudoG mysg;
-G* gp;
-int64 t0;
-G* g;
-#line 91 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-g = runtime_g ( ) ;
-#line 93 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled )
-runtime_racereadobjectpc ( ep , t->__element_type , runtime_getcallerpc ( &t ) , chansend ) ;
-#line 96 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c == nil ) {
-USED ( t ) ;
-if ( !block )
-return false;
-runtime_park ( nil , nil , "chan send (nil chan)" ) ;
-return false;
-}
-#line 104 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( runtime_gcwaiting ( ) )
-runtime_gosched ( ) ;
-#line 107 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug ) {
-runtime_printf ( "chansend: chan=%p\n" , c ) ;
-}
-#line 111 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-t0 = 0;
-mysg.releasetime = 0;
-if ( runtime_blockprofilerate > 0 ) {
-t0 = runtime_cputicks ( ) ;
-mysg.releasetime = -1;
-}
-#line 118 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_lock ( c ) ;
-if ( raceenabled )
-runtime_racereadpc ( c , pc , chansend ) ;
-if ( c->closed )
-goto closed;
-#line 124 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c->dataqsiz > 0 )
-goto asynch;
-#line 127 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sg = dequeue ( &c->recvq ) ;
-if ( sg != nil ) {
-if ( raceenabled )
-racesync ( c , sg ) ;
-runtime_unlock ( c ) ;
-#line 133 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-gp = sg->g;
-gp->param = sg;
-if ( sg->elem != nil )
-runtime_memmove ( sg->elem , ep , c->elemsize ) ;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-return true;
-}
-#line 143 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( !block ) {
-runtime_unlock ( c ) ;
-return false;
-}
-#line 148 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-mysg.elem = ep;
-mysg.g = g;
-mysg.selectdone = nil;
-g->param = nil;
-enqueue ( &c->sendq , &mysg ) ;
-runtime_parkunlock ( c , "chan send" ) ;
-#line 155 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( g->param == nil ) {
-runtime_lock ( c ) ;
-if ( !c->closed )
-runtime_throw ( "chansend: spurious wakeup" ) ;
-goto closed;
-}
-#line 162 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( mysg.releasetime > 0 )
-runtime_blockevent ( mysg.releasetime - t0 , 2 ) ;
-#line 165 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-return true;
-#line 167 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-asynch:
-if ( c->closed )
-goto closed;
-#line 171 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c->qcount >= c->dataqsiz ) {
-if ( !block ) {
-runtime_unlock ( c ) ;
-return false;
-}
-mysg.g = g;
-mysg.elem = nil;
-mysg.selectdone = nil;
-enqueue ( &c->sendq , &mysg ) ;
-runtime_parkunlock ( c , "chan send" ) ;
-#line 182 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_lock ( c ) ;
-goto asynch;
-}
-#line 186 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled )
-runtime_racerelease ( chanbuf ( c , c->sendx ) ) ;
-#line 189 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_memmove ( chanbuf ( c , c->sendx ) , ep , c->elemsize ) ;
-if ( ++c->sendx == c->dataqsiz )
-c->sendx = 0;
-c->qcount++;
-#line 194 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sg = dequeue ( &c->recvq ) ;
-if ( sg != nil ) {
-gp = sg->g;
-runtime_unlock ( c ) ;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-} else
-runtime_unlock ( c ) ;
-if ( mysg.releasetime > 0 )
-runtime_blockevent ( mysg.releasetime - t0 , 2 ) ;
-return true;
-#line 207 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-closed:
-runtime_unlock ( c ) ;
-runtime_panicstring ( "send on closed channel" ) ;
-return false;
-}
-#line 214 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static bool
-chanrecv ( ChanType *t , Hchan* c , byte *ep , bool block , bool *received )
-{
-SudoG *sg;
-SudoG mysg;
-G *gp;
-int64 t0;
-G *g;
-#line 223 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( runtime_gcwaiting ( ) )
-runtime_gosched ( ) ;
-#line 228 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "chanrecv: chan=%p\n" , c ) ;
-#line 231 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-g = runtime_g ( ) ;
-#line 233 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c == nil ) {
-USED ( t ) ;
-if ( !block )
-return false;
-runtime_park ( nil , nil , "chan receive (nil chan)" ) ;
-return false;
-}
-#line 241 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-t0 = 0;
-mysg.releasetime = 0;
-if ( runtime_blockprofilerate > 0 ) {
-t0 = runtime_cputicks ( ) ;
-mysg.releasetime = -1;
-}
-#line 248 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_lock ( c ) ;
-if ( c->dataqsiz > 0 )
-goto asynch;
-#line 252 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c->closed )
-goto closed;
-#line 255 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sg = dequeue ( &c->sendq ) ;
-if ( sg != nil ) {
-if ( raceenabled )
-racesync ( c , sg ) ;
-runtime_unlock ( c ) ;
-#line 261 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( ep != nil )
-runtime_memmove ( ep , sg->elem , c->elemsize ) ;
-gp = sg->g;
-gp->param = sg;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-#line 269 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( received != nil )
-*received = true;
-return true;
-}
-#line 274 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( !block ) {
-runtime_unlock ( c ) ;
-return false;
-}
-#line 279 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-mysg.elem = ep;
-mysg.g = g;
-mysg.selectdone = nil;
-g->param = nil;
-enqueue ( &c->recvq , &mysg ) ;
-runtime_parkunlock ( c , "chan receive" ) ;
-#line 286 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( g->param == nil ) {
-runtime_lock ( c ) ;
-if ( !c->closed )
-runtime_throw ( "chanrecv: spurious wakeup" ) ;
-goto closed;
-}
-#line 293 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( received != nil )
-*received = true;
-if ( mysg.releasetime > 0 )
-runtime_blockevent ( mysg.releasetime - t0 , 2 ) ;
-return true;
-#line 299 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-asynch:
-if ( c->qcount <= 0 ) {
-if ( c->closed )
-goto closed;
-#line 304 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( !block ) {
-runtime_unlock ( c ) ;
-if ( received != nil )
-*received = false;
-return false;
-}
-mysg.g = g;
-mysg.elem = nil;
-mysg.selectdone = nil;
-enqueue ( &c->recvq , &mysg ) ;
-runtime_parkunlock ( c , "chan receive" ) ;
-#line 316 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_lock ( c ) ;
-goto asynch;
-}
-#line 320 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled )
-runtime_raceacquire ( chanbuf ( c , c->recvx ) ) ;
-#line 323 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( ep != nil )
-runtime_memmove ( ep , chanbuf ( c , c->recvx ) , c->elemsize ) ;
-runtime_memclr ( chanbuf ( c , c->recvx ) , c->elemsize ) ;
-if ( ++c->recvx == c->dataqsiz )
-c->recvx = 0;
-c->qcount--;
-#line 330 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sg = dequeue ( &c->sendq ) ;
-if ( sg != nil ) {
-gp = sg->g;
-runtime_unlock ( c ) ;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-} else
-runtime_unlock ( c ) ;
-#line 340 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( received != nil )
-*received = true;
-if ( mysg.releasetime > 0 )
-runtime_blockevent ( mysg.releasetime - t0 , 2 ) ;
-return true;
-#line 346 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-closed:
-if ( ep != nil )
-runtime_memclr ( ep , c->elemsize ) ;
-if ( received != nil )
-*received = false;
-if ( raceenabled )
-runtime_raceacquire ( c ) ;
-runtime_unlock ( c ) ;
-if ( mysg.releasetime > 0 )
-runtime_blockevent ( mysg.releasetime - t0 , 2 ) ;
-return true;
-}
-#line 361 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-void
-__go_send_small ( ChanType *t , Hchan* c , uint64 val )
-{
-union
-{
-byte b[sizeof ( uint64 ) ];
-uint64 v;
-} u;
-byte *v;
-#line 371 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-u.v = val;
-#ifndef WORDS_BIGENDIAN
-v = u.b;
-#else
-v = u.b + sizeof ( uint64 ) - t->__element_type->__size;
-#endif
-chansend ( t , c , v , true , runtime_getcallerpc ( &t ) ) ;
-}
-#line 382 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-void
-__go_send_big ( ChanType *t , Hchan* c , byte* v )
-{
-chansend ( t , c , v , true , runtime_getcallerpc ( &t ) ) ;
-}
-#line 390 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-void
-__go_receive ( ChanType *t , Hchan* c , byte* v )
-{
-chanrecv ( t , c , v , true , nil ) ;
-}
-#line 396 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-_Bool runtime_chanrecv2 ( ChanType *t , Hchan* c , byte* v )
-__asm__ ( GOSYM_PREFIX "runtime.chanrecv2" ) ;
-#line 399 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-_Bool
-runtime_chanrecv2 ( ChanType *t , Hchan* c , byte* v )
-{
-bool received = false;
-#line 404 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-chanrecv ( t , c , v , true , &received ) ;
-return received;
-}
-bool runtime_selectnbsend(ChanType* t, Hchan* c, byte* elem) __asm__ (GOSYM_PREFIX "runtime.selectnbsend");
-bool runtime_selectnbsend(ChanType* t, Hchan* c, byte* elem)
-{
- bool selected;
-#line 425 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- selected = chansend(t, c, elem, false, runtime_getcallerpc(&t));
-return selected;
-}
-bool runtime_selectnbrecv(ChanType* t, byte* elem, Hchan* c) __asm__ (GOSYM_PREFIX "runtime.selectnbrecv");
-bool runtime_selectnbrecv(ChanType* t, byte* elem, Hchan* c)
-{
- bool selected;
-#line 446 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- selected = chanrecv(t, c, elem, false, nil);
-return selected;
-}
-bool runtime_selectnbrecv2(ChanType* t, byte* elem, bool* received, Hchan* c) __asm__ (GOSYM_PREFIX "runtime.selectnbrecv2");
-bool runtime_selectnbrecv2(ChanType* t, byte* elem, bool* received, Hchan* c)
-{
- bool selected;
-#line 467 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- bool r;
-
- selected = chanrecv(t, c, elem, false, received == nil ? nil : &r);
- if(received != nil)
- *received = r;
-return selected;
-}
-bool reflect_chansend(ChanType* t, Hchan* c, byte* elem, bool nb) __asm__ (GOSYM_PREFIX "reflect.chansend");
-bool reflect_chansend(ChanType* t, Hchan* c, byte* elem, bool nb)
-{
- bool selected;
-#line 475 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- selected = chansend(t, c, elem, !nb, runtime_getcallerpc(&t));
-return selected;
-}
-struct reflect_chanrecv_ret {
- bool selected;
- bool received;
-};
-struct reflect_chanrecv_ret reflect_chanrecv(ChanType* t, Hchan* c, bool nb, byte* elem) __asm__ (GOSYM_PREFIX "reflect.chanrecv");
-struct reflect_chanrecv_ret reflect_chanrecv(ChanType* t, Hchan* c, bool nb, byte* elem)
-{
- bool selected;
- bool received;
-#line 479 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- received = false;
- selected = chanrecv(t, c, elem, !nb, &received);
- {
- struct reflect_chanrecv_ret __ret;
- __ret.selected = selected;
- __ret.received = received;
- return __ret;
- }
-}
-
-#line 484 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static Select* newselect ( int32 ) ;
-byte* runtime_newselect(int32 size) __asm__ (GOSYM_PREFIX "runtime.newselect");
-byte* runtime_newselect(int32 size)
-{
- byte* sel;
-#line 486 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- sel = (byte*)newselect(size);
-return sel;
-}
-
-#line 490 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static Select*
-newselect ( int32 size )
-{
-int32 n;
-Select *sel;
-#line 496 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-n = 0;
-if ( size > 1 )
-n = size-1;
-#line 504 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sel = runtime_mal ( sizeof ( *sel ) +
-n*sizeof ( sel->scase[0] ) +
-size*sizeof ( sel->lockorder[0] ) +
-size*sizeof ( sel->pollorder[0] ) ) ;
-#line 509 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sel->tcase = size;
-sel->ncase = 0;
-sel->lockorder = ( void* ) ( sel->scase + size ) ;
-sel->pollorder = ( void* ) ( sel->lockorder + size ) ;
-#line 514 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "newselect s=%p size=%d\n" , sel , size ) ;
-return sel;
-}
-#line 520 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void selectsend ( Select *sel , Hchan *c , int index , void *elem ) ;
-void runtime_selectsend(Select* sel, Hchan* c, byte* elem, int32 index) __asm__ (GOSYM_PREFIX "runtime.selectsend");
-void runtime_selectsend(Select* sel, Hchan* c, byte* elem, int32 index)
-{
-#line 522 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- // nil cases do not compete
- if(c != nil)
- selectsend(sel, c, index, elem);
-}
-
-#line 528 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-selectsend ( Select *sel , Hchan *c , int index , void *elem )
-{
-int32 i;
-Scase *cas;
-#line 534 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-i = sel->ncase;
-if ( i >= sel->tcase )
-runtime_throw ( "selectsend: too many cases" ) ;
-sel->ncase = i+1;
-cas = &sel->scase[i];
-#line 540 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-cas->index = index;
-cas->chan = c;
-cas->kind = CaseSend;
-cas->sg.elem = elem;
-#line 545 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "selectsend s=%p index=%d chan=%p\n" ,
-sel , cas->index , cas->chan ) ;
-}
-#line 551 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void selectrecv ( Select *sel , Hchan *c , int index , void *elem , bool* ) ;
-void runtime_selectrecv(Select* sel, Hchan* c, byte* elem, int32 index) __asm__ (GOSYM_PREFIX "runtime.selectrecv");
-void runtime_selectrecv(Select* sel, Hchan* c, byte* elem, int32 index)
-{
-#line 553 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- // nil cases do not compete
- if(c != nil)
- selectrecv(sel, c, index, elem, nil);
-}
-void runtime_selectrecv2(Select* sel, Hchan* c, byte* elem, bool* received, int32 index) __asm__ (GOSYM_PREFIX "runtime.selectrecv2");
-void runtime_selectrecv2(Select* sel, Hchan* c, byte* elem, bool* received, int32 index)
-{
-#line 559 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- // nil cases do not compete
- if(c != nil)
- selectrecv(sel, c, index, elem, received);
-}
-
-#line 565 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-selectrecv ( Select *sel , Hchan *c , int index , void *elem , bool *received )
-{
-int32 i;
-Scase *cas;
-#line 571 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-i = sel->ncase;
-if ( i >= sel->tcase )
-runtime_throw ( "selectrecv: too many cases" ) ;
-sel->ncase = i+1;
-cas = &sel->scase[i];
-cas->index = index;
-cas->chan = c;
-#line 579 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-cas->kind = CaseRecv;
-cas->sg.elem = elem;
-cas->receivedp = received;
-#line 583 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "selectrecv s=%p index=%d chan=%p\n" ,
-sel , cas->index , cas->chan ) ;
-}
-#line 589 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void selectdefault ( Select* , int ) ;
-void runtime_selectdefault(Select* sel, int32 index) __asm__ (GOSYM_PREFIX "runtime.selectdefault");
-void runtime_selectdefault(Select* sel, int32 index)
-{
-#line 591 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- selectdefault(sel, index);
-}
-
-#line 595 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-selectdefault ( Select *sel , int32 index )
-{
-int32 i;
-Scase *cas;
-#line 601 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-i = sel->ncase;
-if ( i >= sel->tcase )
-runtime_throw ( "selectdefault: too many cases" ) ;
-sel->ncase = i+1;
-cas = &sel->scase[i];
-cas->index = index;
-cas->chan = nil;
-#line 609 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-cas->kind = CaseDefault;
-#line 611 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "selectdefault s=%p index=%d\n" ,
-sel , cas->index ) ;
-}
-#line 616 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-sellock ( Select *sel )
-{
-uint32 i;
-Hchan *c , *c0;
-#line 622 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-c = nil;
-for ( i=0; i<sel->ncase; i++ ) {
-c0 = sel->lockorder[i];
-if ( c0 && c0 != c ) {
-c = sel->lockorder[i];
-runtime_lock ( c ) ;
-}
-}
-}
-#line 632 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-selunlock ( Select *sel )
-{
-int32 i , n , r;
-Hchan *c;
-#line 646 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-n = ( int32 ) sel->ncase;
-r = 0;
-#line 649 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( n>0 && sel->lockorder[0] == nil )
-r = 1;
-for ( i = n-1; i >= r; i-- ) {
-c = sel->lockorder[i];
-if ( i>0 && sel->lockorder[i-1] == c )
-continue;
-runtime_unlock ( c ) ;
-}
-}
-#line 659 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static bool
-selparkcommit ( G *gp , void *sel )
-{
-USED ( gp ) ;
-selunlock ( sel ) ;
-return true;
-}
-void runtime_block() __asm__ (GOSYM_PREFIX "runtime.block");
-void runtime_block()
-{
-#line 667 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- runtime_park(nil, nil, "select (no cases)"); // forever
-}
-
-#line 671 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static int selectgo ( Select** ) ;
-int32 runtime_selectgo(Select* sel) __asm__ (GOSYM_PREFIX "runtime.selectgo");
-int32 runtime_selectgo(Select* sel)
-{
- int32 ret;
-#line 675 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- return selectgo(&sel);
-return ret;
-}
-
-#line 679 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static int
-selectgo ( Select **selp )
-{
-Select *sel;
-uint32 o , i , j , k , done;
-int64 t0;
-Scase *cas , *dfl;
-Hchan *c;
-SudoG *sg;
-G *gp;
-int index;
-G *g;
-#line 692 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sel = *selp;
-if ( runtime_gcwaiting ( ) )
-runtime_gosched ( ) ;
-#line 696 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "select: sel=%p\n" , sel ) ;
-#line 699 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-g = runtime_g ( ) ;
-#line 701 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-t0 = 0;
-if ( runtime_blockprofilerate > 0 ) {
-t0 = runtime_cputicks ( ) ;
-for ( i=0; i<sel->ncase; i++ )
-sel->scase[i].sg.releasetime = -1;
-}
-#line 717 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-for ( i=0; i<sel->ncase; i++ )
-sel->pollorder[i] = i;
-for ( i=1; i<sel->ncase; i++ ) {
-o = sel->pollorder[i];
-j = runtime_fastrand1 ( ) % ( i+1 ) ;
-sel->pollorder[i] = sel->pollorder[j];
-sel->pollorder[j] = o;
-}
-#line 728 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-for ( i=0; i<sel->ncase; i++ ) {
-j = i;
-c = sel->scase[j].chan;
-while ( j > 0 && sel->lockorder[k= ( j-1 ) /2] < c ) {
-sel->lockorder[j] = sel->lockorder[k];
-j = k;
-}
-sel->lockorder[j] = c;
-}
-for ( i=sel->ncase; i-->0; ) {
-c = sel->lockorder[i];
-sel->lockorder[i] = sel->lockorder[0];
-j = 0;
-for ( ;; ) {
-k = j*2+1;
-if ( k >= i )
-break;
-if ( k+1 < i && sel->lockorder[k] < sel->lockorder[k+1] )
-k++;
-if ( c < sel->lockorder[k] ) {
-sel->lockorder[j] = sel->lockorder[k];
-j = k;
-continue;
-}
-break;
-}
-sel->lockorder[j] = c;
-}
-#line 763 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sellock ( sel ) ;
-#line 765 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-loop:
-#line 767 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-dfl = nil;
-for ( i=0; i<sel->ncase; i++ ) {
-o = sel->pollorder[i];
-cas = &sel->scase[o];
-c = cas->chan;
-#line 773 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-switch ( cas->kind ) {
-case CaseRecv:
-if ( c->dataqsiz > 0 ) {
-if ( c->qcount > 0 )
-goto asyncrecv;
-} else {
-sg = dequeue ( &c->sendq ) ;
-if ( sg != nil )
-goto syncrecv;
-}
-if ( c->closed )
-goto rclose;
-break;
-#line 787 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-case CaseSend:
-if ( raceenabled )
-runtime_racereadpc ( c , runtime_selectgo , chansend ) ;
-if ( c->closed )
-goto sclose;
-if ( c->dataqsiz > 0 ) {
-if ( c->qcount < c->dataqsiz )
-goto asyncsend;
-} else {
-sg = dequeue ( &c->recvq ) ;
-if ( sg != nil )
-goto syncsend;
-}
-break;
-#line 802 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-case CaseDefault:
-dfl = cas;
-break;
-}
-}
-#line 808 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( dfl != nil ) {
-selunlock ( sel ) ;
-cas = dfl;
-goto retc;
-}
-#line 816 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-done = 0;
-for ( i=0; i<sel->ncase; i++ ) {
-o = sel->pollorder[i];
-cas = &sel->scase[o];
-c = cas->chan;
-sg = &cas->sg;
-sg->g = g;
-sg->selectdone = &done;
-#line 825 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-switch ( cas->kind ) {
-case CaseRecv:
-enqueue ( &c->recvq , sg ) ;
-break;
-#line 830 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-case CaseSend:
-enqueue ( &c->sendq , sg ) ;
-break;
-}
-}
-#line 836 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-g->param = nil;
-runtime_park ( selparkcommit , sel , "select" ) ;
-#line 839 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sellock ( sel ) ;
-sg = g->param;
-#line 844 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-for ( i=0; i<sel->ncase; i++ ) {
-cas = &sel->scase[i];
-if ( cas != ( Scase* ) sg ) {
-c = cas->chan;
-if ( cas->kind == CaseSend )
-dequeueg ( &c->sendq ) ;
-else
-dequeueg ( &c->recvq ) ;
-}
-}
-#line 855 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( sg == nil )
-goto loop;
-#line 858 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-cas = ( Scase* ) sg;
-c = cas->chan;
-#line 861 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c->dataqsiz > 0 )
-runtime_throw ( "selectgo: shouldn't happen" ) ;
-#line 864 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( debug )
-runtime_printf ( "wait-return: sel=%p c=%p cas=%p kind=%d\n" ,
-sel , c , cas , cas->kind ) ;
-#line 868 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( cas->kind == CaseRecv ) {
-if ( cas->receivedp != nil )
-*cas->receivedp = true;
-}
-#line 873 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-if ( cas->kind == CaseRecv && cas->sg.elem != nil )
-runtime_racewriteobjectpc ( cas->sg.elem , c->elemtype , selectgo , chanrecv ) ;
-else if ( cas->kind == CaseSend )
-runtime_racereadobjectpc ( cas->sg.elem , c->elemtype , selectgo , chansend ) ;
-}
-#line 880 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-selunlock ( sel ) ;
-goto retc;
-#line 883 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-asyncrecv:
-#line 885 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-if ( cas->sg.elem != nil )
-runtime_racewriteobjectpc ( cas->sg.elem , c->elemtype , selectgo , chanrecv ) ;
-runtime_raceacquire ( chanbuf ( c , c->recvx ) ) ;
-}
-if ( cas->receivedp != nil )
-*cas->receivedp = true;
-if ( cas->sg.elem != nil )
-runtime_memmove ( cas->sg.elem , chanbuf ( c , c->recvx ) , c->elemsize ) ;
-runtime_memclr ( chanbuf ( c , c->recvx ) , c->elemsize ) ;
-if ( ++c->recvx == c->dataqsiz )
-c->recvx = 0;
-c->qcount--;
-sg = dequeue ( &c->sendq ) ;
-if ( sg != nil ) {
-gp = sg->g;
-selunlock ( sel ) ;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-} else {
-selunlock ( sel ) ;
-}
-goto retc;
-#line 910 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-asyncsend:
-#line 912 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-runtime_racerelease ( chanbuf ( c , c->sendx ) ) ;
-runtime_racereadobjectpc ( cas->sg.elem , c->elemtype , selectgo , chansend ) ;
-}
-runtime_memmove ( chanbuf ( c , c->sendx ) , cas->sg.elem , c->elemsize ) ;
-if ( ++c->sendx == c->dataqsiz )
-c->sendx = 0;
-c->qcount++;
-sg = dequeue ( &c->recvq ) ;
-if ( sg != nil ) {
-gp = sg->g;
-selunlock ( sel ) ;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-} else {
-selunlock ( sel ) ;
-}
-goto retc;
-#line 932 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-syncrecv:
-#line 934 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-if ( cas->sg.elem != nil )
-runtime_racewriteobjectpc ( cas->sg.elem , c->elemtype , selectgo , chanrecv ) ;
-racesync ( c , sg ) ;
-}
-selunlock ( sel ) ;
-if ( debug )
-runtime_printf ( "syncrecv: sel=%p c=%p o=%d\n" , sel , c , o ) ;
-if ( cas->receivedp != nil )
-*cas->receivedp = true;
-if ( cas->sg.elem != nil )
-runtime_memmove ( cas->sg.elem , sg->elem , c->elemsize ) ;
-gp = sg->g;
-gp->param = sg;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-goto retc;
-#line 953 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-rclose:
-#line 955 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-selunlock ( sel ) ;
-if ( cas->receivedp != nil )
-*cas->receivedp = false;
-if ( cas->sg.elem != nil )
-runtime_memclr ( cas->sg.elem , c->elemsize ) ;
-if ( raceenabled )
-runtime_raceacquire ( c ) ;
-goto retc;
-#line 964 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-syncsend:
-#line 966 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-runtime_racereadobjectpc ( cas->sg.elem , c->elemtype , selectgo , chansend ) ;
-racesync ( c , sg ) ;
-}
-selunlock ( sel ) ;
-if ( debug )
-runtime_printf ( "syncsend: sel=%p c=%p o=%d\n" , sel , c , o ) ;
-if ( sg->elem != nil )
-runtime_memmove ( sg->elem , cas->sg.elem , c->elemsize ) ;
-gp = sg->g;
-gp->param = sg;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-#line 981 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-retc:
-#line 983 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-index = cas->index;
-if ( cas->sg.releasetime > 0 )
-runtime_blockevent ( cas->sg.releasetime - t0 , 2 ) ;
-runtime_free ( sel ) ;
-return index;
-#line 989 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-sclose:
-#line 991 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-selunlock ( sel ) ;
-runtime_panicstring ( "send on closed channel" ) ;
-return 0;
-}
-#line 997 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-typedef struct runtimeSelect runtimeSelect;
-struct runtimeSelect
-{
-uintptr dir;
-ChanType *typ;
-Hchan *ch;
-byte *val;
-} ;
-#line 1007 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-enum SelectDir {
-SelectSend = 1 ,
-SelectRecv ,
-SelectDefault ,
-} ;
-struct reflect_rselect_ret {
- intgo chosen;
- bool recvOK;
-};
-struct reflect_rselect_ret reflect_rselect(Slice cases) __asm__ (GOSYM_PREFIX "reflect.rselect");
-struct reflect_rselect_ret reflect_rselect(Slice cases)
-{
- intgo chosen;
- bool recvOK;
-#line 1013 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- int32 i;
- Select *sel;
- runtimeSelect* rcase, *rc;
-
- chosen = -1;
- recvOK = false;
-
- rcase = (runtimeSelect*)cases.__values;
-
- sel = newselect(cases.__count);
- for(i=0; i<cases.__count; i++) {
- rc = &rcase[i];
- switch(rc->dir) {
- case SelectDefault:
- selectdefault(sel, i);
- break;
- case SelectSend:
- if(rc->ch == nil)
- break;
- selectsend(sel, rc->ch, i, rc->val);
- break;
- case SelectRecv:
- if(rc->ch == nil)
- break;
- selectrecv(sel, rc->ch, i, rc->val, &recvOK);
- break;
- }
- }
-
- chosen = (intgo)(uintptr)selectgo(&sel);
- {
- struct reflect_rselect_ret __ret;
- __ret.chosen = chosen;
- __ret.recvOK = recvOK;
- return __ret;
- }
-}
-
-#line 1046 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void closechan ( Hchan *c , void *pc ) ;
-void runtime_closechan(Hchan* c) __asm__ (GOSYM_PREFIX "runtime.closechan");
-void runtime_closechan(Hchan* c)
-{
-#line 1048 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- closechan(c, runtime_getcallerpc(&c));
-}
-void reflect_chanclose(Hchan* c) __asm__ (GOSYM_PREFIX "reflect.chanclose");
-void reflect_chanclose(Hchan* c)
-{
-#line 1052 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- closechan(c, runtime_getcallerpc(&c));
-}
-
-#line 1056 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-closechan ( Hchan *c , void *pc )
-{
-SudoG *sg;
-G* gp;
-#line 1062 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( c == nil )
-runtime_panicstring ( "close of nil channel" ) ;
-#line 1065 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( runtime_gcwaiting ( ) )
-runtime_gosched ( ) ;
-#line 1068 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_lock ( c ) ;
-if ( c->closed ) {
-runtime_unlock ( c ) ;
-runtime_panicstring ( "close of closed channel" ) ;
-}
-#line 1074 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( raceenabled ) {
-runtime_racewritepc ( c , pc , runtime_closechan ) ;
-runtime_racerelease ( c ) ;
-}
-#line 1079 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-c->closed = true;
-#line 1082 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-for ( ;; ) {
-sg = dequeue ( &c->recvq ) ;
-if ( sg == nil )
-break;
-gp = sg->g;
-gp->param = nil;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-}
-#line 1094 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-for ( ;; ) {
-sg = dequeue ( &c->sendq ) ;
-if ( sg == nil )
-break;
-gp = sg->g;
-gp->param = nil;
-if ( sg->releasetime )
-sg->releasetime = runtime_cputicks ( ) ;
-runtime_ready ( gp ) ;
-}
-#line 1105 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-runtime_unlock ( c ) ;
-}
-#line 1108 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-void
-__go_builtin_close ( Hchan *c )
-{
-runtime_closechan ( c ) ;
-}
-intgo reflect_chanlen(Hchan* c) __asm__ (GOSYM_PREFIX "reflect.chanlen");
-intgo reflect_chanlen(Hchan* c)
-{
- intgo len;
-#line 1114 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- if(c == nil)
- len = 0;
- else
- len = c->qcount;
-return len;
-}
-
-#line 1121 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-intgo
-__go_chan_len ( Hchan *c )
-{
-return reflect_chanlen ( c ) ;
-}
-intgo reflect_chancap(Hchan* c) __asm__ (GOSYM_PREFIX "reflect.chancap");
-intgo reflect_chancap(Hchan* c)
-{
- intgo cap;
-#line 1127 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-
- if(c == nil)
- cap = 0;
- else
- cap = c->dataqsiz;
-return cap;
-}
-
-#line 1134 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-intgo
-__go_chan_cap ( Hchan *c )
-{
-return reflect_chancap ( c ) ;
-}
-#line 1140 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static SudoG*
-dequeue ( WaitQ *q )
-{
-SudoG *sgp;
-#line 1145 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-loop:
-sgp = q->first;
-if ( sgp == nil )
-return nil;
-q->first = sgp->link;
-#line 1152 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( sgp->selectdone != nil ) {
-#line 1154 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-if ( *sgp->selectdone != 0 || !runtime_cas ( sgp->selectdone , 0 , 1 ) )
-goto loop;
-}
-#line 1158 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-return sgp;
-}
-#line 1161 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-dequeueg ( WaitQ *q )
-{
-SudoG **l , *sgp , *prevsgp;
-G *g;
-#line 1167 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-g = runtime_g ( ) ;
-prevsgp = nil;
-for ( l=&q->first; ( sgp=*l ) != nil; l=&sgp->link , prevsgp=sgp ) {
-if ( sgp->g == g ) {
-*l = sgp->link;
-if ( q->last == sgp )
-q->last = prevsgp;
-break;
-}
-}
-}
-#line 1179 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-enqueue ( WaitQ *q , SudoG *sgp )
-{
-sgp->link = nil;
-if ( q->first == nil ) {
-q->first = sgp;
-q->last = sgp;
-return;
-}
-q->last->link = sgp;
-q->last = sgp;
-}
-#line 1192 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/chan.goc"
-static void
-racesync ( Hchan *c , SudoG *sg )
-{
-runtime_racerelease ( chanbuf ( c , 0 ) ) ;
-runtime_raceacquireg ( sg->g , chanbuf ( c , 0 ) ) ;
-runtime_racereleaseg ( sg->g , chanbuf ( c , 0 ) ) ;
-runtime_raceacquire ( chanbuf ( c , 0 ) ) ;
-} \ No newline at end of file
diff --git a/libgo/runtime/cpuprof.c b/libgo/runtime/cpuprof.c
deleted file mode 100644
index 3398a92ea82..00000000000
--- a/libgo/runtime/cpuprof.c
+++ /dev/null
@@ -1,350 +0,0 @@
-// AUTO-GENERATED by autogen.sh; DO NOT EDIT
-
-#include "runtime.h"
-#include "arch.h"
-#include "malloc.h"
-#include "array.h"
-
-#line 57 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-typedef struct __go_open_array Slice;
-#define array __values
-#define len __count
-#define cap __capacity
-#line 62 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-enum
-{
-HashSize = 1<<10 ,
-LogSize = 1<<17 ,
-Assoc = 4 ,
-MaxStack = 64 ,
-} ;
-#line 70 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-typedef struct Profile Profile;
-typedef struct Bucket Bucket;
-typedef struct Entry Entry;
-#line 74 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-struct Entry {
-uintptr count;
-uintptr depth;
-uintptr stack[MaxStack];
-} ;
-#line 80 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-struct Bucket {
-Entry entry[Assoc];
-} ;
-#line 84 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-struct Profile {
-bool on;
-Note wait;
-uintptr count;
-uintptr evicts;
-uintptr lost;
-uintptr totallost;
-#line 93 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-Bucket hash[HashSize];
-#line 98 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-uintptr log[2][LogSize/2];
-uintptr nlog;
-int32 toggle;
-uint32 handoff;
-#line 106 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-uint32 wtoggle;
-bool wholding;
-bool flushing;
-bool eod_sent;
-} ;
-#line 112 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static Lock lk;
-static Profile *prof;
-#line 115 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static void tick ( uintptr* , int32 ) ;
-static void add ( Profile* , uintptr* , int32 ) ;
-static bool evict ( Profile* , Entry* ) ;
-static bool flushlog ( Profile* ) ;
-#line 120 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static uintptr eod[3] = { 0 , 1 , 0 } ;
-#line 125 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static void
-LostProfileData ( void )
-{
-}
-#line 130 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-extern void runtime_SetCPUProfileRate ( intgo )
-__asm__ ( GOSYM_PREFIX "runtime.SetCPUProfileRate" ) ;
-#line 135 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-void
-runtime_SetCPUProfileRate ( intgo hz )
-{
-uintptr *p;
-uintptr n;
-#line 142 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( hz < 0 )
-hz = 0;
-if ( hz > 1000000 )
-hz = 1000000;
-#line 147 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-runtime_lock ( &lk ) ;
-if ( hz > 0 ) {
-if ( prof == nil ) {
-prof = runtime_SysAlloc ( sizeof *prof , &mstats.other_sys ) ;
-if ( prof == nil ) {
-runtime_printf ( "runtime: cpu profiling cannot allocate memory\n" ) ;
-runtime_unlock ( &lk ) ;
-return;
-}
-}
-if ( prof->on || prof->handoff != 0 ) {
-runtime_printf ( "runtime: cannot set cpu profile rate until previous profile has finished.\n" ) ;
-runtime_unlock ( &lk ) ;
-return;
-}
-#line 163 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-prof->on = true;
-p = prof->log[0];
-#line 167 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-*p++ = 0;
-*p++ = 3;
-*p++ = 0;
-*p++ = 1000000 / hz;
-*p++ = 0;
-prof->nlog = p - prof->log[0];
-prof->toggle = 0;
-prof->wholding = false;
-prof->wtoggle = 0;
-prof->flushing = false;
-prof->eod_sent = false;
-runtime_noteclear ( &prof->wait ) ;
-#line 180 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-runtime_setcpuprofilerate ( tick , hz ) ;
-} else if ( prof != nil && prof->on ) {
-runtime_setcpuprofilerate ( nil , 0 ) ;
-prof->on = false;
-#line 187 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-for ( ;; ) {
-n = prof->handoff;
-if ( n&0x80000000 )
-runtime_printf ( "runtime: setcpuprofile(off) twice" ) ;
-if ( runtime_cas ( &prof->handoff , n , n|0x80000000 ) )
-break;
-}
-if ( n == 0 ) {
-#line 196 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-runtime_notewakeup ( &prof->wait ) ;
-}
-}
-runtime_unlock ( &lk ) ;
-}
-#line 202 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static void
-tick ( uintptr *pc , int32 n )
-{
-add ( prof , pc , n ) ;
-}
-#line 213 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static void
-add ( Profile *p , uintptr *pc , int32 n )
-{
-int32 i , j;
-uintptr h , x;
-Bucket *b;
-Entry *e;
-#line 221 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( n > MaxStack )
-n = MaxStack;
-#line 225 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-h = 0;
-for ( i=0; i<n; i++ ) {
-h = h<<8 | ( h>> ( 8* ( sizeof ( h ) -1 ) ) ) ;
-x = pc[i];
-h += x*31 + x*7 + x*3;
-}
-p->count++;
-#line 234 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-b = &p->hash[h%HashSize];
-for ( i=0; i<Assoc; i++ ) {
-e = &b->entry[i];
-if ( e->depth != ( uintptr ) n )
-continue;
-for ( j=0; j<n; j++ )
-if ( e->stack[j] != pc[j] )
-goto ContinueAssoc;
-e->count++;
-return;
-ContinueAssoc:;
-}
-#line 248 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-e = &b->entry[0];
-for ( i=1; i<Assoc; i++ )
-if ( b->entry[i].count < e->count )
-e = &b->entry[i];
-if ( e->count > 0 ) {
-if ( !evict ( p , e ) ) {
-#line 255 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-p->lost++;
-p->totallost++;
-return;
-}
-p->evicts++;
-}
-#line 263 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-e->depth = n;
-e->count = 1;
-for ( i=0; i<n; i++ )
-e->stack[i] = pc[i];
-}
-#line 275 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static bool
-evict ( Profile *p , Entry *e )
-{
-int32 i , d , nslot;
-uintptr *log , *q;
-#line 281 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-d = e->depth;
-nslot = d+2;
-log = p->log[p->toggle];
-if ( p->nlog+nslot > nelem ( p->log[0] ) ) {
-if ( !flushlog ( p ) )
-return false;
-log = p->log[p->toggle];
-}
-#line 290 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-q = log+p->nlog;
-*q++ = e->count;
-*q++ = d;
-for ( i=0; i<d; i++ )
-*q++ = e->stack[i];
-p->nlog = q - log;
-e->count = 0;
-return true;
-}
-#line 304 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-static bool
-flushlog ( Profile *p )
-{
-uintptr *log , *q;
-#line 309 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( !runtime_cas ( &p->handoff , 0 , p->nlog ) )
-return false;
-runtime_notewakeup ( &p->wait ) ;
-#line 313 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-p->toggle = 1 - p->toggle;
-log = p->log[p->toggle];
-q = log;
-if ( p->lost > 0 ) {
-*q++ = p->lost;
-*q++ = 1;
-*q++ = ( uintptr ) LostProfileData;
-}
-p->nlog = q - log;
-return true;
-}
-#line 327 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-Slice
-getprofile ( Profile *p )
-{
-uint32 i , j , n;
-Slice ret;
-Bucket *b;
-Entry *e;
-#line 335 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-ret.array = nil;
-ret.len = 0;
-ret.cap = 0;
-#line 339 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( p == nil )
-return ret;
-#line 342 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( p->wholding ) {
-#line 345 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-for ( ;; ) {
-n = p->handoff;
-if ( n == 0 ) {
-runtime_printf ( "runtime: phase error during cpu profile handoff\n" ) ;
-return ret;
-}
-if ( n & 0x80000000 ) {
-p->wtoggle = 1 - p->wtoggle;
-p->wholding = false;
-p->flushing = true;
-goto flush;
-}
-if ( runtime_cas ( &p->handoff , n , 0 ) )
-break;
-}
-p->wtoggle = 1 - p->wtoggle;
-p->wholding = false;
-}
-#line 364 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( p->flushing )
-goto flush;
-#line 367 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( !p->on && p->handoff == 0 )
-return ret;
-#line 371 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-runtime_notetsleepg ( &p->wait , -1 ) ;
-runtime_noteclear ( &p->wait ) ;
-#line 374 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-n = p->handoff;
-if ( n == 0 ) {
-runtime_printf ( "runtime: phase error during cpu profile wait\n" ) ;
-return ret;
-}
-if ( n == 0x80000000 ) {
-p->flushing = true;
-goto flush;
-}
-n &= ~0x80000000;
-#line 386 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-p->wholding = true;
-#line 388 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-ret.array = ( byte* ) p->log[p->wtoggle];
-ret.len = n*sizeof ( uintptr ) ;
-ret.cap = ret.len;
-return ret;
-#line 393 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-flush:
-#line 398 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-for ( i=0; i<HashSize; i++ ) {
-b = &p->hash[i];
-for ( j=0; j<Assoc; j++ ) {
-e = &b->entry[j];
-if ( e->count > 0 && !evict ( p , e ) ) {
-#line 404 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-goto breakflush;
-}
-}
-}
-breakflush:
-#line 411 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( p->nlog > 0 ) {
-#line 414 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-ret.array = ( byte* ) p->log[p->toggle];
-ret.len = p->nlog*sizeof ( uintptr ) ;
-ret.cap = ret.len;
-p->nlog = 0;
-return ret;
-}
-#line 422 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-if ( !p->eod_sent ) {
-#line 425 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-p->eod_sent = true;
-ret.array = ( byte* ) eod;
-ret.len = sizeof eod;
-ret.cap = ret.len;
-return ret;
-}
-#line 433 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-p->flushing = false;
-if ( !runtime_cas ( &p->handoff , p->handoff , 0 ) )
-runtime_printf ( "runtime: profile flush racing with something\n" ) ;
-return ret;
-}
-Slice runtime_CPUProfile() __asm__ (GOSYM_PREFIX "runtime.CPUProfile");
-Slice runtime_CPUProfile()
-{
- Slice ret;
-#line 441 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/cpuprof.goc"
-
- ret = getprofile(prof);
-return ret;
-}
diff --git a/libgo/runtime/lfstack.c b/libgo/runtime/lfstack.c
deleted file mode 100644
index cefe7b8fb38..00000000000
--- a/libgo/runtime/lfstack.c
+++ /dev/null
@@ -1,76 +0,0 @@
-// AUTO-GENERATED by autogen.sh; DO NOT EDIT
-
-#include "runtime.h"
-#include "arch.h"
-#if __SIZEOF_POINTER__ == 8
-# define PTR_BITS 47
-#else
-# define PTR_BITS 32
-#endif
-#define PTR_MASK ((1ull<<PTR_BITS)-1)
-#define CNT_MASK (0ull-1)
-#if __SIZEOF_POINTER__ == 8 && (defined(__sparc__) || (defined(__sun__) && defined(__amd64__)))
-#undef PTR_BITS
-#undef CNT_MASK
-#undef PTR_MASK
-#define PTR_BITS 0
-#define CNT_MASK 7
-#define PTR_MASK ((0ull-1)<<3)
-#endif
-
-#line 33 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-void
-runtime_lfstackpush ( uint64 *head , LFNode *node )
-{
-uint64 old , new;
-#line 38 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-if ( ( uintptr ) node != ( ( uintptr ) node&PTR_MASK ) ) {
-runtime_printf ( "p=%p\n" , node ) ;
-runtime_throw ( "runtime_lfstackpush: invalid pointer" ) ;
-}
-#line 43 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-node->pushcnt++;
-new = ( uint64 ) ( uintptr ) node| ( ( ( uint64 ) node->pushcnt&CNT_MASK ) <<PTR_BITS ) ;
-for ( ;; ) {
-old = runtime_atomicload64 ( head ) ;
-node->next = ( LFNode* ) ( uintptr ) ( old&PTR_MASK ) ;
-if ( runtime_cas64 ( head , old , new ) )
-break;
-}
-}
-#line 53 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-LFNode*
-runtime_lfstackpop ( uint64 *head )
-{
-LFNode *node , *node2;
-uint64 old , new;
-#line 59 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-for ( ;; ) {
-old = runtime_atomicload64 ( head ) ;
-if ( old == 0 )
-return nil;
-node = ( LFNode* ) ( uintptr ) ( old&PTR_MASK ) ;
-node2 = runtime_atomicloadp ( &node->next ) ;
-new = 0;
-if ( node2 != nil )
-new = ( uint64 ) ( uintptr ) node2| ( ( ( uint64 ) node2->pushcnt&CNT_MASK ) <<PTR_BITS ) ;
-if ( runtime_cas64 ( head , old , new ) )
-return node;
-}
-}
-void runtime_lfstackpush_go(uint64* head, LFNode* node) __asm__ (GOSYM_PREFIX "runtime.lfstackpush_go");
-void runtime_lfstackpush_go(uint64* head, LFNode* node)
-{
-#line 73 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-
- runtime_lfstackpush(head, node);
-}
-LFNode* runtime_lfstackpop_go(uint64* head) __asm__ (GOSYM_PREFIX "runtime.lfstackpop_go");
-LFNode* runtime_lfstackpop_go(uint64* head)
-{
- LFNode* node;
-#line 77 "../../../trunk/libgo/runtime/../../../trunk/libgo/runtime/lfstack.goc"
-
- node = runtime_lfstackpop(head);
-return node;
-}