FreeBSD was passing stk as the new thread's stack base, while
stk is the top of the stack in go. The added check should cause
a trap if this ever comes up in any new ports, or regresses
in current ones.
R=rsc
CC=golang-dev
https://golang.org/cl/167055
nodes in the tree are nested with respect to one another.
a simple change to the Visitor interface makes it possible
to do this (for example to maintain a current node-depth, or a
knowledge of the name of the current function).
Visit(nil) is called at the end of a node's children;
this make possible the channel-based interface below,
amongst other possibilities.
It is still just as simple to get the original behaviour - just
return the same Visitor from Visit.
Here are a couple of possible Visitor types.
// closure-based
type FVisitor func(n interface{}) FVisitor
func (f FVisitor) Visit(n interface{}) Visitor {
return f(n);
}
// channel-based
type CVisitor chan Visit;
type Visit struct {
node interface{};
reply chan CVisitor;
};
func (v CVisitor) Visit(n interface{}) Visitor
{
if n == nil {
close(v);
} else {
reply := make(chan CVisitor);
v <- Visit{n, reply};
r := <-reply;
if r == nil {
return nil;
}
return r;
}
return nil;
}
R=gri
CC=rsc
https://golang.org/cl/166047
Roughly 33% faster for simple cases, probably more for complex ones.
Before:
mallocs per Sprintf(""): 4
mallocs per Sprintf("xxx"): 6
mallocs per Sprintf("%x"): 10
mallocs per Sprintf("%x %x"): 12
Now:
mallocs per Sprintf(""): 2
mallocs per Sprintf("xxx"): 3
mallocs per Sprintf("%x"): 5
mallocs per Sprintf("%x %x"): 7
Speed improves because of avoiding mallocs and also by sharing a bytes.Buffer
between print.go and format.go rather than copying the data back after each
printed item.
Before:
fmt_test.BenchmarkSprintfEmpty 1000000 1346 ns/op
fmt_test.BenchmarkSprintfString 500000 3461 ns/op
fmt_test.BenchmarkSprintfInt 500000 3671 ns/op
Now:
fmt_test.BenchmarkSprintfEmpty 2000000 995 ns/op
fmt_test.BenchmarkSprintfString 1000000 2745 ns/op
fmt_test.BenchmarkSprintfInt 1000000 2391 ns/op
fmt_test.BenchmarkSprintfIntInt 500000 3751 ns/op
I believe there is more to get but this is a good milestone.
R=rsc
CC=golang-dev, hong
https://golang.org/cl/166076
For 386 we use the [f]statfs64 system call, which takes three
parameters: the filename, the size of the statfs64 structure,
and a pointer to the structure itself.
R=rsc
https://golang.org/cl/166073
On a microbenchmark that ping-pongs on lots of channels, this makes
the multithreaded case about 20% faster and the uniprocessor case
about 1% slower. (Due to cache effects, I expect.)
R=rsc, agl
CC=golang-dev
https://golang.org/cl/166043
Use them in Copy and Copyn.
Speed up ReadFile by using ReadFrom and avoiding Copy altogether (a minor win).
R=rsc, gri
CC=golang-dev
https://golang.org/cl/166041
tabs for indentation even if -spaces is set.
Changes to gofmt:
- added -tabindent flag
- don't recompute parser and printer mode repeatedly
Changes to go/printer:
- provide new printing mode TabIndent
Changes to tabwriter:
- implement new mode TabIndent to use tabs independent
of the actual padding character for leading empty columns
- distinguish between minimal cell width and tab width
(tabwidth is only used if the output contains tabs,
minwidth and padding are always considered)
- fixed and added more comments
- some additional factoring
By default, -tabindent is disabled and the default gofmt
behavior is unchanged. By setting -spaces and -tabindent,
gofmt will use tabs for indentation but do any other
alignment with spaces. This permits a user to change the
visible indentation by simply changing the editor's tab
width and the code will remain properly aligned without
the need to rerun gofmt.
R=rsc
https://golang.org/cl/163068
1) need to send slice and array types (was only sending element types)
2) compatibleType needs to use decoder's type map
R=rsc
CC=golang-dev
https://golang.org/cl/164062
The python script needs a checkout of xcb/proto to generate
an xproto.go file, which together with xgb.go provide functions
to access all of the core X11 protocol requests. I have included the
generated file.
Extensions and authentication methods are not implemented.
R=r, rsc, nigeltao_golang
https://golang.org/cl/162053
this is the exact same thing issue #115 is about. fix makefiles to use relative
path to work in the case we have whitespaces as part of GOROOT.
R=rsc
https://golang.org/cl/162055
This provides an experimental X11 backend for the exp/draw interface.
It does not aim to provide a complete implementation of the X11 client protocol.
This works for me (Ubuntu Hardy 8.04, GOARCH=386). Your mileage my vary.
R=r, rsc, r1
CC=golang-dev
https://golang.org/cl/156109
before this change, if pkg/Make.deps is missing or broken, clean.bash fails and the build dies
but not until much later.
add freebsd to error message about valid values of $GOOS
TODO: would be nice if this process exited when an error occurred. subshells make it hard
R=rsc
CC=golang-dev
https://golang.org/cl/160065
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Fixes#115.
R=rsc, dsymonds1
https://golang.org/cl/157067
a little slow, but usable (speed unchanged when not using -r)
tweak go/printer to handle nodes without line numbers
more gracefully in a couple cases.
R=gri
https://golang.org/cl/156103
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.
Replaces CL 157083.
R=r, rsc
https://golang.org/cl/157087
* 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
R=ken2
https://golang.org/cl/157106
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.
Fixes#259.
R=r, rsc
https://golang.org/cl/157088
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.
R=rsc
CC=golang-dev
https://golang.org/cl/157099
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
R=rsc
CC=golang-dev
https://golang.org/cl/157095
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line. This change includes
sample benchmarks for regexp.
% gotest --benchmarks=.*
(standard test output redacted)
testing.BenchmarkSimpleMatch 200000 7799 ns/op
testing.BenchmarkUngroupedMatch 20000 76898 ns/op
testing.BenchmarkGroupedMatch 50000 38148 ns/op
R=r, rsc
https://golang.org/cl/154173
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.
R=rsc
CC=golang-dev
https://golang.org/cl/156091
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.
Fixes#143.
R=rsc
CC=golang-dev
https://golang.org/cl/152130
7x speedup on big and crypto/rsa unit tests.
also dropped useAsm in favor of making the
asm stubs jump to the Go versions.
R=agl1
CC=golang-dev, gri
https://golang.org/cl/157062
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 :).
R=rsc
CC=golang-dev
https://golang.org/cl/156073
* move memmove to arch-specific subdirectories
* add memmove for arm
* add copyright notices marking them as copied from Inferno
R=ken2
https://golang.org/cl/156061
* 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.
R=rsc
CC=golang-dev
https://golang.org/cl/156047
the signal handling stack is a different size than
the normal stack, so it cannot be allocated using
the backup stack allocator.
Fixes#250.
R=agl1
CC=golang-dev
https://golang.org/cl/157044
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.
R=r, rsc
https://golang.org/cl/154159
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! ;)
R=rsc, VenkateshSrinivas
https://golang.org/cl/152142