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

1347 Commits

Author SHA1 Message Date
Russ Cox
4e4097d9d9 386 shift bug; wasn't zero-extending 16- and 8-bit counts
+test

R=ken
OCL=35801
CL=35801
2009-10-15 16:32:45 -07:00
Russ Cox
a75e347a21 do not migrate x to the heap because of *&x.
R=ken
OCL=35799
CL=35799
2009-10-15 16:03:01 -07:00
Kai Backman
f72ea8eb76 LDREX and STREX
R=rsc
APPROVED=rsc
DELTA=30  (30 added, 0 deleted, 0 changed)
OCL=35751
CL=35756
2009-10-14 21:47:08 -07:00
Rob Pike
fd4767f2c5 rename the source directory for gopack from ar to gopack.
remove the references to 6ar

R=rsc
DELTA=3547  (1770 added, 1775 deleted, 2 changed)
OCL=35669
CL=35671
2009-10-13 12:37:28 -07:00
Kai Backman
101f7cbd61 changed 5c 64 bit word ordering to little endian so it matches
5g. fixes to 64 bit code gen. added (finally) function to do
shifts properly.

go/test: passes 83% (287/342)

R=rsc
APPROVED=rsc
DELTA=156  (50 added, 53 deleted, 53 changed)
OCL=35589
CL=35616
2009-10-12 13:35:28 -07:00
Russ Cox
2372408189 sort errors by line number
turn off testdclstack and "not used" errors
when there are syntax errors.

BUG=2181825
R=ken
OCL=35606
CL=35608
2009-10-12 11:03:48 -07:00
Russ Cox
add89dd1ba stack overflow debugging and fix.
* in 6l, -K already meant check for stack underflow.
    add -KK to mean double-check stack overflows
    even in nosplit functions.

  * comment out print locks; they deadlock too easily
     but are still useful to put back for special occasions.

  * let runcgo assembly switch to scheduler stack
    without involving scheduler directly.  because runcgo
    gets called from matchmg, it is too hard to keep it
    from being called on other stacks.

R=r
DELTA=94  (65 added, 18 deleted, 11 changed)
OCL=35591
CL=35604
2009-10-12 10:26:38 -07:00
Russ Cox
fd76b4f385 new builtin.c.boot from arm.
node printing fixes.
silence incorrect redeclaration error.

R=ken
OCL=35602
CL=35602
2009-10-12 10:12:37 -07:00
Kai Backman
6d0983ae46 64bit and float code generation. fmt compiles but
reflect is broken so fmt doesn't work.

go/test: passes 83% (285/342)

R=rsc
APPROVED=rsc
DELTA=415  (240 added, 29 deleted, 146 changed)
OCL=35576
CL=35588
2009-10-11 20:01:11 -07:00
Kai Backman
1620023d03 fix float <-> int64 conversions
R=rsc
APPROVED=rsc
DELTA=25  (25 added, 0 deleted, 0 changed)
OCL=35566
CL=35574
2009-10-10 22:06:26 -07:00
Rob Pike
86cfaf66a7 reallocate library, libraryobj: 50 isn't nearly enough
R=rsc
DELTA=7  (2 added, 0 deleted, 5 changed)
OCL=35569
CL=35569
2009-10-10 12:29:06 -07:00
Russ Cox
c736b6579f bug209
R=ken
OCL=35546
CL=35546
2009-10-09 16:01:32 -07:00
Russ Cox
f0bde7c51b fix nacl build
R=r
DELTA=23  (5 added, 0 deleted, 18 changed)
OCL=35510
CL=35518
2009-10-09 11:15:19 -07:00
Kai Backman
6084dcdd07 floating point calc, added a few more packages that pass
go/test: passes 80% (274/340)

R=rsc
APPROVED=rsc
DELTA=61  (59 added, 0 deleted, 2 changed)
OCL=35506
CL=35517
2009-10-09 07:37:49 -07:00
Russ Cox
680ee6af63 add & fix bug208, from ken.
fix bug198.

R=ken
OCL=35504
CL=35507
2009-10-08 23:03:34 -07:00
Kai Backman
98fff8ffb2 dupok, gcc compile fix, sync and syscall asm fix
R=rsc
APPROVED=rsc
DELTA=27  (18 added, 0 deleted, 9 changed)
OCL=35503
CL=35505
2009-10-08 22:16:08 -07:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Russ Cox
55edf49a01 add & fix bug207: rewritten if condition
was discarding initialization work.

R=ken
OCL=35454
CL=35457
2009-10-07 22:19:42 -07:00
Russ Cox
d515063588 better handling of mistaken top-level variable
references during the parsing of :=.  the base
problem is that when reading

	a,b,c,d

the parser makes those refer to existing variables,
which might create a few stub top-level ones
for undefined names, but then if a := is the next
token, we need to undo those stubs.

this was causing problems in multifile packages
in which one file used a := variable named rpc
and the other imported a package named rpc.

R=ken
OCL=35446
CL=35446
2009-10-07 14:55:12 -07:00
Russ Cox
4fd7a908bb do not import testing twice when testing testing.
R=r
DELTA=3  (2 added, 0 deleted, 1 changed)
OCL=35443
CL=35445
2009-10-07 14:52:44 -07:00
Russ Cox
c2874976e4 factor portable object+library bits out of 5l/6l/8l into ld
R=r
DELTA=3214  (904 added, 2260 deleted, 50 changed)
OCL=35425
CL=35427
2009-10-07 00:11:59 -07:00
Kai Backman
a2cf914379 5l library loading, 64 bit entry points
R=rsc
APPROVED=rsc
DELTA=58  (52 added, 3 deleted, 3 changed)
OCL=35417
CL=35417
2009-10-06 19:00:30 -07:00
Kai Backman
116beb2653 - moved 3 functions from syscall_linux to _386 and _amd64 (arm lacks them)
- 64 bit OMINUS
- added bunch of missing arm syscalls

R=rsc
APPROVED=rsc
DELTA=203  (189 added, 3 deleted, 11 changed)
OCL=35412
CL=35414
2009-10-06 16:39:38 -07:00
Rob Pike
0bf5553538 fix build
R=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=35387
CL=35401
2009-10-06 15:08:32 -07:00
Russ Cox
650bff6aa9 another round of gofmt applications
R=gri
DELTA=900  (106 added, 31 deleted, 763 changed)
OCL=35384
CL=35396
2009-10-06 14:55:39 -07:00
Kai Backman
620ec45c5f cleaned up cgen() to be a bit more straightforward.
R=rsc
APPROVED=rsc
DELTA=104  (46 added, 56 deleted, 2 changed)
OCL=35392
CL=35394
2009-10-06 14:48:39 -07:00
Russ Cox
c62b3265a7 apply gofmt to the LGTM-marked files from 34501
that have not changed since I applied gofmt.

R=gri
DELTA=456  (77 added, 3 deleted, 376 changed)
OCL=35378
CL=35383
2009-10-06 11:42:55 -07:00
Kai Backman
5afce0ca85 64 bit cmp and some sgen tweaks
go/test: passes 75% (256/339)

R=rsc
APPROVED=rsc
DELTA=142  (53 added, 4 deleted, 85 changed)
OCL=35367
CL=35375
2009-10-06 09:47:46 -07:00
Rob Pike
e6bc5bf5af allow multiple -L options
R=rsc
DELTA=31  (15 added, 3 deleted, 13 changed)
OCL=35364
CL=35364
2009-10-05 21:31:50 -07:00
Robert Griesemer
c915bc54ba remove a file from idempotency test so that the entire suite passes
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=35355
CL=35358
2009-10-05 19:32:10 -07:00
Russ Cox
11d3805579 clean more
R=r
DELTA=40  (9 added, 3 deleted, 28 changed)
OCL=35277
CL=35305
2009-10-03 10:38:03 -07:00
Russ Cox
133a158bd8 8c, 8l dynamic loading support.
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.

on snow leopard:
  - non-cgo binaries work; all tests pass.
  - cgo binaries work on amd64 but not 386.

