Patchwork libgo patch committed: Update to current library

login
register
mail settings
Submitter Ian Taylor
Date Dec. 12, 2012, 11:13 p.m.
Message ID <mcry5h2dftv.fsf@google.com>
Download mbox | patch
Permalink /patch/205683/
State New
Headers show

Comments

Ian Taylor - Dec. 12, 2012, 11:13 p.m.
I've updated libgo to the current master Go library sources.  As usual
this e-mail only includes patches to files that are substantially
specific to gccgo.  The bulk of the patch is available from the
repository or from the master Go repository.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
Rainer Orth - Dec. 17, 2012, 2:49 p.m.
Ian Lance Taylor <iant@google.com> writes:

> I've updated libgo to the current master Go library sources.  As usual
> this e-mail only includes patches to files that are substantially
> specific to gccgo.  The bulk of the patch is available from the
> repository or from the master Go repository.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

This patch broke Solaris bootstrap:

/vol/gcc/src/hg/trunk/local/libgo/go/log/syslog/syslog_libc.go:17:9: error: incompatible type for return value 1 (incompatible type for method 'writeString' (different number of parameters))
  return libcConn(0), nil
         ^

	Rainer
Ian Taylor - Dec. 17, 2012, 9:08 p.m.
On Mon, Dec 17, 2012 at 6:49 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Ian Lance Taylor <iant@google.com> writes:
>
>> I've updated libgo to the current master Go library sources.  As usual
>> this e-mail only includes patches to files that are substantially
>> specific to gccgo.  The bulk of the patch is available from the
>> repository or from the master Go repository.  Bootstrapped and ran Go
>> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.
>
> This patch broke Solaris bootstrap:
>
> /vol/gcc/src/hg/trunk/local/libgo/go/log/syslog/syslog_libc.go:17:9: error: incompatible type for return value 1 (incompatible type for method 'writeString' (different number of parameters))
>   return libcConn(0), nil
>          ^

Sorry about that.  This patch should fix the build.  I have not yet
tested whether it passes the tests.  Bootstrapped on
x86_64-unknown-linux-gnu, which proves nothing since the file is not
used on GNU/Linux.  Committed to mainline.

Ian
Rainer Orth - Dec. 19, 2012, 2:04 p.m.
Hi Ian,

> Sorry about that.  This patch should fix the build.  I have not yet

it does, thanks.

> tested whether it passes the tests.  Bootstrapped on
> x86_64-unknown-linux-gnu, which proves nothing since the file is not
> used on GNU/Linux.  Committed to mainline.

I've tried it on i386-pc-solaris2.10, and it passes the log/syslog test
even with -test.short=false.  On the other hand, I wonder how the
message formatting interoperates with Solaris syslog: the libc function
adds an ID field since at least Solaris 8, something like

Oct  8 16:53:11 luole xntpd[244]: [ID 204180 daemon.info] synchronisation lost

	Rainer

Patch

diff -r ddfa689e6405 libgo/MERGE
--- a/libgo/MERGE	Wed Dec 05 20:09:59 2012 -0800
+++ b/libgo/MERGE	Wed Dec 12 15:03:42 2012 -0800
@@ -1,4 +1,4 @@ 
-a070de932857
+c031aa767edf
 
 The first line of this file holds the Mercurial revision number of the
 last merge done from the master library sources.
diff -r ddfa689e6405 libgo/Makefile.am
--- a/libgo/Makefile.am	Wed Dec 05 20:09:59 2012 -0800
+++ b/libgo/Makefile.am	Wed Dec 12 15:03:42 2012 -0800
@@ -221,6 +221,7 @@ 
 toolexeclibgoexpdir = $(toolexeclibgodir)/exp
 
 toolexeclibgoexp_DATA = \
+	exp/cookiejar.gox \
 	exp/ebnf.gox \
 	exp/html.gox \
 	$(exp_inotify_gox) \
@@ -251,6 +252,7 @@ 
 	go/ast.gox \
 	go/build.gox \
 	go/doc.gox \
+	go/format.gox \
 	go/parser.gox \
 	go/printer.gox \
 	go/scanner.gox \
