Commit Graph

2623 Commits

Author SHA1 Message Date
Russ Cox
0d400a7dea fmt: use new reflect interface (CL 31107)
R=r
DELTA=208  (37 added, 63 deleted, 108 changed)
OCL=31111
CL=31281
2009-07-07 11:03:31 -07:00
Russ Cox
64f4e0b197 update reflect supporting functions,
tests to use new reflect interface.

also make tests a real gotest.

depends on CL 31107

R=r
DELTA=582  (56 added, 194 deleted, 332 changed)
OCL=31108
CL=31279
2009-07-07 11:03:12 -07:00
Russ Cox
541e638f9b 6g, 8g: generate data structures for new reflect interface (CL 31107)
R=ken
OCL=31122
CL=31278
2009-07-07 11:03:04 -07:00
Russ Cox
c7513eac88 runtime: use new reflect data structures (CL 31107)
in place of sigi, sigt.

R=ken
OCL=31118
CL=31277
2009-07-07 11:02:54 -07:00
Russ Cox
ce2e450c6b install new reflect:
rename ntype.go and nvalue.go to type.go and value.go

R=r
DELTA=4295  (761 added, 2819 deleted, 715 changed)
OCL=31238
CL=31276
2009-07-07 11:02:44 -07:00
Robert Griesemer
985390bc52 bug167: types declared in different scopes should
be independent of each other

R=rsc
DELTA=28  (28 added, 0 deleted, 0 changed)
OCL=31271
CL=31273
2009-07-07 10:42:42 -07:00
Robert Griesemer
f401cb3e75 fix test
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=31270
CL=31272
2009-07-07 10:30:31 -07:00
Ian Lance Taylor
5abf395be7 Avoid race condition. Following the left to right rule,
s.output.Data() was being retrieved before the synchronization
point, which meant that it could be retrieved before the
goroutine wrote it.  Using gccgo this caused random errors.

R=gri
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=31046
CL=31267
2009-07-07 10:15:01 -07:00
Russ Cox
27432d67ec move 6c/pgen.c, 6c/pswt.c into cc
and make 5c, 8c use them.

centralizes reachability analysis
and switch generation.

now 8c doesn't have spurious warnings
in pkg/runtime.

R=ken
OCL=31266
CL=31266
2009-07-07 10:07:15 -07:00
Robert Griesemer
8afeb52cac - removed implementation restrictions for creation of small
Natural, Integer, and Rational numbers
- added Value() methods to access small Natural and Integers
  as uint64 or int64 respectively, and to get the components
  of Rational numbers
- fixed a bug with Integer creation
- removed some _'s from names
- added more comments in places
- added test cases

R=rsc
DELTA=184  (127 added, 11 deleted, 46 changed)
OCL=31210
CL=31265
2009-07-07 10:03:42 -07:00
Russ Cox
0417aafe75 insert ODCL in type switch case.
needed for heap allocation if variable escapes.

package main
func main(){
	var i interface{} = 42;
	switch v := i.(type) {
	case int:
		println(&v, v);
	}
}

R=ken
OCL=31245
CL=31245
2009-07-06 23:42:57 -07:00
Russ Cox
0aa1b1508a shift typechecking bugs
x << "a"
	1 << int(2)

R=ken
OCL=31244
CL=31244
2009-07-06 23:33:17 -07:00
Kai Backman
908cd8f857 cleaned up data generation in 5g, reverted 5l handling of D_ADDR.
R=rsc
APPROVED=rsc
DELTA=46  (0 added, 5 deleted, 41 changed)
OCL=31241
CL=31243
2009-07-06 23:04:56 -07:00
David Symonds
52ccdf3510 Add support for v7 tar.
R=rsc
APPROVED=rsc
DELTA=32  (26 added, 4 deleted, 2 changed)
OCL=31172
CL=31242
2009-07-06 22:59:31 -07:00
Russ Cox
2acbc37166 various 6g cleanup:
* give genwrapper and genembedtramp the same signature.
* move duint8, duint16, duint32, duint64, duintptr into gc.
* tidy genwrapper.
* bug involving struct field symbols in signature list.
  (hash-order dependent so hard to trigger)
* new Type print format %#-T like %#T but omits
  names on function arguments.

R=ken
OCL=31237
CL=31237
2009-07-06 22:31:20 -07:00
Russ Cox
74b546aefd statements after panicln are unreachable, just like after panic.
missing break after error.

