1
0
mirror of https://github.com/golang/go synced 2024-10-04 17:11:21 -06:00
Commit Graph

5666 Commits

Author SHA1 Message Date
Robert Hencke
c55fb521cc flag: failf documentation nit
"standard output" should have been "standard error".  Sorry about that..

R=adg
CC=golang-dev
https://golang.org/cl/4240088
2011-03-08 18:02:07 +11:00
Andrew Gerrand
d2e011d518 http: add test for recently fixed HTTP/1.0 keep-alive issue
R=bradfitzgo, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4235056
2011-03-08 16:12:44 +11:00
Robert Hencke
2a36f9df1c flag: replace fail with failf
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4254061
2011-03-08 15:41:36 +11:00
Russ Cox
4c052844dd gc: fix handling of return values named _
Fixes #1586.

R=ken2
CC=golang-dev
https://golang.org/cl/4244057
2011-03-07 19:36:17 -05:00
Ian Lance Taylor
800217f8c5 net: fix test for Solaris: gopher and http are not in /etc/services.
R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4250063
2011-03-07 15:31:41 -08:00
Ian Lance Taylor
89930bda9d os: adjust test: /bin is a symlink, not a directory, on Solaris.
R=rsc
CC=golang-dev
https://golang.org/cl/4239066
2011-03-07 15:30:51 -08:00
Ian Lance Taylor
6892155ded runtime: remove unused declarations from mgc0.c.
R=rsc
CC=golang-dev
https://golang.org/cl/4252063
2011-03-07 15:30:25 -08:00
Russ Cox
5c2666c18c gc: unsafe.Pointer is not a pointer
Change unsafe.Pointer to be its own kind of
type, instead of making it equivalent to *any.
The change complicates import and export
but avoids the need to find all the places that
operate on pointers but should not operate on
unsafe.Pointer.

Fixes #1566. (a different way)
Fixes #1582.

R=ken2
CC=golang-dev
https://golang.org/cl/4264050
2011-03-07 15:10:01 -05:00
Rob Pike
22c45c558b gob: support GobEncoder for type T when the receiver is *T.
Still to do: **T.

R=rsc
CC=golang-dev
https://golang.org/cl/4247061
2011-03-07 12:08:31 -08:00
Brad Fitzpatrick
2168e6aaf1 http: change Hijacker to return a net.Conn
net.Conn is itself a io.ReadWriteCloser, so
most code should be unaffected.

R=rsc, gburd
CC=golang-dev
https://golang.org/cl/4261052
2011-03-07 12:04:04 -08:00
Russ Cox
792ff38604 http: fix cookie_test
Was only breaking on some dashboard builds because
not all run the network tests.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240086
2011-03-07 14:45:45 -05:00
Robert Griesemer
021b040a1e go/ast, go/parser: populate identifier scopes at parse time
The parser populates all scopes for a given file (except
type-related scopes for structs, interfaces, and methods
of types) at parse time.

A new parser flag, DeclarationErrors, enables error messages
related to declaration errors (as far as it is possible to
provide them).

The resulting AST has all (non-field, non-method) identifiers
resolved that can be resolved w/o doing imports or parsing
missing package files.

The ast.File node contains the (partially complete)
package scope and a list of unresolved global identifiers.

All type-specific data structures have been removed from the AST.

The existing typechecker is functional but needs to be adjusted
(simplified) accordingly. Utility functions to resolve all
identifiers for a package (after handling imports and parsing
all package files) are  missing.

Unrelated changes:
- Rename typechecker/testdata files to that they are not considered
  by gofmt.
- Minor cleanups/simplifications.

Parses all .go files in src and misc without declaration errors.
Runs all tests. Changes do not affect gofmt output.

