Commit Graph

3230 Commits

Author SHA1 Message Date
Russ Cox
67815ef65b checkpoint & test (pidigits) before trying to automate.
R=r
DELTA=616  (598 added, 11 deleted, 7 changed)
OCL=33846
CL=33848
2009-08-25 15:37:22 -07:00
Russ Cox
75a38963ca cgocall bug fix.
better FFI demo: compute fibonacci numbers using FFI'ed libgmp.

R=r
DELTA=281  (255 added, 19 deleted, 7 changed)
OCL=33815
CL=33820
2009-08-24 21:16:15 -07:00
David Symonds
429157848f Wrap kludge text in HTML comments so the text/html output will remain valid HTML.
Be more conservative: only mess with text/html and text/plain output.

R=rsc
APPROVED=rsc
DELTA=20  (12 added, 5 deleted, 3 changed)
OCL=33806
CL=33812
2009-08-24 17:31:35 -07:00
Russ Cox
fdc4b4a47f start of FFI support, and a demo.
R=r
DELTA=494  (492 added, 0 deleted, 2 changed)
OCL=33784
CL=33810
2009-08-24 17:30:00 -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
92543daff1 change reflect test to avoid bug132
R=gri
DELTA=20  (17 added, 0 deleted, 3 changed)
OCL=33793
CL=33802
2009-08-24 17:04:12 -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
Rob Pike
0262f8834d fix duplicated word
R=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=33788
CL=33791
2009-08-24 16:12:59 -07:00
Ian Lance Taylor
92ac4bff74 Match gccgo error messages.
bug192.go:11:5: error: redefinition of ‘fmt’
bug192.go:9:8: note: previous definition of ‘fmt’ was here

R=r
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=33780
CL=33790
2009-08-24 15:56:39 -07:00
Robert Griesemer
c36fbdf713 - fix for multiple fields at same depth error
R=rsc
DELTA=9  (5 added, 0 deleted, 4 changed)
OCL=33768
CL=33785
2009-08-24 15:45:51 -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
Austin Clements
9a36b8087c Make it only necessary to exit blocks, not scopes. Allow
variables to be given initial values in some cases, to make
building global scopes more convenient.

R=rsc
APPROVED=rsc
DELTA=29  (17 added, 0 deleted, 12 changed)
OCL=33760
CL=33766
2009-08-24 13:48:16 -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
Rob Pike
c409976b85 semicolons, ifs, switches
R=rsc
DELTA=196  (118 added, 24 deleted, 54 changed)
OCL=33716
CL=33727
2009-08-23 14:00:28 -07:00
Rob Pike
d55370760f allow "comma ok" in initializers
DELTA=11  (4 added, 0 deleted, 7 changed)
OCL=33698
CL=33712
2009-08-22 00:04:04 -07:00
Russ Cox
28b655ea07 more interface embedding tests
6g's error for I4 is not quite accurate
(it calls I4 a non-interface) but also
not a crash or infinite loop.

R=iant
DELTA=15  (15 added, 0 deleted, 0 changed)
OCL=33701
CL=33709
2009-08-21 21:30:24 -07:00
Austin Clements
30a2dabdc3 Implement map types
R=rsc
APPROVED=rsc
DELTA=329  (301 added, 2 deleted, 26 changed)
OCL=33696
CL=33706
2009-08-21 18:37:38 -07:00
Austin Clements
fc18391209 Decode overlapping section names correctly.
R=rsc
APPROVED=rsc
DELTA=23  (14 added, 8 deleted, 1 changed)
OCL=33699
CL=33705
2009-08-21 18:30:20 -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
Ian Lance Taylor
5261be20eb A test for an interface which uses a forward declared type
which turns out to be invalid.

R=rsc
DELTA=15  (15 added, 0 deleted, 0 changed)
OCL=33691
CL=33693
2009-08-21 17:42:41 -07:00
Ian Lance Taylor
f861c7f61b If the compiler dumps core, bash will print a useless error
message with the full path of the errchk script.  Catch that
by wrapping the if statement which invokes the compiler in a
subshell.  Use the $TMPOUT file as a flag to let the main
shell know whether the subshell ran.  Since the compiler
stdout and stderr are redirected, if the if statement produces
any output, then the compiler crashed, and we report that.

