Commit Graph

2826 Commits

Author SHA1 Message Date
Russ Cox
1ff5897d64 tweak final line of test output:
4 known bugs; 0 unexpected bugs

which should be less scary to people
unfamiliar with the tests.

R=r
DELTA=44  (29 added, 12 deleted, 3 changed)
OCL=32460
CL=32464
2009-07-29 15:11:19 -07:00
Rob Pike
1f6e18fdce handle some error conditions involving bad data.
R=rsc
DELTA=32  (24 added, 1 deleted, 7 changed)
OCL=32461
CL=32463
2009-07-29 15:10:29 -07:00
Russ Cox
2946069e3f break and continue fixes
labeled break/continue was using
first loop with any label,
not first loop with the right label.

R=ken
OCL=32453
CL=32458
2009-07-29 14:49:01 -07:00
Rob Pike
75e0569b99 statistics HTML page for rpc
R=rsc
DELTA=121  (115 added, 0 deleted, 6 changed)
OCL=32427
CL=32429
2009-07-29 13:26:49 -07:00
Russ Cox
9271c6402e introduce typecheck pass before walkexpr.
not complete but compiler still works.

R=ken
OCL=32424
CL=32426
2009-07-29 12:47:51 -07:00
Russ Cox
056940d84b convert walkexpr to take Node**; drop indir
R=ken
OCL=32421
CL=32421
2009-07-29 12:00:34 -07:00
Austin Clements
8f694f6661 Flatten the Frame tree. Now each function call produces a
single frame and non-overlapping variables reuse frame slots.
As a result, entering and exiting blocks no longer requires
code execution, which means jumps across block boundaries
should be doable now.  Frame slot initialization happens at
definition time now, instead of at frame creation time.  As an
added bonus, Scope's are now exclusively compile-time objects
and we no longer need to specially track the function
activation frame for access to out vars.

R=rsc
APPROVED=rsc
DELTA=313  (102 added, 90 deleted, 121 changed)
OCL=32416
CL=32420
2009-07-29 11:57:46 -07:00
Russ Cox
4152b925f9 expression printer; %#N
R=ken
OCL=32419
CL=32419
2009-07-29 11:51:34 -07:00
Russ Cox
6b8ba5d8fc quietgcc: do not use -m64 on 32-bit machines
R=r
DELTA=9  (8 added, 0 deleted, 1 changed)
OCL=32413
CL=32418
2009-07-29 11:47:11 -07:00
Russ Cox
9346c6d901 make every func literal expression allocate,
so that == on func means that the
functions originated in the same
execution of a func literal or definition.

before, there was an inconsistency:

	func() {x++} != func() {x++}

but

	func() {} == func() {}

this CL makes the second case != too,
just like

	make(map[int]int) != make(map[int]int)

R=r
DELTA=202  (71 added, 62 deleted, 69 changed)
OCL=32393
CL=32398
2009-07-28 20:01:00 -07:00
David Symonds
83940d7c4a Add a unique list ID to list elements, and verify it as necessary.
This makes the list closed under its provided operations.

R=rsc,gri
APPROVED=rsc
DELTA=18  (14 added, 0 deleted, 4 changed)
OCL=32388
CL=32395
2009-07-28 18:19:16 -07:00
Robert Griesemer
40a66ef59e missed changes to Makefiles for container/ring
R=rsc
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=32389
CL=32392
2009-07-28 17:52:30 -07:00
Rob Pike
b85147cd70 change the encoding of uints to simplify overflow checking and to make them
easier and faster to read.  they are now either a one-byte value or a n-byte value
preceded by a byte holding -n.

R=rsc
DELTA=150  (45 added, 7 deleted, 98 changed)
OCL=32381
CL=32387
2009-07-28 17:20:19 -07:00
Russ Cox
189153ed13 fix error that gcc thinks is a warning
R=ken
OCL=32264
CL=32386
2009-07-28 17:02:05 -07:00
Russ Cox
123ff2ebb8 bug177: anonymous struct fields in reflect
(reported by iant)

R=r
DELTA=50  (32 added, 12 deleted, 6 changed)
OCL=32263
CL=32385
2009-07-28 17:01:46 -07:00
Austin Clements
27b0c351af Implement comparison operators.
R=rsc
APPROVED=rsc
DELTA=304  (281 added, 0 deleted, 23 changed)
OCL=32361
CL=32382
2009-07-28 16:40:23 -07:00
Robert Griesemer
2210a643b7 Intersperse comments nicely when printing an AST.
gofmt formatted source code looks pretty good already;
with a bit more fine-tuning it should be great.

printer.go:
- Implemented comment intersperse algorithm.
  The approach is a result of many trial-and-error
  experiments but at this point reasonably simple
  and open to arbitrary fine-tuning.