@@ -1194,6 +1196,9 @@ 
 	go/encoding/xml/typeinfo.go \
 	go/encoding/xml/xml.go
 
+go_exp_cookiejar_files = \
+	go/exp/cookiejar/jar.go \
+	go/exp/cookiejar/storage.go
 go_exp_ebnf_files = \
 	go/exp/ebnf/ebnf.go \
 	go/exp/ebnf/parser.go
@@ -1284,6 +1289,8 @@ 
 	go/go/doc/filter.go \
 	go/go/doc/reader.go \
 	go/go/doc/synopsis.go
+go_go_format_files = \
+	go/go/format/format.go
 go_go_parser_files = \
 	go/go/parser/interface.go \
 	go/go/parser/parser.go
@@ -1384,6 +1391,7 @@ 
 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_net_http_files = \
@@ -1456,6 +1464,7 @@ 
 
 go_os_user_files = \
 	go/os/user/user.go \
+	go/os/user/lookup.go \
 	go/os/user/lookup_unix.go
 
 go_path_filepath_files = \
@@ -1822,6 +1831,7 @@ 
 	encoding/json.lo \
 	encoding/pem.lo \
 	encoding/xml.lo \
+	exp/cookiejar.lo \
 	exp/ebnf.lo \
 	exp/html.lo \
 	exp/html/atom.lo \
@@ -1836,6 +1846,7 @@ 
 	go/ast.lo \
 	go/build.lo \
 	go/doc.lo \
+	go/format.lo \
 	go/parser.lo \
 	go/printer.lo \
 	go/scanner.lo \
@@ -2658,6 +2669,15 @@ 
 	@$(CHECK)
 .PHONY: encoding/xml/check
 
+@go_include@ exp/cookiejar.lo.dep
+exp/cookiejar.lo.dep: $(go_exp_cookiejar_files)
+	$(BUILDDEPS)
+exp/cookiejar.lo: $(go_exp_cookiejar_files)
+	$(BUILDPACKAGE)
+exp/cookiejar/check: $(CHECK_DEPS)
+	@$(CHECK)
+.PHONY: exp/cookiejar/check
+
 @go_include@ exp/ebnf.lo.dep
 exp/ebnf.lo.dep: $(go_exp_ebnf_files)
 	$(BUILDDEPS)
@@ -2802,6 +2822,15 @@ 
 	@$(CHECK)
 .PHONY: go/doc/check
 
+@go_include@ go/format.lo.dep
+go/format.lo.dep: $(go_go_format_files)
+	$(BUILDDEPS)
+go/format.lo: $(go_go_format_files)
+	$(BUILDPACKAGE)
+go/format/check: $(CHECK_DEPS)
+	@$(CHECK)
+.PHONY: go/format/check
+
 @go_include@ go/parser.lo.dep
 go/parser.lo.dep: $(go_go_parser_files)
 	$(BUILDDEPS)
@@ -3450,6 +3479,8 @@ 
 encoding/xml.gox: encoding/xml.lo
 	$(BUILDGOX)
 
+exp/cookiejar.gox: exp/cookiejar.lo
+	$(BUILDGOX)
 exp/ebnf.gox: exp/ebnf.lo
 	$(BUILDGOX)
 exp/html.gox: exp/html.lo
@@ -3482,6 +3513,8 @@ 
 	$(BUILDGOX)
 go/doc.gox: go/doc.lo
 	$(BUILDGOX)
+go/format.gox: go/format.lo
+	$(BUILDGOX)
 go/parser.gox: go/parser.lo
 	$(BUILDGOX)
 go/printer.gox: go/printer.lo
@@ -3681,6 +3714,7 @@ 
 	encoding/json/check \
 	encoding/pem/check \
 	encoding/xml/check \
+	exp/cookiejar/check \
 	exp/ebnf/check \
 	exp/html/check \
 	exp/html/atom/check \
@@ -3696,6 +3730,7 @@ 
 	go/ast/check \
 	$(go_build_check_omitted_since_it_calls_6g) \
 	go/doc/check \
+	go/format/check \
 	go/parser/check \
 	go/printer/check \
 	go/scanner/check \
