summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-09 09:26:05 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-09 09:26:05 +0000
commita3b6a257aaf8dc97997ab7a6963e4f98323f8f04 (patch)
tree5aff4b8c013e437ef3b2a38568d0c8a65d1b8cfa /libgo
parent8711ce070c7fd7aaa19a6514032bd91ac9b9d6e3 (diff)
downloadgcc-a3b6a257aaf8dc97997ab7a6963e4f98323f8f04.tar.gz
2011-03-09 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 170812 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@170814 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am19
-rw-r--r--libgo/Makefile.in13
-rw-r--r--libgo/go/net/port_test.go2
-rw-r--r--libgo/go/net/sock.go3
-rw-r--r--libgo/go/os/os_test.go2
-rw-r--r--libgo/runtime/go-go.c23
-rw-r--r--libgo/runtime/go-new-map.c2
-rw-r--r--libgo/runtime/go-new.c2
-rw-r--r--libgo/runtime/thread.c9
-rw-r--r--libgo/syscalls/syscall_solaris_386.go3
-rw-r--r--libgo/syscalls/syscall_uname.go7
-rw-r--r--libgo/syscalls/syscall_unix.go2
12 files changed, 64 insertions, 23 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 814d7ed6132..40786877982 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1201,6 +1201,18 @@ else
syscall_socket_epoll_file =
endif
+# Support for uname.
+if LIBGO_IS_SOLARIS
+if LIBGO_IS_386
+# 32-bit Solaris 2/x86 needs _nuname, handled in syscall_solaris_386.go.
+syscall_uname_file =
+else # !LIBGO_IS_386 && LIBGO_IS_SOLARIS
+syscall_uname_file = syscalls/syscall_uname.go
+endif
+else # !LIBGO_IS_SOLARIS
+syscall_uname_file = syscalls/syscall_uname.go
+endif
+
syscall_arch.go: s-syscall_arch; @true
s-syscall_arch: Makefile
rm -f syscall_arch.go.tmp
@@ -1222,6 +1234,7 @@ go_syscall_files = \
$(syscall_socket_os_file) \
$(syscall_socket_epoll_file) \
$(syscall_syscall_file) \
+ $(syscall_uname_file) \
syscalls/syscall_unix.go \
syscalls/stringbyte.go \
syscalls/syscall_$(GOOS).go \
@@ -2939,13 +2952,13 @@ TEST_PACKAGES = \
fmt/check \
gob/check \
html/check \
- http/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),http/check) \
io/check \
json/check \
log/check \
math/check \
mime/check \
- net/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),net/check) \
netchan/check \
os/check \
patch/check \
@@ -2961,7 +2974,7 @@ TEST_PACKAGES = \
strconv/check \
strings/check \
sync/check \
- syslog/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),syslog/check) \
tabwriter/check \
template/check \
time/check \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 11352cf93d9..46821bad8ad 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -1563,6 +1563,12 @@ go_testing_script_files = \
# Support for epoll.
@LIBGO_IS_LINUX_TRUE@syscall_socket_epoll_file = syscalls/socket_epoll.go
+@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_uname_file = syscalls/syscall_uname.go
+
+# Support for uname.
+# 32-bit Solaris 2/x86 needs _nuname, handled in syscall_solaris_386.go.
+@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@syscall_uname_file =
+@LIBGO_IS_SOLARIS_FALSE@syscall_uname_file = syscalls/syscall_uname.go
go_syscall_files = \
$(syscall_errstr_file) \
$(syscall_errstr_decl_file) \
@@ -1575,6 +1581,7 @@ go_syscall_files = \
$(syscall_socket_os_file) \
$(syscall_socket_epoll_file) \
$(syscall_syscall_file) \
+ $(syscall_uname_file) \
syscalls/syscall_unix.go \
syscalls/stringbyte.go \
syscalls/syscall_$(GOOS).go \
@@ -1811,13 +1818,13 @@ TEST_PACKAGES = \
fmt/check \
gob/check \
html/check \
- http/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),http/check) \
io/check \
json/check \
log/check \
math/check \
mime/check \
- net/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),net/check) \
netchan/check \
os/check \
patch/check \
@@ -1833,7 +1840,7 @@ TEST_PACKAGES = \
strconv/check \
strings/check \
sync/check \
- syslog/check \
+ $(if $(GCCGO_RUN_ALL_TESTS),syslog/check) \
tabwriter/check \
template/check \
time/check \
diff --git a/libgo/go/net/port_test.go b/libgo/go/net/port_test.go
index 1b7eaf2312d..329b169f349 100644
--- a/libgo/go/net/port_test.go
+++ b/libgo/go/net/port_test.go
@@ -27,9 +27,7 @@ var porttests = []portTest{
{"tcp", "smtp", 25, true},
{"tcp", "time", 37, true},
{"tcp", "domain", 53, true},
- {"tcp", "gopher", 70, true},
{"tcp", "finger", 79, true},
- {"tcp", "http", 80, true},
{"udp", "echo", 7, true},
{"udp", "tftp", 69, true},
diff --git a/libgo/go/net/sock.go b/libgo/go/net/sock.go
index 8ad3548add4..5a88ddcbc29 100644
--- a/libgo/go/net/sock.go
+++ b/libgo/go/net/sock.go
@@ -54,6 +54,9 @@ func socket(net string, f, p, t int, la, ra syscall.Sockaddr, toAddr func(syscal
if ra != nil {
e = syscall.Connect(s, ra)
+ for e == syscall.EINTR {
+ e = syscall.Connect(s, ra)
+ }
if e != 0 {
closesocket(s)
return nil, os.Errno(e)
diff --git a/libgo/go/os/os_test.go b/libgo/go/os/os_test.go
index eece3c7af5b..5b577065ad8 100644
--- a/libgo/go/os/os_test.go
+++ b/libgo/go/os/os_test.go
@@ -609,7 +609,7 @@ func TestChdirAndGetwd(t *testing.T) {
}
// These are chosen carefully not to be symlinks on a Mac
// (unlike, say, /var, /etc, and /tmp).
- dirs := []string{"/bin", "/", "/usr/bin"}
+ dirs := []string{"/", "/usr/bin"}
for mode := 0; mode < 2; mode++ {
for _, d := range dirs {
if mode == 0 {
diff --git a/libgo/runtime/go-go.c b/libgo/runtime/go-go.c
index 8c2de2877cf..3d8e9e62908 100644
--- a/libgo/runtime/go-go.c
+++ b/libgo/runtime/go-go.c
@@ -92,25 +92,32 @@ remove_current_thread (void)
if (list_entry->next != NULL)
list_entry->next->prev = list_entry->prev;
+ /* This will look runtime_mheap as needed. */
runtime_MCache_ReleaseAll (mcache);
+ /* This should never deadlock--there shouldn't be any code that
+ holds the runtime_mheap lock when locking __go_thread_ids_lock.
+ We don't want to do this after releasing __go_thread_ids_lock
+ because it will mean that the garbage collector might run, and
+ the garbage collector does not try to lock runtime_mheap in all
+ cases since it knows it is running single-threaded. */
+ runtime_lock (&runtime_mheap);
+ mstats.heap_alloc += mcache->local_alloc;
+ mstats.heap_objects += mcache->local_objects;
+ __builtin_memset (mcache, 0, sizeof (struct MCache));
+ runtime_FixAlloc_Free (&runtime_mheap.cachealloc, mcache);
+ runtime_unlock (&runtime_mheap);
+
/* As soon as we release this look, a GC could run. Since this
thread is no longer on the list, the GC will not find our M
structure, so it could get freed at any time. That means that
- any code from here to thread exit must not assume that the m is
+ any code from here to thread exit must not assume that m is
valid. */
m = NULL;
i = pthread_mutex_unlock (&__go_thread_ids_lock);
__go_assert (i == 0);
- runtime_lock (&runtime_mheap);
- mstats.heap_alloc += mcache->local_alloc;
- mstats.heap_objects += mcache->local_objects;
- __builtin_memset (mcache, 0, sizeof (struct MCache));
- runtime_FixAlloc_Free (&runtime_mheap.cachealloc, mcache);
- runtime_unlock (&runtime_mheap);
-
free (list_entry);
}
diff --git a/libgo/runtime/go-new-map.c b/libgo/runtime/go-new-map.c
index 8ea6c714a11..519f38f788a 100644
--- a/libgo/runtime/go-new-map.c
+++ b/libgo/runtime/go-new-map.c
@@ -85,7 +85,7 @@ __go_map_next_prime (unsigned long n)
{
size_t mid;
- mid = (low + high / 2);
+ mid = (low + high) / 2;
/* Here LOW <= MID < HIGH. */
diff --git a/libgo/runtime/go-new.c b/libgo/runtime/go-new.c
index e673d14fc95..a592174e50f 100644
--- a/libgo/runtime/go-new.c
+++ b/libgo/runtime/go-new.c
@@ -11,7 +11,7 @@
void *
__go_new (size_t size)
{
- return __go_alloc (size);
+ return runtime_mallocgc (size, 0, 1, 1);
}
void *
diff --git a/libgo/runtime/thread.c b/libgo/runtime/thread.c
index b600754f64c..bac3f7dfdc1 100644
--- a/libgo/runtime/thread.c
+++ b/libgo/runtime/thread.c
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include <errno.h>
#include "runtime.h"
#include "go-assert.h"
@@ -32,8 +33,12 @@ static void runtime_lock_full(Lock *l) __attribute__ ((noinline));
static void
runtime_lock_full(Lock *l)
{
- if(sem_wait(&l->sem) != 0)
- runtime_throw("sem_wait failed");
+ for(;;){
+ if(sem_wait(&l->sem) == 0)
+ return;
+ if(errno != EINTR)
+ runtime_throw("sem_wait failed");
+ }
}
void
diff --git a/libgo/syscalls/syscall_solaris_386.go b/libgo/syscalls/syscall_solaris_386.go
index 687722ddc1d..7ff8f5b0740 100644
--- a/libgo/syscalls/syscall_solaris_386.go
+++ b/libgo/syscalls/syscall_solaris_386.go
@@ -15,3 +15,6 @@ func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int __asm__ (
var dummy *byte
const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))
+
+// 32-bit Solaris 2/x86 needs to use _nuname internally, cf. <sys/utsname.h>.
+func libc_uname(buf *Utsname) (errno int) __asm__("_nuname")
diff --git a/libgo/syscalls/syscall_uname.go b/libgo/syscalls/syscall_uname.go
new file mode 100644
index 00000000000..955866c89f1
--- /dev/null
+++ b/libgo/syscalls/syscall_uname.go
@@ -0,0 +1,7 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall
+
+func libc_uname(buf *Utsname) (errno int) __asm__("uname")
diff --git a/libgo/syscalls/syscall_unix.go b/libgo/syscalls/syscall_unix.go
index 408d0b8b7aa..a29b6b54bfb 100644
--- a/libgo/syscalls/syscall_unix.go
+++ b/libgo/syscalls/syscall_unix.go
@@ -15,8 +15,6 @@ const ENONE = 0
func GetErrno() int
func SetErrno(int)
-func libc_uname(buf *Utsname) (errno int) __asm__("uname")
-
func Uname(buf *Utsname) (errno int) {
r := libc_uname(buf)
if r < 0 {