parser.go:
- Simplified handling of lead and line comments
  (formerly called leading and trailing comments).
- Use a comments list instead of an array (I may
  change this back - this is not obviously better
  and uses more space).

doc.go:
- Remove comments from AST nodes that have been
  'consumed' in the documentation to avoid duplicate
  printing of them. Allows for better control of
  what is printed w/o use of printing control flags
  (which are hard to use and not fine-grained enough).

Corresponding adjustments to various clients of these
files.

R=rsc
DELTA=478  (275 added, 108 deleted, 95 changed)
OCL=32185
CL=32380
2009-07-28 16:38:59 -07:00
Austin Clements
f62585118c Fix segfault on unnamed function arguments. Make continue
jump to the post statement instead of the condition check.

R=rsc
APPROVED=rsc
DELTA=10  (6 added, 1 deleted, 3 changed)
OCL=32359
CL=32379
2009-07-28 16:38:41 -07:00
Robert Griesemer
d27bae5033 Fixed typos in comments.
TBR=rsc
OCL=32330
CL=32330
2009-07-28 15:03:05 -07:00
Robert Griesemer
6d3d25de21 Ring ADT.
- Provides analogous functionality to a doubly-linked list
  implementation.
- Completely symmetric set of operations.
- Operations on the ADT do not lead to results that are
  outside the domain of the ADT (closed interface).
- Alternative to container/list.

R=rsc
DELTA=489  (489 added, 0 deleted, 0 changed)
OCL=32284
CL=32323
2009-07-28 14:54:49 -07:00
Russ Cox
e50d3ba7e4 floating-point limits and equations
R=r
DELTA=13  (8 added, 2 deleted, 3 changed)
OCL=32291
CL=32322
2009-07-28 14:50:50 -07:00
Russ Cox
92c3627950 fmt boundary bugs.
pow10 was giving up too easily.

R=r
DELTA=4  (0 added, 3 deleted, 1 changed)
OCL=32310
CL=32321
2009-07-28 14:50:17 -07:00
Austin Clements
709e75e3a1 Implement if, for (modulo ranges), break, continue, increment,
and decrement.  blockCompilers now form a tree the mimics the
nesting of scopes and provide convenient ways to enter and
exit scopes.  blockCompilers also track the break and continue
PC for the current block.  The statement testing interface now
works in lists of statements, which simplifies a bunch of
things.

R=rsc
APPROVED=rsc
DELTA=401  (335 added, 44 deleted, 22 changed)
OCL=32308
CL=32317
2009-07-28 14:37:06 -07:00
Rob Pike
483e4fc409 - clean up code creating keys for type maps
- derive int, uint, float, uintptr decoders based on their size
- add overflow checks in decode

R=rsc
DELTA=407  (281 added, 44 deleted, 82 changed)
OCL=32286
CL=32290
2009-07-28 12:59:39 -07:00
Rob Pike
08b5b4843b constants for integer limits
R=rsc
DELTA=16  (16 added, 0 deleted, 0 changed)
OCL=32288
CL=32288
2009-07-28 12:57:33 -07:00
Rob Pike
326de9ca97 constants for floating point limits
R=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=32283
CL=32287
2009-07-28 11:53:16 -07:00
Phil Pennock
d6f89c69c4 Support use of $GOBINDIR to override $HOME/bin
R=r,gri,rsc
APPROVED=rsc
DELTA=53  (12 added, 6 deleted, 35 changed)
OCL=31822
CL=32282
2009-07-28 11:23:24 -07:00
Austin Clements
eaa25ac16b Fix bug where typeArrayMap was using the address of the
pointer to the Type instead of the address of the Type.

R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=32265
CL=32279
2009-07-28 09:58:31 -07:00
Russ Cox
18840f5429 constant keys for array initializers
R=ken
OCL=32261
CL=32261
2009-07-27 17:58:25 -07:00
Austin Clements
75760a4b5d Implement multi-valued functions, multi-valued return, and
unpacking for assignments, call arguments, and returns.  This
change revamps the whole assignment compilation system to be
multi-valued, using the new MultiType type and multiV value.
Function calls, returns, and assignments now share a lot of
code and produce very consistent error messages.