dot symbol bug fix: leave sym alone
(was incorrect for inserted cross-package dots).

R=ken
OCL=31234
CL=31236
2009-07-06 22:25:54 -07:00
Russ Cox
58c4142e74 new reflect Value implementations.
for now, canSet stays.
i will look into getting rid of it in
a future CL.

R=r
DELTA=420  (419 added, 0 deleted, 1 changed)
OCL=31231
CL=31235
2009-07-06 22:10:40 -07:00
Russ Cox
ef4ddd63f8 another piece for cross-file forward struct declarations.
R=ken
OCL=31233
CL=31233
2009-07-06 21:39:18 -07:00
Russ Cox
a14b28a24d fix bug involving typed nil constants:
interface = (*int)(nil) is not the same as
interface = nil.

package main
func main() {
	var x interface{} = (*int)(nil);
	println(x.(*int));
}

R=ken
OCL=31232
CL=31232
2009-07-06 21:37:29 -07:00
Russ Cox
7af032b87b fix forward struct declarations
R=ken
OCL=31230
CL=31230
2009-07-06 18:05:11 -07:00
Russ Cox
d436a70193 allow conversion to interface type
when implicit assignment would have been okay.

R=ken
OCL=31225
CL=31227
2009-07-06 17:20:48 -07:00
Russ Cox
53ebd163c6 more precise error message
package main

func main() {
       var x interface {} = 42;
       switch x := x.(type) {
       case int:
       case foo:
       }
}

before:
x.go:7: non-type case in type switch
x.go:7: inappropriate case for a type switch

now:
x.go:7: foo: undefined

R=ken
OCL=31221
CL=31221
2009-07-06 16:29:28 -07:00
Russ Cox
a7b4e9f03e new reflect type.go implementation
R=r
DELTA=179  (172 added, 6 deleted, 1 changed)
OCL=31215
CL=31220
2009-07-06 16:06:31 -07:00
Russ Cox
769919c4ee better error message + line numbers
package main
func main() {
       var x interface{};
       switch x {
       case 41:
       case "b":
       }
}

before:
x.go:5: fatal error: exprcmp

now:
x.go:5: illegal types for operand: EQ
	interface { }
	int
x.go:6: illegal types for operand: EQ
	interface { }
	string

R=ken
OCL=31217
CL=31219
2009-07-06 16:05:48 -07:00
Russ Cox
4793400bd1 new reflect library data structures and code declarations
* use structs instead of interfaces
  * compiler lays out data structures ahead of time,
    so no more parsing of strings.
  * unified reflect data structures with interface
    runtime data structures.
  * richer data structures should enable reflection
    on chans and maps, but not implemented here.

R=r,iant
DELTA=1179  (1179 added, 0 deleted, 0 changed)
OCL=31107
CL=31213
2009-07-06 15:34:04 -07:00
Rob Pike
eaf6a344b7 a few edits and simplifications.
R=rsc
DELTA=248  (40 added, 108 deleted, 100 changed)
OCL=31211
CL=31211
2009-07-06 15:15:56 -07:00
Robert Griesemer
4f40f5eaab - bug fix: do not strip lower-case parameter and result names in signatures
- display: show '...' if a struct/interface has fields/methods removed; show
  struct/interface w/o {}'s if all fields/methods were removed; and show the
  {}'s if the struct/interface was empty to begin with

R=rsc
DELTA=41  (36 added, 0 deleted, 5 changed)
OCL=31201
CL=31204
2009-07-06 11:39:48 -07:00
Rob Pike
d3a2925bb2 catch corruption - avoid crash
R=rsc
DELTA=4  (4 added, 0 deleted, 0 changed)
OCL=31192
CL=31198
2009-07-06 10:58:55 -07:00
Robert Griesemer
deb954772d - ast.FilterExports: strips all non-exported nodes from an AST
- use FilterExports instead of the various predicates in printer.go and doc.go
  which simplifies a lot of code and makes it easier to deal with complex cases