R=r,rsc
DELTA=14  (11 added, 1 deleted, 2 changed)
OCL=33690
CL=33692
2009-08-21 17:41:18 -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
Ian Lance Taylor
1f1551f179 Test composite literals with undeclared types. This crashed
gccgo in a few different places, and crashes 6g as of this
writing.  Note that the index in a composite literal must be
looked up in a different namespace if the composite literal
type turns out to be a struct.

R=rsc
DELTA=36  (36 added, 0 deleted, 0 changed)
OCL=33681
CL=33685
2009-08-21 16:09:17 -07:00
Austin Clements
1068bcab96 Make stop causes pointers so users outside the package can
type switch on them despite their private fields.  Add some
tracing stuff.

R=rsc
APPROVED=rsc
DELTA=18  (7 added, 0 deleted, 11 changed)
OCL=33678
CL=33683
2009-08-21 15:54:54 -07:00
Ian Lance Taylor
8bbe748b84 Enable these tests. Fix divconst.go and modconst.go to
compile with the current compiler.  Adjust expected error
message in method1.go to match 6g output.

R=rsc
DELTA=9  (2 added, 5 deleted, 2 changed)
OCL=33674
CL=33682
2009-08-21 15:43:23 -07:00
Rob Pike
83cbca5657 rewrite type rules for expressions and add shift examples
DELTA=48  (22 added, 0 deleted, 26 changed)
OCL=33657
CL=33668
2009-08-21 14:18:08 -07:00
Robert Griesemer
cfa52e5e0b unexpected shift conversion behavior
R=r
DELTA=20  (20 added, 0 deleted, 0 changed)
OCL=33646
CL=33667
2009-08-21 14:14:25 -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
Robert Griesemer
ef45e64afc - unifying rules for var decls, short var decls, and assignments
DELTA=39  (4 added, 15 deleted, 20 changed)
OCL=33639
CL=33649
2009-08-21 11:25:00 -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
e107afddc5 fix build
TBR=r
OCL=33623
CL=33623
2009-08-20 17:36:21 -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
Nigel Tao
b58ecb11b0 Fix inflate.go's decompressing of a fixed Huffman block that has
length-distance pairs.

The new test data was generated by "gzip shesells.txt", which is
presumably what you (rsc) did before, for the other test cases in
gunzip_test.go.

R=rsc
APPROVED=rsc
DELTA=21  (17 added, 2 deleted, 2 changed)
OCL=33582
CL=33616
2009-08-20 16:03:34 -07:00
Rob Pike
f0ccd40736 names
R=rsc
DELTA=96  (25 added, 5 deleted, 66 changed)
OCL=33607
CL=33612
2009-08-20 15:39:41 -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
7c4f7cc7eb introduce meaningful section names, so that
go_spec.html#Return_statements

can be used to link to spec sections.  passes hlint.
renamed final section to simply "Implementation differences"
to shorten the name, but otherwise no non-formatting changes

R=gri
DELTA=230  (10 added, 0 deleted, 220 changed)
OCL=33598
CL=33598
2009-08-20 11:11:03 -07:00
Russ Cox
fe53795422 clean up multifile package section.
remove ASCII digit comment that isn't true.

R=gri
DELTA=41  (1 added, 25 deleted, 15 changed)
OCL=33594
CL=33596
2009-08-20 10:47:40 -07:00
Russ Cox
16b95ba614 simplifications.
mark multifile section with TODO only
because that is a bigger change.

R=gri
DELTA=45  (9 added, 22 deleted, 14 changed)
OCL=33565
CL=33593
2009-08-20 10:22:52 -07:00
Russ Cox
52cf67a611 naming cleanup.
gzip.GzipInflater -> gzip.Inflater
gzip.NewGzipInflater -> gzip.NewInflater
zlib.NewZlibInflater -> zlib.NewInflater

io.ByteReader deleted in favor of bytes.Buffer
io.NewByteReader -> bytes.NewBuffer

R=r
DELTA=52  (3 added, 0 deleted, 49 changed)
OCL=33589
CL=33592
2009-08-20 10:18:48 -07:00