Robert Griesemer [Fri, 20 Nov 2009 19:50:11 +0000 (11:50 -0800)]
Support for basic try-catch style exception handling.
Meant as illustration of the Go pattern that is using
goroutines and channels to handle exceptional situations.
Note: There is no need for "Finally" since the
"try block" (the function f supplied to Try)
cannot do a Smalltalk-style non-local return
and terminate the function surrounding Try.
Russ Cox [Fri, 20 Nov 2009 17:11:46 +0000 (09:11 -0800)]
x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
* remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
* port cgen_inline into 8g, 5g.
* use native memmove in maps
Russ Cox [Fri, 20 Nov 2009 16:59:11 +0000 (08:59 -0800)]
test/bench revisions;
* reverse-complement: port C algorithm to Go
saves 30% on my MacBook Pro and makes it a fairer comparison.
* test reverse-complement with and without GC (another 15%)
* revise timing.sh to work on more systems
* avoid two glibcisms in fasta.c
James Meneghello [Fri, 20 Nov 2009 05:08:05 +0000 (21:08 -0800)]
Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.
-Psuedocode-
mp map[string]string = {
"header" : "A fantastic header!",
"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)
...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:
type s struct {
mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)
...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.
Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.
Evan Shaw [Fri, 20 Nov 2009 04:43:30 +0000 (20:43 -0800)]
archive/tar: Make Reader and Writer more closely follow io.Reader and io.Writer interfaces
There's no functional change here. io gives the Read and Write methods byte slice arguments, but tar called them uint8. It's the same thing, but I think this is clearer and it matches what other packages do.
Rob Pike [Fri, 20 Nov 2009 00:45:50 +0000 (16:45 -0800)]
two easy optimizations for regexp:
1) if char class contains a single character, make it a single character.
(this is used to quote, e.g. [.] rather than \.
2) if regexp begins with ordinary text substring, use plain string match to start engine
Trevor Strohman [Fri, 20 Nov 2009 00:35:34 +0000 (16:35 -0800)]
Adds benchmark support to gotest.
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line. This change includes
sample benchmarks for regexp.
Rob Pike [Thu, 19 Nov 2009 03:23:08 +0000 (19:23 -0800)]
add bytes.IndexByte; common case we can make fast later.
also pick off the special case in strings.Index. don't want strings.IndexByte
because the call site will very rarely need to allocate and we can handle the
test in the code itself. bytes.IndexByte can avoid a common allocation.
Adam Langley [Wed, 18 Nov 2009 21:18:34 +0000 (13:18 -0800)]
net: remove race condition on Close.
Previously a netFd could be queued for reading/writing in the channel,
but close(2)'ed before pollServer got to it. In this case, the kernel
would consider the descriptor closed and the attempt to add it to the
epoll set would fail and panic.
This patch makes Close a roundtrip to the pollServer, although the
actual close(2) still occurs elsewhere to avoid blocking the
pollServer.
Eden Li [Wed, 18 Nov 2009 17:59:10 +0000 (09:59 -0800)]
Mangle C struct fields that happen to be named after Go keywords by prefixing them with _. Collisions with existing fields are resolved by prefixing the new Go identifier with _ until it matches nothing else in the struct.
Fixes #36.
Russ Cox [Wed, 18 Nov 2009 17:54:51 +0000 (09:54 -0800)]
big: implement 386 assembly routines
7x speedup on big and crypto/rsa unit tests.
also dropped useAsm in favor of making the
asm stubs jump to the Go versions.
Devon H. O'Dell [Wed, 18 Nov 2009 17:11:39 +0000 (09:11 -0800)]
Add an intptr type to runtime; needed in FreeBSD
In thread.c, we need to cast to whatever the native
size of intptr is on the system, but we only have
uintptr available. They're the same size, but can't
do signed casts without this one :).
Adam Langley [Wed, 18 Nov 2009 02:09:41 +0000 (18:09 -0800)]
asn1:
* add Marshal
* add BitString.RightAlign
* change to using a *time.Time (from time.Time) since that's what
the time package uses.
* return the unparsed data from Unmarshal.
Russ Cox [Tue, 17 Nov 2009 22:42:08 +0000 (14:42 -0800)]
runtime: do not create new threads during malloc.
the signal handling stack is a different size than
the normal stack, so it cannot be allocated using
the backup stack allocator.
Aron Nopanen [Tue, 17 Nov 2009 19:29:02 +0000 (11:29 -0800)]
Make non-errored RPC calls return 'nil' error to caller.
Error information is carried from RPC server to client in the string
'Error' field of rpc.Response. An empty string is sent in the success
case. This empty string was being returned to the caller (of Client.Call
or Client.Go), resulting in a non-nil error response.
This change detects an empty-string Response.Error at the client, and
translates it into a nil value in Call.Error.
Tests updated to check error return in success cases.
Sergio Luis O. B. Correia [Tue, 17 Nov 2009 17:02:47 +0000 (09:02 -0800)]
cmd/cc: Fix -I switch to handle a path with blankspaces correctly
Currently, -I switch can't deal with a path containing spaces.
This commit simplify setinclude(), by removing the special case
of a string that had spaces. After this change, setinclude() will
merely add the given directories to the include path, if it does
not yet exist, and this approach works.
Will be needed for solving issue 115.
R=agl1, rsc, iant2, r
https://golang.org/cl/155059
Russ Cox [Tue, 17 Nov 2009 16:47:48 +0000 (08:47 -0800)]
codereview: add clpatch --ignore_hgpatch_errors.
of limited utility but good for creating the metadata
for an AUTHORS/CONTRIBUTORS change even if
the patch doesn't apply cleanly.
Devon H. O'Dell [Tue, 17 Nov 2009 16:20:58 +0000 (08:20 -0800)]
FreeBSD-specific porting work.
cgo/libmach remain unimplemented. However, compilers, runtime,
and packages are 100%. I still need to go through and implement
missing syscalls (at least make sure they're all listed), but
for all shipped functionality, this is done. Ship! ;)