Commit Graph

2772 Commits

Author SHA1 Message Date
Austin Clements
d426b6389e Implement assignment. Move convertTo.
R=rsc
APPROVED=rsc
DELTA=591  (497 added, 76 deleted, 18 changed)
OCL=31933
CL=31955
2009-07-21 15:40:41 -07:00
Rob Pike
3d42e691b9 make 6l produce dynamically linked binaries (although they are fully statically linked as far
as go is concerned).  the -d flag is now flipped; as on the mac, -d disables dynamic.

much remains to be improved to move the output closer to the gcc format.

R=rsc
DELTA=366  (310 added, 30 deleted, 26 changed)
OCL=31929
CL=31951
2009-07-21 15:10:47 -07:00
Robert Griesemer
ff790f4704 adjust comment for better godoc output
R=rsc
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=31944
CL=31950
2009-07-21 15:09:59 -07:00
Robert Griesemer
e62dd7bce9 - split bignum package into 3 files
- use array for common small values
- integer.go, rational.go don't contain changes besides the added file header

R=rsc
DELTA=1475  (748 added, 713 deleted, 14 changed)
OCL=31939
CL=31942
2009-07-21 14:28:59 -07:00
Ian Lance Taylor
f0c00f7eee Don't cast nil to a fixed array type.
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31916
CL=31937
2009-07-21 14:06:14 -07:00
Ian Lance Taylor
c9399f13f8 You can't set a fixed array to nil.
R=r
DELTA=12  (12 added, 0 deleted, 0 changed)
OCL=31915
CL=31936
2009-07-21 14:05:21 -07:00
Robert Griesemer
2b1ec70d0f implemented outstanding bit ops on negative integerts
R=rsc
DELTA=195  (146 added, 1 deleted, 48 changed)
OCL=31895
CL=31931
2009-07-21 13:35:51 -07:00
Austin Clements
90ffb7b8f5 Cleanup of Type/Value interface. Add Type.ZeroVal, replace
all type-specific value functions, and use ZeroVal to create
new frames.  Remove Value.Type; it was unused and difficult
for values with composite types.  Add Value.Assign methods.

R=rsc
APPROVED=rsc
DELTA=282  (135 added, 90 deleted, 57 changed)
OCL=31894
CL=31930
2009-07-21 13:31:23 -07:00
Ian Lance Taylor
39808db15a Make struct field names unique.
R=rsc
DELTA=5  (0 added, 0 deleted, 5 changed)
OCL=31900
CL=31900
2009-07-20 23:26:03 -07:00
Austin Clements
79fac7ca86 Implement array types and index expressions.
Some cleanup.  Elem() on PtrType is now just Elem and matches
with ArrayType.  Generators now switch over the result type
instead of the operand type.  Delete unused diag function.

R=rsc
APPROVED=rsc
DELTA=281  (219 added, 18 deleted, 44 changed)
OCL=31876
CL=31891
2009-07-20 17:41:40 -07:00
Russ Cox
1d51978fed fix cut-and-paste bugs in error messages
R=ken
OCL=31890
CL=31890
2009-07-20 17:41:18 -07:00
Austin Clements
fb65906367 Fix typo. MUL_ASSIGN is "*=", not "+=".
R=gri
APPROVED=gri
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31879
CL=31886
2009-07-20 16:14:48 -07:00
Russ Cox
6e1ad041f7 avoid strncat in formatters.
the n argument to strncat is the maximum
number of bytes to read from the src,
not the total size of the destination.

R=ken
OCL=31871
CL=31875
2009-07-20 14:16:25 -07:00
Russ Cox
940e381b75 triple quote
R=ken
OCL=31868
CL=31874
2009-07-20 14:15:36 -07:00
Russ Cox
3913550110 fix memset in fmtnull.
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31863
CL=31870
2009-07-20 13:37:35 -07:00
Robert Griesemer
9e2fa390da - bignum.AndNot
- corresponding test cases
- some cleanups

R=rsc
DELTA=173  (68 added, 3 deleted, 102 changed)
OCL=31866
CL=31869
2009-07-20 13:37:28 -07:00
Russ Cox
f664d0e904 explain selectsend problem
R=ken
OCL=31865
CL=31867
2009-07-20 13:29:56 -07:00
Rob Pike
f687fb7e73 6l cleanup: last set of magic numbers for elf64 moved to ld/elf64*.
R=rsc
DELTA=68  (21 added, 28 deleted, 19 changed)
OCL=31857
CL=31864
2009-07-20 13:19:47 -07:00
Rob Pike
fe734d8630 clean up generation of exec header.
make endianness explicit when writing values.