R=rsc
CC=golang-dev
https://golang.org/cl/4244049
2011-03-07 11:01:23 -08:00
Gustavo Niemeyer
e08f0c18c9 goinstall: handle .c files with gc when cgo isn't used
As a data point, this enables goinstall to handle the standard
syscall package almost unchanged (there's one file with the _bsd
extension, and a .c file which isn't supposed to be compiled in).

R=rsc
CC=golang-dev
https://golang.org/cl/4259057
2011-03-07 12:53:39 -05:00
Russ Cox
02323c0e21 rpc: clean up dregs from June 2010
In June 2010 I accidentally checked in pending
changes to package rpc in a compiler CL:
https://golang.org/cl/1736041

I backed them out by hand in a followup CL:
https://golang.org/cl/1736042

That followup CL missed the lines being deleted
in this CL, spotted by Petar.

hg diff -r 5678:5683 src/cmd/prof/gopprof \
        src/pkg/image/png/reader.go \
        src/pkg/rpc/client.go \
        src/pkg/rpc/jsonrpc/all_test.go \
        src/pkg/rpc/jsonrpc/server.go \
        src/pkg/rpc/server.go \
        test/arm-pass.txt

confirms that these lines in server.go are the
only ones that were missed by the original followup.

Fixes #1583.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4266046
2011-03-07 12:09:00 -05:00
Gustavo Niemeyer
ff40deee62 goinstall: handle .s files with gc
As a data point, with this change goinstall is able to
fully build package big out of the box.

R=rsc
CC=golang-dev
https://golang.org/cl/4264049
2011-03-07 12:08:52 -05:00
Petar Maymounkov
3e042ebb57 http: adapt Cookie code to follow IETF draft
R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4235055
2011-03-07 12:08:39 -05:00
Russ Cox
ad29ef9561 runtime: fix windows/386 build
TBR=brainman
CC=golang-dev
https://golang.org/cl/4237060
2011-03-07 11:48:35 -05:00
Russ Cox
5946e46138 goinstall: fix build
func init runs *after* var declarations

TBR=niemeyer
CC=golang-dev
https://golang.org/cl/4260055
2011-03-07 11:33:26 -05:00
Pascal S. de Kloe
4371e09457 hash: new FNV-1a implementation
R=agl1, rsc
CC=golang-dev
https://golang.org/cl/4257042
2011-03-07 11:11:21 -05:00
Gustavo Niemeyer
70f08b47a0 goinstall: handle $(GOOS) and $(GOARCH) in filenames
This enables goinstall to handle .go and .c files (for cgo)
which are named after the following patterns:

    name_$(GOOS).*
    name_$(GOARCH).*
    name_$(GOOS)_$(GOARCH).*

Files with those names are only included if the $(GOOS) and
$(GOARCH) match the current system.

R=rsc
CC=golang-dev
https://golang.org/cl/4172055
2011-03-07 10:54:53 -05:00
Russ Cox
f9ca3b5d5b runtime: scheduler, cgo reorganization
* Change use of m->g0 stack (aka scheduler stack).
* Provide runtime.mcall(f) to invoke f() on m->g0 stack.
* Replace scheduler loop entry with runtime.mcall(schedule).

Runtime.mcall eliminates the need for fake scheduler states that
exist just to run a bit of code on the m->g0 stack
(Grecovery, Gstackalloc).

The elimination of the scheduler as a loop that stops and
starts using gosave and gogo fixes a bad interaction with the
way cgo uses the m->g0 stack.  Cgo runs external (gcc-compiled)
C functions on that stack, and then when calling back into Go,
it sets m->g0->sched.sp below the added call frames, so that
other uses of m->g0's stack will not interfere with those frames.
Unfortunately, gogo (longjmp) back to the scheduler loop at
this point would end up running scheduler with the lower
sp, which no longer points at a valid stack frame for
a call to scheduler.  If scheduler then wrote any function call
arguments or local variables to where it expected the stack
frame to be, it would overwrite other data on the stack.
I realized this possibility while debugging a problem with
calling complex Go code in a Go -> C -> Go cgo callback.
This wasn't the bug I was looking for, it turns out, but I believe
it is a real bug nonetheless.  Switching to runtime.mcall, which
only adds new frames to the stack and never jumps into
functions running in existing ones, fixes this bug.

* Move cgo-related code out of proc.c into cgocall.c.
* Add very large comment describing cgo call sequences.
* Simpilify, regularize cgo function implementations and names.
* Add test suite as misc/cgo/test.

Now the Go -> C path calls cgocall, which calls asmcgocall,
and the C -> Go path calls cgocallback, which calls cgocallbackg.

The shuffling, which affects mainly the callback case, moves
most of the callback implementation to cgocallback running
on the m->curg stack (not the m->g0 scheduler stack) and
only while accounted for with $GOMAXPROCS (between calls
to exitsyscall and entersyscall).

The previous callback code did not block in startcgocallback's
approximation to exitsyscall, so if, say, the garbage collector
were running, it would still barge in and start doing things
like call malloc.  Similarly endcgocallback's approximation of
entersyscall did not call matchmg to kick off new OS threads
when necessary, which caused the bug in issue 1560.

Fixes #1560.

R=iant
CC=golang-dev
https://golang.org/cl/4253054
2011-03-07 10:37:42 -05:00
Russ Cox
6d6f3381ff io: reimplement Pipe
No known bugs in the current pipe,
but this one is simpler and easier to
understand.

R=iant
CC=golang-dev
https://golang.org/cl/4252057
2011-03-07 10:37:28 -05:00
Robert Hencke
c7ef0fd26b rpc: use httptest.Server for tests
R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4253060
2011-03-07 10:37:10 -05:00
Russ Cox
c4407b7552 http: close after responding to HTTP/1.0 request without Connection: keep-alive
R=adg
CC=golang-dev
https://golang.org/cl/4245065
2011-03-07 00:14:40 -05:00
Alex Brainman
2ae4f356cc doc/codelab/wiki: include into windows build
R=adg, rsc
CC=Joe Poirier, golang-dev
https://golang.org/cl/4257052
2011-03-07 15:48:39 +11:00
Russ Cox
0db312b6a8 http: use Header type consistently
R=bradfitzgo, dsymonds
CC=golang-dev
https://golang.org/cl/4244053
2011-03-06 23:02:29 -05:00
Brad Fitzpatrick
545a1eef6a http: add Hijacker type; remove Hijack from ResponseWriter
The Hijack functionality wasn't removed, but now you have
to test if your ResponseWriter is also a Hijacker:

func ServeHTTP(rw http.ResponseWriter, req *http.Request) {
    if hj, ok := rw.(http.Hijacker); ok {
        hj.Hijack(..)
    }
}

R=rsc
CC=golang-dev
https://golang.org/cl/4245064
2011-03-06 18:59:50 -08:00
Russ Cox
2b4a9603d3 io/ioutil: use filepath.Join, handle trailing / in $TMPDIR
R=niemeyer
CC=golang-dev
https://golang.org/cl/4256057
2011-03-06 21:52:37 -05:00
Alex Brainman
94401f524e path/filepath: disable test on windows to fix build
R=golang-dev, rsc1
CC=golang-dev
https://golang.org/cl/4235054
2011-03-07 12:23:57 +11:00
Brad Fitzpatrick
6193e0ba00 mime/multipart: switch from map to MIMEHeader
R=rsc
CC=golang-dev
https://golang.org/cl/4253058
2011-03-06 15:12:03 -08:00
Gustavo Niemeyer
99686ec789 cgo: fix dwarf type parsing
The recursive algorithm used to parse types in cgo
has a bug related to building the C type representation.

As an example, when the recursion starts at a type *T,
the C type representation won't be known until type T
itself is parsed.  But then, it is possible that type T
references the type **T internally.  The latter
representation is built based on the one of *T, which
started the recursion, so it won't attempt to parse it
again, and will instead use the current representation
value for *T, which is still empty at this point.

This problem was fixed by introducing a simple TypeRepr
type which builds the string representation lazily,
analogous to how the Go type information is built within
the same algorithm.  This way, even if a type
representation is still unknown at some level in the
recursion, representations dependant on it can still
be created correctly.

R=rsc
CC=golang-dev
https://golang.org/cl/4244052
2011-03-06 18:05:57 -05:00
Gustavo Niemeyer
04ca4f8242 path/filepath: new OS-specific path support
The path package now contains only functions which
deal with slashed paths, sensible for any OS when dealing
with network paths or URLs.  OS-specific functionality
has been moved into the new path/filepath package.

This also includes fixes for godoc, goinstall and other
packages which were mixing slashed and OS-specific paths.

R=rsc, gri, mattn, brainman
CC=golang-dev
https://golang.org/cl/4252044
2011-03-06 17:33:23 -05:00
Robert Hencke
ce65b72508 websocket: use httptest.Server for tests
R=rsc
CC=golang-dev
https://golang.org/cl/4266044
2011-03-06 17:05:12 -05:00
Russ Cox
59d2acd2d4 build: remove old cgo files
Cgo changed to write these files into _obj, but some
trees may still have the old ones in the source directory.
They need to be removed during make clean so that
a subsequent build will use the ones in _obj.

R=r, r2
CC=golang-dev
https://golang.org/cl/4254056
2011-03-06 17:04:24 -05:00
Petar Maymounkov
6afe7eba32 http: add cookie support
R=rsc1, mattn, bradfitzwork, pascal, bradfitzgo
CC=golang-dev
https://golang.org/cl/4214042
2011-03-06 15:02:06 -05:00
Devon H. O'Dell
eeb8d00c86 syscall: work around FreeBSD execve kernel bug
FreeBSD's execve implementation has an integer underflow in a bounds test which
causes it to erroneously think the argument list is too long when argv[0] is
longer than interpreter + path.

R=rsc, bradfitz, rsc1
CC=golang-dev
https://golang.org/cl/4259056
2011-03-06 14:57:05 -05:00
Rob Pike
9e25eccf48 gob: clean up getTypeInfo (address a TODO)
also fix a caching bug.

R=rsc
CC=golang-dev
https://golang.org/cl/4261049
2011-03-06 10:50:07 -08:00
Russ Cox
255b538152 http/cgi: skip test if perl or CGI.pm not available
R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4264047
2011-03-06 11:23:47 -05:00
Robert Hencke
ff3ef8a963 fmt: trivial cleanup
R=golang-dev, bradfitzgo
CC=golang-dev
https://golang.org/cl/4235052
2011-03-05 17:55:53 -08:00
Rob Pike
369c48cafb gob: don't send type information about unexported fields.
A change a while back stop sending data for unexported fields
but due to an oversight the type info was being sent also. It's
inconsequential but wrong to do that.

R=rsc, rh
CC=golang-dev
https://golang.org/cl/4252058
2011-03-05 16:05:35 -08:00
Brad Fitzpatrick
bfd3d81b92 httptest: fix docs out-of-sync from earlier renaming
R=rh
CC=golang-dev
https://golang.org/cl/4239060
2011-03-05 15:43:26 -08:00
Brad Fitzpatrick
f88abdad0f httptest: introduce TempServer, clean up tests
This also breaks fs_test into two parts
as the range tests test http's private httpRange
and I had to change the fs_test package from
"http" to "http_test" to use httptest which otherwise
has a cyclic depedency back on http.

Aside: we should start exposing the Range
stuff in the future.

R=rsc
CC=golang-dev
https://golang.org/cl/4261047
2011-03-05 13:51:35 -08:00
Dave Cheney
5f54c807f1 build: avoid calling gomake wrapper in recursive make
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4243058
2011-03-05 14:53:29 -05:00
Petar Maymounkov
5db0a8b9ef http: fixed race condition in persist.go
R=rsc, bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4266042
2011-03-05 14:44:05 -05:00
Russ Cox
7bc90eda69 http: fix, use WriteProxy
Fixes #53.

R=bradfitzgo, bradfitzwork
CC=golang-dev
https://golang.org/cl/4240075
2011-03-05 14:35:15 -05:00
Russ Cox
d044674a0d compress/flate: fix test
The test was checking for a buffer to be empty but
actually racing with the background goroutine that
was emptying it.  Left a comment so that the check
is not reintroduced later.

Fixes #1557.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4248063
2011-03-05 14:35:03 -05:00
Russ Cox
1169559658 cgo: use correct frame size for 0 arguments
Passing a frame size of 1 was causing the cgo callback
to push 1 byte of arguments onto the stack, making
the stack pointer misaligned, which had the effect of
hiding all the pointers on the stack from the garbage
collector.

SWIG only wraps calls to C++ virtual methods, so it
always has at least 1 argument, so SWIG does not need
to be fixed too.

Fixes #1328.

R=iant
CC=golang-dev
https://golang.org/cl/4261046
2011-03-05 14:24:44 -05:00
David Symonds
633df67b66 gc, gopack: add some missing flags to the docs.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4260051
2011-03-04 20:21:26 -08:00
David Symonds
4c30ca067d time: split os-dependent part into sys.go.
R=rsc
CC=golang-dev
https://golang.org/cl/4259051
2011-03-04 19:57:39 -08:00
Rob Pike
9442e9518d gob: enable the GobEncoder and GobDecoder interfaces.
These allow data items to control their own representation.

For now, the implementation requires that the value passed
to Encode and Decode must be exactly the type of the
methods' receiver; it cannot be, for instance, T if the receiver
is of type *T.  This will be fixed in a later CL.

R=rsc
CC=golang-dev
https://golang.org/cl/4235051
2011-03-04 14:18:52 -08:00
Brad Fitzpatrick
99f17aa0b8 http/cgi: skip tests on Windows
The tests require Perl, not commonly installed on Windows.

R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4239057
2011-03-04 14:12:39 -08:00
Russ Cox
e339d27db7 runtime: make printf work on misaligned stack
(Shouldn't happen, but if it does, it's useful to be
able to use printf to debug it.)

R=r
CC=golang-dev
https://golang.org/cl/4250057
2011-03-04 15:42:39 -05:00
Rob Pike
c91daefb24 gob: beginning of support for GobEncoder/GobDecoder interfaces.
This allows a data item that can marshal itself to be transmitted by its
own encoding, enabling some types to be handled that cannot be
normally, plus providing a way to use gobs on data with unexported
fields.

In this CL, the necessary methods are protected by leading _, so only
package gob can use the facilities (in its tests, of course); this
code is not ready for real use yet.  I could be talked into enabling
it for experimentation, though.  The main drawback is that the
methods must be implemented by the actual type passed through,
not by an indirection from it.  For instance, if *T implements
GobEncoder, you must send a *T, not a T.  This will be addressed
in due course.

Also there is improved commentary and a couple of unrelated
minor bug fixes.

R=rsc
CC=golang-dev
https://golang.org/cl/4243056
2011-03-04 12:25:18 -08:00
Brad Fitzpatrick
7b563be516 http: rename ClientTransport to Transport
http.Transport looks nicer, and ServerTransport
doesn't make much sense anyway.

R=rsc
CC=golang-dev
https://golang.org/cl/4239056
2011-03-04 11:41:57 -08:00
Brad Fitzpatrick
da679db0f1 http: add packages http/cgi and http/httptest
R=rsc, adg, jnw, bradfitzwork
CC=golang-dev
https://golang.org/cl/4247048
2011-03-04 10:55:47 -08:00
Robert Griesemer
21f3080d0f gofmt: exclude test file that is not legal Go
R=r, r2
CC=golang-dev
https://golang.org/cl/4252053
2011-03-03 16:52:56 -08:00
Brad Fitzpatrick
38a105e48a http: change localhost URL; maybe fix Windows
R=golang-dev, rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4259048
2011-03-03 13:29:31 -08:00
Brad Fitzpatrick
61fd11ef96 http: allow handlers to send non-chunked responses
Currently all http handlers reply to HTTP/1.1 requests with
chunked responses.  This patch allows handlers to opt-out of
that behavior by pre-declaring their Content-Length (which is
then enforced) and unsetting their Transfer-Encoding or
setting it to the "identity" encoding.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/4245058
2011-03-03 12:22:13 -08:00
Russ Cox
9ebe384b71 io/ioutil: add TempDir
It's a little confusing that os.TempDir and ioutil.TempDir have
different meanings.  I don't know what to change the names to,
if anything.  At least they also have different signatures.

R=golang-dev, bradfitzgo, r, gri
CC=golang-dev
https://golang.org/cl/4247051
2011-03-03 14:51:49 -05:00
Roger Peppe
da833474f5 testing: run GC before each benchmark run.
R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055
2011-03-03 11:26:53 -08:00
Roger Peppe
5bd284e868 fmt: make recursive scan more efficient.
Detect when scan is being called recursively and
re-use the same scan state.

On my machine, for a recursion-heavy benchmark, this
results in 44x speed up. This does impose a 4% penalty
on the non-recursive case, which can be removed by
heap-allocating the saved state, at 40% performance penalty
on the recursive case. Either way is fine with me.

R=r
CC=golang-dev
https://golang.org/cl/4253049
2011-03-03 10:43:29 -08:00
Russ Cox
e46acb091f reflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr)
This change makes it possible to take the address of a
struct field or slice element in order to call a method that
requires a pointer receiver.

