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.
R=rsc
CC=golang-dev
https://golang.org/cl/1616042
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.
Fixes#850.
R=rsc
CC=golang-dev
https://golang.org/cl/1615043
* 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.
Fixes#840.
Fixes#830.
Fixes#778.
R=ken2
CC=golang-dev
https://golang.org/cl/1303042
(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
fallthrough statement considered harmful!
R=rsc
CC=golang-dev
https://golang.org/cl/1593042
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
R=rsc
CC=golang-dev
https://golang.org/cl/1532041
Also fix an interface bug: white-space-delimited doesn't work well for cases like "%d, %d" on "23, 23")
R=rsc
CC=golang-dev
https://golang.org/cl/1502041
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.
R=r
CC=golang-dev
https://golang.org/cl/1495041
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.
R=r
CC=golang-dev
https://golang.org/cl/1480041
- 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
R=rsc
CC=golang-dev
https://golang.org/cl/1458041
- 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
R=rsc
CC=golang-dev
https://golang.org/cl/1458041
For example, earlier, the regexp would accept SIGQUEUE_MAX
as a unix signal with name SIGQUEUE. Now it is ignored.
R=iant
CC=golang-dev, golang-nuts, joel.sherrill
https://golang.org/cl/1452041
Also, move Do() to vector.go, so that Do() for IntVector and StringVector
is autogenerated.
The only files edited are Makefile, defs.go, and vector.go. The rest are
autogenerated with "make generate".
R=r
CC=golang-dev, hoisie
https://golang.org/cl/1435041
- 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.
R=rsc
CC=golang-dev
https://golang.org/cl/1418041
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.
R=rsc
CC=golang-dev
https://golang.org/cl/1399041
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
ModInverse is just a small wrapper around GcdInt, but it's nice to
have in order to be clear about what one is doing in other code.
R=gri, agl1
CC=golang-dev
https://golang.org/cl/1244045
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.
R=rsc
CC=golang-dev
https://golang.org/cl/1252045
On my laptop, time to prepare and write 800x600 pixels over the
socket falls from 125-ish ms to 80-ish ms.
Thanks to Roger Peppe for the suggestion.
R=r
CC=golang-dev
https://golang.org/cl/1228044
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
Time to draw.Draw a 200x200 image fell from 18.4ms (and 1 malloc) to
5.6ms (and 0 mallocs). It's still relatively slow since it assumes
nothing about the src or mask images, but it does remove the malloc.
There are existing faster, more specialized paths for copies, fills
and image glyph masks.
Also added a "compare to a slow but obviously correct implementation"
check to draw_test.go.
R=rsc, r
CC=golang-dev
https://golang.org/cl/1223044
- implemented setWord, use it where setUint64 is wrong
- divLarge: use fast mulWW, divWW; implemented mulWW, divWW
- better assembly code for addMulVVW
R=rsc
CC=golang-dev
https://golang.org/cl/1258042
Previously the compiler would just emit "internal compiler error" when
trying to compute the remainder of floats or complex types.
R=rsc
CC=golang-dev
https://golang.org/cl/1243041
- support for binary prefix 0b (to match fmt.Format)
- renamed nat.new -> nat.setUint64 for consistency
- more tests
R=r
CC=golang-dev
https://golang.org/cl/1233041
Also update range of Phase and Polar due to signed zero.
[Phase(cmplx(-1, +0)) = pi and Phase(cmplx(-1, -0)) = -pi]
R=rsc, r
CC=golang-dev
https://golang.org/cl/1235041
Timings (as for change 1122043) go from 49ms to 48ms ish. It's
mostly lost in the noise, but it probably doesn't hurt.
R=r
CC=golang-dev
https://golang.org/cl/1179041
To draw.Draw a 32x32 image.Alpha 10000 times,
Before: 633ms with 10000 mallocs
After: 49ms with 0 mallocs
These times are just blitting an image.Alpha, and do not include
rasterizing a glyph's vector contours to an image.Alpha.
The "generic" test case in draw_test.go tests this fast path.
R=rsc
CC=golang-dev
https://golang.org/cl/1122043
- removed last argument (n) from all core arithmetic routines;
instead, use the length of the result
- simplified nat.make implementation and chose a better capacity
for new values, removed a TODO in the process
Changing the constant e from 1 (old) to 4 (new) improved
pidigits -s -n 10000 by ~9% (on a 3.06GHz Intel Core 2 Duo):
user 0m3.882s (old)
user 0m3.549s (new)
R=rsc
CC=golang-dev
https://golang.org/cl/1133043
This permits cgo callbacks to work when run in init code.
Otherwise cgocallback switches to the wrong stack address.
R=rsc
CC=golang-dev
https://golang.org/cl/1123043
- no need to make copies in cases of aliases
- removed deprecated internal shift functions
- minor unrelated simplifications
This change improves pidigits -s -n10000 by almost 20%:
user 0m6.156s (old)
user 0m4.999s (new)
(pidigits -s -n20000 goes from ~25s to ~19s)
R=rsc
CC=golang-dev
https://golang.org/cl/1149041
Because maps are mostly a hidden type, they must be
implemented using reflection values and will not be as
efficient as arrays and slices.
R=rsc
CC=golang-dev
https://golang.org/cl/1127041