Russ Cox [Fri, 11 Jun 2010 22:29:19 +0000 (15:29 -0700)]
gopack: simplify go metadata code
There's only one Go object file per package now,
so there's no need to parse the metadata and merge
metadata from multiple files. Just save the original
and use it as __.PKGDEF verbatim.
Ian Lance Taylor [Fri, 11 Jun 2010 20:41:49 +0000 (13:41 -0700)]
Pad Go symbol table out to page boundary when linking dynamically.
This avoids a crash when using cgo where glibc's malloc thinks
that it can use some of the memory following the symbol table.
This fails because the symbol table is mapped read-only, which
affects the whole page.
Adam Langley [Thu, 10 Jun 2010 00:52:41 +0000 (20:52 -0400)]
asn1: allow '*' in PrintableString.
Although technically incorrect, we want this in order to parse X.509
certificates where a wildcard hostname ("*.example.com") has been put
into a PrintableString.
Russ Cox [Wed, 9 Jun 2010 18:00:55 +0000 (11:00 -0700)]
gc: more cleanup
* disallow surrogate pair runes.
* diagnose impossible type assertions
* eliminate another static buffer.
* do not overflow lexbuf.
* add -u flag to disable package unsafe.
Russ Cox [Wed, 9 Jun 2010 01:50:02 +0000 (18:50 -0700)]
gc: new typechecking rules
* Code for assignment, conversions now mirrors spec.
* Changed some snprint -> smprint.
* Renamed runtime functions to separate
interface conversions from type assertions:
convT2I, assertI2T, etc.
* Correct checking of \U sequences.
Robert Griesemer [Wed, 9 Jun 2010 00:06:26 +0000 (17:06 -0700)]
go/parser: correct position of empty statement ';'
(caused certain files to not be idempotent under gofmt)
- corrected golden files for go/printer
- slightly simplified some code in nodes.go (no impact on formatting)
- these changes have no impact on gofmt output of .go files under src, misc
Robert Griesemer [Mon, 7 Jun 2010 22:49:39 +0000 (15:49 -0700)]
go spec: clean-up and consolidation of spec with implementation
Specifically:
- introduced notion of "underlying type"
- removed notion of type compatibility
- consolidated rules about assignment compatibility in
assignment compatibility section
- be consistent with specyfing that nil is the value
for uninitialized variables that can be nil (this
was not specified clearly for pointers, functions, interfaces)
- added/fixed various related links throughout
- clarify language on conversions
Nigel Tao [Fri, 4 Jun 2010 00:19:00 +0000 (17:19 -0700)]
draw.Draw fast paths for the Over operator.
Time (us) to draw a 200x200 src onto an image.RGBA dst with the Over
operator. Each case was measured three separate times, and the sorted
times are reported.
Fill case (where src is an image.ColorImage):
Before:
7438, 7511, 7526
After:
3073, 3087, 3102
Copy case (where src is an image.RGBA):
Before:
9506, 9510, 9563
After:
5262, 5300, 5344
Robert Griesemer [Thu, 3 Jun 2010 23:55:50 +0000 (16:55 -0700)]
go spec: Base comparison compatibility on assignment compatibility.
Specifically:
- Simplified definition of comparison compatibility and folded into
section on comparison operators since it's only used there.
This is a small language change/cleanup. As a consequence:
- An interface value may now be compared against a non-interface value.
- Channels with opposite directions cannot be compared directly anymore
(per discussion with rsc).
Kyle Consalus [Thu, 3 Jun 2010 06:04:44 +0000 (23:04 -0700)]
Optimization to regexp _CharClass: keep track of overall range of
charclass to avoid unnecessarily iterating over ranges.
Also, use the fact that IntVector is an []int to avoid method calls.
On my machine, this brings us from ~27500 ns/op to ~17500 ns/op in the benchmark I've added (it is also faster in the case where a range check
doesn't help, added a benchmark for this too.)
I'd also like to propose that "[]", and "[^]" be disallowed. They aren't useful as far as I can tell, they aren't widely supported, and they make reasoning about character classes a bit more complicated.
Russ Cox [Wed, 2 Jun 2010 23:17:18 +0000 (16:17 -0700)]
bufio: change ReadSlice to match description
On error, ReadSlice is defined to return the available data
and advance past that data, but it was not behaving that
way for err == ErrBufferFull, making it harder for callers to
handle well.
Rob Pike [Tue, 1 Jun 2010 22:22:01 +0000 (15:22 -0700)]
fmt.Scan: renamings, strings, errors
- implement scanning for all renamed types
(compiler bug stops complex from being renamable,
so it can't be tested but the code is there)
- %q %x for strings
- error handling now done with panic/recover
Rob Pike [Tue, 1 Jun 2010 22:21:21 +0000 (15:21 -0700)]
fmt.Scan: renamings, strings, errors
- implement scanning for all renamed types
(compiler bug stops complex from being renamable,
so it can't be tested but the code is there)
- %q %x for strings
- error handling now done with panic/recover
Vinu Rajashekhar [Tue, 1 Jun 2010 19:02:00 +0000 (12:02 -0700)]
Correct the regexp for finding unix signal names.
For example, earlier, the regexp would accept SIGQUEUE_MAX
as a unix signal with name SIGQUEUE. Now it is ignored.
Rob Pike [Mon, 31 May 2010 21:53:15 +0000 (14:53 -0700)]
fmt.Scan: refactor the implementation so format-driven and normal scanning use the same function.
simplifies the code significantly.
Still TODO:
- proper format handling
- strings
Rob Pike [Mon, 31 May 2010 17:56:58 +0000 (10:56 -0700)]
fmt.Scan:
- reimplement integer scanning to handle renamed basic integer types
- start implementation of Fscanf and Scanf; not yet ready for general use.
This intermediate CL is a useful checkpoint. A similar change needs to be
done for float and complex, but it seemed worth getting the approach
reviewed before making those changes.
Ian Lance Taylor [Mon, 31 May 2010 05:22:47 +0000 (22:22 -0700)]
Correct _cgo_free when C ABI does not pass first arg on stack.
It turns out that _cgo_malloc is used, via cmalloc in
runtime/cgocall.c, which is called by code generated by out.go
for the ยท_C_CString function. I can't find a call to
_cgo_free, but given _cgo_malloc we might as well keep
_cgo_free. This patch fixes it so that it should work on
amd64.
Robert Griesemer [Fri, 28 May 2010 21:17:30 +0000 (14:17 -0700)]
go spec: change def. of "type compatibility" to be non-recursive
and adjust conversion rules.
Also:
- clarification of type identity (no language change)
- adjust special rules for channel assignment/comparison to
require identical element types (in correspondence to non-
recursiveness of type compatibility)
R=rsc, iant, ken2, r
CC=golang-dev
https://golang.org/cl/1376042
Roger Peppe [Fri, 28 May 2010 00:19:47 +0000 (17:19 -0700)]
Add Rectangle.Eq and Point.In.
Fix Rectangle.Clip.
It could return a non-canonical rectangle if its arguments
did not overlap.
e.g. Rect(0, 0, 10, 10).Clip(Rect(0, 20, 10, 30)) -> Rect(0, 20, 10, 10)
R=rsc, r
CC=golang-dev, golang-dev
https://golang.org/cl/1290041
Rob Pike [Wed, 26 May 2010 04:02:35 +0000 (21:02 -0700)]
fmt.Scan, fmt.Scanln: Start of a simple scanning API in the fmt package.
Still to do:
- composite types
- user-defined scanners
- format-driven scanning
The package comment will be updated when more of the functionality is in place.