Existing code that uses the Value.Addr method will have
to change (as gob does in this CL) to call UnsafeAddr instead.

R=r, rog
CC=golang-dev
https://golang.org/cl/4239052
2011-03-03 13:20:17 -05:00
Russ Cox
44fd7573aa gc, ld: reflect support for PtrTo
R=ken2
CC=golang-dev
https://golang.org/cl/4245055
2011-03-03 13:17:54 -05:00
Russ Cox
2d404c4bff fix build (observed in wild, not on dashboard)
TBR=r
CC=golang-dev
https://golang.org/cl/4257054
2011-03-03 11:51:16 -05:00
Adam Langley
e7fa307902 bzip2: speed up decompression.
This borrows a trick from the bzip2 source and effects a decent speed
up when decompressing highly compressed sources. Rather than unshuffle
the BTW block when performing the IBTW, a linked-list is threaded
through the array, in place. This improves cache hit rates.

R=bradfitzgo, bradfitzwork, cw
CC=golang-dev
https://golang.org/cl/4247047
2011-03-03 09:13:06 -05:00
Nigel Tao
7483c6ee3c image: add a decoding test for common file formats.
The test image was converted from doc/video-001.png using the
convert command line tool (ImageMagick 6.5.7-8) at -quality 100.

R=r, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4259047
2011-03-03 20:35:49 +11:00
Rob Pike
68add46af7 unsafe: fix the documentation
Reflection is about Pointer, not uintptr.
Also clarify that Reflect and Unreflect are indirect.

R=rsc
CC=golang-dev
https://golang.org/cl/4254052
2011-03-02 19:39:08 -08:00
Gustavo Niemeyer
daffc2d2ef gc: fix init of packages named main
This change removes the special case which existed
for handling the initalization of the main package,
so that other modules named 'main' get properly
initialized when imported.

Note that gotest of main packages will break in most
cases without this.

R=rsc
CC=golang-dev
https://golang.org/cl/4190050
2011-03-02 16:18:17 -05:00
Dave Cheney
ff1d89d600 runtime: fix unused variable warning
R=rsc
CC=golang-dev
https://golang.org/cl/4188043
2011-03-02 15:29:13 -05:00
Yasuhiro Matsumoto
1a6b1dd0de xml: fix typo in test.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4218042
2011-03-02 15:05:52 -05:00
Roger Peppe
c1fdb6f156 goinstall: protect against malicious filenames.
It was possible to make package run arbitrary
commands when installing if its filenames contained
make metacharacters.

R=rsc, niemeyer
CC=golang-dev
https://golang.org/cl/4248041
2011-03-02 15:04:08 -05:00
Dave Cheney
49a4d7dc39 build: simplify clean.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4257045
2011-03-02 14:57:47 -05:00
Russ Cox
f104a198e4 fix build
TBR=rog
CC=golang-dev
https://golang.org/cl/4259046
2011-03-02 14:52:35 -05:00
Dave Cheney
9a8c079075 build: fix race condition building enam.o
R=golang-dev, rsc
CC=albert.strasheim, golang-dev
https://golang.org/cl/4240055
2011-03-02 14:22:39 -05:00
Roger Peppe
9704d4ec3d cgo: put temporary source files in _obj.
Fixes #1572.
Initially I tried changing things so all object
files get put in _obj, but it's too much - everything
needs changing. Perhaps some other time.