R=rsc
APPROVED=rsc
DELTA=510  (335 added, 74 deleted, 101 changed)
OCL=32248
CL=32258
2009-07-27 17:32:35 -07:00
Russ Cox
eece85c9a7 move bug148, already fixed, to fixedbugs
R=ken
OCL=32257
CL=32257
2009-07-27 17:32:02 -07:00
Rob Pike
5b1d52e81d document rpc.
R=rsc
DELTA=160  (124 added, 0 deleted, 36 changed)
OCL=32233
CL=32256
2009-07-27 17:25:41 -07:00
Russ Cox
b7dd312c93 bug170; fix test for bug175
R=ken
OCL=32255
CL=32255
2009-07-27 17:24:07 -07:00
Russ Cox
a587d9a73f multiple return in := bug
R=ken
OCL=32253
CL=32253
2009-07-27 16:59:10 -07:00
Russ Cox
059bbdd340 print(1<<x)
R=ken
OCL=32252
CL=32252
2009-07-27 16:17:09 -07:00
Russ Cox
30228a3bc6 avoid register computing len(x), cap(x)
for slice or string x.

R=ken
OCL=32249
CL=32249
2009-07-27 15:55:27 -07:00
Austin Clements
33c1045056 Fix bug where nothing could ever be added to a code buffer.
R=rsc
APPROVED=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=32245
CL=32247
2009-07-27 15:21:32 -07:00
Russ Cox
811e59f2fa named string type bugs
R=ken
OCL=32244
CL=32244
2009-07-27 15:16:28 -07:00
Russ Cox
03b25a92a3 catch
a := true;
	a |= a;
in the front end.

R=ken
OCL=32240
CL=32243
2009-07-27 14:55:14 -07:00
Russ Cox
0b2683d1ee do not insert implicit "return;" in empty function body
R=ken
OCL=32239
CL=32239
2009-07-27 14:36:32 -07:00
Ivan Krasin
b388d84013 Fixed a small bug with compress/flate/Inflater. It incorrectly checked
the size of chunk with uncompressed data (00 is terms of DEFLATE).

APPROVED=rsc
DELTA=15  (14 added, 0 deleted, 1 changed)
OCL=32105
CL=32238
2009-07-27 14:33:21 -07:00
Russ Cox
7729c3f955 fix gc bug causing make smoketest to die in cmd/gofmt.
saving of sp was too far away from use in scanstack;
the stack had changed since the sp was saved.

R=r
DELTA=9  (4 added, 2 deleted, 3 changed)
OCL=32232
CL=32237
2009-07-27 14:16:28 -07:00
Austin Clements
d3888fe8a3 Implement single-valued, non-variadic function literals and
function calling.  Implement a type compiler and named types.
Implement a universal scope containing built-in named types,
and some built-in constants.  Implement a simple virtual
machine for executing statements and single-valued return.

Fix many places that incorrectly dealt with named types.  In
particular, the Type.Zero methods now use the type's bit count
to determine the appropriate value representation.  As a
result, a bit count of 0 now means architecture-dependent and
bounded types use unsafe.Sizeof to determine the correct
bounds.  Previously, the bounds on a 32-bit machine would have
been wrong.

Eliminated Type.compatible, since the implementation is
equivalent for all types.  Added Type.rep that shallowly
strips named types.  Replaced almost all uses of Type.literal
with Type.rep.

Fix implementation of assign-op's so it only evaluates the
left side once.  As part of this, there is now a generic way
to separate out the effect and value of an expression.

R=rsc
APPROVED=rsc
DELTA=1530  (1244 added, 68 deleted, 218 changed)
OCL=32184
CL=32230
2009-07-27 13:01:23 -07:00
Russ Cox
ca01716934 fix build - broke with uint32 -> int change in reflect SliceHeader
TBR=r
OCL=32225
CL=32225
2009-07-27 11:23:49 -07:00
Rob Pike
5aa174557a clean up for public use: make some stuff private, add doc comments.
R=rsc
DELTA=298  (202 added, 0 deleted, 96 changed)
OCL=32006
CL=32224
2009-07-27 11:02:06 -07:00
Russ Cox
3ff5e727e2 fix bug in CL 30057: missed if+continue in one place.
R=gri
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=32214
CL=32223
2009-07-27 10:59:59 -07:00
Russ Cox
22ea3f9e49 fix SliceHeader: len and cap are int, not uint32
R=r,iant
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=32215
CL=32222
2009-07-27 10:59:37 -07:00
David Symonds
a225706e5f container/list: Add Len() method to List.
R=r
APPROVED=gri
DELTA=23  (23 added, 0 deleted, 0 changed)
OCL=32106
CL=32189
2009-07-25 17:18:05 -07:00
Ian Lance Taylor
b64b75daa7 If we can't parse the package, call Fatalf so that the test
fails without crashing.

R=gri
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=32164
CL=32171
2009-07-24 13:07:12 -07:00
Russ Cox
dbba489951 do not echo command in errchk,
so that golden.out does not include
the name of the compiler (which is
arch-specific and shows up in diffs).

R=r,iant
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=31980
CL=31983
2009-07-21 19:45:06 -07:00