libgo: update to 1.8.3 release
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 8 Jun 2017 19:02:12 +0000 (19:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 8 Jun 2017 19:02:12 +0000 (19:02 +0000)
    Reviewed-on: https://go-review.googlesource.com/45150

From-SVN: r249033

gcc/go/gofrontend/MERGE
libgo/MERGE
libgo/VERSION
libgo/go/cmd/go/build.go
libgo/go/crypto/elliptic/elliptic_test.go
libgo/go/database/sql/sql.go
libgo/go/database/sql/sql_test.go
libgo/go/net/http/h2_bundle.go
libgo/go/runtime/malloc.go
libgo/go/runtime/mbitmap.go
libgo/go/runtime/mgc.go

index a30f61a2963b525e9dc85df413b51b61135ffaba..3280bcfe1f88215e8227eb01148f485fb5b47d48 100644 (file)
@@ -1,4 +1,4 @@
-81d9f6d05c2bb92b2b3af02807713b6bed9bf053
+82961ce59e8bb02598d963d2a05b3acca860d9dd
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index a5808db54ff4c4fcb01fae79c808159cd73385c6..ddfb006437b67310fa3c80a7017ae785ef666a0a 100644 (file)
@@ -1,4 +1,4 @@
-a4c18f063b6659079ca2848ca217a0587dabc001
+352996a381701cfa0c16e8de29cbde8f3922182f
 
 The first line of this file holds the git revision number of the
 last merge done from the master library sources.
index dce1d463ba144a2d58ae0d9a336b2796938d8f15..b38ce7712f869ec39d37e47e24643e7149bc9978 100644 (file)
@@ -1 +1 @@
-go1.8.1
+go1.8.3
index f2d11f43f19aab525b0d47d09b15ba35bc1550fd..4b9150583ee7800b5ed06fc994f74ba8886a5fae 100644 (file)
@@ -3133,6 +3133,26 @@ func (b *builder) ccompile(p *Package, outfile string, flags []string, file stri
        desc := p.ImportPath
        output, err := b.runOut(p.Dir, desc, nil, compiler, flags, "-o", outfile, "-c", file)
        if len(output) > 0 {
+               // On FreeBSD 11, when we pass -g to clang 3.8 it
+               // invokes its internal assembler with -dwarf-version=2.
+               // When it sees .section .note.GNU-stack, it warns
+               // "DWARF2 only supports one section per compilation unit".
+               // This warning makes no sense, since the section is empty,
+               // but it confuses people.
+               // We work around the problem by detecting the warning
+               // and dropping -g and trying again.
+               if bytes.Contains(output, []byte("DWARF2 only supports one section per compilation unit")) {
+                       newFlags := make([]string, 0, len(flags))
+                       for _, f := range flags {
+                               if !strings.HasPrefix(f, "-g") {
+                                       newFlags = append(newFlags, f)
+                               }
+                       }
+                       if len(newFlags) < len(flags) {
+                               return b.ccompile(p, outfile, newFlags, file, compiler)
+                       }
+               }
+
                b.showOutput(p.Dir, desc, b.processOutput(output))
                if err != nil {
                        err = errPrintedOutput
index 902c414383753cc4332c461228fb373682dc5ca2..c3e4c17d2509d9485a66888d3709b9350cc5ce5b 100644 (file)
@@ -300,6 +300,29 @@ var p224BaseMultTests = []baseMultTest{
        },
 }
 
+type scalarMultTest struct {
+       k          string
+       xIn, yIn   string
+       xOut, yOut string
+}
+
+var p256MultTests = []scalarMultTest{
+       {
+               "2a265f8bcbdcaf94d58519141e578124cb40d64a501fba9c11847b28965bc737",
+               "023819813ac969847059028ea88a1f30dfbcde03fc791d3a252c6b41211882ea",
+               "f93e4ae433cc12cf2a43fc0ef26400c0e125508224cdb649380f25479148a4ad",
+               "4d4de80f1534850d261075997e3049321a0864082d24a917863366c0724f5ae3",
+               "a22d2b7f7818a3563e0f7a76c9bf0921ac55e06e2e4d11795b233824b1db8cc0",
+       },
+       {
+               "313f72ff9fe811bf573176231b286a3bdb6f1b14e05c40146590727a71c3bccd",
+               "cc11887b2d66cbae8f4d306627192522932146b42f01d3c6f92bd5c8ba739b06",
+               "a2f08a029cd06b46183085bae9248b0ed15b70280c7ef13a457f5af382426031",
+               "831c3f6b5f762d2f461901577af41354ac5f228c2591f84f8a6e51e2e3f17991",
+               "93f90934cd0ef2c698cc471c60a93524e87ab31ca2412252337f364513e43684",
+       },
+}
+
 func TestBaseMult(t *testing.T) {
        p224 := P224()
        for i, e := range p224BaseMultTests {
@@ -379,6 +402,19 @@ func TestP256Mult(t *testing.T) {
                        break
                }
        }
+
+       for i, e := range p256MultTests {
+               x, _ := new(big.Int).SetString(e.xIn, 16)
+               y, _ := new(big.Int).SetString(e.yIn, 16)
+               k, _ := new(big.Int).SetString(e.k, 16)
+               expectedX, _ := new(big.Int).SetString(e.xOut, 16)
+               expectedY, _ := new(big.Int).SetString(e.yOut, 16)
+
+               xx, yy := p256.ScalarMult(x, y, k.Bytes())
+               if xx.Cmp(expectedX) != 0 || yy.Cmp(expectedY) != 0 {
+                       t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, xx, yy, expectedX, expectedY)
+               }
+       }
 }
 
 func TestInfinity(t *testing.T) {
index c016681fca13c305aaea2cbfd6fc0707135c5827..f8a884446e40882a133621885c7563869089b509 100644 (file)
@@ -1955,12 +1955,12 @@ func (s *Stmt) QueryContext(ctx context.Context, args ...interface{}) (*Rows, er
                                rowsi: rowsi,
                                // releaseConn set below
                        }
-                       rows.initContextClose(ctx)
                        s.db.addDep(s, rows)
                        rows.releaseConn = func(err error) {
                                releaseConn(err)
                                s.db.removeDep(s, rows)
                        }
+                       rows.initContextClose(ctx)
                        return rows, nil
                }
 
index 450e5f1f8c961d1c0885a4bc97f3de8bcf26bd44..381aafc86b77c07e7395bcbd7d6d6c722857f8ad 100644 (file)
@@ -322,7 +322,7 @@ func TestQueryContext(t *testing.T) {
        select {
        case <-ctx.Done():
                if err := ctx.Err(); err != context.Canceled {
-                       t.Fatalf("context err = %v; want context.Canceled")
+                       t.Fatalf("context err = %v; want context.Canceled", ctx.Err())
                }
        default:
                t.Fatalf("context err = nil; want context.Canceled")
@@ -413,7 +413,8 @@ func TestTxContextWait(t *testing.T) {
        db := newTestDB(t, "people")
        defer closeDB(t, db)
 
-       ctx, _ := context.WithTimeout(context.Background(), time.Millisecond*15)
+       ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*15)
+       defer cancel()
 
        tx, err := db.BeginTx(ctx, nil)
        if err != nil {
index 25fdf09d92b08301985d8da9d3d72abcd8aebfce..6fbbcd0fc762043010cda0a29afab32bbee0e812 100644 (file)
@@ -1,4 +1,4 @@
-// Code generated by golang.org/x/tools/cmd/bundle.
+// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
 //go:generate bundle -o h2_bundle.go -prefix http2 -underscore golang.org/x/net/http2
 
 // Package http2 implements the HTTP/2 protocol.
@@ -3536,9 +3536,13 @@ func (sc *http2serverConn) serve() {
                sc.idleTimerCh = sc.idleTimer.C
        }
 
-       var gracefulShutdownCh <-chan struct{}
+       var gracefulShutdownCh chan struct{}
        if sc.hs != nil {
-               gracefulShutdownCh = http2h1ServerShutdownChan(sc.hs)
+               ch := http2h1ServerShutdownChan(sc.hs)
+               if ch != nil {
+                       gracefulShutdownCh = make(chan struct{})
+                       go sc.awaitGracefulShutdown(ch, gracefulShutdownCh)
+               }
        }
 
        go sc.readFrames()
@@ -3587,6 +3591,14 @@ func (sc *http2serverConn) serve() {
        }
 }
 
+func (sc *http2serverConn) awaitGracefulShutdown(sharedCh <-chan struct{}, privateCh chan struct{}) {
+       select {
+       case <-sc.doneServing:
+       case <-sharedCh:
+               close(privateCh)
+       }
+}
+
 // readPreface reads the ClientPreface greeting from the peer
 // or returns an error on timeout or an invalid greeting.
 func (sc *http2serverConn) readPreface() error {
@@ -6003,7 +6015,6 @@ func http2commaSeparatedTrailers(req *Request) (string, error) {
        }
        if len(keys) > 0 {
                sort.Strings(keys)
-
                return strings.Join(keys, ","), nil
        }
        return "", nil
index ed2578233fc02692a22b7c0f04a85fc04acf316b..05a69c98aadde8786d004657edc8cb381cf560b5 100644 (file)
@@ -412,10 +412,12 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
                        if p == 0 {
                                return nil
                        }
+                       // p can be just about anywhere in the address
+                       // space, including before arena_end.
                        if p == h.arena_end {
                                h.arena_end = new_end
                                h.arena_reserved = reserved
-                       } else if h.arena_start <= p && p+p_size-h.arena_start-1 <= _MaxArena32 {
+                       } else if h.arena_end < p && p+p_size-h.arena_start-1 <= _MaxArena32 {
                                // Keep everything page-aligned.
                                // Our pages are bigger than hardware pages.
                                h.arena_end = p + p_size
@@ -425,6 +427,16 @@ func (h *mheap) sysAlloc(n uintptr) unsafe.Pointer {
                                h.arena_used = used
                                h.arena_reserved = reserved
                        } else {
+                               // We got a mapping, but it's not
+                               // linear with our current arena, so
+                               // we can't use it.
+                               //
+                               // TODO: Make it possible to allocate
+                               // from this. We can't decrease
+                               // arena_used, but we could introduce
+                               // a new variable for the current
+                               // allocation position.
+
                                // We haven't added this allocation to
                                // the stats, so subtract it from a
                                // fake stat (but avoid underflow).
index 2b00493d43c3172f55b2520764b301868c95e2de..a7ccc650adaf17f49a22a7ba48c3c44a6e0506a9 100644 (file)
@@ -374,6 +374,7 @@ func heapBitsForAddr(addr uintptr) heapBits {
 // heapBitsForSpan returns the heapBits for the span base address base.
 func heapBitsForSpan(base uintptr) (hbits heapBits) {
        if base < mheap_.arena_start || base >= mheap_.arena_used {
+               print("runtime: base ", hex(base), " not in range [", hex(mheap_.arena_start), ",", hex(mheap_.arena_used), ")\n")
                throw("heapBitsForSpan: base out of range")
        }
        return heapBitsForAddr(base)
index f828e7c28f328b4d343c001372955adbf4ac9e0b..5cee12d8b81cae7da393dbc74dc35730c80e294e 100644 (file)
@@ -1908,7 +1908,7 @@ func gchelper() {
                traceGCScanDone()
        }
 
-       nproc := work.nproc // work.nproc can change right after we increment work.ndone
+       nproc := atomic.Load(&work.nproc) // work.nproc can change right after we increment work.ndone
        if atomic.Xadd(&work.ndone, +1) == nproc-1 {
                notewakeup(&work.alldone)
        }