R=rsc
CC=golang-dev
https://golang.org/cl/4237050
2011-03-02 14:22:33 -05:00
Roger Peppe
81bfbe9333 fmt: allow recursive calls to Fscan etc.
Add a new Read method to ScanState so that it
satisfies the io.Reader interface; rename
Getrune and Ungetrune to ReadRune and UnreadRune.
Make sure ReadRune does not read past width restrictions;
remove now-unnecessary Width method from ScanState.
Also make the documentation a little clearer as to
how ReadRune and UnreadRune are used.

R=r, r2
CC=golang-dev
https://golang.org/cl/4240056
2011-03-02 10:54:23 -08:00
Russ Cox
324cc3d040 runtime: record goroutine creation pc and display in traceback
package main

func main() {
        go func() { *(*int)(nil) = 0 }()
        select{}
}

panic: runtime error: invalid memory address or nil pointer dereference

[signal 0xb code=0x1 addr=0x0 pc=0x1c96]

runtime.panic+0xac /Users/rsc/g/go/src/pkg/runtime/proc.c:1083
        runtime.panic(0x11bf0, 0xf8400011f0)
runtime.panicstring+0xa3 /Users/rsc/g/go/src/pkg/runtime/runtime.c:116
        runtime.panicstring(0x29a57, 0x0)
runtime.sigpanic+0x144 /Users/rsc/g/go/src/pkg/runtime/darwin/thread.c:470
        runtime.sigpanic()
main._func_001+0x16 /Users/rsc/g/go/src/pkg/runtime/x.go:188
        main._func_001()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
main.main+0x3d /Users/rsc/g/go/src/pkg/runtime/x.go:4

goroutine 1 [4]:
runtime.gosched+0x77 /Users/rsc/g/go/src/pkg/runtime/proc.c:598
        runtime.gosched()
runtime.block+0x27 /Users/rsc/g/go/src/pkg/runtime/chan.c:680
        runtime.block()
main.main+0x44 /Users/rsc/g/go/src/pkg/runtime/x.go:5
        main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:77
        runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:150
        runtime.goexit()
----- goroutine created by -----
_rt0_amd64+0x8e /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:64

Fixes #1563.

R=r
CC=golang-dev
https://golang.org/cl/4243046
2011-03-02 13:42:02 -05:00
Brad Fitzpatrick
9733f96b47 http: initialize request Header for the transport
Fixes #1558

R=rsc, r, bradfitzwork
CC=golang-dev
https://golang.org/cl/4260042
2011-03-02 10:21:56 -08:00
David Symonds
1d258a554a http: give ParseHTTPVersion a real example.
R=rsc
CC=golang-dev
https://golang.org/cl/4239050
2011-03-02 10:10:12 +11:00
Brad Fitzpatrick
60f193781d http: expose Client's Transport
This is again an intentionally minimal change.

The plan is to keep Client's zero value be a usable
client, with optional fields being added over time
(e.g. cookie manager, redirect policy, auth)

