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

22356 Commits

Author SHA1 Message Date
Russ Cox
c7fa3c625e [dev.cc] cmd/yacc: introduce yyParser to expose parser state
Historically, yacc has supported various kinds of inspections
and manipulations of the parser state, exposed as global variables.
The Go implementation of yacc puts that state (properly) in local
stack variables, so it can only be exposed explicitly.

There is now an explicit parser type, yyParser, returned by a
constructor, yyNewParser.

	type yyParser interface {
		Parse(yyLexer) int
		Lookahead() int
	}

Parse runs a parse. A call to the top-level func Parse
is equivalent to calling yyNewParser().Parse, but constructing
the parser explicitly makes it possible to access additional
parser methods, such as Lookahead.

Lookahead can be called during grammar actions to read
(but not consume) the value of the current lookahead token,
as returned by yylex.Lex. If there is no current lookahead token,
Lookahead returns -1. Invoking Lookahead corresponds to
reading the global variable yychar in a traditional Unix yacc grammar.

To support Lookahead, the internal parsing code now separates
the return value from Lex (yychar) from the reencoding used
by the parsing tables (yytoken). This has the effect that grammars
that read yychar directly in the action (possible since the actions
are in the same function that declares yychar) now correctly see values
from the Lex return value space, not the internal reencoding space.
This can fix bugs in ported grammars not even using SetParse and Lookahead.
(The reencoding was added on Plan 9 for large character sets.
No Plan 9 programs using yacc looked at yychar.)

Other methods may be added to yyParser later as needed.
Obvious candidates include equivalents for the traditional
yyclearin and yyerrok macros.

Change-Id: Iaf7649efcf97e09f44d1f5bc74bb563a11f225de
Reviewed-on: https://go-review.googlesource.com/4850
Reviewed-by: Rob Pike <r@golang.org>
2015-02-18 02:39:48 +00:00
Rob Pike
2633f2aad4 [dev.cc] cmd/asm/internal/asm: add operand parsing tests for 386 and arm
Change-Id: If2aafc4dd3f91650fc7727ea7d534ad7aa627c8c
Reviewed-on: https://go-review.googlesource.com/5090
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-18 01:49:41 +00:00
Russ Cox
8c195bdf12 [dev.cc] cmd/internal/gc, cmd/new6g etc: convert from cmd/gc, cmd/6g etc
First draft of converted Go compiler, using rsc.io/c2go rev 83d795a.

Change-Id: I29f4c7010de07d2ff1947bbca9865879d83c32c3
Reviewed-on: https://go-review.googlesource.com/4851
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:51 +00:00
Russ Cox
c11882bc3e [dev.cc] cmd/go: install new6g etc (once they are committed) to tool directory
Change-Id: I2853535ab6c79d14f430c780161e4c35c52d9fb3
Reviewed-on: https://go-review.googlesource.com/4839
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:41 +00:00
Russ Cox
2286989912 [dev.cc] cmd/gc, cmd/ld, runtime: minor tweaks for c2go
Change-Id: I3be69a4ebf300ad24b55b5f43fd7ad1f001c762e
Reviewed-on: https://go-review.googlesource.com/4838
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:28:32 +00:00
Russ Cox
535f29c68e [dev.cc] cmd/dist: write default GO386 for cmd/internal/obj
Change-Id: Ida60c30041505c321fbfc48b22b8ff5af1a3f474
Reviewed-on: https://go-review.googlesource.com/4837
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 23:28:24 +00:00
Rob Pike
aa55bd44b9 [dev.cc] cmd/asm: clean up jumps
Set TYPE_BRANCH for x(PC) in the parser and the assembler has less work to do.
This also makes the operand test handle -4(PC) correctly.

Also add a special test case for AX:DX, which should be fixed in obj really.

Change-Id: If195e3a8cf3454a73508633e9b317d66030da826
Reviewed-on: https://go-review.googlesource.com/5071
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 23:17:51 +00:00
Nigel Tao
391805b14b image/draw: add CMYK fast path.
Change-Id: I9582aff7ca141a8aead5692af74b9c708b1700cc
Reviewed-on: https://go-review.googlesource.com/5020
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 23:17:12 +00:00
Rob Pike
e190e27143 [dev.cc] misc/cgo/test: fix PC reference in arm assembler
Use R15.
May fix build.