diff -r ddfa689e6405 libgo/runtime/chan.c
--- a/libgo/runtime/chan.c	Wed Dec 05 20:09:59 2012 -0800
+++ b/libgo/runtime/chan.c	Wed Dec 12 15:03:42 2012 -0800
@@ -197,7 +197,7 @@ 
 	runtime_lock(c);
 	// TODO(dvyukov): add similar instrumentation to select.
 	if(raceenabled)
-		runtime_racereadpc(c, pc);
+		runtime_racereadpc(c, pc, runtime_chansend);
 	if(c->closed)
 		goto closed;
 
@@ -1271,7 +1271,7 @@ 
 	}
 
 	if(raceenabled) {
-		runtime_racewritepc(c, runtime_getcallerpc(&c));
+		runtime_racewritepc(c, runtime_getcallerpc(&c), runtime_closechan);
 		runtime_racerelease(c);
 	}
 
diff -r ddfa689e6405 libgo/runtime/mgc0.c
--- a/libgo/runtime/mgc0.c	Wed Dec 05 20:09:59 2012 -0800
+++ b/libgo/runtime/mgc0.c	Wed Dec 12 15:03:42 2012 -0800
@@ -949,6 +949,7 @@ 
 		dumpspan(spanidx);
 	}
 }
+
 void
 runtime_gchelper(void)
 {
@@ -1025,16 +1026,21 @@ 
 	mstats.stacks_sys = stacks_sys;
 }
 
+// Structure of arguments passed to function gc().
+// This allows the arguments to be passed via reflect_call.
+struct gc_args
+{
+	int32 force;
+};
+
+static void gc(struct gc_args *args);
+
 void
 runtime_gc(int32 force)
 {
 	M *m;
-	int64 t0, t1, t2, t3;
-	uint64 heap0, heap1, obj0, obj1;
 	const byte *p;
-	GCStats stats;
-	M *m1;
-	uint32 i;
+	struct gc_args a, *ap;
 
 	// The atomic operations are not atomic if the uint64s
 	// are not aligned on uint64 boundaries. This has been
@@ -1074,12 +1080,37 @@ 
 	if(gcpercent < 0)
 		return;
 
+	// Run gc on a bigger stack to eliminate
+	// a potentially large number of calls to runtime_morestack.
+	// But not when using gccgo.
+	a.force = force;
+	ap = &a;
+	gc(ap);
+
+	if(gctrace > 1 && !force) {
+		a.force = 1;
+		gc(&a);
+	}
+}
+
+static void
+gc(struct gc_args *args)
+{
+	M *m;
+	int64 t0, t1, t2, t3;
+	uint64 heap0, heap1, obj0, obj1;
+	GCStats stats;
+	M *m1;
+	uint32 i;
+
 	runtime_semacquire(&runtime_worldsema);
-	if(!force && mstats.heap_alloc < mstats.next_gc) {
+	if(!args->force && mstats.heap_alloc < mstats.next_gc) {
 		runtime_semrelease(&runtime_worldsema);
 		return;
 	}
 
+	m = runtime_m();
+
 	t0 = runtime_nanotime();
 
 	m->gcing = 1;
@@ -1181,9 +1212,6 @@ 
 	// give the queued finalizers, if any, a chance to run
 	if(finq != nil)
 		runtime_gosched();
-
-	if(gctrace > 1 && !force)
-		runtime_gc(1);
 }
 
 void runtime_ReadMemStats(MStats *)
diff -r ddfa689e6405 libgo/runtime/race.h
--- a/libgo/runtime/race.h	Wed Dec 05 20:09:59 2012 -0800
+++ b/libgo/runtime/race.h	Wed Dec 12 15:03:42 2012 -0800
@@ -20,8 +20,8 @@ 
 void	runtime_racefree(void *p);
 void	runtime_racegostart(int32 goid, void *pc);
 void	runtime_racegoend(int32 goid);
-void	runtime_racewritepc(void *addr, void *pc);
-void	runtime_racereadpc(void *addr, void *pc);
+void	runtime_racewritepc(void *addr, void *callpc, void *pc);
+void	runtime_racereadpc(void *addr, void *callpc, void *pc);
 void	runtime_racefingo(void);
 void	runtime_raceacquire(void *addr);
 void	runtime_raceacquireg(G *gp, void *addr);