R=rsc
CC=golang-dev
https://golang.org/cl/4239044
2011-03-01 14:07:28 -08:00
Rob Pike
a77744f488 fmt: delete debugging print that crept in to test.
(you'd never see it, but ouch.)
Spotted by Florian Weimer.

R=rsc
CC=golang-dev
https://golang.org/cl/4259044
2011-03-01 13:39:44 -08:00
Rob Pike
2b9ab22732 fmt: make %#p suppress leading 0x
Fixes bug 1567.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4245048
2011-03-01 13:25:52 -08:00
David Symonds
7eaecb8915 http: export parseHTTPVersion.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4244045
2011-03-01 22:38:18 +11:00
Rob Pike
41a23ca08b goyacc: clarify it's package, not binary, that has
conflict and explain that you could put the grammars
in separate packages instead.

I could be talked into rolling back the previous change
and just making a doc change instead, but I'm content
to let it stand.

R=rsc
CC=golang-dev
https://golang.org/cl/4240053
2011-02-28 20:47:52 -08:00
Rob Pike
bb0e7bda35 goyacc: provide -p flag to set prefix for names.
This should allow multiple goyacc grammars to be
compiled into the same binary. There's a chance it
Fixes #1562.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4256044
2011-02-28 17:43:16 -08:00
Dave Cheney
432b4f309b build: convert src/cmd to use make directly and simplify src/make.bash
R=adg, bsiegert, rsc
CC=golang-dev
https://golang.org/cl/4221047
2011-03-01 09:20:32 +11:00
Russ Cox
7da86983a8 gc: bug325 / issue 1566
Fixes #1566.

R=ken2
CC=golang-dev
https://golang.org/cl/4259041
2011-02-28 17:16:44 -05:00
Russ Cox
a3ef19825c build: move $GOBIN ahead of /bin, /usr/bin in build $PATH
Otherwise if there is an installed /usr/bin/6g the build
will use that one instead of the one it builds.

R=r
CC=golang-dev
https://golang.org/cl/4249045
2011-02-28 14:55:27 -05:00
Chris Dollin
b00f7310f3 xml: permit nested directives
Return <!DOCTYPE ...> with nested directives as one big token.

Fixes #1549.

R=niemeyer, rsc
CC=golang-dev
https://golang.org/cl/4216050
2011-02-28 14:09:04 -05:00
Rob Pike
b2efedbf36 template: document the delimiters better
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4248047
2011-02-28 10:27:33 -08:00
Mikio Hara
dd51f3537f syscall: regenerate zerrors_freebsd_amd64.go
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4248043
2011-02-28 10:21:19 -05:00
Russ Cox
582fd17e11 runtime: idle goroutine
This functionality might be used in environments
where programs are limited to a single thread,
to simulate a select-driven network server.  It is
not exposed via the standard runtime API.

R=r, r2
CC=golang-dev
https://golang.org/cl/4254041
2011-02-27 23:32:42 -05:00
Nigel Tao
fdbbb066ed compress/lzw: don't use a closure in NewReader, which avoids having
to move some variables from the stack to the heap.

Sorted benchmark runs on my 2007-era Mac Mini (GOARCH=amd64, GOOS=linux):

Before:
lzw.BenchmarkDecoder        2000        878176 ns/op
lzw.BenchmarkDecoder        2000        878415 ns/op
lzw.BenchmarkDecoder        2000        880352 ns/op
lzw.BenchmarkDecoder        2000        898445 ns/op
lzw.BenchmarkDecoder        2000        901728 ns/op

After:
lzw.BenchmarkDecoder        2000        859065 ns/op
lzw.BenchmarkDecoder        2000        859402 ns/op
lzw.BenchmarkDecoder        2000        860035 ns/op
lzw.BenchmarkDecoder        2000        860555 ns/op
lzw.BenchmarkDecoder        2000        861109 ns/op

The ratio of before/after median times is 1.024.

The runtime.MemStats.Mallocs delta per loop drops from 109 to 104.

R=r, r2, dfc
CC=golang-dev
https://golang.org/cl/4253043
2011-02-26 16:42:49 +11:00
Nigel Tao
5b1d47d105 compress/lzw: fix the stupidity of allocating and zeroing a new buffer
on each loop iteration, yielding a 20x performance improvement.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/4240044
2011-02-26 09:25:29 +11:00
Rob Pike
54f0040723 crypto/openpgp: fix test prints
R=agl, agl1
CC=golang-dev
https://golang.org/cl/4255041
2011-02-25 13:44:37 -08:00
Russ Cox
d1cd829405 runtime: omit breakpoint during terminal panic
again.
CL 4222043 missed this case.

R=brainman, r, r2
CC=golang-dev
https://golang.org/cl/4235043
2011-02-25 15:17:34 -05:00
Russ Cox
c833d2fd94 sync/atomic: make BUG comment godoc-compatible
go/doc wants to see text after BUG(uid): on the same line
in order to treat it as an official bug comment.

R=gri
CC=golang-dev
https://golang.org/cl/4250043
2011-02-25 14:40:36 -05:00
Russ Cox
9ad9742157 runtime: use kernel-supplied cas on linux/arm
Using the kernel-supplied compare-and-swap code
on linux/arm means that runtime doesn't have to care
whether this is GOARM=5 or GOARM=6 anymore.

Fixes #1494.

R=r, r2
CC=golang-dev
https://golang.org/cl/4245043
2011-02-25 14:29:55 -05:00
Russ Cox
12b7875bf2 sync: use sync/atomic
Remove references to custom assembly routines.

R=r, r2
CC=golang-dev
https://golang.org/cl/4241043
2011-02-25 14:29:47 -05:00
Russ Cox
22eab1f5c7 sync/atomic: new package
Fixes #170.

R=gri, iant, r, r2
CC=golang-dev
https://golang.org/cl/4241041
2011-02-25 14:29:36 -05:00
Rob Pike
c54b5d032f gob: make recursive map and slice types work.
Before this fix, types such as
        type T map[string]T
caused infinite recursion in the gob implementation.
Now they just work.

Fixes #1518.

R=rsc
CC=golang-dev
https://golang.org/cl/4230045
2011-02-25 09:45:06 -08:00
Russ Cox
895631770a 8a, 8l: add CMPXCHG8B, XADDB, XADDL, XADDW
R=ken2
CC=golang-dev
https://golang.org/cl/4240041
2011-02-25 01:04:29 -05:00
Russ Cox
96c785de39 5a, 5l: add LDREXD, STREXD
R=ken2
CC=golang-dev
https://golang.org/cl/4239041
2011-02-25 01:03:54 -05:00
Adam Langley
6ca009f58d crypto/openpgp: add package
R=bradfitzgo
CC=golang-dev
https://golang.org/cl/3989052
2011-02-24 20:19:53 -05:00
Robert Griesemer
27ccb41c4a godoc: accept symbolic links as path names provided to -path
When providing addition file systems to godoc via -path, the
path names may be symbolic links. Follow them.

Also: better logging of error and special conditions.

R=r, dsymonds, r2
CC=golang-dev
https://golang.org/cl/4217045
2011-02-24 16:24:51 -08:00
Alex Brainman
176eb49d9c runtime: add empty windows/signals.h file to fix build
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4223049
2011-02-25 11:16:39 +11:00
Nigel Tao
741eab4eb6 compress/lzw: implement an encoder.
R=rsc, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4209043
2011-02-25 09:20:04 +11:00
Russ Cox
8d36a78440 reflect: add pointer word to CommonType
The pointer will eventually let us find *T given T.
This CL just makes room for it, always storing a zero.

R=r, r2
CC=golang-dev
https://golang.org/cl/4221046
2011-02-24 17:11:20 -05:00
Russ Cox
820dc9ff1a runtime: fix signal stack bug
In CL 4188061 I changed malg to allocate the requested
number of bytes n, not n+StackGuard, so that the
allocations would use rounder numbers.

The allocation of the signal stack asks for 32k and
then used g->stackguard as the base, but g->stackguard
is StackGuard bytes above the base.  Previously, asking
for 32k meant getting 32k+StackGuard bytes, so using
g->stackguard as the base was safe.  Now, the actual base
must be computed, so that the signal handler does not
run StackGuard bytes past the top of the stack.

Was causing flakiness mainly in programs that use the
network, because they sometimes write to closed network
connections, causing SIGPIPEs.  Was also causing problems
in the doc/progs test.

Also fix Makefile so that changes to stack.h trigger rebuild.

R=bradfitzgo, r, r2
CC=golang-dev
https://golang.org/cl/4230044
2011-02-24 13:46:44 -08:00
Russ Cox
d94bf76239 ld: weak symbols
A reference to the address of weak.foo resolves at link time
to the address of the symbol foo if foo would end up in the
binary anyway, or to zero if foo would not be in the binary.

For example:

        int xxx = 1;
        int yyy = 2;
        int weak·xxx;
        int weak·yyy;

        void main·main(void) {
                runtime·printf("%p %p %p\n", &xxx, &weak·xxx, &weak·yyy);
        }

prints the same non-nil address twice, then 0 (because yyy is not
referenced so it was dropped from the binary).

This will be used by the reflection tables.

R=iant
CC=golang-dev
https://golang.org/cl/4223044
2011-02-24 16:45:45 -05:00
Russ Cox
4185a9e2b2 http: remove debugging log statement
Issue 1547 is fixed.

R=bradfitzgo, r
CC=golang-dev
https://golang.org/cl/4209045
2011-02-24 14:36:18 -05:00
Robert Griesemer
c9021a1afe godoc: fix writeFileAtomically utility function
If the filename was absolute, writeFileAtomically
used the wrong filename for ioutil.TempFile leading
to non-existent directories and the TempFile would
fail.

R=r, r2
CC=golang-dev
https://golang.org/cl/4224043
2011-02-24 11:13:20 -08:00
Robert Griesemer
11bda7df47 godoc: log errors when reading filter files
R=r, r2
CC=golang-dev
https://golang.org/cl/4230042
2011-02-24 10:22:32 -08:00
Rob Pike
87fe958a49 fmt: stop giving characters to the Scan method of Scanner
when we hit a newline during *scanln routines.

Fixes #1490.

R=rsc
CC=golang-dev
https://golang.org/cl/4209042
2011-02-24 10:14:19 -08:00
Alex Brainman
75fb2f6c82 8l/6l: new -Hwindowsgui flag allows to build windows gui pe
Fixes #1516.

R=rsc, mattn
CC=golang-dev
https://golang.org/cl/4214041
2011-02-24 16:10:30 +11:00
Dave Cheney
a1d95deaaa build: remove unused nacl conditional from make.bash
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4217042
2011-02-24 15:56:53 +11:00
Alex Brainman
162d510d7e net: *netFD.Read to return os.EOF on eof (fixes windows build)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4210041
2011-02-24 10:17:45 +11:00
Brad Fitzpatrick
c7978584c3 http: set method GET on Get() requests
R=adg, bradfitzwork
CC=golang-dev
https://golang.org/cl/4229042
2011-02-23 15:03:30 -08:00
Russ Cox
8b8d5e9e00 build: remove _gcc_main.c during make clean
R=r, r2
CC=golang-dev
https://golang.org/cl/4226043
2011-02-23 15:51:27 -05:00
Russ Cox
b5dfac45ba runtime: always run stackalloc on scheduler stack
Avoids deadlocks like the one below, in which a stack split happened
in order to call lock(&stacks), but then the stack unsplit cannot run
because stacks is now locked.

The only code calling stackalloc that wasn't on a scheduler
stack already was malg, which creates a new goroutine.

runtime.futex+0x23 /home/rsc/g/go/src/pkg/runtime/linux/amd64/sys.s:139
       runtime.futex()
futexsleep+0x50 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:51
       futexsleep(0x5b0188, 0x300000003, 0x100020000, 0x4159e2)
futexlock+0x85 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:119
       futexlock(0x5b0188, 0x5b0188)
runtime.lock+0x56 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:158
       runtime.lock(0x5b0188, 0x7f0d27b4a000)
runtime.stackfree+0x4d /home/rsc/g/go/src/pkg/runtime/malloc.goc:336
       runtime.stackfree(0x7f0d27b4a000, 0x1000, 0x8, 0x7fff37e1e218)
runtime.oldstack+0xa6 /home/rsc/g/go/src/pkg/runtime/proc.c:705
       runtime.oldstack()
runtime.lessstack+0x22 /home/rsc/g/go/src/pkg/runtime/amd64/asm.s:224
       runtime.lessstack()
----- lessstack called from goroutine 2 -----
runtime.lock+0x56 /home/rsc/g/go/src/pkg/runtime/linux/thread.c:158
       runtime.lock(0x5b0188, 0x40a5e2)
runtime.stackalloc+0x55 /home/rsc/g/go/src/pkg/runtime/malloc.c:316
       runtime.stackalloc(0x1000, 0x4055b0)
runtime.malg+0x3d /home/rsc/g/go/src/pkg/runtime/proc.c:803
       runtime.malg(0x1000, 0x40add9)
runtime.newproc1+0x12b /home/rsc/g/go/src/pkg/runtime/proc.c:854
       runtime.newproc1(0xf840027440, 0x7f0d27b49230, 0x0, 0x49f238, 0x40, ...)
runtime.newproc+0x2f /home/rsc/g/go/src/pkg/runtime/proc.c:831
       runtime.newproc(0x0, 0xf840027440, 0xf800000010, 0x44b059)
...

R=r, r2
CC=golang-dev
https://golang.org/cl/4216045
2011-02-23 15:51:20 -05:00
Russ Cox
59ce067da8 runtime: omit breakpoint during terminal panic
A terminal panic (one that prints a stack trace and exits)
has been calling runtime.breakpoint before calling exit,
so that if running under a debugger, the debugger can
take control.  When not running under a debugger, though,
this causes an additional SIGTRAP on Unix and pop-up
dialogs on Windows.

Support for debugging Go programs has gotten good
enough that we can rely on the debugger to set its own
breakpoint on runtime.exit if it wants to look around.

R=r, r2
CC=golang-dev
https://golang.org/cl/4222043
2011-02-23 15:42:13 -05:00
Brad Fitzpatrick
e0a2c5d4b5 http: introduce start of Client and ClientTransport
Much yet to come, but this is a safe first step, introducing
an in-the-future configurable Client object (where policy for
cookies, auth, redirects will live) as well as introducing a
ClientTransport interface for sending requests.

The CL intentionally ignores everything around the creation
and configuration of Clients and merely ports/wraps the old
interfaces to/around Client/ClientTransport.

R=rsc, dsymonds, nigeltao, bradfitzwork
CC=golang-dev
https://golang.org/cl/4182086
2011-02-23 12:20:50 -08:00
Russ Cox
690291a2c0 runtime: pass to signal handler value of g at time of signal
The existing code assumed that signals only arrived
while executing on the goroutine stack (g == m->curg),
not while executing on the scheduler stack (g == m->g0).

Most of the signal handling trampolines correctly saved
and restored g already, but the sighandler C code did not
have access to it.

Some rewriting of assembly to make the various
implementations as similar as possible.

Will need to change Windows too but I don't
understand how sigtramp gets called there.

R=r
CC=golang-dev
https://golang.org/cl/4203042
2011-02-23 14:47:42 -05:00
Russ Cox
4b376ef328 runtime: traceback through active lessstack
With this change, a panic trace due to a signal arriving while
running on the scheduler stack during a lessstack
(a stack unsplit) will trace through the lessstack to show
the state of the goroutine that was unsplitting its stack.

R=r
CC=golang-dev
https://golang.org/cl/4206042
2011-02-23 14:47:22 -05:00
Russ Cox
63c24081a0 5g: fix optimizer bug
same as in issue below, never fixed on ARM

changeset:   5498:3fa1372ca694
user:        Ken Thompson <ken@golang.org>
date:        Thu May 20 17:31:28 2010 -0700

description:
fix issue 798
cannot allocate an audomatic temp
while real registers are allocated.
there is a chance that the automatic
will be allocated to one of the
allocated registers. the fix is to
not registerize such variables.

R=rsc
CC=golang-dev
https://golang.org/cl/1202042

R=ken2
CC=golang-dev
https://golang.org/cl/4226042
2011-02-23 13:21:39 -05:00
Robert Griesemer
9fc0f159c3 sync: make package comment appear
R=rsc
CC=golang-dev
https://golang.org/cl/4220044
2011-02-23 10:12:38 -08:00
Rob Pike
c9b90c9d70 gob: protect against pure recursive types.
There are further changes required for things like
recursive map types.  Recursive struct types work
but the mechanism needs generalization.  The
case handled in this CL is pathological since it
cannot be represented at all by gob, so it should
be handled separately. (Prior to this CL, encode
would recur forever.)

R=rsc
CC=golang-dev
https://golang.org/cl/4206041
2011-02-23 09:49:35 -08:00
Adam Langley
da8e6eec9a compress/bzip2: fix bugs
(Once again, proving that a fuzz tester is the first thing that I
should try.)

R=bradfitzgo
CC=golang-dev
https://golang.org/cl/4227042
2011-02-23 12:02:41 -05:00
Roger Peppe
83da7d15a3 json: use base64 to encode []byte
R=rsc
CC=golang-dev
https://golang.org/cl/4160058
2011-02-23 11:32:29 -05:00
Adam Langley
bf6939829d compress/bzip2: add package.
This code implements bzip2 decompression only.

R=bradfitzgo, r2, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/4176051
2011-02-23 10:23:28 -05:00
Nigel Tao
658447ab66 compress/lzw: implement a decoder.
R=rsc
CC=bsiegert, golang-dev, mpl
https://golang.org/cl/4182081
2011-02-23 20:52:43 +11:00
Petar Maymounkov
b8fa61885a http: introduce Header type, implement with net/textproto
textproto: introduce Header type
websocket: use new interface to access Header

R=rsc, mattn
CC=golang-dev
https://golang.org/cl/4185053
2011-02-23 00:39:25 -05:00
Kyle Consalus
07cc8b9ad2 Make.pkg, doc: Replace references to "-benchmarks" and "-match" with "-test.bench" and "-test.run".
R=r
CC=golang-dev
https://golang.org/cl/4197041
2011-02-22 20:23:21 -08:00
Robert Griesemer
8e4e11506b go/parser: if and switch statements still can have empty init statements
This is a fix for the overly aggressive CL 4173075.
Ran all tests.

R=r, rsc
CC=golang-dev
https://golang.org/cl/4203041
2011-02-22 20:10:09 -08:00
Alex Brainman
0e7995c02f net: refactor windows code
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4185054
2011-02-23 14:40:24 +11:00
Alex Brainman
0cf6f8c096 5l/6l/8l: use enums for header type and symbolic strings for -H option values
Thanks to rsc for the suggestion.

R=r
CC=golang-dev
https://golang.org/cl/4174060
2011-02-23 14:30:40 +11:00
Robert Griesemer
cd0f799e65 exp/eval, go/printer: fix build
There are some minor irregularities in the printer
output (some paren's are present that should be
removed), but these are unrelated issues.
Will review in a 2nd step.

R=rsc
CC=golang-dev
https://golang.org/cl/4188068
2011-02-22 18:17:03 -08:00
Russ Cox
bdbea6e410 arm: fix build
Changes on laptop were not sync'ed to machine
where I ran hg submit.

R=r
CC=golang-dev
https://golang.org/cl/4195048
2011-02-22 21:10:02 -05:00
Robert Griesemer
23c16cf216 go/ast, parser: condition in if statement is mandatory
As a result, parsing a "control clause" is now sufficiently
different for if, switch, and for statements that the code
is not factored out anymore. The code is a bit longer but
clearer in each individual case.

Reflect the changes in AST.

R=r, r2
CC=golang-dev
https://golang.org/cl/4173075
2011-02-22 17:25:10 -08:00
Russ Cox
52943bfe4d gc: require if condition
R=ken2, r2
CC=golang-dev
https://golang.org/cl/4195045
2011-02-22 18:23:29 -05:00
Russ Cox
d9fd11443c ld: detect stack overflow due to NOSPLIT
Fix problems found.

On amd64, various library routines had bigger
stack frames than expected, because large function
calls had been added.

runtime.assertI2T: nosplit stack overflow
        120	assumed on entry to runtime.assertI2T
        8	after runtime.assertI2T uses 112
        0	on entry to runtime.newTypeAssertionError
        -8	on entry to runtime.morestack01

runtime.assertE2E: nosplit stack overflow
        120	assumed on entry to runtime.assertE2E
        16	after runtime.assertE2E uses 104
        8	on entry to runtime.panic
        0	on entry to runtime.morestack16
        -8	after runtime.morestack16 uses 8

runtime.assertE2T: nosplit stack overflow
        120	assumed on entry to runtime.assertE2T
        16	after runtime.assertE2T uses 104
        8	on entry to runtime.panic
        0	on entry to runtime.morestack16
        -8	after runtime.morestack16 uses 8

runtime.newselect: nosplit stack overflow
        120	assumed on entry to runtime.newselect
        56	after runtime.newselect uses 64
        48	on entry to runtime.printf
        8	after runtime.printf uses 40
        0	on entry to vprintf
        -8	on entry to runtime.morestack16

runtime.selectdefault: nosplit stack overflow
        120	assumed on entry to runtime.selectdefault
        56	after runtime.selectdefault uses 64
        48	on entry to runtime.printf
        8	after runtime.printf uses 40
        0	on entry to vprintf
        -8	on entry to runtime.morestack16

runtime.selectgo: nosplit stack overflow
        120	assumed on entry to runtime.selectgo
        0	after runtime.selectgo uses 120
        -8	on entry to runtime.gosched

On arm, 5c was tagging functions NOSPLIT that should
not have been, like the recursive function printpanics:

printpanics: nosplit stack overflow
        124	assumed on entry to printpanics
        112	after printpanics uses 12
        108	on entry to printpanics
        96	after printpanics uses 12
        92	on entry to printpanics
        80	after printpanics uses 12
        76	on entry to printpanics
        64	after printpanics uses 12
        60	on entry to printpanics
        48	after printpanics uses 12
        44	on entry to printpanics
        32	after printpanics uses 12
        28	on entry to printpanics
        16	after printpanics uses 12
        12	on entry to printpanics
        0	after printpanics uses 12
        -4	on entry to printpanics

R=r, r2
CC=golang-dev
https://golang.org/cl/4188061
2011-02-22 17:40:40 -05:00
Rob Pike
14b6a47748 gob: compute information about a user's type once.
Other than maybe cleaning the code up a bit, this has
little practical effect for now, but lays the foundation
for remembering the method set of a type, which can
be expensive.

R=rsc
CC=golang-dev
https://golang.org/cl/4193041
2011-02-22 12:31:57 -08:00
Rob Pike
795ff00df0 reflect: add a secret method to ArrayOrSliceType.
It was observed that the interface was generic enough
that several other types implemented it too.

Fixes #1530.

R=rsc
CC=golang-dev
https://golang.org/cl/4169063
2011-02-22 09:21:50 -08:00
Andrew Gerrand
1e73fed888 http: add pointer from Handle[Func] to ServeMux docs
R=r
CC=golang-dev
https://golang.org/cl/4169065
2011-02-22 11:16:25 +11:00
Padraig Kitterick
1f39ed8a2d http: cleaned up HEAD request method.
Removed a redefinition of the request URL which is never used and
redundant checking of the return value from send().

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4184061
2011-02-22 10:40:37 +11:00
David Symonds
1634390fb1 testing: Fix typo on Logf doc comment.
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4167064
2011-02-22 10:12:18 +11:00
Mikael Tillenius
ca0d483014 image/png: support for more formats
Added support for reading images with grayscale + alpha and
for images with depth 1, 2 or 4.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4174053
2011-02-22 10:04:32 +11:00
Luuk van Dijk
db22e236fd runtime-gdb.py: gdb pretty printer for go strings properly handles length.
R=rsc, r2
CC=golang-dev
https://golang.org/cl/4183060
2011-02-20 18:53:23 +01:00
Adam Langley
7b166cd73c crypto/openpgp/packet: comment typo fix.
R=rsc
CC=golang-dev
https://golang.org/cl/4178065
2011-02-19 10:41:57 -05:00
Dave Cheney
8a8ecda54a build: reduce the use of subshells in recursive make
Using make -C $* rather than (cd $* ; make) results in a small,
but measurable improvement in build times where compilation is
not the major component. eg.

before - ~/go/src/pkg$ time make
        real	0m1.176s
        user	0m0.639s
        sys	0m0.399s
after - ~/go/src/pkg$ time make
        real	0m0.916s
        user	0m0.571s
        sys	0m0.243s

There are other places in the distribution src/make.common for example
that could also benefit from this change.

R=adg
CC=golang-dev, rsc
https://golang.org/cl/4174055
2011-02-19 10:49:46 +11:00
Dave Cheney
90847a8577 net: fix multicast tests
R=rsc, mikioh, rsc1, dho
CC=golang-dev
https://golang.org/cl/4174056
2011-02-18 13:48:13 -05:00
Rob Pike
7e6488f9ad crypto/openpgp/packet: fix testing print (missing arg)
R=agl
CC=golang-dev
https://golang.org/cl/4173062
2011-02-18 10:47:38 -08:00
Andrew Gerrand
06a923ada0 godoc: serve robots.txt raw
R=gri, niemeyer, rsc, r2, r
CC=golang-dev
https://golang.org/cl/4188063
2011-02-19 05:46:20 +11:00
Russ Cox
7081e67565 runtime: handle non-standard call sequences in arm traceback
R=r
CC=golang-dev
https://golang.org/cl/4191048
2011-02-18 13:30:29 -05:00
Russ Cox
f07a45f23d fix build
pieces of an upcoming CL leaked into CL 4168056

TBR=r
CC=golang-dev
https://golang.org/cl/4180057
2011-02-18 12:37:16 -05:00
Russ Cox
d3ac545f80 runtime: record $GOROOT_FINAL for runtime.GOROOT
Update #1527.

R=adg, oerdnj
CC=golang-dev
https://golang.org/cl/4171060
2011-02-18 11:35:43 -05:00
Russ Cox
afac1c2654 ld: drop rpath
Was required by old cgo but we don't
generate stub .so files anymore.

Update #1527.

R=iant
CC=golang-dev
https://golang.org/cl/4168056
2011-02-18 11:35:36 -05:00
Adam Langley
193709736f crypto/rsa: left-pad OAEP results when needed.
PKCS#1 v2.1 section 7.1.1 says that the result of an OAEP encryption
is "an octet string of length $k$". Since we didn't left-pad the
result it was previously possible for the result to be smaller when
the most-significant byte was zero.

Fixes #1519.

R=rsc
CC=golang-dev
https://golang.org/cl/4175059
2011-02-18 11:31:10 -05:00
Robert Griesemer
547918e363 go/scanner: update comment
R=r, r2
CC=golang-dev
https://golang.org/cl/4184053
2011-02-17 17:22:16 -08:00
Gustavo Niemeyer
6d9db54be5 testing: rename cmdline flags to avoid conflicts
Flags defined in the testing package may conflict
with real flags defined in the main package, or in
any other imported package.

This change makes them less likely to be used for
other purposes.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4167055
2011-02-17 16:17:33 -08:00
Wei Guangjing
8ba4df2e9a 6l: pe fixes
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4182061
2011-02-18 10:58:47 +11:00
Nigel Tao
42ed1ad4a6 html: small documentation fix.
R=rsc
CC=golang-dev
https://golang.org/cl/4169058
2011-02-18 10:35:49 +11:00
Russ Cox
063125dfcf http: send full URL in proxy requests
Fixes #53.  (again)

R=agl1
CC=golang-dev
https://golang.org/cl/4167054
2011-02-17 17:14:50 -05:00
Russ Cox
f80d002438 json: only use alphanumeric tags
Almost the same definition as Go identifier names.
(Leading digits are allowed.)

Fixes #1520.

R=r, r2
CC=golang-dev
https://golang.org/cl/4173061
2011-02-17 17:14:19 -05:00
Russ Cox
6e03ed32c7 gc: interface error message fixes
Fixes #1526.

R=ken2
CC=golang-dev
https://golang.org/cl/4190051
2011-02-17 16:33:26 -05:00
Russ Cox
dd7403b1b8 net: remove comment fragments
I have no idea how I meant to complete that sentence.

R=r, r2
CC=golang-dev
https://golang.org/cl/4191046
2011-02-17 16:32:50 -05:00
Russ Cox
f2852ba618 runtime: descriptive panics for use of nil map
R=r, r2
CC=golang-dev
https://golang.org/cl/4173060
2011-02-17 16:08:52 -05:00
Albert Strasheim
712888910b crypto/rand: Added read buffer to speed up requests for small amounts of bytes.
R=agl1, rsc
CC=golang-dev
https://golang.org/cl/4170056
2011-02-17 15:14:41 -05:00
Rob Pike
eb8688154b arm runtime: attempt to fix build by adding casp (same as cas)
untested.

Fixes #1523.

R=rsc
CC=golang-dev
https://golang.org/cl/4171057
2011-02-16 22:01:57 -08:00
Alex Brainman
946cdf82bc syscall: fix windows SetFileAttributes
R=golang-dev, rsc, hector
CC=golang-dev, mattn
https://golang.org/cl/4180052
2011-02-17 12:09:12 +11:00
Alex Brainman
6cf98a4553 net: fix windows build
R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4184051
2011-02-17 12:00:02 +11:00
Nigel Tao
a5ff8ad9db html: tokenize HTML comments.
I'm not sure if it's 100% correct wrt the HTML5 specification,
but the test suite has plenty of HTML comment test cases, and
we'll shake out any tokenization bugs as the parser improves its
coverage.

R=gri
CC=golang-dev
https://golang.org/cl/4186055
2011-02-17 10:45:30 +11:00
Jeff R. Allen
3a2d64789b gc: make string const comparison unsigned
Make compile-time string const comparison match semantics
of runtime.cmpstring.

Fixes #1515.

R=rsc
CC=golang-dev, rog
https://golang.org/cl/4172049
2011-02-16 17:57:15 -05:00
Dave Cheney
0856731daa net: add IPv4 multicast to UDPConn
notes:
Darwin is very particular about joining a multicast group if the
listneing socket is not created in "udp4" mode, the other supported
OS's are more flexible.

A simple example sets up a socket to listen on the mdns/bonjour
group 224.0.0.251:5353

// ensure the sock is udp4, and the IP is a 4 byte IPv4
socket, err := net.ListenUDP("udp4", &net.UDPAddr {
        IP: net.IPv4zero,
        // currently darwin will not allow you to bind to
        // a port if it is already bound to another process
        Port: 5353,
})
if err != nil {
        log.Exitf("listen %s", err)
}
defer socket.Close()
err = socket.JoinGroup(net.IPv4(224, 0, 0, 251))
if err != nil {
        log.Exitf("join group %s", err)
}

R=adg, rsc
CC=golang-dev
https://golang.org/cl/4066044
2011-02-16 15:07:13 -05:00
Mikio Hara
9b66129fe3 net: more accurate IPv4-in-IPv6 API test
R=rsc
CC=golang-dev
https://golang.org/cl/4172045
2011-02-16 15:05:48 -05:00
Olivier Antoine
df4b22fcff net: reject invalid net:proto network names
R=rsc
CC=golang-dev
https://golang.org/cl/4129042
2011-02-16 15:03:47 -05:00
Gustavo Niemeyer
05b1dbd0a6 sync: add Cond
R=rsc, rog, r
CC=golang-dev
https://golang.org/cl/3775048
2011-02-16 14:11:07 -05:00
Russ Cox
52ffb6af00 os: remove ENODATA (fixes freebsd build)
R=r, r2
CC=golang-dev
https://golang.org/cl/4175053
2011-02-16 14:10:52 -05:00
Yasuhiro Matsumoto
f04b5a3bac http: add proxy support
Fixes #53.

R=agl1, jacek.masiulaniec, adg, rsc, agl
CC=golang-dev
https://golang.org/cl/3794041
2011-02-16 14:06:50 -05:00
Rob Pike
be560e0401 reflect: add a couple of sentences explaining how Methods operate.
R=rsc, gri, rsc1, bsiegert
CC=golang-dev
https://golang.org/cl/4183053
2011-02-16 11:01:21 -08:00
Russ Cox
250977690b runtime: fix memory allocator for GOMAXPROCS > 1
Bitmaps were not being updated safely.
Depends on 4188053.

Fixes #1504.
May fix issue 1479.

R=r, r2
CC=golang-dev
https://golang.org/cl/4184048
2011-02-16 13:21:20 -05:00
Russ Cox
6779350349 runtime: minor cleanup
implement runtime.casp on amd64.
keep simultaneous panic messages separate.

R=r
CC=golang-dev
https://golang.org/cl/4188053
2011-02-16 13:21:13 -05:00
Albert Strasheim
e881d42f87 os: add ENODATA and ENOTCONN
syscall: add MCL_* flags for mlockall

R=rsc
CC=golang-dev
https://golang.org/cl/4177044
2011-02-16 13:19:31 -05:00
Roger Peppe
1a96391971 netchan: allow use of arbitrary connections.
R=r, r2, rsc
CC=golang-dev
https://golang.org/cl/4119055
2011-02-16 08:14:41 -08:00
Yasuhiro Matsumoto
a54cbcec88 syscall: implement chmod() for win32.
R=golang-dev, rsc, brainman
CC=golang-dev
https://golang.org/cl/4175049
2011-02-16 16:24:59 +11:00
Alex Brainman
074354c2ea 8l,6l: allow for more os threads to be created on Windows
Program listed http://code.google.com/p/go/issues/detail?id=1495
(with nRequester set to 10000) will crash with

runtime: failed to create new OS thread (have 4526 already; errno=8)

instead of

runtime: failed to create new OS thread (have 618 already; errno=8).

R=golang-dev, rsc, vcc
CC=golang-dev
https://golang.org/cl/4172046
2011-02-16 16:08:42 +11:00
Yasuhiro Matsumoto
186b07afff syscall: fix inverse checking of result code on windows.
R=golang-dev, brainman, rsc
CC=golang-dev
https://golang.org/cl/4179049
2011-02-16 16:07:04 +11:00
Nigel Tao
1c5ed263ae compress: move zlib/testdata to testdata so it can be shared by all
compression algorithms.

R=rsc, r2, nigeltao_gnome
CC=golang-dev
https://golang.org/cl/4188054
2011-02-16 11:41:29 +11:00
Adam Langley
a0c3b96065 crypto/tls: make protocol negotiation failure fatal
R=r, r2
CC=golang-dev
https://golang.org/cl/4178054
2011-02-15 16:38:45 -05:00
Adam Langley
5311d915f4 encoding/line: fix line returned after EOF
Fixes #1509.

R=r
CC=golang-dev
https://golang.org/cl/4167045
2011-02-15 09:52:20 -05:00
Robert Griesemer
e6ee0d2492 godoc: don't hide package lookup error if there's no command with the same name
Fixes #1514.

R=r, r2
CC=golang-dev
https://golang.org/cl/4173050
2011-02-14 17:41:47 -08:00
Roger Peppe
34dd450fb8 rpc: properly discard values.
R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4171050
2011-02-14 14:51:08 -08:00
Alex Brainman
ff7d7b271f runtime: detect failed thread creation on Windows
Fixes #1495.

R=rsc
CC=golang-dev
https://golang.org/cl/4182047
2011-02-15 09:42:25 +11:00
Andrew Gerrand
858972c3f9 archive/zip: handle files with data descriptors
Fixes #1471.

R=rsc
CC=golang-dev
https://golang.org/cl/4183048
2011-02-15 05:42:16 +11:00
Rob Pike
1778f50da3 gob: decode into nil, this time for sure.
Yesterday's change was too simple-minded and failed if an
interface value was being discarded.  We need to parse the
data stream and remember any type information that arrives.

Also fix a minor bug when ignoring an interface: toss only what
we know about, not everything.

R=rsc
CC=golang-dev
https://golang.org/cl/4179045
2011-02-14 10:17:30 -08:00
Hector Chu
1723fbe13e windows: runtime: implemented console ctrl handler (SIGINT).
R=rsc, brainman, iant2
CC=golang-dev
https://golang.org/cl/4129049
2011-02-14 12:15:13 -05:00
Russ Cox
b9f94768f9 build: run test/ directory first
R=adg, r
CC=golang-dev
https://golang.org/cl/4183047
2011-02-14 09:27:02 -05:00
Robert Griesemer
6b526eb300 go/printer: line comments must always end in a newline
Fixes #1503.

R=rsc
CC=golang-dev
https://golang.org/cl/4170045
2011-02-13 19:27:02 -08:00
Rob Pike
ea46bda72b gob: allow Decode(nil) and have it just discard the next value.
Fixes #1489.

R=rsc
CC=golang-dev
https://golang.org/cl/4187046
2011-02-12 18:03:54 -08:00
Ken Thompson
888ab02228 5ld: part of 64bit eor - forgot to check in.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4176046
2011-02-11 20:13:57 -08:00