Change-Id: Ia25b0936c5aab2a427f8e6531688c3e537fbfdd0
Reviewed-on: https://go-review.googlesource.com/5070
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 21:42:27 +00:00
Rob Pike
f14020a64e [dev.cc] cmd/asm/internal/asm: add operand parsing test
Generated by reducing all the amd64 operands in the core.
Will add 386 and ARM later; this is a trial balloon.

NOTE: There is at least one anomaly: AX:DX doesn't print correctly in this situation.

Change-Id: I9f327c1890b100e3edb7b1b2a1c01f3e4b798f43
Reviewed-on: https://go-review.googlesource.com/4967
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 20:23:52 +00:00
Austin Clements
1ab55a3f04 runtime: fix runtime-gdb_test on arm
Apparently when ARM stops at a GDB breakpoint, it appears to be in
syscall.Syscall.  The "info goroutines" test expected it to be in a
runtime function.  Since this isn't fundamental to the test, simply
tweak the test's regexp to make sure "info goroutines" prints some
running goroutine with an active M, but don't require it to be in any
particular function.

Change-Id: Iba2618b46d3dc49cef62ffb72484b83ea7b0317d
Reviewed-on: https://go-review.googlesource.com/5060
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-17 20:10:31 +00:00
Austin Clements
8ed95a942c runtime: rename gcwork.go to mgcwork.go
All of the other memory-related source files start with "m".  Keep up
the tradition.

Change-Id: Idd88fdbf2a1453374fa12109b949b1c4d149a4f8
Reviewed-on: https://go-review.googlesource.com/4853
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:42:41 +00:00
Austin Clements
98651d6edf runtime: in runtime-gdb.py, use SliceValue wrapper
Rather than reaching in to slices directly in the slice pretty
printer, use the newly introduced SliceValue wrapper.

Change-Id: Ibb25f8c618c2ffb3fe1a8dd044bb9a6a085df5b7
Reviewed-on: https://go-review.googlesource.com/4936
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:41:10 +00:00
Austin Clements
545686857b runtime: fix GDB "info goroutines" for Go 1.5
"info goroutines" is failing because it hasn't kept up with changes in
the 1.5 runtime.  This fixes three issues preventing "info goroutines"
from working.  allg is no longer a linked list, so switch to using the
allgs slice.  The g struct's 'status' field is now called
'atomicstatus', so rename uses of 'status'.  Finally, this was trying
to parse str(pc) as an int, but str(pc) can return symbolic
information after the raw hex value; fix this by stripping everything
after the first space.

This also adds a test for "info goroutines" to runtime-gdb_test, which
was previously quite skeletal.

Change-Id: I8ad83ee8640891cdd88ecd28dad31ed9b5833b7a
Reviewed-on: https://go-review.googlesource.com/4935
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:41:01 +00:00
Rob Pike
0f3f2c4110 [dev.cc] runtime/cgo: change PC to R15 in asm_arm.s
R15 is the real register. PC is a pseudo-register that we are making
illegal in this context as part of the grand assembly unification.

Change-Id: Ie0ea38ce7ef4d2cf4fcbe23b851a570fd312ce8d
Reviewed-on: https://go-review.googlesource.com/4966
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 18:23:08 +00:00
Rob Pike
09ce5d38d0 [dev.cc] cmd/asm: fix build: handle g in register lists on ARM
Handle the special name of R10 on the ARM - it's g - when it appears
in a register list [R0, g, R3]. Also simplify the pseudo-register parsing
a little.

Should fix the ARM build.

Change-Id: Ifcafc8195dcd3622653b43663ced6e4a144a3e51
Reviewed-on: https://go-review.googlesource.com/4965
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 17:23:10 +00:00
Ivan Ukhov
277eddb8f2 math: change Nextafter64 to Nextafter in the description of Nextafter
Change-Id: I3419d6247fbff36aa1ed5451bb3cfb7502c3d07e
Reviewed-on: https://go-review.googlesource.com/5030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-17 14:29:18 +00:00
David Crawshaw
04774336b1 cmd/go: skip stat check when using -toolexec
Change-Id: Idc88b1ee950e33cfe757a27e9a3383d879793af7
Reviewed-on: https://go-review.googlesource.com/4934
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-17 12:21:45 +00:00
Alex Brainman
f20826692b syscall: make mksyscall_windows.go to work even when output does not uses unsafe package
Fixes #9900