R=rsc
DELTA=129  (37 added, 7 deleted, 85 changed)
OCL=31826
CL=31854
2009-07-20 10:08:48 -07:00
Rob Pike
94d89ede1c take care of a few more magic numbers
R=rsc
DELTA=51  (41 added, 0 deleted, 10 changed)
OCL=31815
CL=31818
2009-07-17 17:32:34 -07:00
Austin Clements
51c0a84175 Gather errors in a go.scanner.ErrorList instead of printing
them as we go.

Lots of bug fixes.  Let the parser toss illegal character and
string literals.  Compile unary + correctly.  Allow float OP
ideal.  Compile unary * correctly.  Implement min and max float
values.

R=rsc
APPROVED=rsc
DELTA=64  (29 added, 7 deleted, 28 changed)
OCL=31811
CL=31814
2009-07-17 16:58:59 -07:00
Rob Pike
b63d40a53e count SHdrs and PHdrs and write them out as a unit
R=rsc
DELTA=181  (93 added, 63 deleted, 25 changed)
OCL=31802
CL=31812
2009-07-17 16:34:58 -07:00
Robert Griesemer
821897bc96 - better documentation
- code cleanup

R=rsc,austin
DELTA=28  (12 added, 2 deleted, 14 changed)
OCL=31808
CL=31810
2009-07-17 16:22:55 -07:00
Ian Lance Taylor
3321470488 Recognize gccgo error message.
explicit.go:21:5: error: incompatible types in assignment (need explicit conversion)
   explicit.go:26:5: error: incompatible types in assignment (type has no methods)
   explicit.go:27:5: error: incompatible types in assignment (need explicit conversion)
   explicit.go:30:6: error: incompatible types in assignment (need explicit conversion; missing method ‘N’)
   explicit.go:33:7: error: invalid type conversion (need explicit conversion; missing method ‘N’)
   explicit.go:36:5: error: incompatible types in assignment

R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31805
CL=31807
2009-07-17 16:12:29 -07:00
Austin Clements
25b4be5a55 Support exponential notation in RatFromString.
R=gri
APPROVED=gri
DELTA=30  (25 added, 0 deleted, 5 changed)
OCL=31796
CL=31799
2009-07-17 15:09:43 -07:00
Rob Pike
e86dcf1603 more elf64 support: phdrs, constants
R=rsc
DELTA=130  (68 added, 6 deleted, 56 changed)
OCL=31798
CL=31798
2009-07-17 15:09:17 -07:00
Austin Clements
f95a42e6ba Produce friendlier errors messages for malformed character
literals and when the parser hits an unexpected EOF.  Also,
disallow newlines in character literals.

R=gri
APPROVED=gri
DELTA=23  (15 added, 1 deleted, 7 changed)
OCL=31790
CL=31797
2009-07-17 14:58:02 -07:00
Russ Cox
35e5906f91 another baby step.
excluding import data,
no yacc node has type Type* anymore.

0 reduce/reduce conflicts.

R=ken
OCL=31793
CL=31795
2009-07-17 14:42:14 -07:00
Rob Pike
1593b1fc23 First steps towards cleaner support for ELF64 in 6l.
R=rsc
DELTA=337  (165 added, 119 deleted, 53 changed)
OCL=31786
CL=31794
2009-07-17 14:32:37 -07:00
Rob Pike
ba0cf083a2 change reflect.Type.Name() into two functions: Name() and PkgPath() for ease of use.
R=rsc
DELTA=31  (8 added, 2 deleted, 21 changed)
OCL=31778
CL=31792
2009-07-17 14:20:33 -07:00
Russ Cox
db508ccbff baby step: const decls can refer to future
consts in the same factored block

	const (
		X = Y;
		Y = 2;
	)

R=ken
OCL=31782
CL=31782
2009-07-17 13:38:16 -07:00
Austin Clements
2ac1528e55 Finish shift implementation for ideals.
R=rsc
APPROVED=rsc
DELTA=65  (29 added, 17 deleted, 19 changed)
OCL=31775
CL=31777
2009-07-17 11:50:32 -07:00
Rob Pike
cb0a02f028 ignore missing structs
R=rsc
DELTA=113  (74 added, 14 deleted, 25 changed)
OCL=31776
CL=31776
2009-07-17 11:38:31 -07:00
Austin Clements
b751be4cf5 Cleanup func literals. "func (" -> "func("
R=rsc
APPROVED=rsc
DELTA=41  (0 added, 0 deleted, 41 changed)
OCL=31773
CL=31773
2009-07-17 10:45:53 -07:00
Austin Clements
96e844393e Implement all unary and binary arithmetic operators.
R=rsc
APPROVED=rsc
DELTA=689  (497 added, 169 deleted, 23 changed)
OCL=31755
CL=31772
2009-07-17 10:38:44 -07:00
Russ Cox
e52e9ca82e another step toward eliminating forward declarations.
introduce NodeList* type in compiler to replace OLIST.
this clarifies where lists can and cannot occur.
list append and concatenation are now cheap.
the _r rules are gone from yacc.
rev and unrev are gone.
no more lists of lists.