R=rsc
DELTA=445  (197 added, 190 deleted, 58 changed)
OCL=31110
CL=31196
2009-07-06 10:37:33 -07:00
Kai Backman
cd4aab62e3 sudoaddable odot
R=rsc
APPROVED=rsc
DELTA=7  (0 added, 1 deleted, 6 changed)
OCL=31189
CL=31191
2009-07-06 09:23:41 -07:00
Russ Cox
6da41be2d3 fix float32 comparison. was doing l op l instead of l op r.
R=ken
OCL=31190
CL=31190
2009-07-06 09:05:33 -07:00
Kai Backman
86987055a3 agen, sgen, cgen_callret, cgen_asop, D_ADDR handling, gmove
8bit and 16bit, some optoas, replaced Addr.index with
Addr.name

empty function compiles, mutex compiles

R=rsc
APPROVED=rsc
DELTA=908  (83 added, 41 deleted, 784 changed)
OCL=31127
CL=31188
2009-07-06 06:42:37 -07:00
Kai Backman
a7735f8a16 fixed bug that cause -g to segfault
R=rsc
APPROVED=rsc
DELTA=48  (30 added, 16 deleted, 2 changed)
OCL=31152
CL=31187
2009-07-06 06:36:25 -07:00
David Symonds
c1edbe9a10 Remove assumption about google.com being the default search domain.
R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31151
CL=31168
2009-07-05 15:00:11 -07:00
Ken Thompson
6bb3c48d3d another seg fault
R=r
OCL=31156
CL=31156
2009-07-04 13:59:08 -07:00
Russ Cox
db312fa8de bug163
R=ken
OCL=31149
CL=31149
2009-07-03 13:34:05 -07:00
Russ Cox
8a1bfe89b2 change bug163 to use actual non-letter in identifier
R=r,iant
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31146
CL=31148
2009-07-03 13:33:00 -07:00
Rob Pike
3dab3e65d8 put gob into the standard build
R=rsc
DELTA=77  (76 added, 0 deleted, 1 changed)
OCL=31147
CL=31147
2009-07-03 12:54:59 -07:00
Russ Cox
1af3edc37f maps have == so maps should work as map keys.
fix tests of bad map keys to use slices instead.

R=r
DELTA=7  (0 added, 1 deleted, 6 changed)
OCL=31123
CL=31145
2009-07-03 09:45:15 -07:00
Russ Cox
75fe1303c1 maps have == so maps are okay as map keys.
alignment issue is fixed.

R=ken
OCL=31124
CL=31144
2009-07-03 09:44:59 -07:00
Kai Backman
84ded32817 sys.cas for mutex
R=rsc
APPROVED=rsc
DELTA=28  (28 added, 0 deleted, 0 changed)
OCL=31128
CL=31130
2009-07-02 22:05:06 -07:00
Kai Backman
84ef63b9d5 minor comment and debug flag for dumping all oplooks.
R=rsc
APPROVED=rsc
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=31016
CL=31126
2009-07-02 21:35:39 -07:00
Russ Cox
29aa3ffbf6 move Structrnd to runtime.h
R=ken
OCL=31125
CL=31125
2009-07-02 21:25:46 -07:00
Rob Pike
265674fa57 slices
R=rsc
DELTA=59  (44 added, 13 deleted, 2 changed)
OCL=31105
CL=31105
2009-07-02 18:02:42 -07:00
Rob Pike
c1fc4c8f37 indirection on array elements.
R=rsc
DELTA=57  (34 added, 10 deleted, 13 changed)
OCL=31098
CL=31101
2009-07-02 17:21:48 -07:00
Russ Cox
b5666a123a add Uitoa etc.
R=r
DELTA=113  (89 added, 9 deleted, 15 changed)
OCL=31087
CL=31096
2009-07-02 16:57:46 -07:00
Rob Pike
0c33d4353e arrays, not slices, and only with non-pointer elements.
(actually slices encode but do not decode yet)

R=rsc
DELTA=221  (82 added, 65 deleted, 74 changed)
OCL=31095
CL=31095
2009-07-02 16:43:46 -07:00
Rob Pike
29e6eb21ec make a description of the slice header public
R=rsc
DELTA=18  (3 added, 0 deleted, 15 changed)
OCL=31086
CL=31094
2009-07-02 16:28:04 -07:00
Russ Cox
c7a9d9818a fix atoi test
R=r
DELTA=28  (5 added, 0 deleted, 23 changed)
OCL=31093
CL=31093
2009-07-02 16:24:44 -07:00
Ian Lance Taylor
7ae0c67825 Recognize gccgo error message.
bug022.go:8:13: error: attempt to index object which is not array, string, or map

R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31082
CL=31089
2009-07-02 15:55:17 -07:00