Change-Id: I5dd401e8d2040e84ccb97c2fe9f5c5a28095b538
Reviewed-on: https://go-review.googlesource.com/5005
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 08:31:38 +00:00
Alex Brainman
201b12499c [dev.cc] runtime: remove comma at the end of DIVL instruction (fixes windows build)
Change-Id: Ia47e1e387acd30f30559d766aa6fca18cbb098f9
Reviewed-on: https://go-review.googlesource.com/5010
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-17 08:15:13 +00:00
Rob Pike
412ce1f7d6 [dev.cc] cmd/go: enable verifyAsm for asm on ARM
Change-Id: I182ea770110255a5ac1c91cf30dd650696a8f1db
Reviewed-on: https://go-review.googlesource.com/4961
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 05:10:18 +00:00
Rob Pike
68bcc13291 [dev.cc] cmd/asm: fix build for x86 architectures
Mishandled the complex addressing mode in masks<>(SB)(CX*8)
as a casualty of the ARM work. Fix by backing all the flows up to
the state where registerIndirect is always called with the input
sitting on the opening paren.

With this, build passes for me with linux-arm, linux-386, and linux-amd64.

Change-Id: I7cae69a6fa9b635c79efd93850bd1e744b22bc79
Reviewed-on: https://go-review.googlesource.com/4964
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 04:55:38 +00:00
Yasuhiro Matsumoto
d866cd6817 all: fix typo in doc
Change-Id: I89fdda2914030dfea3183a8b4681dd4b33489729
Reviewed-on: https://go-review.googlesource.com/4996
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 04:37:18 +00:00
Rob Pike
188296e5bf [dev.cc] cmd/internal/asm: fix build: was mishandling SP reference on amd64
A consequence of the ARM work overlooked that SP is a real register
on x86, so we need to detect it specially.

This will be done better soon, but this is a fast fix for the build.

Change-Id: Ia30d111c3f42a5f0b5f4eddd4cc4d8b10470c14f
Reviewed-on: https://go-review.googlesource.com/4963
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 04:20:19 +00:00
Rob Pike
bf2d611a85 [dev.cc] cmd/internal/obj/arm: delete trailing space from AND instruction
The tools have been fixed to not do this, but verifyAsm depends on this
being fixed.

TBR=rsc

Change-Id: Ia8968cc803b3498dfa2f98188c6ed1cf2e11c66d
Reviewed-on: https://go-review.googlesource.com/4962
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 03:52:58 +00:00
Nigel Tao
5c8f9e38eb image: fix Rectangle.Overlaps and Rectangle.Union for empty rectangles.
Fixes #9895.

Change-Id: I37d78ced9ff8196e32d299504908a1c41ad4592d
Reviewed-on: https://go-review.googlesource.com/4990
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 03:40:33 +00:00
Rob Pike
581c309d8f [dev.cc] cmd/internal/obj/arm: add a couple of missing settings of Ctxt
Change-Id: Ic33431cdcc93db300fc2c3467eafdb5340ee4896
Reviewed-on: https://go-review.googlesource.com/4924
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 03:37:27 +00:00
Rob Pike
c497349a5b [dev.cc] cmd/asm: support ARM
There are many peculiarites of the ARM architecture that require work:
condition codes, new instructions, new instruction arg counts, and more.

Rewrite the parser to do a cleaner job, flowing left to right through the
sequence of elements of an operand.

Add ARM to arch.
Add ARM-specific details to the arch in a new file, internal/arch/arm.
These are probably better kept away from the "portable" asm. However
there are some pieces, like MRC, that are hard to disentangle. They
can be cleaned up later.

Change-Id: I8c06aedcf61f8a3960a406c094e168182d21b972
Reviewed-on: https://go-review.googlesource.com/4923
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 03:37:17 +00:00
Rob Pike
ae2b145da2 [dev.cc] cmd/asm: fix macro definition bug in the lexer
Because text/scanner hides the spaces, the lexer treated
	#define A(x)
and
	#define A (x)