the representation of assignments is a bit clunkier.
split into OAS (1=1) and OAS2 (2 or more on one side).

delete dead chanrecv3 code.

delay construction of func types.

R=ken
OCL=31745
CL=31762
2009-07-17 01:00:44 -07:00
Rob Pike
9b475bd2a4 fix up prints in flag.go
R=rsc
DELTA=11  (0 added, 0 deleted, 11 changed)
OCL=31760
CL=31760
2009-07-16 23:14:33 -07:00
Rob Pike
be2cf952a8 clean up the code, flow errors out to decoder.
R=rsc
DELTA=99  (32 added, 22 deleted, 45 changed)
OCL=31759
CL=31759
2009-07-16 23:01:10 -07:00
Rob Pike
1737157189 use FieldByName where possible.
R=rsc
DELTA=20  (0 added, 12 deleted, 8 changed)
OCL=31758
CL=31758
2009-07-16 21:24:30 -07:00
Robert Griesemer
e1b8cb8cf0 - renamed SimpleVarDecl -> ShortVarDecl, in sync with terminology used in prose
- added a few TODOs

R=r
DELTA=4  (2 added, 0 deleted, 2 changed)
OCL=31751
CL=31756
2009-07-16 20:31:41 -07:00
Rob Pike
a93c5c8550 add FieldByName to the interface of reflect.StructType
R=rsc
DELTA=34  (33 added, 0 deleted, 1 changed)
OCL=31752
CL=31754
2009-07-16 18:21:14 -07:00
Rob Pike
1399badb02 - allow wire type and receive type to differ.
- still TODO: ignoring struct fields.

R=rsc
DELTA=309  (240 added, 2 deleted, 67 changed)
OCL=31750
CL=31750
2009-07-16 17:55:16 -07:00
Robert Griesemer
f3ffd93a61 ast:
- renamed Program -> SourceFile
- added Package node representing the AST for an entire package
- added filter function to create a source file mimicking the
  interface of an entire package

parser:
- parser entry to parse entire packages
- unified naming of parser entry points
- factored out entry points into new file (interface.go)

gofmt:
- extended to accept single .go files, and package paths:
  gofmt file.go	     	    // formatting of a single file
  gofmt -x file.go	    // interface of a single file
  gofmt -x ./MyPackage	    // interface of a local package
  gofmt -x math		    // interface of a $GOROOT relative package

Various adjustments in dependent files, documentation.

R=rsc
DELTA=634  (369 added, 153 deleted, 112 changed)
OCL=31743
CL=31748
2009-07-16 17:11:18 -07:00
Rob Pike
b75df2f695 fix some bad testing prints
R=rsc
DELTA=5  (0 added, 0 deleted, 5 changed)
OCL=31740
CL=31742
2009-07-16 15:01:21 -07:00
Rob Pike
04ae91cf71 clean up the decode loop and fix a couple of bad prints
R=rsc
DELTA=15  (8 added, 2 deleted, 5 changed)
OCL=31738
CL=31738
2009-07-16 13:05:46 -07:00
Austin Clements
1902283053 Fix handling of non-waitable zombie threads. Now they are not
considered running, so WaitStop doesn't lock up and
breakpoints get installed and uninstalled.  We also don't try
to detach from them, since that will fail.

R=rsc
APPROVED=rsc
DELTA=35  (26 added, 2 deleted, 7 changed)
OCL=31683
CL=31731
2009-07-16 09:48:37 -07:00
David Symonds
13960ae8ae exvar: new Timer var type.
R=rsc
APPROVED=r
DELTA=146  (142 added, 0 deleted, 4 changed)
OCL=31654
CL=31716
2009-07-15 23:24:27 -07:00
Rob Pike
a9be3f46c6 add rpc to the build
R=rsc
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=31693
CL=31714
2009-07-15 21:28:45 -07:00
Rob Pike
7d94cfdfb9 /usr/local/bin might not exist so use /usr/bin in the chdir test.
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31708
CL=31713
2009-07-15 21:28:08 -07:00
Austin Clements
816e3da26d Make Value always represent an l-value and never a generic
container for values.

Instead of having one evaluator function that returns a
generic Value, there is now an evaluator function for each
generalized type that simply returns a native type.

The compiler is more type-safe now because there are almost no
type conversions at evaluation time and it's impossible to
invoke a nil evaluator function during evaluation.  This also
makes ideals and pointers really clean.

As an added bonus, expression evaluation should be faster
because it doesn't require heap allocation for every
intermediate value, type switches, or lots of conversions to
and from Value.  It also involves fewer function calls.

R=rsc
APPROVED=rsc
DELTA=431  (280 added, 115 deleted, 36 changed)
OCL=31705
CL=31709
2009-07-15 17:56:17 -07:00