R=r
DELTA=2031  (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304
2009-10-03 10:37:12 -07:00
Kai Backman
3e5a817d07 a few more code generation bugs and an interface alignment issue.
go/test: passes 74% (251/339)

R=rsc
APPROVED=rsc
DELTA=40  (34 added, 0 deleted, 6 changed)
OCL=35254
CL=35275
2009-10-02 09:06:51 -07:00
Robert Griesemer
53440da835 Factored out boilerplate from all html docs in doc directory:
- the first HTML comment in those files is extracted as page
  title when serving them
- lib/godoc.html is top-level template for all pages served
- experimented a bit with package documentation layout
  (feedback welcome)
- various related cleanups

TODO:
- The / page (doc/root.html) content repeats links that are
  in the navigation bar. It needs to be cleaned up.

R=rsc
DELTA=826  (86 added, 692 deleted, 48 changed)
OCL=35230
CL=35245
2009-10-01 14:08:00 -07:00
Kai Backman
57f834aeff generate float registers correctly.
go/test: passes 71% (242/339)

R=rsc
APPROVED=rsc
DELTA=9  (5 added, 0 deleted, 4 changed)
OCL=35233
CL=35243
2009-10-01 13:52:55 -07:00
Kai Backman
8fd53f4754 cgen_asop sudoaddable
R=rsc
APPROVED=rsc
DELTA=14  (4 added, 0 deleted, 10 changed)
OCL=35190
CL=35210
2009-10-01 06:50:59 -07:00
Kai Backman
a1b4796394 fixed a few calls to gcmp and some really bothched OINDEX code
(how did that happen?)

go/test: passes 70% (238/339)

R=rsc
APPROVED=rsc
DELTA=18  (10 added, 0 deleted, 8 changed)
OCL=35185
CL=35188
2009-09-30 18:56:37 -07:00
Russ Cox
2157025ef0 step toward darwin ffi: factor out macho code
R=r
DELTA=771  (374 added, 287 deleted, 110 changed)
OCL=35187
CL=35187
2009-09-30 17:33:39 -07:00
Kai Backman
399d23d4f4 load binary op arguments into registers
go/test: passes 69% (237/339)

R=rsc
APPROVED=rsc
DELTA=12  (3 added, 9 deleted, 0 changed)
OCL=35178
CL=35180
2009-09-30 14:28:18 -07:00
Russ Cox
e67a5084b8 cgo working on linux/386
R=r
DELTA=70  (47 added, 4 deleted, 19 changed)
OCL=35167
CL=35171
2009-09-30 13:47:15 -07:00
Russ Cox
cce01111a9 cgo: works on amd64.
integrated into Makefiles (see misc/cgo/gmp/Makefile).

R=r
DELTA=1110  (540 added, 525 deleted, 45 changed)
OCL=35153
CL=35158
2009-09-30 11:51:08 -07:00
Russ Cox
5124e66fca c compiler bug tickled by
void f(struct { int x[1]; } p) { }
the "int" was getting attached to f.

R=ken
OCL=35145
CL=35151
2009-09-30 10:25:22 -07:00
Russ Cox
b71c484c91 fix 386 build - register allocation and shift bug
R=ken
OCL=35140
CL=35142
2009-09-30 08:56:01 -07:00
Russ Cox
e7f9452da5 missing error checking related to ([...]int){...}
R=ken
OCL=35132
CL=35132
2009-09-29 21:23:34 -07:00
Russ Cox
6f1698774d undo 35108 (disallow parens around type in struct literal).
allow parens around [...]int in struct literal.

R=ken
OCL=35112
CL=35130
2009-09-29 21:21:14 -07:00
Kai Backman
187cc1eb49 fix munging of pointer.
go/test: passes 69% (235/339)

R=rsc
APPROVED=rsc
DELTA=5  (4 added, 1 deleted, 0 changed)
OCL=35107
CL=35109
2009-09-29 16:07:59 -07:00
Russ Cox
9c3c140984 disallow parens around type in struct literal syntax,
per discussion with gri.

R=ken
OCL=35108
CL=35108
2009-09-29 16:05:44 -07:00
Kai Backman
8ccf8240f4 fixed alignment issue resulting from confusion around the
meaning of out args.

go/test: passes 68% (231/339)

R=rsc
APPROVED=rsc
DELTA=13  (7 added, 0 deleted, 6 changed)
OCL=35072
CL=35080
2009-09-29 07:27:49 -07:00
Kai Backman
24bfaaf07a - added gcmp for proper ACMP generation, changed all call
sites plus optimized constant code a bit (one less register
  used).
- changed conditional branches, might need a re-tweak later
- gave up on agen OINDEX and copied/fixed the version in 8g

go/test: passes 66% (225/339)

R=rsc
APPROVED=rsc
DELTA=148  (67 added, 32 deleted, 49 changed)
OCL=35040
CL=35055
2009-09-28 15:40:13 -07:00
Russ Cox
7743ffead4 disallow interface { x, y() }
R=ken
OCL=35042
CL=35044
2009-09-28 14:05:34 -07:00
Russ Cox
ed6de5af4c comparisons have type bool
R=ken
OCL=34995
CL=34997
2009-09-24 17:55:22 -07:00
Russ Cox
285b6021e9 missing files; cleaned up g4 nothave output.
fixes 386 build.

R=r
DELTA=56  (56 added, 0 deleted, 0 changed)
OCL=34979
CL=34981
2009-09-24 13:38:18 -07:00
Russ Cox
0c71ead9e6 convert 8l to new ELF code.
mostly cut and paste from 6l.

R=r
DELTA=930  (525 added, 182 deleted, 223 changed)
OCL=34976
CL=34976
2009-09-24 12:53:35 -07:00
Russ Cox
5de6096415 allow runes >= 0x80 in symbols in #pragmas
R=ken
OCL=34975
CL=34975
2009-09-24 11:45:08 -07:00
Russ Cox
12fc217336 cgo checkpoint.
can write all 3 output files and then compile them by hand.

R=r
DELTA=919  (841 added, 16 deleted, 62 changed)
OCL=34954
CL=34973
2009-09-24 11:43:19 -07:00
Russ Cox
567673fc42 nacl - run tests under emulator.
special all-nacl.bash and test/run-nacl that
run just the tests known to work under nacl.
the rest requires closures.

fix another bug or two in syscall.

R=r
DELTA=420  (410 added, 8 deleted, 2 changed)
OCL=34882
CL=34907
2009-09-22 16:56:28 -07:00
Kai Backman
8ce5f6e14a fix bad code generation.
go/test: passes 64% (215/337) tests

metric updated, had total number of tests wrong. number of
failing tests is down from 129 to 122.

R=rsc
APPROVED=rsc
DELTA=228  (12 added, 5 deleted, 211 changed)
OCL=34897
CL=34899
2009-09-22 13:13:23 -07:00
Russ Cox
586d9d5a19 use $(shell uname) instead of $GOOS when
deciding what the host process support is.
this makes a cross-compiling (e.g., GOOS=nacl) build
still generate valid host debugger binaries.

R=r
DELTA=5  (0 added, 0 deleted, 5 changed)
OCL=34878
CL=34889
2009-09-22 07:48:43 -07:00
Russ Cox
7390aa0102 nacl:
add jmp to constant pc.
	generate HLT for INT $3
	do not insert NOPs between REP/REPN and subsequent instruction.
	allow very long time for convergence.

R=ken
OCL=34879
CL=34879
2009-09-22 01:10:40 -07:00
Ken Thompson
2975308125 more inlining of sliceslice
R=rsc
OCL=34871
CL=34871
2009-09-21 18:23:16 -07:00
Russ Cox
eae0906bed rewrite RET, indirect CALL, indirect JMP for nacl.
can JMP or CALL indirect through a register R
provided the preceding instruction is AND $~31, R.

R=ken
OCL=34863
CL=34867
2009-09-21 15:48:22 -07:00
Russ Cox
bbcb91a3a7 convert 386 to use %gs instead of %fs for extern register.
required for nacl and may be nicer for ffi,
because %gs is the standard register for thread-local storage.

R=ken
OCL=34861
CL=34866
2009-09-21 15:46:50 -07:00
Russ Cox
a95ee61aea ideal bools and related fixes
R=ken
OCL=34859
CL=34865
2009-09-21 15:45:55 -07:00
Russ Cox
de0d762a0f accept CALL $(constant) to call absolute PC
R=ken
OCL=34845
CL=34845
2009-09-21 09:41:21 -07:00
Russ Cox
4a4ec23870 8l: step toward native client.
- ELF header bits and addresses
  - do not let instructions span 32-byte boundary
  - align CALLs so return is to 32-byte boundary
  - align indirect jump targets to 32-byte boundary
    (only possible indirect jumps are function entries)

still to do:
  - replace indirect jump, indirect call, and ret with
    nacl-approved instruction sequences
  - switch to GS segment for m-local storage

R=ken
OCL=34818
CL=34818
2009-09-18 18:57:15 -07:00
Russ Cox
c64986f706 merge first pass into main loop in span calculation.
having one copy will cut nacl changes in half.

R=ken
OCL=34815
CL=34815
2009-09-18 17:08:18 -07:00
Kai Backman
46e392e01c changed 5c calling convention to use stack exclusively for in
params. a number of fixes to assembly routines that assumed R0
had the first arg. one stack offset fix, arm pushes the link
register on stack top.

go/test: passes 65% (235/364) tests

R=rsc
APPROVED=rsc
DELTA=20  (11 added, 0 deleted, 9 changed)
OCL=34809
CL=34812
2009-09-18 16:45:41 -07:00
Kai Backman
2c7ec3d861 fix 5g -S and -g output
R=rsc
APPROVED=rsc
DELTA=115  (93 added, 14 deleted, 8 changed)
OCL=34798
CL=34802
2009-09-18 12:47:44 -07:00
Kai Backman
020dbcd4df revert setting of name from type. already set correctly.
R=rsc
APPROVED=rsc
DELTA=1  (0 added, 1 deleted, 0 changed)
OCL=34799
CL=34801
2009-09-18 12:47:25 -07:00
Russ Cox
6a2602de91 cgo: can look up C identifier kind (type or value) and type
gmp.go:197:4:  type mpz_t          C type  mpz_t
gmp.go:205:2:  call mpz_init       C value func(mpz_ptr) void
gmp.go:206:2:  call mpz_set        C value func(mpz_ptr, mpz_srcptr) void
gmp.go:221:2:  call mpz_init       C value func(mpz_ptr) void
gmp.go:227:7:  call size_t         C type  size_t
gmp.go:228:2:  call mpz_export     C value func(*void, *size_t, int, size_t, int, size_t, mpz_srcptr) *void
gmp.go:235:13: call mpz_sizeinbase C value func(mpz_srcptr, int) size_t
gmp.go:241:2:  call mpz_set        C value func(mpz_ptr, mpz_srcptr) void
gmp.go:252:3:  call mpz_import     C value func(mpz_ptr, size_t, int, size_t, int, size_t, *const void) void
gmp.go:261:2:  call mpz_set_si     C value func(mpz_ptr, long int) void
gmp.go:273:5:  call mpz_set_str    C value func(mpz_ptr, *const char, int) int
gmp.go:282:9:  call mpz_get_str    C value func(*char, int, mpz_srcptr) *char
gmp.go:287:3:  call mpz_clear      C value func(mpz_ptr) void
gmp.go:302:2:  call mpz_add        C value func(mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:311:2:  call mpz_sub        C value func(mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:320:2:  call mpz_mul        C value func(mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:329:2:  call mpz_tdiv_q     C value func(mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:339:2:  call mpz_tdiv_r     C value func(mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:348:2:  call mpz_mul_2exp   C value func(mpz_ptr, mpz_srcptr, long unsigned int) void
gmp.go:356:2:  call mpz_div_2exp   C value func(mpz_ptr, mpz_srcptr, long unsigned int) void
gmp.go:367:3:  call mpz_pow_ui     C value func(mpz_ptr, mpz_srcptr, long unsigned int) void
gmp.go:369:3:  call mpz_powm       C value func(mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr) void
gmp.go:378:2:  call mpz_neg        C value func(mpz_ptr, mpz_srcptr) void
gmp.go:386:2:  call mpz_abs        C value func(mpz_ptr, mpz_srcptr) void
gmp.go:404:9:  call mpz_cmp        C value func(mpz_srcptr, mpz_srcptr) int
gmp.go:413:2:  call mpz_tdiv_qr    C value func(mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr) void
gmp.go:426:2:  call mpz_gcdext     C value func(mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr) void

R=r
DELTA=938  (628 added, 308 deleted, 2 changed)
OCL=34733
CL=34791
2009-09-18 11:52:00 -07:00
Kai Backman
a0a965fbcf fixing width bug in DATA output. some logging to make fixing
similar issues easier in the future.

R=rsc
APPROVED=rsc
DELTA=6  (1 added, 0 deleted, 5 changed)
OCL=34771
CL=34773
2009-09-17 23:08:15 -07:00
Kai Backman
6b0bd43fe4 fix code generation of CMP to use registers properly. also fix
one case of uninitialized memory and some output.

R=rsc
APPROVED=rsc
DELTA=73  (43 added, 1 deleted, 29 changed)
OCL=34743
CL=34772
2009-09-17 23:07:52 -07:00
Kai Backman
803a73c431 floating point constants and symbol export fix.
R=rsc
APPROVED=rsc
DELTA=16  (0 added, 1 deleted, 15 changed)
OCL=34753
CL=34769
2009-09-17 19:24:07 -07:00
Russ Cox
cb49a999d1 move static init code from 6g into gc.
hook up to 8g and 5g too.

R=ken
OCL=34768
CL=34768
2009-09-17 19:15:54 -07:00
Russ Cox
73e52ae971 check for unused imports
R=ken
OCL=34732
CL=34756
2009-09-17 16:42:10 -07:00
Russ Cox
20011bc878 unused imports
R=r
OCL=34731
CL=34731
2009-09-17 10:27:04 -07:00
Russ Cox
0b7878a96e first step toward cgo tool.
can extract import "C" doc comment
and all references to C package.

; cgo gmp.go | sort
#include <gmp.h>
gmp.go:197:4: mpz_t as type
gmp.go:205:2: mpz_init as call
gmp.go:206:2: mpz_set as call
gmp.go:221:2: mpz_init as call
gmp.go:227:7: size_t as call
gmp.go:228:2: mpz_export as call
gmp.go:235:13: mpz_sizeinbase as call
gmp.go:241:2: mpz_set as call
gmp.go:252:3: mpz_import as call
gmp.go:261:2: mpz_set_si as call
gmp.go:273:5: mpz_set_str as call
gmp.go:282:9: mpz_get_str as call
gmp.go:287:3: mpz_clear as call
gmp.go:302:2: mpz_add as call
gmp.go:311:2: mpz_sub as call
gmp.go:320:2: mpz_mul as call
gmp.go:329:2: mpz_tdiv_q as call
gmp.go:339:2: mpz_tdiv_r as call
gmp.go:348:2: mpz_mul_2exp as call
gmp.go:356:2: mpz_div_2exp as call
gmp.go:367:3: mpz_pow as call
gmp.go:369:3: mpz_powm as call
gmp.go:378:2: mpz_neg as call
gmp.go:386:2: mpz_abs as call
gmp.go:404:9: mpz_cmp as call
gmp.go:413:2: mpz_tdiv_qr as call
gmp.go:426:2: mpz_gcdext as call
;

R=r
DELTA=746  (746 added, 0 deleted, 0 changed)
OCL=34710
CL=34714
2009-09-16 18:14:18 -07:00
Rob Pike
d5be41fc4e rename bytes.Buffer.Data() to bytes.Buffer.Bytes()
R=rsc
DELTA=152  (6 added, 0 deleted, 146 changed)
OCL=34695
CL=34701
2009-09-16 15:15:00 -07:00
Rob Pike
2a1c9377d9 use /bin/ed to avoid portability issues
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=34696
CL=34700
2009-09-16 15:14:12 -07:00
Russ Cox
aaaa1fc69b make 6g match spec:
no semicolon allowd after package clause.
	semicolon allowed after import statement.
	no doubled semicolons allowed

R=ken
OCL=34674
CL=34674
2009-09-15 17:29:08 -07:00
Kai Backman
ff196fbde7 patch in proper branch address in zaddr output
R=rsc
APPROVED=rsc
DELTA=12  (11 added, 1 deleted, 0 changed)
OCL=34658
CL=34664
2009-09-15 16:14:49 -07:00
Kai Backman
4c952153aa use register intermediate
R=rsc
APPROVED=rsc
DELTA=21  (7 added, 5 deleted, 9 changed)
OCL=34607
CL=34663
2009-09-15 16:12:47 -07:00
Russ Cox
1c9e4b358f declared and not used; this time for sure
R=ken
OCL=34657
CL=34657
2009-09-15 14:11:43 -07:00
Robert Griesemer
7f25485fc6 go/printer:
- printing of expressions: put spaces only where "needed"
- printing of import statements: no double indentation if there are no renames
- print labels on separate lines
- added extra test files

go/ast:
- unified basic literal nodes and as a result deleted duplicated code
- added initial code to track scopes (not fully used yet)

replaces CL 34553

R=rsc
DELTA=881  (579 added, 223 deleted, 79 changed)
OCL=34623
CL=34651
2009-09-15 13:06:24 -07:00
Russ Cox
59914723df declared and not used error, but disabled.
fix some bugs involving _.

R=ken
OCL=34621
CL=34621
2009-09-14 18:38:30 -07:00
Russ Cox
1a0860b93f make 5g, 8g build again by disabling init code.
R=ken
OCL=34604
CL=34604
2009-09-14 14:27:19 -07:00
Russ Cox
2204cfddea fix bug206.
delay calls to savex as long as possible.

R=ken
OCL=34535
CL=34546
2009-09-10 17:33:01 -07:00
Ken Thompson
93b1dcbfcb minor changes
R=rsc
OCL=34545
CL=34545
2009-09-10 17:32:48 -07:00
Robert Griesemer
58c5e62f8b better gofmt formatting:
- first cut a better line breaks in expr lists
- trailing commas and semis printed where we tend to write them
- fixed a couple of minor spacing issues (interface{}, chan<-, map[x]y, x: y)
- removed some formatting flags from gofmt: no need to change default
- removed option to reverse declaration order when printing
- excluded files from test that cause trouble with idempotency test for now

R=rsc
DELTA=497  (364 added, 83 deleted, 50 changed)
OCL=34539
CL=34544
2009-09-10 17:27:06 -07:00
Russ Cox
fc90fb8c81 rename units -> units.txt.
add makefile rules to build a binary named units as a demo.

R=r
DELTA=1257  (659 added, 597 deleted, 1 changed)
OCL=34528
CL=34530
2009-09-10 14:47:10 -07:00
Ken Thompson
61f27d3c22 sample goyacc program
R=rsc
OCL=34526
CL=34526
2009-09-10 13:53:35 -07:00
Ken Thompson
a138b50ee1 goyacc command
written in (c-style) go
produces go source parser

R=rsc
OCL=34522
CL=34522
2009-09-10 13:19:46 -07:00
Ken Thompson
0631d65dc5 composit literal under
init function context.
also moved composit literal
code from walk.c to sinit.c

R=rsc
OCL=34503
CL=34503
2009-09-09 17:48:55 -07:00
Russ Cox
aa6e81dd71 a few more blank tests
R=ken
OCL=34500
CL=34500
2009-09-09 16:59:41 -07:00
Russ Cox
f4ee9f133c check type of string/map/array index expressions
R=ken
OCL=34478
CL=34480
2009-09-09 01:31:10 -07:00
Russ Cox
83bdb805a2 error message fixes
x == nil
x.go:5: cannot use nil as bool

c := x.(type);
x.go:88: use of .(type) outside type switch

R=ken
OCL=34476
CL=34476
2009-09-09 01:21:20 -07:00
Russ Cox
e780fa8669 defining package block names must override
universe block names.

BUG=2097244
R=ken
OCL=34295
CL=34473
2009-09-09 01:01:39 -07:00
Russ Cox
5d16d23362 update type switch to match spec.
R=ken
OCL=34471
CL=34471
2009-09-09 00:18:16 -07:00
Russ Cox
5438be4541 write-only variable _
R=ken
OCL=34465
CL=34470
2009-09-08 23:16:19 -07:00
Ken Thompson
32aa5be6ef init context for composit literals
R=rsc
OCL=34462
CL=34462
2009-09-08 15:52:27 -07:00
Russ Cox
54414ad866 add -S flag to print size of symbol
R=r
DELTA=24  (15 added, 0 deleted, 9 changed)
OCL=34447
CL=34458
2009-09-08 14:40:27 -07:00
Russ Cox
7a0f4cac03 pass Type* to makechan and makemap so that
they can get the official alignment out of there
instead of guessing.

R=ken
OCL=34450
CL=34450
2009-09-08 13:46:54 -07:00
Ken Thompson
0421cf072e maps in static initialization
R=rsc
OCL=34434
CL=34434
2009-09-07 17:36:47 -07:00
Ken Thompson
a24a26c107 more static init
almost done

R=rsc
OCL=34422
CL=34422
2009-09-06 15:03:51 -07:00
Ken Thompson
18f2e360a0 composit literals
plateau - more to come

R=rsc
OCL=34413
CL=34413
2009-09-05 20:32:24 -07:00
Russ Cox
107d404378 stop using filename for disambiguation within a package.
R=ken
OCL=34339
CL=34341
2009-09-03 15:23:21 -07:00
Robert Griesemer
eea6b0d8d5 simplify extractEBNF code
R=rsc
DELTA=15  (3 added, 2 deleted, 10 changed)
OCL=34307
CL=34314
2009-09-03 10:53:27 -07:00
Rob Pike
d4903abeae use %L in listings so we see source line number in easy format
R=ken
DELTA=9  (0 added, 0 deleted, 9 changed)
OCL=34309
CL=34311
2009-09-03 10:24:38 -07:00
Robert Griesemer
6384cac343 linkify EBNF sections in spec when served via godoc
R=rsc
DELTA=217  (216 added, 0 deleted, 1 changed)
OCL=34279
CL=34306
2009-09-03 09:58:13 -07:00
Russ Cox
a1391c2d13 fix one bug involving [...] constructors.
added iant's bug202 (in main code)
and ken's bug203 (in init function).
bug187 remains at large.

R=ken
OCL=34293
CL=34293
2009-09-02 23:26:13 -07:00
Rob Pike
9e85c790e5 fix initialization of noreturn
R=ken
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=34283
CL=34283
2009-09-02 17:14:30 -07:00
Russ Cox
ee2d5128d6 the last bug involving type hashes
R=ken
OCL=34244
CL=34249
2009-09-02 09:09:32 -07:00
Russ Cox
bebe06a784 type switch bug involving function parameter names
R=ken
OCL=34232
CL=34232
2009-09-01 18:04:49 -07:00
Russ Cox
27c4e7e74e catch package net import "net" for release
R=ken
OCL=34205
CL=34207
2009-09-01 14:12:09 -07:00
Russ Cox
40bcbb30b7 fix 386 build
R=ken
OCL=34164
CL=34164
2009-08-31 18:05:12 -07:00
Russ Cox
fda0e78b23 fix line numbers, again.
if first function in file was dead code, it was being
discarded along with the file name information for that file.
leave the functions in the master function list longer:
let xfol take the dead code out of the code list,
and let span skip the unreachable functions during output.

before
	throw: sys·mapaccess1: key not in map

	panic PC=0x2e7b20
	throw+0x33 /Users/rsc/go/src/pkg/runtime/runtime.c:65
		throw(0x5834f, 0x0)
	sys·mapaccess1+0x73 /Users/rsc/go/src/pkg/runtime/hashmap.c:769
		sys·mapaccess1(0x2b9bd0, 0x0)
	gob·*Encoder·Encode+0x16b /Users/rsc/go/src/pkg/fmt/print.go:2926
		gob·*Encoder·Encode(0x2bb440, 0x0, 0x558b0, 0x0, 0x2e4be0, ...)
	main·walk+0x331 :1603
		main·walk(0x33a480, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300640, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300520, 0x0)
	main·walk+0x271 :1596
		main·walk(0x300240, 0x0)
	main·walk+0x271 :1596
		main·walk(0x678f8, 0x0)
	main·main+0x22 :1610
		main·main()

after
	throw: sys·mapaccess1: key not in map

	panic PC=0x2e7b20
	throw+0x33 /Users/rsc/go/src/pkg/runtime/runtime.c:65
		throw(0x5834f, 0x0)
	sys·mapaccess1+0x73 /Users/rsc/go/src/pkg/runtime/hashmap.c:769
		sys·mapaccess1(0x2b9bd0, 0x0)
	gob·*Encoder·Encode+0x16b /Users/rsc/go/src/pkg/gob/encoder.go:319
		gob·*Encoder·Encode(0x2bb3c0, 0x0, 0x558b0, 0x0, 0x2e4be0, ...)
	main·walk+0x331 /Users/rsc/dir.go:121
		main·walk(0x2f6ab0, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301640, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301520, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x301240, 0x0)
	main·walk+0x271 /Users/rsc/dir.go:114
		main·walk(0x678f8, 0x0)
	main·main+0x22 /Users/rsc/dir.go:128
		main·main()
	mainstart+0xe /Users/rsc/go/src/pkg/runtime/amd64/asm.s:55
		mainstart()
	goexit /Users/rsc/go/src/pkg/runtime/proc.c:133
		goexit()

R=r
DELTA=46  (20 added, 25 deleted, 1 changed)
OCL=34094
CL=34103
2009-08-30 19:21:48 -07:00
Russ Cox
6e8524be18 array index bug
x[i]
x not addressable, i >= UINF
double evaluated i
second eval killed live registers

manifested as gob instability

R=ken
OCL=34097
CL=34099
2009-08-30 18:47:48 -07:00
Ken Thompson
6fceadbba3 cleanup getting ready for static init
R=rsc
OCL=34090
CL=34090
2009-08-30 14:43:33 -07:00
Ken Thompson
be219c5e9b removed debug print
R=r
OCL=34087
CL=34087
2009-08-30 11:36:42 -07:00
Ken Thompson
bc15b94181 sped up optimization by not optimizing
very large functions.

R=r
OCL=34080
CL=34080
2009-08-29 20:33:21 -07:00
Ken Thompson
e667e8a4f7 arraytoslice and some cleanup
R=rsc
OCL=34058
CL=34058
2009-08-28 15:44:24 -07:00
Ken Thompson
3983171b08 sliceslice bug
R=rsc
OCL=34050
CL=34050
2009-08-28 13:45:48 -07:00
Ken Thompson
47c568880d bug in sliceslice
R=rsc
OCL=34047
CL=34047
2009-08-28 13:32:09 -07:00
Ken Thompson
bf0130cc0f sliceslice inline
R=rsc
OCL=34041
CL=34041
2009-08-28 12:37:39 -07:00
Robert Griesemer
a7dc9dbd20 - exponentially back off auto-sync'ing instead disabling it in case of failure
R=rsc
DELTA=48  (35 added, 3 deleted, 10 changed)
OCL=34030
CL=34034
2009-08-28 11:28:05 -07:00
Kai Backman
ee31157e16 64 bit lsh, sub, and/or/eor. some placeholder files in syscall and os.
R=rsc
APPROVED=rsc
DELTA=204  (139 added, 0 deleted, 65 changed)
OCL=34009
CL=34025
2009-08-28 07:23:24 -07:00
Ken Thompson
c19c933f5a bug in arrayslice
R=rsc
OCL=33987
CL=33987
2009-08-27 14:59:26 -07:00
Ken Thompson
9bf597a210 inline slicearray
R=rsc
OCL=33974
CL=33974
2009-08-27 13:19:44 -07:00
Russ Cox
bdcf1f8125 add and use Make.cmd
R=r
DELTA=63  (23 added, 31 deleted, 9 changed)
OCL=33932
CL=33959
2009-08-27 11:17:14 -07:00
Russ Cox
3443656bce clean up ideal handling; reject attempts
to write type descriptors for ideal types

R=ken
OCL=33958
CL=33958
2009-08-27 11:16:34 -07:00
Ken Thompson
2d73b7f7f0 bug slicing array - cap is huge
R=rsc
OCL=33936
CL=33936
2009-08-26 19:19:07 -07:00
Rob Pike
87f2208bda rename runtime internals to have modern names (array->slice etc)
R=rsc
DELTA=444  (179 added, 177 deleted, 88 changed)
OCL=33847
CL=33849
2009-08-25 15:54:25 -07:00
Russ Cox
165a99038f ffi -> dynld.
move out of export data into its own section

R=r
DELTA=222  (71 added, 99 deleted, 52 changed)
OCL=33801
CL=33808
2009-08-24 17:27:55 -07:00
Russ Cox
d66d65da96 bug132
R=ken
OCL=33792
CL=33803
2009-08-24 17:06:10 -07:00
Russ Cox
8c253bcae5 first attempt at real FFI support.
in a .6 file, an export line

	//ffi T localfib remotefib remote.so

means the dynamic linker should initialize
localfib, always a pointer, to the address of
remotefib, either text (T) or data (D) after
loading remote.so.

the C compiler will generate an export section
when given the pragmas

	#pragma package fib
	#pragma ffi T localfib remotefib remote.so

needing #pragma package is a bit of a kludge
and hopefully could go away later.

this is just the 6 tool chain support.
other architectures will happen once 6 settles down.

code using this to do FFI is in a later CL.

R=r
DELTA=161  (141 added, 14 deleted, 6 changed)
OCL=33783
CL=33795
2009-08-24 16:15:21 -07:00
Russ Cox
89f69bb3be gc: handle iface == nil in back end
R=ken
OCL=33778
CL=33781
2009-08-24 15:20:37 -07:00
Kai Backman
c6fd23ce6d 64bit literal RSH
R=rsc
APPROVED=rsc
DELTA=85  (35 added, 0 deleted, 50 changed)
OCL=33761
CL=33767
2009-08-24 13:57:04 -07:00
Russ Cox
14be733a25 bug197
R=ken
OCL=33765
CL=33765
2009-08-24 13:41:47 -07:00
Russ Cox
9feee91d79 avoid duplicate field names, so that bug132 can be fixed
also fix echo bug that just surfaced in mkerrors.sh

R=r
DELTA=67  (11 added, 19 deleted, 37 changed)
OCL=33743
CL=33757
2009-08-24 11:03:23 -07:00
Russ Cox
1f177cd8b2 linker work
* use //ffi comments in package import data
    to generate relocation entries and library loads.
  * call initffi in rt0.s if present

R=r
DELTA=117  (91 added, 3 deleted, 23 changed)
OCL=33739
CL=33750
2009-08-24 10:19:31 -07:00
Russ Cox
ef3e6810b8 bug189
R=ken
OCL=33745
CL=33745
2009-08-24 09:23:04 -07:00
Russ Cox
ac9d833c1e half of bug193
R=ken
OCL=33730
CL=33730
2009-08-23 18:09:44 -07:00
Russ Cox
fd6cdbd807 linker work
* more elf constants from FreeBSD
  * simple relocation demo

R=r
DELTA=410  (354 added, 49 deleted, 7 changed)
OCL=33689
CL=33729
2009-08-23 18:03:14 -07:00
Austin Clements
bd65739bc2 Implement line-to-PC mapping. Add unit tests for
PC/line/aline conversion methods.

R=rsc
APPROVED=rsc
DELTA=458  (434 added, 15 deleted, 9 changed)
OCL=33677
CL=33702
2009-08-21 18:13:35 -07:00
Russ Cox
59e2e54eab fix bug195
R=ken
OCL=33700
CL=33700
2009-08-21 18:07:11 -07:00
Russ Cox
e1c5d179d6 fix crash in bug194; add bug196
R=ken
OCL=33694
CL=33697
2009-08-21 17:54:07 -07:00
Kai Backman
f50e7b156e mostly 64 bit support.
- fixed a number of places where we tried to allocate 64bit
  regs. added honeypot in regalloc to catch these in the future.
- implemented quad copying in sgen
- cgen64.c, add, mul
- clearfat done
- D_REGREG output from 5g (linker already knew about them)
- gmove done
- optoas almost done, last bit probably not needed
- D_SHIFT support in list.c

R=rsc
APPROVED=rsc
DELTA=963  (711 added, 112 deleted, 140 changed)
OCL=33619
CL=33688
2009-08-21 16:29:19 -07:00
Russ Cox
0e25c1dc6d linker work
* remove now-unused D_SBIG (was for typestrings)
 * rename elf64.[ch] to elf.[ch]
 * pull in elf headers from FreeBSD instead of writing our own
 * emit non-header ELF data in data section
 * stub out a few more ELF sections needed for dynamic loading

R=r
DELTA=1928  (1237 added, 635 deleted, 56 changed)
OCL=33642
CL=33658
2009-08-21 13:08:11 -07:00
Kai Backman
005509e367 fix 386/arm builds
R=rsc
APPROVED=rsc
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=33640
CL=33645
2009-08-21 10:53:31 -07:00
Russ Cox
7b29dbb866 symbol bugs.
do not emit unreachable data symbols.

R=austin
DELTA=103  (71 added, 4 deleted, 28 changed)
OCL=33325
CL=33622
2009-08-20 17:33:28 -07:00
Russ Cox
bd4161fcba FFI step 2: can ask for libc.so.6.
introduced explicit "data" symbol instead of etext
to mark beginning of data, so that using larger
alignment (i.e. 4MB like GNU loader) doesn't
confuse garbage collector.

split dodata into dodata and dobss in preparation
for putting the dynamic data + headers in the data
segment instead of stuffed at the beginning of the binary.

R=r
DELTA=52  (37 added, 3 deleted, 12 changed)
OCL=33610
CL=33618
2009-08-20 16:09:38 -07:00
Russ Cox
5bd266d1ee add #include for time and ctime
R=r
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=33615
CL=33617
2009-08-20 16:06:06 -07:00
Russ Cox
8a45917f3d len and cap on chans
R=ken
OCL=33599
CL=33599
2009-08-20 11:12:04 -07:00
Russ Cox
364301efc6 exclude _test from godoc as well as _obj.
R=gri
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=33586
CL=33590
2009-08-20 09:49:05 -07:00
Kai Backman
8811896597 more work on adding in pieces. fixed my bad assumptions about
signed and unsigned integer conversions.

R=rsc
APPROVED=rsc
DELTA=398  (40 added, 230 deleted, 128 changed)
OCL=33546
CL=33569
2009-08-19 20:17:09 -07:00
Russ Cox
5600435fe4 produce diagnostic for
import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561
2009-08-19 17:27:08 -07:00
Russ Cox
38df5ec58d try to do better line number reporting
in the presence of yacc lookahead.
better but still not perfect

R=ken
OCL=33541
CL=33541
2009-08-19 15:18:08 -07:00
Kai Backman
8e96b45fd6 genembedtramp for arm
R=rsc
APPROVED=rsc
DELTA=104  (0 added, 33 deleted, 71 changed)
OCL=33531
CL=33535
2009-08-19 13:57:11 -07:00
Russ Cox
63aeaa2a03 fix import dot bug
R=ken
OCL=33526
CL=33528
2009-08-19 11:32:46 -07:00
Kai Backman
382a19c3de pkg/sort compiling and some progress on syscall. mostly
re-enabling and massaging code.

R=rsc
APPROVED=rsc
DELTA=2496  (1880 added, 330 deleted, 286 changed)
OCL=33487
CL=33504
2009-08-18 19:20:33 -07:00
Kai Backman
7a87a3e0df slashed warnings
R=rsc
APPROVED=rsc
DELTA=35  (2 added, 1 deleted, 32 changed)
OCL=33436
CL=33453
2009-08-18 07:16:10 -07:00
Kai Backman
e7acb5df07 fix runtime and compile regression
R=rsc
APPROVED=rsc
DELTA=6  (0 added, 0 deleted, 6 changed)
OCL=33434
CL=33452
2009-08-18 07:14:25 -07:00
Rob Pike
e1325d916e inline lib9.h
R=rsc
DELTA=41  (20 added, 2 deleted, 19 changed)
OCL=33412
CL=33415
2009-08-17 15:14:59 -07:00
Rob Pike
b0a0e3c439 remove compat stuff
R=rsc
DELTA=70  (16 added, 52 deleted, 2 changed)
OCL=33295
CL=33299
2009-08-14 14:55:22 -07:00
Russ Cox
ce9b379c90 no debug symbols for internal-only method types.
now 15% overhead instead of 30% in binaries.

R=ken
OCL=33235
CL=33288
2009-08-14 13:07:53 -07:00
Rob Pike
00274a13cb rename libmach_amd64 libmach
R=rsc
OCL=33273
CL=33276
2009-08-14 10:46:04 -07:00
Russ Cox
45ce825544 debugging symbols for 8g.
backtraces don't work,
but they didn't work when i started either.

R=ken
OCL=33230
CL=33230
2009-08-13 15:45:58 -07:00
Russ Cox
311c0b4807 6g/6l: add go type information to symbol table.
archive size +70%
  binary size +30%

old

wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x  1 rsc  eng  1487922 Aug 13 13:21 /Users/rsc/bin/godoc
-rwxr-xr-x  1 rsc  eng   995995 Aug 13 13:21 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg/
9.5M	/home/rsc/go/pkg/
wreck.mtv=;

new

wreck.mtv=; ls -l /Users/rsc/bin/{godoc,gofmt}
-rwxr-xr-x  1 rsc  eng  2014390 Aug 13 14:25 /Users/rsc/bin/godoc
-rwxr-xr-x  1 rsc  eng  1268705 Aug 13 14:25 /Users/rsc/bin/gofmt
wreck.mtv=; du -sh $GOROOT/pkg
 16M	/home/rsc/go/pkg
wreck.mtv=;

R=ken
OCL=33217
CL=33220
2009-08-13 14:41:42 -07:00
Rob Pike
7b366e9c43 fix build
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=33174
CL=33174
2009-08-13 09:35:42 -07:00
Russ Cox
43f29e64a6 mechanism for putting go types into 6.out symbol table.
no types yet.

R=ken
OCL=33142
CL=33146
2009-08-12 18:16:24 -07:00
Russ Cox
f63b0d6b71 silence gcc warning
R=ken
OCL=33144
CL=33144
2009-08-12 18:14:07 -07:00
Russ Cox
d594639087 rm outfile if 6g exits with an error
R=ken
OCL=33134
CL=33141
2009-08-12 17:58:53 -07:00
Russ Cox
57a9bd0ee3 change gotype in symbol table from
character string to machine address.
not filled in, just carved out.

R=austin
DELTA=77  (11 added, 34 deleted, 32 changed)
OCL=33122
CL=33124
2009-08-12 16:14:53 -07:00
Russ Cox
3e98a40793 bug188 - sort(x)
R=ken
OCL=33123
CL=33123
2009-08-12 15:58:31 -07:00
Russ Cox
7dbb687048 rm gobuild
R=r
DELTA=827  (0 added, 826 deleted, 1 changed)
OCL=33117
CL=33120
2009-08-12 15:17:47 -07:00
Russ Cox
a92610208e delete code for forward type declarations
R=ken
OCL=33108
CL=33113
2009-08-12 14:41:13 -07:00
Russ Cox
8db677b0a7 delete heuristic left over from incremental compilation
R=r
DELTA=31  (2 added, 28 deleted, 1 changed)
OCL=33064
CL=33112
2009-08-12 14:41:02 -07:00
Rob Pike
96a2a2effd fix linux build for whole package compilation
R=rsc
OCL=33103
CL=33103
2009-08-12 13:51:02 -07:00
Russ Cox
eda49f331f new included Make.pkg for handwritten package makefiles.
gobuild is obsolete; don't build it (will delete eventually).

revised gotest for whole-package compilation.

R=r
DELTA=102  (68 added, 6 deleted, 28 changed)
OCL=33067
CL=33098
2009-08-12 13:18:46 -07:00
Russ Cox
dd5f32330c 6g: save all 64 bits of AX/DX
8g: save AX/DX around div

R=ken
OCL=33094
CL=33096
2009-08-12 13:18:27 -07:00
Russ Cox
66bb399fdd whole-package compilation
R=ken
OCL=33063
CL=33095
2009-08-12 13:18:19 -07:00
Russ Cox
866b272336 bug186 - f(iota)
R=ken
OCL=33051
CL=33051
2009-08-11 17:05:22 -07:00
Russ Cox
7732f79daa fix indirect error
x.go:3: invalid indirect of X (type int)

was
x.go:3: invalid indirect of nil

R=ken
OCL=33008
CL=33008
2009-08-10 18:19:32 -07:00
Russ Cox
3f91f80a21 8-bit div and mod
R=ken
OCL=32975
CL=32975
2009-08-10 12:46:23 -07:00
Ken Thompson
f70e285178 bug in int8 mod
R=rsc
OCL=32971
CL=32971
2009-08-10 11:20:33 -07:00
Ken Thompson
60238e25bf increase from 3 to 11 floating registers
R=rsc
OCL=32947
CL=32947
2009-08-09 16:42:21 -07:00
Ken Thompson
34f76b5de5 1. integer division by a constant done.
2. moved functions from 6g to gc
for portability to other families.
3. added rotate-carry instructions to
peek and reg.

R=rsc
OCL=32946
CL=32946
2009-08-09 15:16:06 -07:00
Ken Thompson
812f06b3ca another plateau - almost done
only need to fix up certain
denominators

R=rsc
OCL=32928
CL=32928
2009-08-08 16:53:21 -07:00
Ken Thompson
07044ba6e5 plateau in divide by a constant
still to do - overflow, mod

R=rsc
OCL=32927
CL=32927
2009-08-08 15:26:09 -07:00
Ken Thompson
8b8a2bd945 more work on divide by constant.
no real change -- disabled because of bugs

R=rsc
OCL=32923
CL=32923
2009-08-07 20:21:04 -07:00
Russ Cox
6be0f50b97 bug159
R=ken
OCL=32902
CL=32914
2009-08-07 16:47:54 -07:00
Russ Cox
002623704f remove 8.out before creating it.
hope this will work around Mac NFS bug
where writing to an 8.out that has crashed
recently sometimes wedges NFS.

R=r
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=32906
CL=32908
2009-08-07 15:22:09 -07:00
Russ Cox
39b12e2dcb bug185 - return b,a from func() (a,b int)
R=ken
OCL=32900
CL=32900
2009-08-07 14:38:31 -07:00
Russ Cox
d1ee5d6e8f bug184 - assignment compatibility in unpacked multireturn
R=ken
OCL=32890
CL=32894
2009-08-07 14:00:18 -07:00
Russ Cox
aa7bd48389 bug183 - embedded vs non-embedded struct field in eqtype
R=ken
OCL=32888
CL=32888
2009-08-07 13:23:09 -07:00
Russ Cox
468f244416 bug182 - compiler crash
R=ken
OCL=32887
CL=32887
2009-08-07 13:17:28 -07:00
Russ Cox
6c2738eb43 bug181 - type T *struct { T } is an invalid embedded type
R=ken
OCL=32886
CL=32886
2009-08-07 13:14:01 -07:00
Russ Cox
99eca57d43 clean up a few error messages;
disable func redeclaration mismatch test;
fix golden.out

R=ken
OCL=32883
CL=32883
2009-08-07 13:00:20 -07:00
Russ Cox
76a763e0be 8 shift bug
R=ken
OCL=32882
CL=32882
2009-08-07 12:57:44 -07:00
Russ Cox
b648716ee9 forward declarations not necessary.
still to do:
	* initializer cycle detection
	* nicer error for type checking cycles

R=ken
OCL=32855
CL=32880
2009-08-07 12:50:26 -07:00
Ken Thompson
f1baf78247 divide by a constant power of 2
R=rsc
OCL=32858
CL=32858
2009-08-06 22:33:12 -07:00
Robert Griesemer
2b87d95f01 - allow more general type switch syntax
- support for reverse printing of AST
  (for compiler testing)
- added -reverse flag to gofmt

R=rsc
DELTA=163  (125 added, 11 deleted, 27 changed)
OCL=32808
CL=32853
2009-08-06 17:44:56 -07:00
Russ Cox
2609731736 delay range processing. old2new is gone
R=ken
OCL=32780
CL=32780
2009-08-05 02:33:30 -07:00
Russ Cox
54b403723b delay := processing
R=ken
OCL=32772
CL=32772
2009-08-05 00:42:44 -07:00
Russ Cox
ebdbbe0f49 fix amd64 build
R=ken
OCL=32771
CL=32771
2009-08-05 00:11:24 -07:00
Russ Cox
a121410541 make Syms smaller.
collapse a lot of duplication in dcl.c
switch to NodeList* from Dcl*

R=ken
OCL=32770
CL=32770
2009-08-04 22:59:23 -07:00
Russ Cox
4dec8ef35a get function calls out of the way before
allocating registers in shift and div.

fix behavior when res == a reserved register.

R=ken
OCL=32765
CL=32767
2009-08-04 19:16:57 -07:00
Russ Cox
aa347c4a0d move various bits of code around
and delete some dead code.
no actual changes here.

R=ken
OCL=32764
CL=32764
2009-08-04 18:43:32 -07:00
Russ Cox
d169dcee3b fix division bug
R=ken
OCL=32760
CL=32760
2009-08-04 17:59:10 -07:00
Russ Cox
dbe004efe4 delayed evaluation of var blocks
R=ken
OCL=32750
CL=32753
2009-08-04 16:53:06 -07:00
Rob Pike
b8732215c3 fix build
R=gri,rsc
OCL=32748
CL=32748
2009-08-04 15:35:58 -07:00
Russ Cox
f7a867e1a6 move select into its own file.
split into typecheck + walk

R=ken
OCL=32726
CL=32726
2009-08-04 12:57:48 -07:00
Russ Cox
d8c19c80dc type checking of assignments, switch, if, for
R=ken
OCL=32716
CL=32720
2009-08-04 10:26:29 -07:00
Rob Pike
7deeb5bd78 print profile to stderr. sheesh.
R=rsc
DELTA=40  (0 added, 0 deleted, 40 changed)
OCL=32694
CL=32698
2009-08-03 21:03:40 -07:00
Rob Pike
f17c6bcafb this time really clean up a TODO
R=rsc
DELTA=28  (0 added, 20 deleted, 8 changed)
OCL=32676
CL=32684
2009-08-03 15:27:15 -07:00
Russ Cox
9dc22b6d6f more 6g reorg; checkpoint.
typecheck.c is now responsible for all type checking
except for assignment and function argument "..."

R=ken
OCL=32661
CL=32667
2009-08-03 11:58:52 -07:00
Robert Griesemer
178089056e printer.go:
- emit line tag id's in html mode
- support for general html tags
- better names for a few identifiers

godoc.go:
- emit links from exported names to source code
  (actual placement needs fine-tuning)

R=rsc
DELTA=108  (68 added, 4 deleted, 36 changed)
OCL=32639
CL=32654
2009-08-03 09:53:00 -07:00
Robert Griesemer
62718fb5d4 printer:
- prepare for generation of HTML id tags and links
- do HTML-escaping in central print routine
- move tabwriter setup into printer
- fixed various TODOs

godoc:
- removed tabwriter setup, need for various HTML-escaping

R=rsc
DELTA=210  (107 added, 36 deleted, 67 changed)
OCL=32612
CL=32616
2009-07-31 18:04:53 -07:00
Russ Cox
9953c48dc4 missed in last checkin
R=ken
OCL=32581
CL=32581
2009-07-31 09:45:39 -07:00
Russ Cox
a2b8e38766 checkpoint; still plenty to clean up
R=ken
OCL=32576
CL=32580
2009-07-31 09:29:28 -07:00
Robert Griesemer
9299ae461d - don't call String method of AST nodes when converting them to text
- make token.Position.String more robust

TBR=rsc
DELTA=20  (10 added, 6 deleted, 4 changed)
OCL=32564
CL=32564
2009-07-30 19:39:47 -07:00
Russ Cox
b754b4348f delete some code from walkexpr that is now
handled by typecheck.

second switch is gone

move floating point minus into back end

R=ken
OCL=32558
CL=32558
2009-07-30 18:56:44 -07:00
Robert Griesemer
90e6656c51 go/ast/filter.go:
- more orthogonal functionality of filter functions for better re-use

go/doc/doc.go:
- simplified interface
- collect filenames of packages so that they can be shown

godoc:
- removed TODO, show list of package (linked) files used to create documentation

R=rsc
DELTA=130  (68 added, 24 deleted, 38 changed)
OCL=32549
CL=32552
2009-07-30 18:13:55 -07:00
Russ Cox
ff3a73b407 typechecking checkpoint.
started to move typechecking to another file.
can build entire tree still, but lots of work
is duplicated.  much to clean up.

R=ken
OCL=32536
CL=32543
2009-07-30 16:53:08 -07:00
Russ Cox
517e3457cc fix build on amd64
R=ken
OCL=32521
CL=32521
2009-07-30 11:03:58 -07:00
Robert Griesemer
312bd7a1fc parser:
- Changed filter function for parser.ParsePackage to
  take an *os.Dir instead of a filename for more
  powerful filters

- Removed TODO in ast.PackageInterface: Now collect
  package comments from all package files

- Cleanups in godoc: Use the new ParsePackage and
  PackageInterface functions; as a result computing
  package information is much simpler now.

R=rsc
DELTA=285  (80 added, 110 deleted, 95 changed)
OCL=32473
CL=32486
2009-07-29 17:01:09 -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
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
Russ Cox
4152b925f9 expression printer; %#N
R=ken
OCL=32419
CL=32419
2009-07-29 11:51:34 -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
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
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
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
Russ Cox
18840f5429 constant keys for array initializers
R=ken
OCL=32261
CL=32261
2009-07-27 17:58:25 -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
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
Russ Cox
335b3855c6 a little more 6l cleanup
R=r
DELTA=51  (14 added, 24 deleted, 13 changed)
OCL=31968
CL=31971
2009-07-21 17:18:32 -07:00
Russ Cox
5a74c0b6ba do not use ONONAMEs for line number information,
just like ONAME etc.

R=ken
OCL=31964
CL=31964
2009-07-21 16:38:56 -07:00
Rob Pike
304b7954e8 add a .interp section and fix vaddr in INTERP prog.
R=rsc
DELTA=16  (9 added, 3 deleted, 4 changed)
OCL=31956
CL=31963
2009-07-21 16:31:35 -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
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
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
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
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
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
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
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
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
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
Robert Griesemer
59ee0373fc - removed TODO, minor adjustments
R=rsc
DELTA=16  (6 added, 1 deleted, 9 changed)
OCL=31638
CL=31641
2009-07-14 16:30:06 -07:00
Robert Griesemer
e48d8fe091 update remaining files to match new scanner/parser interface
and use shared error handling infrastructure

R=rsc
DELTA=109  (3 added, 86 deleted, 20 changed)
OCL=31600
CL=31605
2009-07-14 10:46:18 -07:00
Russ Cox
10e995fba8 dead code
R=r
DELTA=20  (0 added, 20 deleted, 0 changed)
OCL=31584
CL=31598
2009-07-14 09:28:42 -07:00
Russ Cox
be16caf872 step toward no function prototypes.
delay evaluation of most types (all but func)
from parse time to type check time.

R=ken
OCL=31585
CL=31585
2009-07-13 23:38:39 -07:00
Russ Cox
a6799963ef update 6g to new REGARG convention.
silence gcc warning.

R=ken
OCL=31583
CL=31583
2009-07-13 23:30:30 -07:00
Russ Cox
e11447f7da bug148.
R=ken
OCL=31582
CL=31582
2009-07-13 23:29:44 -07:00
Kai Backman
60d223a418 added missing pieces required by reflection
R=rsc
APPROVED=rsc
DELTA=61  (40 added, 18 deleted, 3 changed)
OCL=31502
CL=31580
2009-07-13 22:06:28 -07:00
Kai Backman
0e2cce70cb tiny naming cleanup
R=rsc
APPROVED=rsc
DELTA=17  (0 added, 0 deleted, 17 changed)
OCL=31503
CL=31579
2009-07-13 22:04:24 -07:00
Kai Backman
7258bac6e8 fix bug in codegen when we modified move instruction instead
of text.

R=rsc
APPROVED=rsc
DELTA=3  (1 added, 2 deleted, 0 changed)
OCL=31575
CL=31575
2009-07-13 20:33:59 -07:00
Russ Cox
9e2f2fcd2e compilers were inconsistent about
whether no register argument was
REGARG == 0 or REGARG < 0.
use REGARG < 0 because arm needs 0 for R0.

R=ken
OCL=31562
CL=31566
2009-07-13 19:20:43 -07:00
Russ Cox
29e93590b0 fix undefined function error.
before:
	mainstart: undefined: main·init in mainstart
	mainstart: branch out of range in mainstart
	(95)    CALL    ,0(PC) [main·init]
	mainstart: undefined: main·main in mainstart
	mainstart: branch out of range in mainstart
	(97)    CALL    ,0(PC) [main·main]
	mainstart: doasm: notfound from=6f to=6f (95)    CALL    ,
	mainstart: doasm: notfound from=6f to=6f (97)    CALL    ,
	mainstart: doasm: notfound from=6f to=6f (95)    CALL    ,
	mainstart: doasm: notfound from=6f to=6f (97)    CALL    ,
	mainstart: doasm: notfound from=6f to=6f (95)    CALL    ,
	mainstart: doasm: notfound from=6f to=6f (97)    CALL    ,

after:
	mainstart: undefined: main·init in mainstart
	mainstart: undefined: main·main in mainstart

R=r
DELTA=7  (1 added, 0 deleted, 6 changed)
OCL=31555
CL=31555
2009-07-13 16:48:09 -07:00
Robert Griesemer
7b7b83ba1b ebnflint command
- basic verification of EBNF grammars
- tested with (and has testcase for) go_spec.html

R=rsc
DELTA=150  (148 added, 0 deleted, 2 changed)
OCL=31481
CL=31517
2009-07-13 10:26:58 -07:00
Kai Backman
092d6290d0 fixed typo where output arguments where pushed on to R0
instead of SP.

R=rsc
APPROVED=rsc
DELTA=13  (3 added, 7 deleted, 3 changed)
OCL=31488
CL=31501
2009-07-12 22:12:33 -07:00
Russ Cox
0dadc4fe4f cleanup in preparation for new scoping.
walkstate -> walkstmt
walktype -> walkexpr; stmts moved to walkstmt

walktype and friends have a final Node **init
argument that can have side effects appended,
making it more explicit when they do and do not happen.
this replaces the old global addtop and addtotop.

delete switch map and interface conversion cases
(dropped from the language months ago).

R=ken
OCL=31465
CL=31468
2009-07-10 16:29:26 -07:00
Ken Thompson
ed124a971e segfault
R=rsc
OCL=31467
CL=31467
2009-07-10 16:12:21 -07:00
Robert Griesemer
981f4b43ac mention file name only once in error message
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31450
CL=31452
2009-07-10 10:01:08 -07:00
Robert Griesemer
38e7fddc21 Show BUG comments in godoc:
ast.go:
- rename Comments -> CommentGroup (less confusion)
- change all comments/docs to be *CommentGroup

filter.go:
- do not remove unassociated comments from program as part
  of export filtering (they are needed by doc.go for BUG comments)

scanner.go:
- exclude '\n' from //-style comments

parser.go:
- rewrote collection of comments: now all collected comments
  are *ast.CommentGroups
- clarified distinction between leading and trailing comments
- fixed a bug in comment collection (parseGenDecl);
  corresponding test case is in printer/testdata
- extra documentation

doc.go:
- collect BUG comments
- corresponding fix for parser bug in comment collection

comment.go:
- simplified regex

printer.go:
- adjust comment printing to new representation

printer_test.go, testdata/*:
- enable printing of doc comments
- extended tests

package.html, package.txt:
- added Bugs section

gofmt:
- enable printing of doc comments

R=rsc
DELTA=339  (126 added, 38 deleted, 175 changed)
OCL=31403
CL=31416
2009-07-09 16:38:17 -07:00
Russ Cox
7472f4c951 bug168 (dsymonds) + fix
R=ken
OCL=31399
CL=31399
2009-07-09 12:08:50 -07:00
Ken Thompson
5ff7d84892 segment fault
R=rsc
OCL=31396
CL=31396
2009-07-09 11:41:06 -07:00
Ken Thompson
a68b1da3cc another nil reference
R=rsc
OCL=31373
CL=31373
2009-07-08 17:58:15 -07:00
Russ Cox
903d28bd1e ANY is already checked separately,
so remove code from go.y.

show original types in badtype; don't remove pointers.
not sure why this was here but it confuses things
if the bad part involves two named pointer types
with different names but the same pointed-at type.

R=ken
OCL=31369
CL=31369
2009-07-08 16:39:19 -07:00
Russ Cox
7c534e1bd2 the ld-supplied typestrings are now obsolete
R=r
DELTA=167  (0 added, 167 deleted, 0 changed)
OCL=31304
CL=31316
2009-07-07 17:35:45 -07:00
Russ Cox
42af80348c method expansion bugs
R=ken
OCL=31310
CL=31310
2009-07-07 16:05:55 -07:00
Robert Griesemer
61824ff3a4 - ast.FilterExports: filter non-exported anonymous fields
- fixed typo in parser.go
- removed test w/ syntax errors from gofmt test script

R=rsc
DELTA=25  (21 added, 0 deleted, 4 changed)
OCL=31296
CL=31298
2009-07-07 12:02:54 -07:00
Russ Cox
a1b64821f8 bug167
R=ken
OCL=31295
CL=31295
2009-07-07 11:48:22 -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
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
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
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
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
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
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