the same, but they are not: the first is an argument with macros, the
second is a simple one-word macro whose definition contains parentheses.
Fix this by noticing the relative column number as we move from A to (.
Hacky but simple.

Also add a helper to recognize the peculiar ARM shifted register operators.

Change-Id: I2cad22f5f1e11d8dad40ad13955793d178afb3ae
Reviewed-on: https://go-review.googlesource.com/4872
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-17 03:37:01 +00:00
mattn
38be309dcf os: fix typo in doc
Change-Id: I9797b44dfa7c2c853b7a656f4f722df2c862824b
Reviewed-on: https://go-review.googlesource.com/4991
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-17 00:21:02 +00:00
Nigel Tao
37a61746ee image/draw: add CMYK test.
This just adds test cases. Optimizing CMYK draws will be a follow-up
change.

Change-Id: Ic0d6343d420cd021e21f88623ad7182e93017da9
Reviewed-on: https://go-review.googlesource.com/4941
Reviewed-by: Rob Pike <r@golang.org>
2015-02-17 00:08:47 +00:00
Aaron Jacobs
490af4fd83 unicode: Fixed an out of date comment (MaxLatin1, not Latin1Max).
Change-Id: I3ca878e9685f650a9ff02aaac0e2e3cca89634c6
Reviewed-on: https://go-review.googlesource.com/4970
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-16 21:35:33 +00:00
Michael MacInnis
a25e40df47 doc: Add reminder to go1.5.txt for os/signal changes
Document addition of Ignore and Reset: https://golang.org/cl/3580

Change-Id: I33aac149cd1921b87f887028c0365ba0ab9adb02
Reviewed-on: https://go-review.googlesource.com/4980
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-16 21:35:17 +00:00
Mikio Hara
18f273ff92 cmd/dist: don't use "uname -v" to recognize GOHOSTARCH
We can use processor architecture or hardware platform as part of
hostname and it leads to misconfiguration of GOHOSARCH.

For example,

$ uname -m -v
FreeBSD 10.1-RELEASE-p5 #0: Tue Jan 27 08:52:50 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386

Change-Id: I499efd98338beff6a27c03f03273331ecb6fd698
Reviewed-on: https://go-review.googlesource.com/4944
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-16 18:58:34 +00:00
Michael MacInnis
194ad16b83 os/signal: add ability to ignore signals and restore initial signal handlers
There is currently no way to ignore signals using the os/signal package.
It is possible to catch a signal and do nothing but this is not the same
as ignoring it. The new function Ignore allows a set of signals to be
ignored. The new function Reset allows the initial handlers for a set of
signals to be restored.

Fixes #5572

Change-Id: I5c0f07956971e3a9ff9b9d9631e6e3a08c20df15
Reviewed-on: https://go-review.googlesource.com/3580
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-16 14:23:09 +00:00
Nigel Tao
10a4696fb8 image/jpeg: remove the (temporary) dependency on image/draw.
Change-Id: Idd66f9c3c9eaa4ff1f950fb90e4800dc625dec08
Reviewed-on: https://go-review.googlesource.com/4916
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-16 04:37:15 +00:00
Matthew Dempsky
7b36227002 runtime: remove C-style strcmp and strncmp helpers
Change-Id: I4aa23e3a0e765651c91907507a0194fd528b6223
Reviewed-on: https://go-review.googlesource.com/4662
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-16 04:07:19 +00:00
Nigel Tao
f10e03770c image/jpeg: support decoding CMYK and YCbCrK images.
The new testdata was created by:

convert video-001.png -colorspace cmyk video-001.cmyk.jpeg

video-001.cmyk.jpeg was then converted back to video-001.cmyk.png via
the GIMP. ImageMagick (convert) wasn't used for this second conversion
because IM's default color profiles complicates things.

Fixes #4500.

Change-Id: Ibf533f6a6c7e76883acc493ce3a4289d7875df3f
Reviewed-on: https://go-review.googlesource.com/4801
Reviewed-by: Rob Pike <r@golang.org>
2015-02-16 00:25:47 +00:00
Nigel Tao
b5c3a9e572 image: add image.CMYK and color.CMYK types.
Change-Id: Icf212a4b890725c803b16e76e1a88294b8b62cb8
Reviewed-on: https://go-review.googlesource.com/4800
Reviewed-by: Rob Pike <r@golang.org>
2015-02-16 00:08:49 +00:00
Robert Griesemer
61c9c3ddc4 math/big: implement fast path in Float.SetRat if argument is integer
Change-Id: Ib82500e198b86e9fade278c7eea7a4b0c6b0b2e1
Reviewed-on: https://go-review.googlesource.com/4921
Reviewed-by: Rob Pike <r@golang.org>
2015-02-15 20:11:00 +00:00
Dmitry Vyukov
52dadc1f31 cmd/gc: fix noscan maps
Change 85e7bee introduced a bug:
it marks map buckets as noscan when key and val do not contain pointers.
However, buckets with large/outline key or val do contain pointers.

This change takes key/val size into consideration when
marking buckets as noscan.

Change-Id: I7172a0df482657be39faa59e2579dd9f209cb54d
Reviewed-on: https://go-review.googlesource.com/4901
Reviewed-by: Keith Randall <khr@golang.org>
2015-02-15 08:52:14 +00:00
Robert Griesemer
2dd7a6d41f math/big: always round after the sign is set
Some rounding modes are affected by the sign of the value to
be rounded. Make sure the sign is set before round is called.
Added tests (that failed before the fix).

Change-Id: Idd09b8fcbab89894fede0b9bc922cda5ddc87930
Reviewed-on: https://go-review.googlesource.com/4876
Reviewed-by: Rob Pike <r@golang.org>
2015-02-15 05:14:05 +00:00
Shenghou Ma
7aa68756c5 doc/asm: document that assembly function must use short name
e.g. ·Name instead of package·Name for automatic stack map to
be applied from its Go prototype.

The underlying reason is that liblink look up name with suffix
".args_stackmap" for the stackmap coming from its Go prototype,
but all the Go functions are named "".Name as this stage. Thus
an assembly function named package·Name will never find its
stackmap, which is named "".package.Name.args_stackmap.

Perhaps cmd/vet should give a warning for this.

Change-Id: I10d154a73ec969d574d20af877f747424350fbd1
Reviewed-on: https://go-review.googlesource.com/2588
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-15 00:07:11 +00:00
Shenghou Ma
788f78ad08 cmd/go: remove script and script.txt
Fixes #9824.

Change-Id: Id318c61b6884e4fd294f7b0946dcc306f746ee0a
Reviewed-on: https://go-review.googlesource.com/4891
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-14 20:07:08 +00:00
Ian Lance Taylor
5aa448ff8c test: add test case for issue 4365
This is an update of http://golang.org/cl/151410043 by Tim Shen.

Change-Id: I43ab7fcedd785059c535f45a3c8cdb7b618c1499
Reviewed-on: https://go-review.googlesource.com/4873
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-14 16:02:10 +00:00
Robert Griesemer
b7bfb54eaa math/big: fix aliasing bug in Float.Quo
TBR r, adonovan

Change-Id: I1a38e2d724bf1147c7307a7e5ae855c42c60428c
Reviewed-on: https://go-review.googlesource.com/4875
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-14 04:22:56 +00:00
Robert Griesemer
a809dc7adb math/big: don't scan past a binary exponent if not accepted syntactically
TBR adonovan

Change-Id: I842cbc855dbd560f65e76c9a557dff1a22c5d610
Reviewed-on: https://go-review.googlesource.com/4882
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-14 01:01:19 +00:00
Robert Griesemer
ccdbfe3174 math/big: only permit bases 2, 10, 16 when scanning number w/ "decimal" point
TBR adonovan

Change-Id: I4fd694101c2cf1c0c39bf73d16cab18502742dd9
Reviewed-on: https://go-review.googlesource.com/4881
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-14 01:00:30 +00:00
Robert Griesemer
2e3c738649 math/big: remove Float.Round (not needed anymore), fix a bug in SetInt64
TBR adonovan

Change-Id: I30020f39be9183b37275e10a4fd1e1a3b4c48c89
Reviewed-on: https://go-review.googlesource.com/4880
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-14 00:43:07 +00:00
Robert Griesemer
df218d3393 math/big: implement/rename accessors for precision and rounding mode
Also: remove NewFloat - not needed anymore. Work-around for places
where has been used so far:

NewFloat(x, prec, mode) === new(Float).SetMode(mode).SetPrec(prec).SetFloat64(x)

However, if mode == ToNearestEven, SetMode is not needed. SetPrec
is needed if the default precision (53 after SetFloat64) is not
adequate.

TBR adonovan

Change-Id: Ifda12c479ba157f2dea306c32b47c7afbf31e759
Reviewed-on: https://go-review.googlesource.com/4842
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-14 00:42:40 +00:00