Since fp->symsz includes the size of the header
in the new symbol table format, we were reading
past the end and decoding a few garbage symbols
from data in the pc/line table.
R=rsc, r
CC=golang-dev
https://golang.org/cl/7993043
- convert all formatters that require a *token.FileSet to
consistenly use a *PageInfo as first argument instead
- adjust templates correspondingly
- fix outstanding bug from previous CL 8005044
Going forward, with this change the affected functions have
access to the full page "context" (PageInfo), not just the
respective file set. This will permit better context-dependent
formatting in the future.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7860049
A HMUL node appears in some constant divisions, but
to observe a false negative in race detector the divisor must be
suitably chosen to make sure the only memory access is
done for HMUL.
R=dvyukov
CC=golang-dev
https://golang.org/cl/7935045
For Go 1.1, stop checking the rlimit, because it broke now
that mheap is allocated using SysAlloc. See issue 5049.
R=r
CC=golang-dev
https://golang.org/cl/7741050
The arm gentraceback mishandled frame linkage values pointing
to the assembly return function. This function is special as
its frame size is zero and it contains only one instruction.
These conditions would preserve the frame pointer and result
in an off by one error when unwinding the caller.
Fixes#5124
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8023043
The changes are almost completely self-contained
in the new file linkify.go. The other changes are
minimal and should not disturb the currently
working godoc, in anticipation of Go 1.1.
To disable the feature in case of problems, set
-links=false.
Fixes#2063.
R=adg, r
CC=golang-dev
https://golang.org/cl/7883044
Prevents storm of error messages if something goes wrong.
In the case of issue 5073 the epoll fd was closed by the test.
Update #5073.
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/7966043
This CL avoids test data sharing in repetitive test runs;
e.g., go test net -cpu=1,1,1
R=golang-dev, fullung, bradfitz
CC=golang-dev
https://golang.org/cl/8011043
Handle interface comparison correctly,
add a few more tests, mark more nodes as impossible.
R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7942045
Make the copy directly in the convert switch instead of an extra loop.
Also stops converting nil-[]byte to zero-[]byte when assigning to *interface
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7962044
At some point in the past, I believe the GCD algorithm was setting d to
be negative. The RSA code has been correcting that ever since but, now,
it appears to have changed and the correction isn't needed.
Having d be too large is harmless, it's just a little odd and I
happened to notice.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7948044
Fixes SWIG callbacks. Previously crosscall2 was only
cgo_export_static, despite the use of two #pragma declarations
in runtime/cgo/callbacks.c.
R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7817048
This keeps the logic about how to set the thread-local variables
m and g in code compiled and linked by the gc toolchain,
an important property for upcoming cgo changes.
It's also just a nice cleanup: one less place to update when
these details change.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7560048
The right operand of a && and || is only executed conditionnally,
so the instrumentation must be more careful. In particular
it should not turn nodes assumed to be cheap after walk into
expensive ones.
Update #4228
R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7986043
The ARM implementation of runtime.cgocallback_gofunc diverged
from the calling convention by leaving a word of garbage at
the top of the stack and storing the return PC above the
locals. This change stores the return PC at the top of the
stack and removes the save area above the locals.
Update #5124
This CL fixes first part of the ARM issues and added the unwind test.
R=golang-dev, bradfitz, minux.ma, cshapiro, rsc
CC=golang-dev
https://golang.org/cl/7728045
The edit makes Hypot's description match the form
used in the other routines in this package.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8003046
Adds the new debugging constant 'checkgc'. If its value is non-zero
all calls to mallocgc() from hashmap.c will start a garbage collection.
Fixes#5074.
R=golang-dev, khr
CC=golang-dev, rsc
https://golang.org/cl/7663051
Fixes performance of the current windows network poller
with the new scheduler.
Gives runtime a hint when GetQueuedCompletionStatus() will block.
Fixes#5068.
benchmark old ns/op new ns/op delta
BenchmarkTCP4Persistent 4004000 33906 -99.15%
BenchmarkTCP4Persistent-2 21790 17513 -19.63%
BenchmarkTCP4Persistent-4 44760 34270 -23.44%
BenchmarkTCP4Persistent-6 45280 43000 -5.04%
R=golang-dev, alex.brainman, coocood, rsc
CC=golang-dev
https://golang.org/cl/7612045
This CL updates CL 7511043;
- adds new test cases for both UDPConn and UnixConn,
- makes sure unnamed UnixAddr handling,
- replaces t.Errorf with t.Fatalf in sockname related test cases.
Fixes#3721 (again).
Fixes#3838 (again).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7627048
I'm not sure how to write a test for this. The change in
behaviour is that if you somehow get a SIGBUS signal for an
address >= 0x1000, the program will now crash rather than
calling panic. As far as I know, on x86 GNU/Linux, the only
way to get a SIGBUS (rather than a SIGSEGV) is to set the
stack pointer to an invalid value.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7906045
E.g conversions from numeric types to RawBytes are missing, what makes RawBytes unusable in some cases.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7783046
The GIF89a spec says: "Each image must fit within the
boundaries of the Logical Screen, as defined in the
Logical Screen Descriptor." Also, do not accept
GIFs which have too much data for the image size.
R=nigeltao, jra, r
CC=bradfitz, golang-dev
https://golang.org/cl/7602045
On Darwin and FreeBSD, the mmap syscall return value is returned
unmodified. This means that the return value will either be a
valid address or a positive error number.
Also check return value from mmap in SysReserve - the callers of
SysReserve expect nil to be returned if the allocation failed.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7871043
Rather than just checking for ENOMEM, check for a return value of less
than 4096, so that we catch other errors such as EACCES and EINVAL.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7942043
Saves over 8KB of allocations per new connection.
benchmark old ns/op new ns/op delta
BenchmarkServerFakeConnNoKeepAlive 28777 24927 -13.38%
benchmark old allocs new allocs delta
BenchmarkServerFakeConnNoKeepAlive 52 46 -11.54%
benchmark old bytes new bytes delta
BenchmarkServerFakeConnNoKeepAlive 13716 5286 -61.46%
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7799047
After the revert of revision 9ea9e7e6e0c8
the related revision 76ff7da868c6 must be reverted too.
Fixes#5102.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7961044
If a handler didn't consume all its Request.Body, child.go was
closing the socket while the host was still writing to it,
causing the child to send a RST and the host (at least nginx)
to send an empty response body.
Now, we tell the host we're done with the request/response
first, and then close our input pipe after consuming a bit of
it. Consuming the body fixes the problem, and flushing to the
host first to tell it that we're done increases the chance
that the host cuts off further data to us, meaning we won't
have much to consume.
No new tests, because this package is lacking in tests.
Tested by hand with nginx. See issue for testing details.
Fixes#4183
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7939045
Also adjust the implementation of applyRelocationsAMD64
so that the test added in CL 6848044 still passes.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7686049
XOR key into data 128 bits at a time instead of 64 bits
and pipeline half of state loads. Rotate loop to allow
single-register indexing for state[i].
On a MacBookPro10,2 (Core i5):
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 412 224 -45.63%
BenchmarkRC4_1K 3179 1613 -49.26%
BenchmarkRC4_8K 25223 12545 -50.26%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 310.51 570.42 1.84x
BenchmarkRC4_1K 322.09 634.48 1.97x
BenchmarkRC4_8K 320.97 645.32 2.01x
For comparison, on the same machine, openssl 0.9.8r reports
its rc4 speed as somewhat under 350 MB/s for both 1K and 8K
(it is operating 64 bits at a time).
On an Intel Xeon E5520:
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 418 259 -38.04%
BenchmarkRC4_1K 3200 1884 -41.12%
BenchmarkRC4_8K 25173 14529 -42.28%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 306.04 492.48 1.61x
BenchmarkRC4_1K 319.93 543.26 1.70x
BenchmarkRC4_8K 321.61 557.20 1.73x
For comparison, on the same machine, openssl 1.0.1
reports its rc4 speed as 587 MB/s for 1K and 601 MB/s for 8K.
R=agl
CC=golang-dev
https://golang.org/cl/7865046
gcc generates only attr DW_AT_byte_size for DW_TAG_pointer_type of "void *",
but we used to also generate DW_AT_type pointing to imaginary unspecified
type "void", which confuses some gdb.
This change makes old Apple gdb 6.x (specifically, Apple version gdb-1515)
accepts our binary without issue like this:
(gdb) b 'main.main'
Die: DW_TAG_unspecified_type (abbrev = 10, offset = 47079)
has children: FALSE
attributes:
DW_AT_name (DW_FORM_string) string: "void"
Dwarf Error: Cannot find type of die [in module /Users/minux/go/go2.hg/bin/go]
Special thanks to Russ Cox for pointing out the problem in comment #6 of
CL 7891044.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7744051
CL 7504044 accidentally reverted part of CL 7891044 and 7552045, this CL
bring those part back.
R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/7950045
-- amd64 --
On a MacBookPro10,2 (Core i5):
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 470 421 -10.43%
BenchmarkRC4_1K 3123 3275 +4.87%
BenchmarkRC4_8K 26351 25866 -1.84%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 272.22 303.40 1.11x
BenchmarkRC4_1K 327.80 312.58 0.95x
BenchmarkRC4_8K 307.24 313.00 1.02x
For comparison, on the same machine, openssl 0.9.8r reports
its rc4 speed as somewhat under 350 MB/s for both 1K and 8K.
The Core i5 performance can be boosted another 20%, but only
by making the Xeon performance significantly slower.
On an Intel Xeon E5520:
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 774 417 -46.12%
BenchmarkRC4_1K 6121 3200 -47.72%
BenchmarkRC4_8K 48394 25151 -48.03%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 165.18 306.84 1.86x
BenchmarkRC4_1K 167.28 319.92 1.91x
BenchmarkRC4_8K 167.29 321.89 1.92x
For comparison, on the same machine, openssl 1.0.1
(which uses a different implementation than 0.9.8r)
reports its rc4 speed as 587 MB/s for 1K and 601 MB/s for 8K.
It is using SIMD instructions to do more in parallel.
So there's still some improvement to be had, but even so,
this is almost 2x faster than what it replaced.
-- 386 --
On a MacBookPro10,2 (Core i5):
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 3491 421 -87.94%
BenchmarkRC4_1K 28063 3205 -88.58%
BenchmarkRC4_8K 220392 25228 -88.55%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 36.66 303.81 8.29x
BenchmarkRC4_1K 36.49 319.42 8.75x
BenchmarkRC4_8K 36.73 320.90 8.74x
On an Intel Xeon E5520:
benchmark old ns/op new ns/op delta
BenchmarkRC4_128 2268 524 -76.90%
BenchmarkRC4_1K 18161 4137 -77.22%
BenchmarkRC4_8K 142396 32350 -77.28%
benchmark old MB/s new MB/s speedup
BenchmarkRC4_128 56.42 244.13 4.33x
BenchmarkRC4_1K 56.38 247.46 4.39x
BenchmarkRC4_8K 56.86 250.26 4.40x
R=agl
CC=golang-dev
https://golang.org/cl/7547050
Fixes#5061.
Current code relies on the fact that fd's are automatically removed from epoll set when closed. However, it is not true. Underlying file description is removed from epoll set only when *all* fd's referring to it are closed.
There are 2 bad consequences:
1. Kernel delivers notifications on already closed fd's.
2. The following sequence of events leads to error:
- add fd1 to epoll
- dup fd1 = fd2
- close fd1 (not removed from epoll since we've dup'ed the fd)
- dup fd2 = fd1 (get the same fd as fd1)
- add fd1 to epoll = EEXIST
So, if fd can be potentially dup'ed of fork'ed, it's necessary to explicitly remove the fd from epoll set.
R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7870043
Add missing CLOSUREVAR in switch.
Mark MAKE, string conversion nodes as impossible.
Control statements do not need instrumentation.
Instrument COM and LROT nodes.
Instrument map length.
Update #4228
R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7504047
Hashtable is arranged as an array of
8-entry buckets with chained overflow.
Each bucket has 8 extra hash bits
per key to provide quick lookup within
a bucket. Table is grown incrementally.
Update #3885
Go time drops from 0.51s to 0.34s.
R=r, rsc, m3b, dave, bradfitz, khr, ugorji, remyoudompheng
CC=golang-dev
https://golang.org/cl/7504044
Found this inconsistency from net/http's Server while
debugging Issue 4183
Unfortunately this package lacks testing around this,
or most of child.go. :/
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7735046
Fixes#5085.
{6,8}c/swt.c allocates a third Biobuf in automatic memory which is not terminated at the end of the function. This causes the buffer to be 'in use' when the batexit handler fires, confusing valgrind.
Huge thanks to DMorsing for the diagnosis.
R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7844044
No net package involved. And with ReportAllocs we can see
how much garbage is created per request.
R=adg, dave
CC=golang-dev
https://golang.org/cl/7913044
Fixes build. One part of ../misc/cgo/test appears to be unhappy but this does not cause the build to fail.
R=rsc, r
CC=golang-dev
https://golang.org/cl/7769047
Inserting a key-value pair into a hashmap storing keys or values
indirectly can cause the garbage collector to find the hashmap in
an inconsistent state.
Fixes#5074.
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7913043
While we're here, downgrade DWARF to version 2.
We're not using any version 3 features, and OS X gdb
only supports version 2.
Fixes#3436.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7891044
- A note doesn't have to be in the first
comment of a comment group anymore, and
several notes may appear in the same comment
group (e.g., it is fairly common to have a
TODO(uid) note immediately following another
comment).
- Define a doc.Note type which also contains
note uid and position info.
- Better formatting in godoc output. The position
information is not yet used, but could be used to
locate the note in the source text if desired.
Fixes#4843.
R=r, cnicolaou
CC=gobot, golang-dev
https://golang.org/cl/7496048
On NetBSD tv_sec is already an int64 so no need for a test.
On OpenBSD, semasleep expects a Unix time as argument,
and 1<<30 is in 2004.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7810044
Usually, there is no esc info when inlining, but there will be when generating inlined wrapper functions.
If we don't use this information, we get invalid addresses on the stack.
Fixes#5056.
R=golang-dev, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7850045
The example is the same as the FileServer one, but
it's relevant for both.
Also use strings.TrimPrefix while I'm here.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7598046
Now that revision 0c029965805f is in, it's easy
to guarantee that we never access a driver.Conn
concurrently, per the database/sql/driver contract,
so we can remove this overlarge mutex.
Fixes#3857
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7707047
If LookPath in Command fails, sets a sticky error, and then
StdinPipe, StdoutPipe, or StderrPipe were called, those pipe
fds were never cleaned up.
Fixes#5071
R=golang-dev, rogpeppe
CC=golang-dev
https://golang.org/cl/7799046
The current SysAlloc implementation suffers from a signed vs unsigned
comparision bug. Since the error code from mmap is negated, the
unsigned comparision of v < 4096 is always false on error. Fix this
by switching to the darwin/freebsd/linux mmap model and leave the mmap
return value unmodified.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7870044
Avoids printing it every time we ask a question about the package from
the command line.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7789048
They are making the build die. I want to be able to see that everything else is okay.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7546049
It used to not mark parameters as escaping if only one of the
fields it points to leaks out of the function. This causes
problems when importing from another package.
Fixes#4964.
R=rsc, lvd, dvyukov, daniel.morsing
CC=golang-dev
https://golang.org/cl/7648045
This provides a way to generate core dumps when people need them.
The settings are:
GOTRACEBACK=0 no traceback on panic, just exit
GOTRACEBACK=1 default - traceback on panic, then exit
GOTRACEBACK=2 traceback including runtime frames on panic, then exit
GOTRACEBACK=crash traceback including runtime frames on panic, then crash
Fixes#3257.
R=golang-dev, devon.odell, r, daniel.morsing, ality
CC=golang-dev
https://golang.org/cl/7666044
CL 7799045 relaxed the restriction in cmd/go on ~ in GOPATH
to allow paths with ~ in the middle while continuing to
protect against the common mistake of using GOPATH='~/home'
instead of GOPATH=~/home. Unfortunately go/build still
filters these paths out:
$ GOPATH=/tmp/test~ing go build
test.go:22:2: cannot find package "test" in any of:
/usr/lib/go/test (from $GOROOT)
($GOPATH not set)
So relax the requirement in go/build, too.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7826043
NEGL does a negation of the bottom 32 bits and then zero-extends to 64 bits,
resulting in a negative 32-bit number but a positive 64-bit number.
NEGQ does a full 64-bit negation, so that the result is negative both as
a 32-bit and as a 64-bit number.
This doesn't matter for the functions that are declared to return int32.
It only matters for the ones that return int64 or void* [sic].
This will fix the current incorrect error in the OpenBSD/amd64 build.
The build will still be broken, but it won't report a bogus error.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7536046
The database/sql/driver docs make this promise:
"Conn is a connection to a database. It is not used
concurrently by multiple goroutines."
That promises exists as part of database/sql's overall
goal of making drivers relatively easy to write.
So far this promise has been kept without the use of locks by
being careful in the database/sql package, but sometimes too
careful. (cf. golang.org/issue/3857)
The CL associates a Mutex with each driver.Conn, and with the
interface value progeny thereof. (e.g. each driver.Tx,
driver.Stmt, driver.Rows, driver.Result, etc) Then whenever
those interface values are used, the Locker is locked.
This CL should be a no-op (aside from some new Lock/Unlock
pairs) and doesn't attempt to fix Issue 3857 or Issue 4459,
but should make it much easier in a subsequent CL.
Update #3857
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7803043
Bring net/fd_linux.go back (it was deleted this morning)
because it is still needed for ARM.
Fix a few typos in the runtime reorg.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7759046
thread_GOOS.c becomes os_GOOS.c.
signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c,
but with non-GOARCH-specific code moved into os_GOOS.c.
The actual arch-specific signal handler moves into signal_GOARCH.c
to avoid per-GOOS duplication.
New files signal_GOOS_GOARCH.h provide macros for
accessing fields of the very system-specific signal info structs.
Lots moving, but nothing changing.
This is a preliminarly cleanup so I can work on the signal
handling code to fix some open issues without having to
make each change 13 times.
Tested on Linux and OS X, 386 and amd64.
Will fix Plan 9, Windows, and ARM after the fact if necessary.
(Plan 9 and Windows should be fine; ARM will probably have some typos.)
Net effect: -1081 lines of code.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7565048
The problem is that new network poller can have spurious
rediness notifications. This implementation ensures that
the socket is actually connected.
R=golang-dev, rsc, akumar
CC=golang-dev
https://golang.org/cl/7785043
An earlier CL disallowed ~ anywhere in GOPATH, to avoid
problems with GOPATH='~/home' instead of GOPATH=~/home.
But ~ is only special in the shell at the beginning of each of
the paths in the list, and some paths do have ~ in the middle.
So relax the requirement slightly.
Fixes#4140.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7799045
The new build tag "go1.1" will be satisfied by any Go 1.z release >= 1.1.
In general, the build tag "go1.x" will be satisfied by any Go 1.z release >= 1.x.
What happens when we reach Go 2 is yet to be decided.
The tags "go1" or "go1.0" are missing, because +build tags did not exist
before then, and also because the Go 1.0 releases do not recognize them.
The new -installsuffix flag gives access to the build context's InstallSuffix
(formerly named InstallTag, but not part of Go 1.0), for use in isolating
builds to custom directories. For example -race implies -installsuffix race,
and an AppEngine-specific build might use -tags appengine -installsuffix appengine.
Fixes#4116.
Fixes#4443.
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/7794043
Eliminate false positives when you can tell even without
type information that the literal does not need field tags.
Far too noisy otherwise.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7797043
valgrind complained that under some circumstances,
*nr = *nc
was being called when nr and nc were the same *Node. The suggestion my Rémy was to introduce a tmp node to avoid the potential for aliasing in subnode.
R=remyoudompheng, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7780044
If a fixed size array is passed in as the decode target and the JSON
to decode has extra array elements that are objects, then previously
the decoder would return a "data changing underfoot" error.
Fixes#3717.
R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/7490046
Fixes#4705.
Note that libjpeg will print a warning to stderr if there are many
extraneous bytes, but can be silent if the extraneous bytes can fit
into its int32 bit-buffer for Huffman decoding. I'm guessing that
this is why whatever encoder that produced the image filed for issue
4705 did not realize that they are, strictly speaking, generating an
invalid JPEG. That issue's attached image has two extraneous bytes.
For example, piping the program below into libjpeg's djpeg program
will print an "18 extraneous bytes" warning, even though N == 20.
$ cat main.go
package main
import (
"bytes"
"image"
"image/color"
"image/jpeg"
"os"
)
const N = 20
func main() {
// Encode a 1x1 red image.
m := image.NewRGBA(image.Rect(0, 0, 1, 1))
m.Set(0, 0, color.RGBA{255, 0, 0, 255})
buf := new(bytes.Buffer)
jpeg.Encode(buf, m, nil)
b := buf.Bytes()
// Strip the final "\xff\xd9" EOI marker.
b = b[:len(b)-2]
// Append N dummy 0x80 bytes to the SOS data.
for i := 0; i < N; i++ {
b = append(b, 0x80)
}
// Put back the "\xff\xd9" EOI marker.
b = append(b, 0xff, 0xd9)
os.Stdout.Write(b)
}
$ go run main.go | djpeg /dev/stdin > /tmp/foo.pnm
Corrupt JPEG data: 18 extraneous bytes before marker 0xd9
The resultant /tmp/foo.pnm is a perfectly good 1x1 red image.
R=r
CC=golang-dev
https://golang.org/cl/7750043
With the global redefinition of runtime·open by CL 7543043,
we need to provide a third argument and remove the cast
to the string.
Fixes build on 386 version of Plan 9.
R=khr, rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7644047
Many thanks to Elias Naur for finding this with Valgrind on Linux.
Perhaps this is what is breaking the windows/amd64 builder.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7595044
The parameter list layout function was incorrectly computing the
end of the previous line in cases where a parameter type spanned
multiple lines. As a result, an extra (valid, but not needed)
comma was introduced before the paremeter list's closing parenthesis.
Fixes#4533.
R=rsc
CC=golang-dev
https://golang.org/cl/7674044
This was a bug that didn't manifest itself before CL 7674044;
but with that CL and without this fix, the go/doc tests fail.
(The bug fixed by 7674044 and the bug fixed here cancelled
each other out w/ respect to the go/doc tests).
R=rsc
CC=golang-dev
https://golang.org/cl/7628045
Uses AES hardware instructions on 386/amd64 to implement
a fast hash function. Incorporates a random key to
thwart hash collision DOS attacks.
Depends on CL#7548043 for new assembly instructions.
Update #3885
Helps some by making hashing faster. Go time drops from
0.65s to 0.51s.
R=rsc, r, bradfitz, remyoudompheng, khr, dsymonds, minux.ma, elias.naur
CC=golang-dev
https://golang.org/cl/7543043
If two fields have the same name but different explicit name spaces,
treat as non-conflicting. This allows parsing common XML formats
that have ns1:tag and ns2:tag in the same XML element.
Fixes#4691.
Allow setting the default name space for unadorned tags, by
writing to Decoder.DefaultSpace. This allows turned the job of
parsing common XML formats that have tag and ns2:tag in the
same XML element into the first case by setting DefaultSpace="ns1".
Fixes#3703.
Use name space attributes when decoding.
Attach name space to attributes when encoding.
Could be done with fewer annotations, but semantically correct as is.
Fixes#3526.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7227056
The issue was that scvg is assigned *after* the scavenger goroutine is started,
so when the scavenger calls entersyscall() the g==scvg check can fail.
Fixes#5025.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629045
The problem is that there are lots of dead G's from previous tests,
each dead G consumes 1 stack segment.
Fixes#5034.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7749043
Adds a new reader to filter newlines, which fixes errors seen in the
decoder chunking code. Found additional issues with whitespace handling
after the first padding character.
Fixes#4779.
R=minux.ma, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7311069
The system call takes an int, but the kernel stores it in a uint16.
At least one Linux system sets /proc/sys/net/core/somaxconn
to 262144, which ends up being 0 in the uint16. Avoid being tricked.
FreeBSD sources also store the backlog in a uint16.
Assume the problem is systemic and fix it everywhere.
Fixes#5030.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7480046
The old code just assumed that the only thing
you can embed is a struct. Not true.
Fixes#3803.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7743043
This isn't as bad as it used to be, but add a bit
more detail to close the issue.
Fixes#3359
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7606044
Edit encoding/base64's internals and tests to match encoding/base32.
Properly handling line breaks in padding is left for another CL.
R=dsymonds
CC=golang-dev
https://golang.org/cl/7693044
This is what pprof expects, or else it won't use the program.
And if it doesn't use the program, it gets very bad results.
Fixes#4818.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7728043
We added -I$GOROOT/pkg/$GOOS_$GOARCH in cmd/go
(I think for use by cgo and swig, primarily) but didn't
update cmd/dist. I was testing some other code and
found that my changes built with cmd/go but failed
during the initial bootstrap. Make them match again.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7707044
For expressions where the result type is independent
of the argument types (comparisons, conversions, rhs
of shifts), set the final expression types for those
subtrees early.
This fixes several bugs where incorrect lhs shift
operands where used (say in a comparison), but were
not reported.
Together with the changes listed below this CL fixes
many type-checker bugs.
Also:
- better documented updateExprType
- added larger comment to expr.go explaining
the basic expression checking algorithm
- use latest definition for indices and make
arguments; use the same code to check both
- use the same mechanism for cycle detection
in constant expressions as for variables
(new field Constant.visited)
- more tests for complex and make builtins
- many more and systematic tests for shifts;
moved them into separate testfile
- in the testing code, don't compare the
expected error pattern against itself
(the actual message was always ignored...)
- fix affected error patterns in the test files
- various cleanups along the way
R=adonovan
CC=golang-dev
https://golang.org/cl/7432051
lib9: fix runcmd, removeall, and tempdir functions
cmd/dist: Include run_plan9.c and tempdir_plan9.c
from lib9 for build, and in general consider
file names containing "plan9" for building.
cmd/ld: provide function args for the new functions
from lib9.
R=rsc, rminnich, ality, bradfitz
CC=golang-dev
https://golang.org/cl/7666043
Method calls on interfaces with large stored values
will call the pointer receiver method which may be
a wrapper over a method with value receiver.
This is particularly inefficient for very small bodies.
Inlining the wrapped method body saves a potentially expensive
function call.
benchmark old ns/op new ns/op delta
BenchmarkSortString1K 802295 641387 -20.06%
BenchmarkSortInt1K 359914 238234 -33.81%
BenchmarkSortInt64K 35764226 22803078 -36.24%
Fixes#4707.
R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7214044
This includes a simplified resolvePath function and tests for all normal and abnormal path resolution examples described in RFC 3986, sections 5.4.1 and 5.4.2 [1]. Some of those examples failed before (see http://play.golang.org/p/F0ApSaXniv).
Also, parsing a reference "//foo" now works as expected. It was treated as an absolute path with very weird results (see http://play.golang.org/p/089b-_xoNe).
During path resolution, all dot segments are removed as described by the RFC.
A few existing tests had to be changed because they expected the wrong output.
Fixes#4700.
Fixes#4706.
[1] http://tools.ietf.org/html/rfc3986#section-5.4.1
R=rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/7203059
"go build" and "go install" were mixing stdout and stderr
from the toolchain, then putting it all on stdout. With this
change, it stays mixed, and is sent to stderr. Because
the toolchain does not create output in a clean compile/install,
sending all output to stderr makese more sense.
Also fix test.bash because of "mktemp: too few X's
in template `testgo'" on Linux.
Fixes#4917.
R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/7393073
I guess it would be too much to ask for gcc on my machine to give
the same errors as gcc on the builder machines.
R=ken2
CC=golang-dev
https://golang.org/cl/7686044
This brings Mach-O generation more in line with ELF generation.
Having separate sections for the symtab and pclntab mean that we
can find them that way, instead of using the deprecated debug segments.
(And the host linker will keep separate sections for us, but probably
not the debug segments.)
R=ken2
CC=golang-dev
https://golang.org/cl/7688043
Previously it was evaluated once, so re-using the timeout option
repeatedly would always generate the same deadine.
Also switch to doing just one pass over the options, making
the private interface actually useful.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7608045
myrtle$ go version
go version devel +d533352b414d Sat Mar 09 05:39:15 2013 +0100 netbsd/386
myrtle$ time go test -ldflags -hostobj ../misc/cgo/test
ok _/var/project/GoLang/misc/cgo/test 10.962s
68.63s real 49.60s user 19.06s system
myrtle$ uname -a
NetBSD myrtle.plan9.local 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) i386
R=rsc
CC=golang-dev
https://golang.org/cl/7641047
Update #4929
Regenerated from FreeBSD-9.1 for amd64 and 386, FreeBSD-CURRENT for arm.
R=devon.odell, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7438053
The call to the C function runtime.findnull() requires
that we provide the argument at 0(SP).
R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7559047
The sticking point on 386 has been the "PC relative" relocations
used to point the garbage collection metadata at the type info.
These aren't in the code segment, and I don't trust that the linker
isn't doing something special that would be okay in code but
not when interpreting the pointers as data (for example, a PLT
jump table would be terrible).
Solve the problem in two steps:
1. Handle "PC relative" relocations within a section internally,
so that the external linker never sees them.
2. Move the gcdata and gcbss tables into the rodata section,
where the type information lives, so that the relocations can
be handled internally.
(To answer the obvious question, we make the gc->type
references relative so that they need not be relocated
individually when generating a shared object file.)
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7629043
For better printing, I recently changed Name to return "<unnamed>" for templates
with empty names, but this causes trouble for the many packages that used "" as
the template name, so restore the old behavior.
It's usually printed as a quoted string anyway, so it should be fine.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7577044
Otherwise the next goroutine run on the m
can get inadvertently locked if it executes a cgo call
that turns on the internal lock.
While we're here, fix the cgo panic unwind to
decrement m->ncgo like the non-panic unwind does.
Fixes#4971.
R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/7627043
Before this CL, running
cd misc/cgo/test
go test -c
readelf --dyn-syms test.test | grep cgoexp
turned up many UNDEF symbols corresponding to symbols actually
in the binary but marked only cgo_export_static. Only symbols
marked cgo_export_dynamic should be listed in this mode.
And if the symbol is going to be listed, it should be listed with its
actual address instead of UNDEF.
The Linux dynamic linker didn't care about the seemingly missing
symbols, but the BSD one did.
This CL eliminates the symbols from the dyn-syms table.
R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/7624043
- Introduce MaxAlign constant and use in data layout
and ELF section header.
- Allow up to 16-byte alignment for large objects
(will help Keith's hash changes).
- Emit ELF symbol for .rathole (global /dev/null used by 8c).
- Invoke gcc with -m32/-m64 as appropriate.
- Don't invoke gcc if writing the .o file failed.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7563045
Now the default startup is that the program begins at _rt0_386_$GOOS,
which behaves as if calling main(argc, argv). Main jumps to _rt0_386.
This makes the _rt0_386 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.
386 analogue of https://golang.org/cl/7525043
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7551045
Implement what Chrome calls socket "late binding". See:
https://insouciant.org/tech/connection-management-in-chromium/
In a nutshell, if our HTTP client needs a TCP connection to a
remote host and there's not an idle one available, rather than
kick off a dial and wait for that specific dial, we instead
kick off a dial and wait for either our own dial to finish, or
any other TCP connection to that same host to become
available.
The implementation looks like a classic "Learning Go
Concurrency" slide.
Chrome's commit and numbers:
http://src.chromium.org/viewvc/chrome?view=rev&revision=36230
R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/7587043
Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.
Fixes#4994.
R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043
This CL splits multicast listener tests into two; for IPv4 and
for IPv6. It also removes redundant test inputs and makes sure
that assignment of multicast interface to stablize the tests.
Fixes#4059.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7565043
Move pollServer from fd_unix.go to fd_poll_unix.go.
Add pollServerInit(*NetFD) to allow custom initialization.
Add pollServer.Close(*NetFD) to allow custom finalization.
Move setDeadline() to fd_poll_unix.go to allow custom handling of deadlines.
Move newPollServer() to fd_poll_unix.go to allow custom initialization.
No logical code changes.
The next step will be to turn off fd_poll_unix.go for some platform
(I have changes for darwin/linux) and redirect it into runtime. See:
https://golang.org/cl/7569043/diff/2001/src/pkg/net/fd_poll_runtime.go
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7513045
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
runtime·atomicload(&runtime·sched.nmspinning) +
runtime·atomicload(&runtime·sched.npidle) > 0)
continue;
R=rsc
CC=golang-dev
https://golang.org/cl/7424054
Still to do: non-linux and non-amd64.
It may work on other ELF-based amd64 systems too, but untested.
"go test -ldflags -hostobj $GOROOT/misc/cgo/test" passes.
Much may yet change, but this seems a reasonable checkpoint.
R=iant
CC=golang-dev
https://golang.org/cl/7369057
Ensure that accept/connect respect deadline,
even if the operation can be executed w/o blocking.
Note this changes external behavior, but it makes
it consistent with read/write.
Factor out deadline check into pollServer.PrepareRead/Write,
in preparation for edge triggered pollServer.
Ensure that pollServer.WaitRead/Write are not called concurrently
by adding rio/wio locks around connect/accept.
R=golang-dev, mikioh.mikioh, bradfitz, iant
CC=golang-dev
https://golang.org/cl/7436048
Some IDS somewhere thinks "Go http package" is a virus.
Make it something else for Go 1.1. Dumb but easy.
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/7532043
We can enable/disable type checking with a build tag.
Should simplify cutting the go1.1 distribution free of go/types.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7482045
Now the default startup is that the program begins at _rt0_amd64_$GOOS,
which sets DI = argc, SI = argv and jumps to _rt0_amd64.
This makes the _rt0_amd64 entry match the expected semantics for
the standard C "main" function, which we can now provide for use when
linking against a standard C library.
R=golang-dev, devon.odell, minux.ma
CC=golang-dev
https://golang.org/cl/7525043
Previously the HTTP client's (*Response).Body.Close would try
to keep reading until EOF, hoping to reuse the keep-alive HTTP
connection, but the EOF might never come, or it might take a
long time. Now we immediately close the TCP connection if we
haven't seen EOF.
This shifts the burden onto clients to read their whole response
bodies if they want the advantage of reusing TCP connections.
In the future maybe we could decide on heuristics to read some
number of bytes for some max amount of time before forcefully
closing, but I'd rather not for now.
Statistically, touching this code makes things regress, so I
wouldn't be surprised if this introduces new bugs, but all the
tests pass, and I think the code is simpler now too. Maybe.
Please test your HTTP client code before Go 1.1.
Fixes#3672
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7419050
The only check so far is for self-assignments of the form "expr = expr",
but even that found one instance in the standard library.
R=r, adg, mtj, rsc
CC=golang-dev
https://golang.org/cl/7455048
broke arm garbage collector
traceback_arm fails with a missing pc. It needs CL 7494043.
But that only makes the build break later, this time with
"invalid freelist". Roll back until it can be fixed correctly.
««« original CL description
runtime: restrict stack root scan to locals and arguments
R=rsc
CC=golang-dev
https://golang.org/cl/7301062
»»»
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7493044
On OpenBSD 5.2, calling getsockname on an unbound Unix domain socket
results in a successful syscall, however the AF is unset and the length
is returned as zero. This has been changed to more portable behaviour,
which will be included in the OpenBSD 5.3 release.
For now, work around this by treating a successful getsockname() call
that returns a family of AF_UNSPEC and length of zero as a AF_UNIX
socket.
Makes TestPassFD work on OpenBSD 5.2.
Fixes#4956.
R=golang-dev, minux.ma, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7449046