1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:11:22 -06:00
Commit Graph

1033 Commits

Author SHA1 Message Date
Rob Pike
104d0246ea fix gobuild bug
R=rsc
DELTA=4  (3 added, 0 deleted, 1 changed)
OCL=30845
CL=30845
2009-06-29 11:19:38 -07:00
Kai Backman
b2871b727e working on bgen
- removed smallint optimizations
- lifted raddr from 5c
- add back %R, was used in gc/* causing -g to crash
- changed naddr OREGISTER to emit D_REG instead of D_OREG

R=rsc
APPROVED=rsc
DELTA=74  (38 added, 28 deleted, 8 changed)
OCL=30799
CL=30822
2009-06-26 22:04:30 -07:00
Rob Pike
d330c712c1 Getenv: almost no one wants the error, so make it return a string that may be empty.
Getenverror is the new name for the old routine that returns an error too.

R=rsc
DELTA=35  (7 added, 7 deleted, 21 changed)
OCL=30818
CL=30821
2009-06-26 20:28:41 -07:00
Kai Backman
d6197d94b5 Adding more debug output when 5l encounters a bad op
combination.

R=rsc
APPROVED=rsc
DELTA=69  (68 added, 0 deleted, 1 changed)
OCL=30798
CL=30801
2009-06-26 13:44:25 -07:00
Kai Backman
4556c04d8b more changes to make 5g code generation arm compatible.
R=rsc
APPROVED=rsc
DELTA=72  (12 added, 52 deleted, 8 changed)
OCL=30748
CL=30793
2009-06-26 04:08:20 -07:00
Russ Cox
480f51243c bug165
R=ken
OCL=30783
CL=30783
2009-06-25 21:02:39 -07:00
Russ Cox
a0bcaf4c00 Change os.Error convention:
echo back context of call in error if likely to be useful.

For example, if os.Open("/etc/passwd", os.O_RDONLY)
fails with syscall.EPERM, it returns as the os.Error

	&PathError{
		Op: "open",
		Path: "/etc/passwd"
		Error: os.EPERM
	}

which formats as

	open /etc/passwd: permission denied

Not converted:

	datafmt
	go/...
	google/...
	regexp
	tabwriter
	template

R=r
DELTA=1153  (561 added, 156 deleted, 436 changed)
OCL=30738
CL=30781
2009-06-25 20:24:55 -07:00
Russ Cox
70e232e668 separate local path lookup from standard package directories
R=ken
OCL=30760
CL=30779
2009-06-25 20:15:56 -07:00
Russ Cox
cf370a6206 add ./ to imports where necessary
R=r
DELTA=51  (4 added, 4 deleted, 43 changed)
OCL=30759
CL=30778
2009-06-25 20:13:56 -07:00
Russ Cox
5851a1b5ad allow
package main
type t interface
type t interface{ m(map[t]bool) }
type m map[t] int

making it work without the forward declaration will require a second pass.

R=ken
OCL=30773
CL=30773
2009-06-25 18:19:05 -07:00
Russ Cox
1ea28570ec the any fix was too aggressive; allow any in any import.
R=ken
OCL=30768
CL=30768
2009-06-25 16:57:56 -07:00
Russ Cox
fa6df47986 package main
const foo = []int{1,2}

x.go:3: expression must be a constant

instead of

x.go:3: fatal error: gettype: addtop

R=ken
OCL=30767
CL=30767
2009-06-25 16:42:08 -07:00
Russ Cox
70a273476b better error; clean up lineno in a few places
wreck.mtv=; cat x.go
package main
var x = string.Split()
wreck.mtv=; 6g x.go
x.go:2: type string used as expression
x.go:2: undefined DOT Split on string
x.go:3: illegal types for operand: AS
	undefined
wreck.mtv=;

BUG=1938751
R=ken
OCL=30766
CL=30766
2009-06-25 16:32:33 -07:00
Russ Cox
4bce6d455f package main
func foo(y) { }

was:
x.go:2: NONAME-y G0 u(1) a(1) l(77) x(-1000000000) is not a type

now:
x.go:2: y is not a type

R=ken
OCL=30764
CL=30764
2009-06-25 16:25:06 -07:00
Russ Cox
30f2799f88 disable "any" except during canned imports.
new flag -A enables it during mkbuiltin.
avoids mysterious errors in programs
that refer to any accidentally.

R=ken
OCL=30763
CL=30763
2009-06-25 16:22:46 -07:00
Russ Cox
111ae83bb7 6g: update for spec change CL 30586
R=ken
OCL=30593
CL=30756
2009-06-25 14:44:45 -07:00
Kai Backman
190b5c9ad2 fixes to 5g object file generation. arm specific regalloc.
R=rsc
APPROVED=rsc
DELTA=976  (164 added, 237 deleted, 575 changed)
OCL=30705
CL=30743
2009-06-25 11:01:17 -07:00
Ken Thompson
466dd8da4e 6g crash re mail from gri jun 18.
R=r
OCL=30719
CL=30719
2009-06-24 17:50:25 -07:00
Kai Backman
354e61cc52 Fix compile warnings in 5l.
R=rsc
APPROVED=rsc
DELTA=8  (0 added, 0 deleted, 8 changed)
OCL=30692
CL=30695
2009-06-24 11:44:06 -07:00
Russ Cox
a45c54d1a5 fix gobuild.
errors introduced in CL 30601

R=austin
DELTA=6  (3 added, 0 deleted, 3 changed)
OCL=30663
CL=30665
2009-06-23 16:21:05 -07:00
Russ Cox
0aef57e37f fix a 6g crash after type errors.
do not bother warning about marks left
on stack after syntax errors.

leave OCONV nodes in tree to avoid type errors
arising from multiple walks.

R=ken
OCL=30639
CL=30662
2009-06-23 15:30:59 -07:00
Kai Backman
be639b9a51 Runtime is now starting up with a dummy c program as target:
- morestack and gosave/gogo/gocall support
- memclr and memset from inferno
- bugfixes in _rt0_arm

R=rsc
APPROVED=rsc
DELTA=304  (174 added, 36 deleted, 94 changed)
OCL=30636
CL=30642
2009-06-23 11:54:23 -07:00
Russ Cox
2fcc8f2fb6 avoid pointer-to-slice operations in gobuild
R=r
DELTA=19  (3 added, 1 deleted, 15 changed)
OCL=30591
CL=30601
2009-06-22 14:24:32 -07:00
Russ Cox
7f3eb2738f implement new spec language regarding conversions
R=ken
OCL=30519
CL=30534
2009-06-19 14:00:53 -07:00
Russ Cox
05240bb290 use multiline string literal in gobuild
R=r
DELTA=76  (1 added, 0 deleted, 75 changed)
OCL=30497
CL=30510
2009-06-18 16:32:26 -07:00
Ken Thompson
eba82f4391 better diagnostics for eof in a string.
this assumes that embedded newlines are
legal in back-quote strings.

R=r
OCL=30502
CL=30502
2009-06-18 15:49:41 -07:00
Russ Cox
8522a478bb update 386 to new runtime (CL 30381)
R=r
DELTA=298  (119 added, 81 deleted, 98 changed)
OCL=30427
CL=30443
2009-06-17 15:15:55 -07:00
Rob Pike
e15b64e87e clean gofmt
R=rsc
OCL=30363
CL=30363
2009-06-16 14:03:13 -07:00
Rob Pike
6202b0e287 add godoc to clean.bash
R=rsc
OCL=30361
CL=30361
2009-06-16 13:57:08 -07:00
Robert Griesemer
d8e4446d12 - install gofmt in src/cmd/gofmt
- remove some left-over files

R=rsc
DELTA=1465  (281 added, 1181 deleted, 3 changed)
OCL=30350
CL=30353
2009-06-16 12:03:32 -07:00
Kai Backman
1ac2cfc720 grab bag of changes aimed at getting stack splitting to work:
- morestack support for 5l and arm runtime
- argsize support in 5c, 5l, ar and nm. assembly code from 5a
  will break in interesting ways unless NOSPLIT is specified
- explicit cond execution constants
- fix 5l output to use %d instead of %ld so that negative
  values show.
- added a lot of code to arm/asm.s. runtime entry code almost
  working currently aborts at gogo not implemented

R=rsc
APPROVED=rsc
DELTA=305  (125 added, 29 deleted, 151 changed)
OCL=30246
CL=30347
2009-06-16 11:25:58 -07:00
Robert Griesemer
d45442ed65 fix build
R=rsc
DELTA=5  (0 added, 1 deleted, 4 changed)
OCL=30343
CL=30343
2009-06-16 09:39:57 -07:00
Robert Griesemer
f05c04146e forgot to adjust tmproot
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=30342
CL=30342
2009-06-16 09:30:16 -07:00
Robert Griesemer
5071a5a572 move godoc to src/cmd/godoc
R=rsc
DELTA=945  (944 added, 0 deleted, 1 changed)
OCL=30315
CL=30341
2009-06-16 09:14:06 -07:00
Russ Cox
30a28aec25 b/1909731
package main
func f(a *c.b) {}
func main() {}

BUG=1909731
R=ken
OCL=30322
CL=30322
2009-06-15 20:15:59 -07:00
Kai Backman
f2201185ab Added ld/go.c functionality into 5l, primarily dead code
removal and typesigs and strings.

Also added new header support to 5c/5a/5l.

R=rsc
APPROVED=rsc
DELTA=98  (66 added, 10 deleted, 22 changed)
OCL=30103
CL=30123
2009-06-09 20:51:53 -07:00
Kai Backman
1faf06eabf make 5g use 1 byte per binary asm statement.
R=rsc
APPROVED=rsc
DELTA=4  (0 added, 4 deleted, 0 changed)
OCL=30110
CL=30112
2009-06-09 11:34:35 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00
Kai Backman
83632c7359 initial morestack support for 5l. still disabled, doesn't work.
R=rsc
APPROVED=rsc
DELTA=245  (167 added, 63 deleted, 15 changed)
OCL=30039
CL=30081
2009-06-08 20:20:35 -07:00
Russ Cox
b7f0580274 move src/runtime -> src/lib/runtime;
hand-edited files.

R=r
DELTA=125  (77 added, 16 deleted, 32 changed)
OCL=30001
CL=30008
2009-06-06 22:04:50 -07:00
Russ Cox
3c06bd6201 an 8g checkpoint.
needs cleanup, optimizer,
but all.bash works.

R=ken
OCL=29974
CL=30000
2009-06-06 19:28:16 -07:00
Russ Cox
8abcdee175 implement optional semicolons with help from the lexer,
instead of having to double the type and statement grammars.

R=ken
OCL=29987
CL=29998
2009-06-06 19:27:48 -07:00
Russ Cox
e9e388412c 6g: add TODO about float constants back
R=ken
OCL=29984
CL=29997
2009-06-06 19:27:30 -07:00
Russ Cox
8f4af6d205 gc: grammar cleanup:
* no longer distinguishes const, var, type, package names.
  * all the predefined names are not tokens anymore.

R=ken
OCL=29326
CL=29985
2009-06-06 12:46:38 -07:00
Russ Cox
b28d84f644 8l: add AIMULW
R=ken
OCL=29972
CL=29972
2009-06-05 23:52:43 -07:00
Russ Cox
8720b4721f use cc provided xlog2 instead of system log2.
(on plan 9 cc calls it log2, but that conflicts here.)
the difference is that xlog2 returns -1 on non powers of 2.
8c was rewriting /10 into /8.

R=ken
OCL=29968
CL=29968
2009-06-05 23:12:07 -07:00
Russ Cox
01fe6a9c58 more build refinements:
* use new Make.$GOARCH files in gobuild.
 * rename 6ar to arch-generic gopack.
 * place objects in $GOROOT/pkg/$GOOS_$GOARCH
   (makes cross-compiling easier, and no one
   ever types these paths by hand anyway).

R=r
DELTA=29  (6 added, 8 deleted, 15 changed)
OCL=29923
CL=29967
2009-06-05 22:18:32 -07:00
Russ Cox
6609d2f88d restructure makefiles, scripts to factor out O= logic.
remove a few hardcoded paths elsewhere too.

R=r,gri
DELTA=123  (44 added, 15 deleted, 64 changed)
OCL=29914
CL=29945
2009-06-05 10:59:55 -07:00
Kai Backman
25ac4d07a2 Rolling galign back to 32 bit.
R=rsc
APPROVED=rsc
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=29532
CL=29917
2009-06-04 21:11:55 -07:00
Russ Cox
f6402313d3 don't need these anymore;
R=kaib
DELTA=36  (0 added, 36 deleted, 0 changed)
OCL=29908
CL=29916
2009-06-04 21:10:49 -07:00
Russ Cox
2f2577a4f6 bug161, fixed
R=ken
OCL=29907
CL=29907
2009-06-04 16:18:13 -07:00
Russ Cox
9a9ffb2b0e more 8g progress.
likely to go back to registers for most temporaries.

most tests in lib pass.  these fail:

	datafmt
	fmt
	go/scanner
	log
	reflect
	strconv
	template

R=ken
OCL=29896
CL=29898
2009-06-04 15:24:01 -07:00
Russ Cox
f0e6a3caac dangling pointer bug (thanks valgrind)
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=29881
CL=29885
2009-06-04 13:33:29 -07:00
Russ Cox
3a0df4c451 more 386 runtime fixes.
can pass many tests;
current stumbling block is an 8l bug.

R=r
DELTA=122  (83 added, 8 deleted, 31 changed)
OCL=29872
CL=29876
2009-06-04 11:16:03 -07:00
Russ Cox
f51ca384eb fix handling of floating point zero constant 0p+0
R=r
DELTA=25  (25 added, 0 deleted, 0 changed)
OCL=29875
CL=29875
2009-06-04 11:06:37 -07:00
Russ Cox
ea7f5505d1 zero struct in T{}
R=ken
OCL=29849
CL=29849
2009-06-03 16:10:13 -07:00
Russ Cox
ab3d40b271 trivial cut and paste: move 64-bit simulation into cgen64.c
R=ken
OCL=29812
CL=29812
2009-06-02 23:26:02 -07:00
Russ Cox
a00bfb5b49 8g:
* floating point -> integer conversions.
    x86 defines that overflow/underflow
    results in 1<<15, 1<<31, 1<<63 for
    int16, int32, int64.  when building the
    unsigned conversions out of the native signed
    ones, 8g turns overflow/underflow into zero.
    the spec does not say what should happen.

  * many tiny bug fixes.  can run a large number
    of files from go/test now, and can fmt.Printf.

  * struggling with byte register allocation
    and float32 computation.

R=ken
OCL=29642
CL=29811
2009-06-02 23:25:17 -07:00
Russ Cox
73c10dd967 386 library updates
R=r
DELTA=161  (153 added, 0 deleted, 8 changed)
OCL=29802
CL=29809
2009-06-02 23:22:12 -07:00
Russ Cox
f1f970ad21 minor cleanup, 64-bit /= and %= on 32-bit
R=ken
OCL=29806
CL=29808
2009-06-02 23:21:58 -07:00
Russ Cox
07393f8706 8l fixes, cut and paste from 6l.
move PtrSize value into 6l/8l files.

R=r
DELTA=78  (47 added, 15 deleted, 16 changed)
OCL=29729
CL=29798
2009-06-02 22:33:21 -07:00
Russ Cox
278b1ab053 make godefs work better for generating Go.
R=r
DELTA=121  (92 added, 4 deleted, 25 changed)
OCL=29706
CL=29721
2009-06-01 22:14:25 -07:00
Ken Thompson
c17ce9f94f prevent multiple similar errors
in complex literals. side effect is
fix of error in initializerr.go

R=r
OCL=29667
CL=29667
2009-05-31 13:02:24 -07:00
Russ Cox
d6a9817051 bug157
R=ken
OCL=29651
CL=29653
2009-05-30 21:18:15 -07:00
Ken Thompson
be63b6dc44 bug 158
R=r
OCL=29646
CL=29646
2009-05-30 17:06:51 -07:00
Russ Cox
91395ae689 make gobuild failures more readable.
1. ar reports names of objects with duplicate text symbols.
2. gobuild only shows first line of error output for each failed command.
3. gobuild ignores files that begin with ascii non-alphanumeric non _.

; gobuild
$ 6g -I _obj gobuild.go
  gobuild.go:150: PackageImports: undefined
$ 6g -I _obj makefile.go
  makefile.go:102: ShellString: undefined
$ 6g -I _obj util.go
  util.go:114: syntax error near zzz
gobuild: stalemate
;

; gobuild
$ 6ar grc _obj/gobuild.a util.6 util1.6
  duplicate text symbol: util1.6 and util.6: gobuild·Build
$ 6g -I _obj gobuild.go
  gobuild.go:150: PackageImports: undefined
$ 6g -I _obj makefile.go
  makefile.go:102: ShellString: undefined
gobuild: stalemate
;

R=r
DELTA=95  (49 added, 9 deleted, 37 changed)
OCL=29625
CL=29640
2009-05-29 18:12:04 -07:00
Ken Thompson
fbcbcdbb1d bug 156
R=r
OCL=29623
CL=29623
2009-05-29 15:34:47 -07:00
Ken Thompson
1c7bee0567 bug 155
R=r
OCL=29619
CL=29619
2009-05-29 14:42:24 -07:00
Ken Thompson
3b37b02834 bug 149
R=r
OCL=29612
CL=29612
2009-05-29 13:44:30 -07:00
Russ Cox
5d1d8a8258 integer conversions and test.
R=ken
OCL=29577
CL=29589
2009-05-29 09:17:35 -07:00
Russ Cox
6e1762c06e 64-bit integer arithmetic.
passes ridiculous test from CL 29569.

R=ken
OCL=29571
CL=29573
2009-05-29 00:13:09 -07:00
Russ Cox
0a6d83567e print uint64 as uint64.
R=ken
OCL=29568
CL=29570
2009-05-28 22:24:03 -07:00
Ken Thompson
e2613711aa detect recursive initialization
R=r
OCL=29544
CL=29544
2009-05-28 16:00:55 -07:00
Russ Cox
3aa006b8cd better 64-bit handling in 8g.
fewer moves, fewer stupid LEALs.
powser1 runs (with evaln commented out).
beginnings of floating point.

R=ken
OCL=29540
CL=29543
2009-05-28 15:48:47 -07:00
Kai Backman
63e1b714de Rebooted 5g effort from 6g. Tons of minor fixes and tweaks to
get the code going.

R=rsc
APPROVED=rsc
DELTA=4752  (1723 added, 948 deleted, 2081 changed)
OCL=29403
CL=29530
2009-05-28 14:25:54 -07:00
Kai Backman
97fe55720d Change 5l to use Biobufs for IO.
R=rsc
APPROVED=rsc
DELTA=132  (16 added, 45 deleted, 71 changed)
OCL=29468
CL=29497
2009-05-28 07:41:23 -07:00
Russ Cox
e81d97ea84 clean up gmove:
* conversions all in one place.
	* no separate load, store phases;
	  direct memory addressing when possible
	  (this is the x86 after all!).
	  avoids extra registers, extra MOVQs.
	* fixes int32 -> uint64 bug
	  (was zero-extending)

R=ken
OCL=29482
CL=29484
2009-05-27 23:55:14 -07:00
Ken Thompson
b3f303ec9a bug 153
R=r
OCL=29479
CL=29479
2009-05-27 18:37:02 -07:00
Ken Thompson
64c3fe05bf string([]int) conversion
R=r
OCL=29466
CL=29466
2009-05-27 15:38:02 -07:00
Russ Cox
18890eebbf fix bug154; tweak bug153 exit status
R=ken
OCL=29448
CL=29448
2009-05-27 10:16:13 -07:00
Russ Cox
51bb8795cd 8g: missing change from last CL
R=ken
OCL=29426
CL=29426
2009-05-26 21:11:31 -07:00
Russ Cox
a8e4ed6a3d 8g: 64-bit arithmetic and assorted bug fixes;
can run 64-bit sieve and powser.
interfaces are limping along.
next hurdle is floating point.

R=ken
OCL=29418
CL=29423
2009-05-26 21:07:26 -07:00
Ken Thompson
b46e7c4d3c bug 152
R=r
OCL=29419
CL=29419
2009-05-26 19:48:39 -07:00
Ken Thompson
51ddddc67e bug 151
R=r
OCL=29409
CL=29409
2009-05-26 16:30:35 -07:00
Russ Cox
5ecd010beb more 8g.
test/turing.go runs if you move the big array off its stack.

finally remembered to g4 add cgen.c gsubr.c

R=ken
OCL=29408
CL=29408
2009-05-26 16:23:54 -07:00
Ken Thompson
850cd6a2fe bug 150
R=r
OCL=29405
CL=29405
2009-05-26 15:56:37 -07:00
Russ Cox
021abfbd28 8g: hello world works again
* string format changed
	* files got renamed
	* new files that i forgot to check in last time
updates are all copy and paste from 6g

R=ken
OCL=29385
CL=29400
2009-05-26 14:46:06 -07:00
Russ Cox
1f0f2e44a9 6ar: explain why __.SYMDEF didn't get put in.
people using ar for non-object archives
will just have to deal with the warnings.

R=r
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=29384
CL=29398
2009-05-26 14:34:32 -07:00
Kai Backman
3c7a1ef208 Added automatic detection of system libraries to 5l.
R=rsc
APPROVED=rsc
DELTA=83  (73 added, 3 deleted, 7 changed)
OCL=29276
CL=29382
2009-05-26 12:14:55 -07:00
Kai Backman
7943556970 Added enough arm related scaffolding to create a simple
hello.c program linking against the runtime.

R=rsc
APPROVED=rsc
DELTA=178  (175 added, 0 deleted, 3 changed)
OCL=29283
CL=29380
2009-05-26 11:18:42 -07:00
Ken Thompson
802e1a6104 static init reenabled
R=r
OCL=29358
CL=29358
2009-05-25 19:40:41 -07:00
Ken Thompson
798b19bf77 improvement in registerization
R=r
OCL=29317
CL=29317
2009-05-23 16:36:43 -07:00
Ken Thompson
4238b18344 1. check for dups in complex literals
structtype{a:1, a:2}
   maptypetype{"xx":1, "xx":2}
   arraytypetype{5:1, 5:2}
2. bug in registerization concerning
   alias of a struct and one of its elements
3. code optimization of struct.field
   (which exposed bug in 2)

R=r
OCL=29315
CL=29315
2009-05-23 15:34:29 -07:00
Russ Cox
4beac9985b simplifying grammar: delete LBASETYPE and LACONST.
take 2

R=ken
OCL=29304
CL=29306
2009-05-22 22:46:06 -07:00
Russ Cox
ca2fe5d8bd Automated g4 rollback of changelist 29302.
*** Reason for rollback ***

too many files included

*** Original change description ***

simplifying grammar: delete LBASETYPE and LACONST

R=ken
OCL=29303
CL=29303
2009-05-22 22:43:57 -07:00
Russ Cox
2a4dcfffc9 simplifying grammar: delete LBASETYPE and LACONST
R=ken
OCL=29300
CL=29302
2009-05-22 22:42:12 -07:00
Kai Backman
9a2a2474c6 Force usage of dollar signs to circumvent arm-gcc balking at them.
R=rsc
APPROVED=rsc
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=29275
CL=29278
2009-05-22 15:32:43 -07:00
Russ Cox
f4d3d22a94 enforce channel direction
R=ken
OCL=29209
CL=29216
2009-05-21 17:32:44 -07:00
Russ Cox
c2fa45b973 allow type name as key to accomodate anonymous fields.
update tests.

R=ken
OCL=29207
CL=29207
2009-05-21 16:31:10 -07:00
Ken Thompson
bba10b3f49 some array init bugs
renamed 6g/(gen|align|obj).c

R=r
OCL=29205
CL=29205
2009-05-21 15:44:06 -07:00
Russ Cox
8b6b380605 stricter rules for assignment.
when assigning a multifield object
(structs or arrays of structs) they
must not contain any fields that could
not be assigned individually.

R=ken
OCL=29192
CL=29194
2009-05-21 14:06:24 -07:00
Ken Thompson
a016081f43 added key:val extension to
structure and array literals

R=r
OCL=29190
CL=29190
2009-05-21 13:46:07 -07:00
Russ Cox
23e62d169f stricter interface conversion rule: i.(T)
must have non-nil i.

R=ken
OCL=29136
CL=29136
2009-05-20 18:23:19 -07:00
Russ Cox
a39bae095a ifaceop was being called with integers
that came from two different enums.
spilt into ifacecvt and ifaceop depending
on which enum the argument is.

R=ken
OCL=29122
CL=29122
2009-05-20 15:09:50 -07:00
Russ Cox
2da5022bcf change representation of interface values.
this is not a user-visible change.

before, all interface values were

	struct Itype {
		Sigt *type;
		Sigi *inter;
		void *method[n];
	}

	struct Iface {
		void *addr;
		Itype *itype;
	}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

	struct Eface {
		void *addr;
		Sigt *type;
	}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
2009-05-20 14:57:55 -07:00
Russ Cox
47e5152790 fix implicit star for range on *map, *[].
do not update lineno from ONAME nodes,
	because they have declaration lineno not use.
show actual name in top-level statement error.

before
runtime.a:7: x.go:5: walkstate: NAME not a top level statement

after
x.go:14: walkstate: runtime.Goexit not a top level statement

R=ken
OCL=29113
CL=29116
2009-05-20 14:24:23 -07:00
Ken Thompson
da49bfe664 static initialization of strings
R=r
OCL=29036
CL=29036
2009-05-19 13:37:36 -07:00
Ken Thompson
b91a043d02 static initialization of slices
R=r
OCL=29016
CL=29016
2009-05-18 22:11:22 -07:00
Robert Griesemer
1ed725d7cd - changed parser to return os.Error, removed ErrorHandler
- added IsValid predicate to token.Position
- updated pretty, godoc, gobuild
- updated/expanded test cases

R=rsc
DELTA=265  (97 added, 78 deleted, 90 changed)
OCL=28961
CL=29005
2009-05-18 14:59:16 -07:00
Ken Thompson
62231e91d0 static initialization with DATA statements
structs and arrays are done
slices and maps are yet to do

R=r
OCL=28977
CL=28977
2009-05-17 19:16:16 -07:00
Ken Thompson
52b0f77bf9 static initialization
structure set up - no change yet

R=r
OCL=28966
CL=28966
2009-05-16 13:29:08 -07:00
Rob Pike
a8db4593ab fix spelling error in message
R=ken
OCL=28814
CL=28814
2009-05-14 09:59:16 -07:00
Russ Cox
d06a79e31b no need for compiler to hard-code definition of runtime.
use the actual go source instead.

R=r
DELTA=90  (66 added, 18 deleted, 6 changed)
OCL=28708
CL=28719
2009-05-12 16:15:52 -07:00
Russ Cox
0880593436 gobuild: command printing bug fix
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=28583
CL=28590
2009-05-08 16:38:42 -07:00
Russ Cox
b3533dfd72 6g:
new type equality restrictions
	better handling of renamed packages
	"sys" is no longer available to programs

R=ken
OCL=28553
CL=28578
2009-05-08 15:40:31 -07:00
Russ Cox
917aa35f8f implications of stricter type equality:
if both types are named, they must be
the same type (arising from the same
declaration).

R=r,gri
DELTA=44  (21 added, 4 deleted, 19 changed)
OCL=28436
CL=28577
2009-05-08 15:40:14 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
c367d1b789 Move sys.Reflect and sys.Unreflect into unsafe.
R=rsc
DELTA=19  (4 added, 5 deleted, 10 changed)
OCL=28563
CL=28566
2009-05-08 14:57:56 -07:00
Russ Cox
d4fa253837 eqtype(t1, t2, 0) => eqtype(t1, t2)
R=ken
OCL=28559
CL=28562
2009-05-08 14:40:38 -07:00
Rob Pike
c8b47c6fce Name change to improve embeddability:
io.Read->io.Reader
	io.Write,Close,etc.->io.Writer,Closer etc.

R=rsc
DELTA=190  (0 added, 0 deleted, 190 changed)
OCL=28525
CL=28535
2009-05-08 11:22:57 -07:00
Russ Cox
401a95aa83 if a struct s contains an anonymous interface value
with method m, s.m() is ok and m now shows up
in s's method set for interface runtime.

see http://cl/28419-p2 for new test interface10.go.

R=ken
OCL=28420
CL=28423
2009-05-07 13:42:47 -07:00
Russ Cox
88a1aa8e1a 6g: error messages
part 2; missing files

R=ken
OCL=28408
CL=28410
2009-05-07 10:30:22 -07:00
Russ Cox
b5e212ffdd 6g: error messages
replace "shape error across CALL" with more information.

x.go:7: not enough arguments to CALL
	a int, b int
	int
x.go:10: assignment count mismatch: 3 = 2
x.go:12: too many arguments to RETURN
	[no arguments expected]
	int, int, int

also leave type alone after conversion failure,
for later errors:

bug049.go:6: cannot convert nil constant to string
bug049.go:6: illegal types for operand: EQ
	string
	nil		# this used to be blank

R=ken
OCL=28405
CL=28407
2009-05-07 10:29:35 -07:00
Russ Cox
5a67ea3883 6g: simplify trampoline by postponing load.
TEXT tramp
		MOVQ 8(SP), AX
		ADDQ $40, AX
		MOVQ AX, 8(SP)
		JMP oldfunc

	is now

	TEXT tramp
		ADDQ $40, 8(SP)
		JMP oldfunc

	and if s/40/0/, then it simplifies to

	TEXT tramp
		JMP oldfunc

	(the tramp is still needed to satisfy
	symbol references from other object files)

R=ken
OCL=28377
CL=28381
2009-05-06 17:06:06 -07:00
Russ Cox
a6ba5ec535 6g: new interface rules (code got simpler!)
R=ken
OCL=28374
CL=28378
2009-05-06 17:05:35 -07:00
Russ Cox
83cd4ee070 6g: generate string data as individual symbols,
so that 6l can discard strings used by dead code.
also, for short strings, generate DUPOK global
symbols so that references to, say, "%s: %s" in
multiple files result in only a single symbol.

R=ken
OCL=28361
CL=28361
2009-05-06 13:47:40 -07:00
Ken Thompson
c4de24981a signs on div and mod
R=r
OCL=28319
CL=28319
2009-05-05 21:19:58 -07:00
Russ Cox
3e9b171b79 6g bug: was dropping assignment of nil to globals
R=ken
OCL=28314
CL=28314
2009-05-05 17:33:51 -07:00
Russ Cox
f821e3c7c3 6g tweaks
* byteastring is no longer used
	* do not generate ODCL, OAS for globals
	  (wasn't generating any code but might
	  save one or two init functions)
	* do not call self from Init function

R=ken
OCL=28309
CL=28309
2009-05-05 16:53:46 -07:00
Russ Cox
9cba9c8890 6l: eliminate dead code, not just the symbols
editing the firstp list was ineffective,
because follow rebuilds it from the textp list.

the symbols for dead code were being dropped
from the binary but the code was all still there.

text for fmt.Printf("hello, world\n") drops
from 143945 to 128650.

R=r,ken
DELTA=22  (20 added, 0 deleted, 2 changed)
OCL=28255
CL=28290
2009-05-05 12:43:00 -07:00
Ken Thompson
567a7bf664 more code optimization
1. dont clear external and heap objects
2. propagate constant assignment

R=r
OCL=28254
CL=28254
2009-05-04 21:48:46 -07:00
Ken Thompson
5963f59067 more morestack fiddling
R=r
OCL=28204
CL=28204
2009-05-03 19:09:14 -07:00
Ken Thompson
a5a878986c more code fiddling
R=r
OCL=28201
CL=28201
2009-05-03 15:17:03 -07:00
Ken Thompson
49f7494894 code optmization
drip init function if it doesnt do anything

R=r
OCL=28180
CL=28180
2009-05-01 18:55:16 -07:00
Ken Thompson
1ed7f18165 code improvement
better calling of morestack

R=r
OCL=28179
CL=28179
2009-05-01 18:07:33 -07:00
Kai Backman
eac5db7f4c Copied 8g/6g into 5g. Used sharp tools to coax a .5 file out
of 5g. 5l balks at the output and running 5g with -S shows
the true extent of the disaster. Still, better than
yesterday. Maybe.

Tested on the canonical:

package main
func main() {
}

R=rsc
APPROVED=rsc
DELTA=4182  (4181 added, 0 deleted, 1 changed)
OCL=27601
CL=28175
2009-05-01 13:21:53 -07:00
Russ Cox
83e976d53e bug146: array/slice conversion before I left missed conversions
R=ken
OCL=28120
CL=28124
2009-04-30 13:49:58 -07:00
Russ Cox
48974f553d change 6l library directory flag to -L,
to match traditional c linkers.

R=r
DELTA=42  (8 added, 12 deleted, 22 changed)
OCL=28101
CL=28115
2009-04-30 13:32:39 -07:00
Ken Thompson
7a98315c96 allow "defer close(chan)"
bug found by anton

R=r
OCL=28001
CL=28001
2009-04-28 17:20:18 -07:00
Ken Thompson
91ce0ef8f3 bug 139
R=r
OCL=27987
CL=27987
2009-04-28 13:52:56 -07:00
Ken Thompson
ad36c39211 bug 145
R=r
OCL=27979
CL=27979
2009-04-28 12:28:31 -07:00
Ken Thompson
b03b541b7a recognize a defined constant
as a new name in a later declaration
(bug 144)

R=r
OCL=27850
CL=27850
2009-04-24 16:43:31 -07:00
Ben Eitzen
155ec1d904 Clear upper bits of 64-bit indexing register when using types smaller than 64 bits.
APPROVED=ken
OCL=27811
CL=27823
2009-04-23 18:23:34 -07:00
Ken Thompson
190a540892 2 minor bugs.
lv context for some [] operations
calling implicit(*map) before walk.

R=r
OCL=27706
CL=27706
2009-04-21 19:52:13 -07:00
Ken Thompson
c18db5aa18 bug in shift of longer operand
by a shorter operand. the bits
in the difference were not cheared.

R=r
OCL=27705
CL=27705
2009-04-21 19:38:58 -07:00
Ken Thompson
b5e7562191 supply default indirection to
map indexing - bug 143

R=r
OCL=27695
CL=27695
2009-04-21 17:00:08 -07:00
Ken Thompson
34b6f642de mixed old/new declaration
exact spec:
a) must be a multi-assignment w :=
b) a proper subset of the lhs
   can be declared in same block
   with the same type with no
   "redeclaration" error

R=r
OCL=27610
CL=27610
2009-04-18 13:58:04 -07:00
Rob Pike
bfd5ede78d add -P pkgdir option to 6l to have it look first in pkgdir for a package.
this allows gotest to find the locally built package when doing
	make
	gotest
without this option, one would have to say
	make install
	gotest
which kinda defeats the purpose

based on discussions with rsc.

R=ken,rsc
DELTA=12  (10 added, 1 deleted, 1 changed)
OCL=27606
CL=27606
2009-04-17 19:39:45 -07:00
Rob Pike
aaf63f8d06 Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated.

Step 2 will make os's error support internally much cleaner.

R=rsc
OCL=27586
CL=27586
2009-04-17 00:08:24 -07:00
Russ Cox
3ea8d854a3 make string(array) take []byte only (and thus *[10]byte but not [10]byte)
R=ken
OCL=27581
CL=27585
2009-04-16 23:07:30 -07:00
Russ Cox
0f153ec6b4 build packages in obj/ subdirectory that mimics $GOROOT/pkg.
for example, if building in src/lib/container,
objects go in obj/container/, so that 6g -Iobj
will find "container/vector".

install packages in hierarchy in $GOROOT.

this change only updates gobuild.
another change will have to update all
the sources to refer to "container/vector" etc
and regenerate all the Makefiles.

there are some pretty lame functions here
(e.g., Mkdir, Remove, the Getenv("PWD"))
but i will implement better ones in another CL.

R=r
DELTA=117  (99 added, 2 deleted, 16 changed)
OCL=27550
CL=27574
2009-04-16 20:52:13 -07:00
Russ Cox
7847056dfb rewrite gobuild in go.
R=r
DELTA=1305  (704 added, 590 deleted, 11 changed)
OCL=27546
CL=27548
2009-04-16 00:18:11 -07:00
Russ Cox
1cb3b7d124 panicln: emit just one newline
R=ken
OCL=27537
CL=27545
2009-04-15 22:38:09 -07:00
Rob Pike
57bff962d9 fix gotest by fixing nm -s to print in file order by storing a sequence number
as the .6 file is read.   now tests will be run in file order.

R=rsc
DELTA=9  (6 added, 1 deleted, 2 changed)
OCL=27542
CL=27544
2009-04-15 21:57:55 -07:00
Russ Cox
65d397f747 compiler implementation of array slice change
R=ken
OCL=27533
CL=27533
2009-04-15 20:27:22 -07:00
Russ Cox
935953a9f8 tweak interface warning heuristic.
some day i will fix this for real.

R=ken
OCL=27468
CL=27468
2009-04-14 19:57:27 -07:00
Russ Cox
a62467af93 fix stringrange test
R=ken
OCL=27353
CL=27353
2009-04-13 05:31:44 -07:00
Ken Thompson
a91a8042b4 range over strings
R=r
OCL=27332
CL=27332
2009-04-10 19:49:31 -07:00
Kai Backman
35a775d045 Fixed optab to support SWI with long constant (the mode used
for linux system calls).

R=rsc
APPROVED=rsc
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=27325
CL=27328
2009-04-10 16:44:01 -07:00
Kai Backman
4e1896a1b5 Adding ARM elf support to the 5l linker.
R=rsc
APPROVED=rsc
DELTA=312  (312 added, 0 deleted, 0 changed)
OCL=27133
CL=27326
2009-04-10 16:35:36 -07:00
Ken Thompson
cb15bbe748 bug in stack size used in
extending segmented stack

R=r
OCL=27319
CL=27319
2009-04-10 15:23:19 -07:00
Ken Thompson
f9854978e2 bug 142
order of evaluation && and ||

R=r
OCL=27294
CL=27294
2009-04-09 19:11:24 -07:00
Ken Thompson
3657061550 change representation of strings
R=r
OCL=27293
CL=27293
2009-04-09 18:16:21 -07:00
Russ Cox
f95da9a639 yet another attempt at auto-linking
store only the original import path string (+ .a)
if 6g resolves it to an archive file.
let 6l re-resolve the .a at link time.

this lets libraries build against an archive
in the current directory but get used
against an installed archive.

R=r
OCL=27244
CL=27244
2009-04-08 22:45:33 -07:00
Russ Cox
3067781ab9 func f() (int, int);
x := f();

used to give
	fatal error: dowidth fn struct struct { int; int }

now gives
	assignment count mismatch: 1 = 2

R=ken
OCL=27198
CL=27201
2009-04-07 22:20:37 -07:00
Russ Cox
d50c70d261 set line number for errors produced during walkstate.
R=ken
OCL=27145
CL=27145
2009-04-06 22:17:46 -07:00
Russ Cox
907cb4f1e6 fix both of anton's bugs:
* make([100]int) was being compiled to
	make([]int), kind of.
* []this = [100]that was working for any this, that.

turned up a typo in pipe_test.go

R=ken
OCL=27081
CL=27081
2009-04-03 23:20:51 -07:00
Russ Cox
39436f2a74 special case check for this situation
; cat >http.go
	package main
	import "http"  // intended the library, not this file
	^D
	; 6g http.go
	; 6g http.go
	http.go:4: export/package mismatch: init
	;

new error:

	http.6:7 http.go:3: cannot import package main

R=ken
OCL=27053
CL=27053
2009-04-02 21:46:19 -07:00
Russ Cox
07687705a4 type n t;
was copying a bit too much about t into n,
like whether the signature was queued to be printed.
(bug reported by anton)

was also editing t, meaning you could do
	type T int;
	func (p int) Meth() { }

both fixed.

R=ken
OCL=27052
CL=27052
2009-04-02 21:38:11 -07:00
Russ Cox
416b27548e use _f007·filename for func literals.
this avoids problems people have run into with
multiple closures in the same package.

when preparing filename, only cut off .go, not .anything.
this fixes a bug tgs ran into with foo.pb.go and foo.go
in the same package.

also turn bad identifier chars from filename into
underscores: a-b.pb.go => a_b_pb

R=ken
OCL=27050
CL=27050
2009-04-02 18:32:57 -07:00
Ken Thompson
9efd6b8a3d compiler falut for forgetting
the assignment on a type switch

R=r
OCL=27048
CL=27048
2009-04-02 18:06:43 -07:00
Russ Cox
58f5f4f18d use separate lex buf for better errors:
package main
func main() { func(){}() + + }

x.go:2: syntax error near _f001

becomes

x.go:2: syntax error near func

R=ken
OCL=27047
CL=27047
2009-04-02 17:59:09 -07:00
Russ Cox
8d8225d529 turn gc of unused data/code back on in loaders.
turned it off while debugging 8 runtime problem,
checked in the change accidentally.

R=r
DELTA=4  (0 added, 0 deleted, 4 changed)
OCL=27040
CL=27046
2009-04-02 17:56:23 -07:00
Russ Cox
6b07021a2b implement some more 8g
package main
	func main() {
		println("hello,", 123);
	}

R=ken
OCL=27043
CL=27043
2009-04-02 16:48:06 -07:00
Ken Thompson
2450c590e9 typeswitch - expression evaluated
twice instead of once.

R=r
OCL=27015
CL=27015
2009-04-01 21:28:59 -07:00
Russ Cox
95100344d3 fix runtime stack overflow bug that gri ran into:
160 - 75 was just barely not enough for deferproc + morestack.

added enum names and bumped to 256 - 128.
added explanation.

changed a few mal() (garbage-collected) to
malloc()/free() (manually collected).

R=ken
OCL=26981
CL=26981
2009-04-01 00:26:00 -07:00
David Symonds
c025cf64dc Bail out of gotest immediately if compiling fails.
R=rsc
APPROVED=rsc
DELTA=4  (2 added, 2 deleted, 0 changed)
OCL=26978
CL=26978
2009-03-31 22:35:55 -07:00
Russ Cox
42546f4812 multiple bugs in bitfield handling
R=r
DELTA=6  (3 added, 0 deleted, 3 changed)
OCL=26944
CL=26967
2009-03-31 15:44:43 -07:00
Russ Cox
dc5b4678e2 minimal 8g. can compile
package main
	func main() {
	}

and not much else.

R=ken
OCL=26943
CL=26943
2009-03-31 00:22:59 -07:00
Russ Cox
b87e3e8b7f * move go-specific loader code
into gc directory, where it gets included as ../gc/ldbody
this is similar to the assemblers including ../cc/lexbody
and ../cc/macbody.

* hook go-specific loader code into 8l.

* make current 8.out.h and 6.out.h backward compatible
with plan 9's versions.  i had added some constants in
the middle of enums and have now moved them to the end.
this keeps us from invalidating old .8 and .6 files.
not sure how much it really matters, but easy to do.

R=r
DELTA=1314  (667 added, 623 deleted, 24 changed)
OCL=26938
CL=26941
2009-03-31 00:20:07 -07:00
Russ Cox
b199035ba8 move tiny gsubr functions together at the top of the file.
delete unused mkenam file

R=ken
OCL=26940
CL=26940
2009-03-31 00:19:38 -07:00
Russ Cox
aacdc25399 fix http://b/1748082
package main
var f = func(a, b int) int { return a + b }

R=ken
OCL=26935
CL=26935
2009-03-30 22:26:00 -07:00
Russ Cox
441da9af0d fix build (moved decl to go.h earlier
and changed vlong to int64).

R=ken
OCL=26934
CL=26934
2009-03-30 21:39:10 -07:00
Russ Cox
5e792b6c09 move portable object routines (especially
signature generation) into gc.

R=ken
OCL=26933
CL=26933
2009-03-30 21:31:29 -07:00
Russ Cox
941ed00b1d closure bug: carry along outnamed flag.
R=ken
OCL=26930
CL=26930
2009-03-30 19:21:36 -07:00
Russ Cox
bac922c6e1 move portable code generation (basic statements) to gc.
R=ken
OCL=26929
CL=26929
2009-03-30 19:15:07 -07:00
Russ Cox
d30285a6f5 move some portable pieces of 6g/gsubr.c into gc/subr.c
int	brcom(int);
	int	brrev(int);
	void	setmaxarg(Type*);
	Sig*	lsort(Sig*, int(*)(Sig*, Sig*));
	int	dotoffset(Node*, int*, Node**);
	void	stringpool(Node*);
	void	tempname(Node*, Type*);

R=ken
OCL=26922
CL=26922
2009-03-30 17:52:21 -07:00
Russ Cox
e5ba266e93 delete dregs: inarggen, genpanic, regret
R=ken
OCL=26916
CL=26918
2009-03-30 17:15:54 -07:00
Russ Cox
8e54729b5a move alignment calculations into gc
R=ken
OCL=26914
CL=26914
2009-03-30 17:09:28 -07:00
Russ Cox
e224b1ebdb don't crash on
unsafe.Alignof(struct{x float}{0}.x)

R=ken
OCL=26911
CL=26913
2009-03-30 17:07:30 -07:00
Russ Cox
531f242f5d move bits.c from 6g to gc
R=ken
OCL=26909
CL=26909
2009-03-30 16:13:11 -07:00
Russ Cox
47fbb7639a new tool godefs.
uses gcc to determine system header layouts and
emits simple C or Go.  see comment in main.c.

R=r
DELTA=1069  (1067 added, 0 deleted, 2 changed)
OCL=26682
CL=26880
2009-03-30 00:21:25 -07:00
Russ Cox
a2cbc2998d don't write cmp's output to the c file.
cope better with p4 not found.

R=r
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=26877
CL=26879
2009-03-30 00:12:56 -07:00
Kai Backman
99cc2fee81 This is really two changes in one but given interdependencies
and expected review latency I needed to combine the CLs.

1. Made the 5* toolpath build using the go build
   system. Hooked the subdirectories to clean.bash but added a
   separate make5.bash for now. Minor massage to make the code
   more similar to the current structure of 6c/6a/6l.

2. Change all references from long to int32 in line with
   similar change for the other toolchains.

The end result is that 5c, 5a and 5l can now be compiled and
the executables start up properly. Haven't thrown any input at
them yet.

R=rsc
APPROVED=rsc
DELTA=1052  (392 added, 328 deleted, 332 changed)
OCL=26757
CL=26761
2009-03-25 16:31:38 -07:00
Russ Cox
58f7fc331f make 8a, 8c build again.
add 8a 8c 8l to the build to keep us honest.

R=r
DELTA=33  (28 added, 0 deleted, 5 changed)
OCL=26694
CL=26711
2009-03-24 18:04:19 -07:00
Russ Cox
34a5537edb drop rt0 object from 8l (already dropped from 6l).
remove debugging print.

R=r
DELTA=8  (0 added, 8 deleted, 0 changed)
OCL=26695
CL=26710
2009-03-24 18:02:24 -07:00
Ken Thompson
b8be809c10 ^ type(const) now inverts "enough" bits
^ signed(const) becomes illegal
^ unsigned(const) becomes legal

R=r
OCL=26697
CL=26697
2009-03-24 16:40:38 -07:00
Russ Cox
878822f355 move darwin specific code into runtime/darwin/
move darwin-amd64 specific code into runtime/darwin/amd64/
repeat for linux.

move rt0 into runtime.a instead of keeping a separate .6 file.
6l seems to have no problem with that.

TBR=r
OCL=26680
CL=26680
2009-03-24 13:06:51 -07:00
Russ Cox
5a68303a15 throw away most of the compat.h compatibility layer
in favor of the lib9 compatibility layer.  no need for two.

now that mycreate is gone, .6 files are 0644 not 0755.

TBR=r
OCL=26679
CL=26679
2009-03-24 12:12:57 -07:00
Ken Thompson
79fa5b65cb rewrote switch
fixed bug 141

R=r
OCL=26627
CL=26627
2009-03-22 20:54:21 -07:00
Russ Cox
2bd101c4b1 update 8a, 8c, 8l to use new object format.
add "extern register" support to 8c.
extern register means allocate in the FS-relative segment.

make 8l generate segmented stack checks.

R=ken
OCL=26600
CL=26606
2009-03-20 16:40:00 -07:00
Russ Cox
7d443bb67a make 8l generate Darwin Mach-O and Linux ELF binaries
R=ken
OCL=26584
CL=26589
2009-03-20 14:22:59 -07:00
Russ Cox
997b6f9d89 don't need two names for the same function (vputl and llputl).
also use thechar, to make copy/paste easier.

R=ken
OCL=26583
CL=26588
2009-03-20 14:22:46 -07:00
Russ Cox
0932b1f9b8 move pragtextflag into lexbody
R=ken
OCL=26581
CL=26587
2009-03-20 14:22:37 -07:00
Russ Cox
54aa835b44 range over channels.
also fix multiple-evaluation bug in range over arrays.

R=ken
OCL=26576
CL=26576
2009-03-20 11:32:58 -07:00
Russ Cox
f7772627ad fix b/1722502
BUG=1722502
R=ken
OCL=26526
CL=26526
2009-03-18 19:20:54 -07:00
Ken Thompson
1cdcfda140 remove assignment cases from switch
R=r
OCL=26480
CL=26480
2009-03-18 12:13:42 -07:00
Ken Thompson
1e0c17e294 switch on false error
R=r
OCL=26434
CL=26434
2009-03-17 19:10:32 -07:00
Ken Thompson
0f469a99a3 binary search on type switches.
new feature 'case nil:' in type switch
will match iff the interface is nil.

R=r
OCL=26404
CL=26404
2009-03-17 13:58:38 -07:00
Ken Thompson
5136a9e1f7 change format of Sigt and Sigi
to allow room for type hash
needed for log-time type switch.

R=r
OCL=26354
CL=26354
2009-03-16 15:27:08 -07:00
Kai Backman
db3a21d7c6 5a 5c 5l from inferno distribution
R=rsc
APPROVED=rsc
DELTA=19042  (19042 added, 0 deleted, 0 changed)
OCL=26268
CL=26270
2009-03-13 15:03:07 -07:00
Russ Cox
5fbadf0bc3 warn -> yyerror in mparith.
close two more bugs.

R=ken
OCL=26226
CL=26226
2009-03-12 19:57:30 -07:00
Russ Cox
8f194bf5ff make 6g constants behave as ken proposes. (i hope.)
various bug fixes and tests involving constants.

test/const1.go is the major new test case.

R=ken
OCL=26216
CL=26224
2009-03-12 19:04:38 -07:00
Ken Thompson
6eb54cb05b chan flags close/closed installed
runtime not finished.

R=r
OCL=26217
CL=26217
2009-03-12 17:55:11 -07:00
Ken Thompson
bb02e481d2 added bitclear operators &^ and &^=
R=r
OCL=26152
CL=26152
2009-03-11 19:59:35 -07:00
Ken Thompson
767845b6fa bug 125
R=r
OCL=26146
CL=26146
2009-03-11 17:37:04 -07:00
Ken Thompson
48f6b516e2 bug 137
R=r
OCL=26142
CL=26142
2009-03-11 16:25:45 -07:00
Russ Cox
4eb7ceba58 complain when trying to put T into an interface
if T has pointer methods.  this is just a heuristic
but it catches the problem robert ran into and
lets me put the larger interface issues aside for
now.  found one bug in pretty.

R=ken
OCL=26141
CL=26141
2009-03-11 16:06:17 -07:00
Ian Lance Taylor
062d6998ab Add support for a -I option. -I DIR searches for packages in
DIR.

R=ken,rsc
DELTA=49  (41 added, 2 deleted, 6 changed)
OCL=26057
CL=26092
2009-03-10 20:03:31 -07:00
Ken Thompson
d27e9f528d bug086
R=r
OCL=26090
CL=26090
2009-03-10 19:16:31 -07:00
Ken Thompson
0c4f4587d7 bug with interaction of variables
declared in cases and heap allocation

R=r
OCL=26064
CL=26064
2009-03-10 16:49:34 -07:00
Ken Thompson
820f42d977 binary search for constant case statements.
R=r
OCL=25890
CL=25890
2009-03-07 17:33:42 -08:00
Ken Thompson
a4a10ed856 1. type switches
2. fixed fault on bug128
3. got rid of typeof
4. fixed bug in t,ok = I2T

R=r
OCL=25873
CL=25873
2009-03-06 17:50:43 -08:00
Russ Cox
af678a593d new approach for generating sysimport.c
(renamed to avoid any conflict with old p4 copies).

this approach doesn't require auto-generating
files also kept in p4, so it should be easier on
go users who don't sync very often.

this approach will be more work for go developers:
builtin.c needs to be copied to builtin.c.boot in p4
as new functions are added.  mkbuiltin does this
for certain $USERs to help us remember.

R=r
DELTA=343  (176 added, 162 deleted, 5 changed)
OCL=25803
CL=25805
2009-03-05 18:26:12 -08:00
Russ Cox
63985b489b bug085 bug129
R=ken
OCL=25787
CL=25791
2009-03-05 15:57:03 -08:00
Ken Thompson
bf983477a2 new switch implementation
in preparation of type switch.
no functional change (yet).

R=r
OCL=25784
CL=25788
2009-03-05 15:49:34 -08:00
Russ Cox
98b34e5bbd reject invalid map key types at compile time
R=ken
OCL=25720
CL=25720
2009-03-04 17:38:37 -08:00
Russ Cox
955638e2fb disallow ordinary-type.(T), as in spec.
R=ken
OCL=25705
CL=25705
2009-03-04 14:50:25 -08:00
Russ Cox
49cc649e59 back to T{x}, stricter handling of T(x) vs x.(T)
R=ken
DELTA=131  (60 added, 41 deleted, 30 changed)
OCL=25617
CL=25633
2009-03-03 08:41:02 -08:00
Russ Cox
be2edb5761 Automated g4 rollback of changelist 25024,
plus significant hand editing.

Back to T{x} for composite literals.

R=r
OCL=25612
CL=25632
2009-03-03 08:39:12 -08:00
Ken Thompson
751d13cbce bug 130 (go/defer) interface.method()
R=r
OCL=25356
CL=25356
2009-02-23 22:43:04 -08:00
Ken Thompson
a665e2924c bug with select :=
R=r
OCL=25278
CL=25278
2009-02-21 12:41:34 -08:00
Russ Cox
ebc10db3e1 allow parens to disambiguate types.
examples:

	chan <- (chan int)
	chan (<- chan int)
	(map[string]func())("a": main)

R=ken
OCL=25151
CL=25151
2009-02-18 10:07:46 -08:00
Ken Thompson
3c0fc400fb fix unsafe.Sizeof("abc")
R=rsc
OCL=25105
CL=25105
2009-02-17 13:10:57 -08:00
Russ Cox
d3d0c256be bug123
R=ken
OCL=25075
CL=25075
2009-02-16 17:44:05 -08:00
Russ Cox
b4af09ab56 embedded interface types in interfaces.
R=ken
OCL=25072
CL=25072
2009-02-16 16:36:18 -08:00
Russ Cox
97dcc68f1e insert ${GOOS} and ${GOARCH} in
command-line comment.

R=r
DELTA=11  (6 added, 0 deleted, 5 changed)
OCL=25051
CL=25051
2009-02-15 19:20:35 -08:00
Russ Cox
3b3e63735e bug fix for &x[0] when x is slice
R=ken
OCL=25044
CL=25044
2009-02-15 13:15:46 -08:00
Russ Cox
9f8f2e6130 convert composite literals from { } to ( ).
only non-trivial changes are in
	convlit1.go
	golden.out

R=gri
OCL=25019
CL=25024
2009-02-13 14:48:32 -08:00
Russ Cox
07244f7c80 add composite literal ( ) syntax.
warn about composite literal { } syntax.

R=ken
OCL=25018
CL=25023
2009-02-13 14:48:16 -08:00
Russ Cox
5f4f5647ef require type assertions when narrowing.
R=ken
OCL=24350
CL=24914
2009-02-11 17:57:29 -08:00
Russ Cox
73dd4a37f9 fix export bug Rob tripped over.
the lexer is already hiding names,
so this clumsy hack is no longer necessary.

R=ken
OCL=24783
CL=24783
2009-02-10 13:57:31 -08:00
Ian Lance Taylor
651972b31f Implement unsafe.Alignof.
R=ken
DELTA=20  (19 added, 0 deleted, 1 changed)
OCL=24719
CL=24771
2009-02-10 11:46:26 -08:00
Russ Cox
a81870badf add error to catch 6g alignment bug.
the fix appears to be to align the
out struct on an 8 boundary, but that
is a bit involved.

R=ken
OCL=24657
CL=24657
2009-02-08 11:19:45 -08:00
Russ Cox
a6c59ce274 gc funarg return fix.
change type (to satisfy OAS) after nodarg:
nodarg uses offset from type too,
and must use correct offset.

R=ken
OCL=24656
CL=24656
2009-02-08 11:01:52 -08:00
Rob Pike
8f2b774ee1 update sysimport.c for unsafe.Offset and Sizeof
R=ken
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=24643
CL=24643
2009-02-07 14:48:32 -08:00
Ken Thompson
56003374d3 change array padding in structures
to pad to size of element rather
than size of array.

R=r
OCL=24641
CL=24641
2009-02-07 13:31:34 -08:00
Ken Thompson
8a70545b57 unsafe.Sizeof and unsafe.Offsetof
R=r
OCL=24639
CL=24639
2009-02-07 12:34:45 -08:00
Russ Cox
0970c46863 closures - 6g support
R=ken
OCL=24501
CL=24566
2009-02-06 13:47:10 -08:00
Russ Cox
5e5476c2fe 6c: byte* - byte* should be int64, not int32.
R=ken
OCL=24507
CL=24507
2009-02-05 19:09:04 -08:00
Russ Cox
b0009bef20 bug064
make f(g()) work when g returns multiple
args with names different than f expects.

func swap(a, b int) (c, d int) {
	return b, a
}

swap(swap(1,2))

R=ken
OCL=24474
CL=24476
2009-02-05 15:22:49 -08:00
Russ Cox
aab26a5248 do not generate Init proto for sys and unsafe.
R=ken
OCL=24455
CL=24455
2009-02-05 14:49:53 -08:00
Russ Cox
fc8dca9dac heuristic to stop pulling .6 in from .a
is not right if the .6 is only for data and
the init function.

instead of that, pick up everything and
let the dead code/data eliminator throw
away the parts that weren't useful.

R=r
DELTA=25  (0 added, 22 deleted, 3 changed)
OCL=24446
CL=24446
2009-02-05 13:58:43 -08:00
Russ Cox
5e2c05877d allow methods on funcs.
R=ken
OCL=24442
CL=24442
2009-02-05 13:33:07 -08:00
Russ Cox
360f0aacee fix interface not satisifed message:
x.go:13: T is not I - missing M()

NOT
x.go:13: T is not I - missing Mfunc()

R=ken
OCL=24316
CL=24316
2009-02-04 10:37:11 -08:00
Russ Cox
736903c170 libmach:
* heuristic to go farther during stack traces.
	* significantly improved Linux thread handing.

acid:
	* update to new libmach interface.

prof:
	* use new libmach interface.
	* multiple thread support (derived from Rob's copy).
	* first steps toward pprof-like graphs:
	  keep counters indexed by pc,callerpc pairs.

R=r
DELTA=909  (576 added, 123 deleted, 210 changed)
OCL=24240
CL=24259
2009-02-03 15:00:09 -08:00
Russ Cox
f61639d4e2 6g return struct fix:
make t->width of funarg struct be width of struct.

emit MOVSL for 4-byte copy.

R=ken
OCL=24108
CL=24111
2009-02-02 13:41:38 -08:00
Rob Pike
6e395cfecf slightly better code for the frog fix
R=ken
OCL=24025
CL=24025
2009-01-31 16:44:52 -08:00
Rob Pike
2538cf747b Complain about control characters that are not white space.
Bitten by invisible chars too many times.

R=ken
OCL=24024
CL=24024
2009-01-31 16:42:10 -08:00
Russ Cox
47e27758db keep line number history even when
throwing away dead code at end of file.

also fix an uninitialized memory error
found by valgrind.

R=r
DELTA=7  (5 added, 2 deleted, 0 changed)
OCL=23991
CL=23994
2009-01-30 17:10:10 -08:00
Russ Cox
9e735985d4 avoid memcpy(x, x),
which valgrind complains about.

R=ken
OCL=23990
CL=23990
2009-01-30 16:31:26 -08:00
Russ Cox
7b6bdfb735 two uses of uninitialized memory,
picked up by valgrind.
fixes test/escape.go on linux.

R=ken
OCL=23971
CL=23971
2009-01-30 15:11:46 -08:00
Russ Cox
122ed3e988 print format bug
R=ken
OCL=23965
CL=23965
2009-01-30 14:54:49 -08:00
Russ Cox
4a43198390 update compiler to new func rules
R=ken
OCL=23958
CL=23961
2009-01-30 14:39:42 -08:00
Russ Cox
4cf7711568 update go code tree to new func rules.
R=r
DELTA=367  (111 added, 59 deleted, 197 changed)
OCL=23957
CL=23960
2009-01-30 14:39:31 -08:00
Russ Cox
391425ae55 if take address of local, move to heap.
heuristic to not print bogus strings.
fix one error message format.

R=ken
OCL=23849
CL=23851
2009-01-29 17:38:58 -08:00
Ken Thompson
4f49b88dda optimizer bug w STOstring
R=r
OCL=23820
CL=23820
2009-01-29 15:13:36 -08:00
Russ Cox
282bf8cc8c fix possible infinite recursion in eqtype.
don't use intermediate register to move
32-or-fewer-bit immediate constants
into memory.

R=ken
OCL=23726
CL=23726
2009-01-28 16:42:26 -08:00
Russ Cox
3ec4675220 clean up range grammar
R=ken
OCL=23712
CL=23714
2009-01-28 15:41:50 -08:00
Ken Thompson
4b8e030762 bug 135
R=r
OCL=23646
CL=23646
2009-01-27 18:21:03 -08:00
Russ Cox
7fa5941fad make "size 6.out" work on mac.
R=r
DELTA=11  (6 added, 0 deleted, 5 changed)
OCL=23629
CL=23631
2009-01-27 15:40:36 -08:00
Russ Cox
743ac07cc3 change dotdotdot interfaces to be structs,
not pointers to structs.

fix defered dotdotdot.

R=r,ken
DELTA=25  (7 added, 5 deleted, 13 changed)
OCL=23620
CL=23625
2009-01-27 15:05:25 -08:00
Ken Thompson
e90314d024 pragma textflag
fixes latent bugs in go and defer

R=r
OCL=23613
CL=23613
2009-01-27 14:12:35 -08:00
Ken Thompson
1e1cc4eb57 defer
R=r
OCL=23592
CL=23592
2009-01-27 12:03:53 -08:00
Russ Cox
5b129cda5f assignment count mismatch: 2 = 1.
R=ken
OCL=23534
CL=23534
2009-01-26 17:20:29 -08:00
Russ Cox
f1fe21a08f bug134
R=ken
OCL=23532
CL=23532
2009-01-26 17:06:20 -08:00
Russ Cox
4efad58d0a bug133
R=ken
OCL=23528
CL=23528
2009-01-26 16:57:24 -08:00
Russ Cox
3c5f3a8641 print(map) and print(chan) as pointers.
R=ken
OCL=23520
CL=23520
2009-01-26 15:36:28 -08:00
Russ Cox
9b6d385cb5 interface speedups and fixes.
more caching, better hash functions, proper locking.
fixed a bug in interface comparison too.

R=ken
DELTA=177  (124 added, 10 deleted, 43 changed)
OCL=23491
CL=23493
2009-01-26 12:36:21 -08:00
Ken Thompson
7859ae8a2f removed a:b in range syntax
added another channel test

R=r
OCL=23488
CL=23488
2009-01-26 11:34:38 -08:00
Russ Cox
a7f6d4066e implement new restrictions on what
can be compared/hashed.

R=r
DELTA=351  (201 added, 80 deleted, 70 changed)
OCL=23423
CL=23481
2009-01-26 09:56:42 -08:00
Russ Cox
1f8a40d85c move math routines from package sys to package math,
though they still build in src/runtime.

use cgo instead of hand-written wrappers.

R=r
DELTA=740  (289 added, 300 deleted, 151 changed)
OCL=23326
CL=23331
2009-01-22 16:23:44 -08:00
Russ Cox
8c5bc7e93a use $GC, $GL in gotest, to match gccgo's gotest.
use $GC in all_test.go for portability.

R=r
DELTA=19  (12 added, 0 deleted, 7 changed)
OCL=23305
CL=23325
2009-01-22 15:41:12 -08:00
Russ Cox
d9abca81c0 let test sources specify commands to run
before their compilation.

R=r
OCL=23300
CL=23300
2009-01-22 14:23:50 -08:00
Russ Cox
61590c4c44 disallow P.t for lowercase t and not our package P.
implement hiding lowercase methods m in
signatures by adding in a hash of the package name
to the type hash code.

remove remaining checks for internally-generated _ names:
they are all gone.

R=ken
OCL=23236
CL=23238
2009-01-21 14:51:57 -08:00
Russ Cox
c3fa54c48b delete unused code and data from 6.outs.
cuts simple test binary by 7%.
would be more except for reflection.

R=r
DELTA=126  (117 added, 4 deleted, 5 changed)
OCL=23163
CL=23237
2009-01-21 14:50:27 -08:00
Russ Cox
35e37bbf41 6g: better genembedtramp fatal error,
and don't put inaccessible private methods
   in signature.

R=ken
OCL=23138
CL=23140
2009-01-20 15:36:57 -08:00
Russ Cox
a3c4faf83f 6l: do not link in objects from an archive just for init functions.
(makes go libraries behave more like c libraries.)

R=r
DELTA=85  (67 added, 12 deleted, 6 changed)
OCL=23133
CL=23139
2009-01-20 15:36:43 -08:00
Russ Cox
839a68469b delete export
TBR=r
OCL=23121
CL=23127
2009-01-20 14:40:40 -08:00
Russ Cox
0183baaf44 * delete export
* rename init functions

R=ken
OCL=23122
CL=23126
2009-01-20 14:40:00 -08:00
Russ Cox
8f14451fe5 6l: ignore undefined symbols in gotypesigs.
they end up in the symbol table with type==0
   if they are in a library but not pulled in.
   also add a few debugging prints.

R=r
DELTA=11  (5 added, 1 deleted, 5 changed)
OCL=23104
CL=23108
2009-01-20 13:21:22 -08:00
Russ Cox
aec4d3194a disallow other package's names in method calls
R=ken
OCL=22999
CL=22999
2009-01-16 15:35:07 -08:00
Russ Cox
06869eedf9 disallow other package's names in struct field dot.
R=ken
OCL=22996
CL=22996
2009-01-16 15:25:52 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Russ Cox
dec12d3654 re-export of bools was changing
format from hex to decimal, confusing
ar's strcmp-based value comparison.

switched export format to "true" or "false"
to keep bools separate from ints.

R=ken
OCL=22944
CL=22944
2009-01-16 10:45:28 -08:00
Russ Cox
c1e7e270f1 don't crash on:
package main
var x int
type x struct { a int }

R=ken
OCL=22903
CL=22903
2009-01-15 17:32:31 -08:00
Russ Cox
605d0746c5 catch export on func.
print names in message.

R=ken
OCL=22891
CL=22891
2009-01-15 16:43:51 -08:00
Russ Cox
3decb42e6f add warning for export of lowercase too.
R=ken
OCL=22887
CL=22887
2009-01-15 16:20:21 -08:00
Russ Cox
07d344e442 remove export name-list statement.
make package local the default.
warn about name case not matching export keyword.

R=ken
OCL=22881
CL=22886
2009-01-15 16:16:52 -08:00
Rob Pike
8559e3ad54 diagnose missing symbols instead of
silently miscompiling.

R=rsc
OCL=22872
CL=22872
2009-01-15 15:21:12 -08:00