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

126 Commits

Author SHA1 Message Date
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
Russ Cox
fb1bcd47c6 acid bug fix.
lock printf output to avoid interlacing debug prints.

R=r
DELTA=10  (7 added, 0 deleted, 3 changed)
OCL=35539
CL=35561
2009-10-09 16:45:20 -07:00
Russ Cox
93689d863c keep a list of all the M's,
so that the garbage collector doesn't free them.

R=ken
OCL=35538
CL=35538
2009-10-09 15:35:33 -07:00
Russ Cox
91549438d8 apply gofmt to rand reflect regexp rpc runtime sort strconv strings sync syscall testing time unicode unsafe utf8
R=gri
DELTA=1409  (79 added, 24 deleted, 1306 changed)
OCL=35415
CL=35437
2009-10-07 11:55:06 -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
d58b5fca45 move cas out, add dummy runcgo.
R=rsc
APPROVED=rsc
DELTA=73  (45 added, 28 deleted, 0 changed)
OCL=35363
CL=35366
2009-10-05 21:52:10 -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
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
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
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
1b14bdbf1c changes to accommodate nacl:
* change ldt0setup to set GS itself; nacl won't let us do it.
  * change breakpoint to INT $3 so 8l can translate to HLT for nacl.
  * panic if closure is needed on nacl.
  * do not try to access symbol table on nacl.
  * mmap in 64kB chunks.

nacl support:
  * system calls, threading, locks.

R=r
DELTA=365  (357 added, 5 deleted, 3 changed)
OCL=34880
CL=34906
2009-09-22 16:28:32 -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
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
Austin Clements
ad9c6f7700 Rudimentary command shell for Ogle. Hack to prevent linker
from inlining newprocreadylocked.  Fix type bridge's handling
of basic types.  Include interpreter's Thread in bridged
native function calls.

; load . "6.out"
Started 6.out
; BpSet("main·merge")
; ContWait()
breakpoint at 0x400800
=>   400800 main·merge /home/austin/src-go1/usr/austin/ptrace/test/sort.go:19
; bt
=>   400800 main·merge /home/austin/src-go1/usr/austin/ptrace/test/sort.go:19
     400b6a main·mergeSort+0x1be /home/austin/src-go1/usr/austin/ptrace/test/sort.go:34
     448313 goexit /home/austin/src-go1/src/pkg/runtime/proc.c:133
; main.merge.a
{1}

; load . "pid:25753"
Attached to 25753
; bt
=>   479ddf syscall·Syscall+0x24 /home/austin/src-go1/src/pkg/syscall/asm_linux_amd64.s:24
     47c011 syscall·Read+0x5d /home/austin/src-go1/src/pkg/syscall/zsyscall_linux_amd64.go:368
     4119e5 os·*File·Read+0x5f /home/austin/src-go1/src/pkg/os/file.go:122
     427bf3 bufio·*Reader·fill+0x116 /home/austin/src-go1/src/pkg/bufio/bufio.go:105
     428361 bufio·*Reader·ReadSlice+0x195 /home/austin/src-go1/src/pkg/bufio/bufio.go:244
     40204a ogle·Main+0x94 /home/austin/src-go1/usr/austin/ogle/cmd.go:226
     40080f main·main+0xf /home/austin/src-go1/usr/austin/ogle/main.go:6
     41c4b8 mainstart+0xf /home/austin/src-go1/src/pkg/runtime/amd64/asm.s:55
     41531f goexit /home/austin/src-go1/src/pkg/runtime/proc.c:133

R=rsc
APPROVED=rsc
DELTA=433  (420 added, 2 deleted, 11 changed)
OCL=34410
CL=34782
2009-09-18 09:11:19 -07:00
Kai Backman
bcfc6e631f fixed register usage and removed some dead code.
R=rsc
APPROVED=rsc
DELTA=17  (0 added, 12 deleted, 5 changed)
OCL=34659
CL=34665
2009-09-15 16:15:17 -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
Russ Cox
a18208fb60 fix range on invalid utf8 bug
R=r
DELTA=42  (21 added, 20 deleted, 1 changed)
OCL=34328
CL=34333
2009-09-03 13:56:06 -07:00
Russ Cox
fe8ff955e9 add newprocreadylocked for debugger
R=austin
DELTA=10  (9 added, 0 deleted, 1 changed)
OCL=34163
CL=34166
2009-08-31 18:10:11 -07:00
Russ Cox
4962e7ee9b use correct pc for printing fn+%#x in tracebacks
R=austin
DELTA=12  (2 added, 0 deleted, 10 changed)
OCL=34098
CL=34120
2009-08-31 10:55:24 -07:00
Ken Thompson
bf0130cc0f sliceslice inline
R=rsc
OCL=34041
CL=34041
2009-08-28 12:37:39 -07:00
Russ Cox
2aea4a063b recycle G structs
R=r
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=33887
CL=33904
2009-08-26 15:26:09 -07:00
Russ Cox
de7920e6fd finish ChanValue: Len and Cap.
R=r
DELTA=45  (45 added, 0 deleted, 0 changed)
OCL=33873
CL=33881
2009-08-26 12:42:22 -07:00
Russ Cox
653cef1ba0 add Close() and Closed() to ChanValue
R=r
DELTA=60  (56 added, 3 deleted, 1 changed)
OCL=33868
CL=33872
2009-08-26 10:47:18 -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
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
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
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
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
8a45917f3d len and cap on chans
R=ken
OCL=33599
CL=33599
2009-08-20 11:12:04 -07:00
Bill Neubauer
7f09b0177f Removing dead tests from chan.c
Since pres != nil was already checked and the routine sets *pres to false
and returns, the subsequent tests are unneeded.

R=rsc
APPROVED=rsc
DELTA=4  (0 added, 4 deleted, 0 changed)
OCL=33439
CL=33441
2009-08-17 22:21:48 -07:00
Russ Cox
b21425ddee runtime gc bug.
semacquire might move to another m.

R=r
DELTA=5  (2 added, 2 deleted, 1 changed)
OCL=33317
CL=33326
2009-08-14 20:33:20 -07:00
Austin Clements
92e8b121a0 Fix build
R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=33294
CL=33294
2009-08-14 14:41:50 -07:00
Austin Clements
84852fe220 Make the runtime correctly decode the symbol table history
stacks produced by whole-package compilation.

Fix some off-by-ones in PC/line table parsing.  Hopefully.

R=rsc
APPROVED=rsc
DELTA=42  (24 added, 6 deleted, 12 changed)
OCL=33250
CL=33293
2009-08-14 14:36:49 -07:00
Austin Clements
63810f840f Account for CALL instructions before looking up the function
at PC, to deal with functions that end with a CALL
instruction.  Special case known call-by-return functions.

R=rsc
APPROVED=rsc
DELTA=12  (6 added, 6 deleted, 0 changed)
OCL=33255
CL=33279
2009-08-14 11:09:53 -07:00
Austin Clements
dbecfbf86d Don't try to account for CALL instruction in 0th frame.
R=rsc
APPROVED=rsc
DELTA=9  (4 added, 3 deleted, 2 changed)
OCL=33238
CL=33251
2009-08-13 18:10:38 -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
090efde407 makefile fixes; convert runtime to use new makefiles
R=r
DELTA=67  (17 added, 29 deleted, 21 changed)
OCL=33215
CL=33219
2009-08-13 14:41:10 -07:00
Rob Pike
f8295fcd0d rename mkasmh to mkasmh.sh
R=rsc
DELTA=204  (153 added, 49 deleted, 2 changed)
OCL=33213
CL=33213
2009-08-13 14:23:35 -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
b5c57fea96 delete forward type declarations
R=r
DELTA=163  (1 added, 149 deleted, 13 changed)
OCL=33106
CL=33111
2009-08-12 14:40:47 -07:00
Rob Pike
d08f0067b5 commentary about extern register
R=rsc
DELTA=16  (12 added, 0 deleted, 4 changed)
OCL=33030
CL=33035
2009-08-11 13:30:35 -07:00
Rob Pike
7955490de2 add runtime.GOMAXPROCS, allowing a program to, in effect, set $GOMAXPROCS
R=rsc
DELTA=29  (28 added, 1 deleted, 0 changed)
OCL=32829
CL=32837
2009-08-06 13:07:05 -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
7729c3f955 fix gc bug causing make smoketest to die in cmd/gofmt.
saving of sp was too far away from use in scanstack;
the stack had changed since the sp was saved.

R=r
DELTA=9  (4 added, 2 deleted, 3 changed)
OCL=32232
CL=32237
2009-07-27 14:16:28 -07:00
Russ Cox
3ff5e727e2 fix bug in CL 30057: missed if+continue in one place.
R=gri
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=32214
CL=32223
2009-07-27 10:59:59 -07:00
Russ Cox
052a66babd runtime: fix init scheduling bug.
if there is a goroutine waiting to run
and the init goroutine enters a system call,
entersyscall was trying to kick off a new
scheduler for the other goroutine, causing
a panic (new goroutines can't run until main.main).

R=r
DELTA=32  (32 added, 0 deleted, 0 changed)
OCL=31982
CL=31982
2009-07-21 19:43:27 -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
Russ Cox
218c393029 add LockOSThread and UnlockOSThread to
runtime package for use by debugger,
which needs to make sure that all ptrace calls
about a given pid come from the same thread.

R=r
DELTA=175  (90 added, 63 deleted, 22 changed)
OCL=31546
CL=31558
2009-07-13 17:28:39 -07:00
Kai Backman
7842b03f70 Fixed minor typo in asm file.
R=rsc
APPROVED=rsc
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=31487
CL=31500
2009-07-12 22:12:19 -07:00
Russ Cox
92e925778e reflection for interface set
rename map access methods to Elem, SetElem.

R=r
DELTA=95  (66 added, 7 deleted, 22 changed)
OCL=31456
CL=31469
2009-07-10 16:32:26 -07:00
Russ Cox
12ebbe7463 reflection for methods
R=r
DELTA=156  (135 added, 8 deleted, 13 changed)
OCL=31407
CL=31428
2009-07-09 17:27:49 -07:00
Russ Cox
bba278a43b reflection for functions
add channel send type check (thanks austin).
fix type mismatch message.

R=r
DELTA=241  (225 added, 5 deleted, 11 changed)
OCL=31370
CL=31375
2009-07-08 18:16:09 -07:00
Russ Cox
5ddaf9a098 reflection for channels
R=r
DELTA=188  (171 added, 6 deleted, 11 changed)
OCL=31352
CL=31361
2009-07-08 15:00:54 -07:00
Russ Cox
764b6ec1aa reflection for maps
R=r
DELTA=304  (248 added, 34 deleted, 22 changed)
OCL=31345
CL=31347
2009-07-08 13:55:57 -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
4793400bd1 new reflect library data structures and code declarations
* use structs instead of interfaces
  * compiler lays out data structures ahead of time,
    so no more parsing of strings.
  * unified reflect data structures with interface
    runtime data structures.
  * richer data structures should enable reflection
    on chans and maps, but not implemented here.

R=r,iant
DELTA=1179  (1179 added, 0 deleted, 0 changed)
OCL=31107
CL=31213
2009-07-06 15:34:04 -07:00
Russ Cox
29aa3ffbf6 move Structrnd to runtime.h
R=ken
OCL=31125
CL=31125
2009-07-02 21:25:46 -07:00
Russ Cox
20cfa4a568 change alignment rules: roll receiver into
input parameters, move output parameters
into their own struct.

R=ken
OCL=30954
CL=30966
2009-06-30 20:02:07 -07:00
Russ Cox
150a64572b remove declarations for functions that cannot be called from c
(because they return values in the input parameters).

R=iant
DELTA=12  (0 added, 11 deleted, 1 changed)
OCL=30952
CL=30965
2009-06-30 20:01:59 -07:00
Russ Cox
fa40c856ac convert string runtime to use cgo.
now that cgo2c can handle it,
merge x.c and x_go.cgo into
a single x.cgo, for x=float,malloc,sema.

R=r
DELTA=1950  (954 added, 996 deleted, 0 changed)
OCL=30951
CL=30964
2009-06-30 20:01:50 -07:00
Russ Cox
88e7fd5410 in preparation for changing 6g's behavior to
align the output args separately from the input args,
change cgo2c to insert the necessary padding
when the two arg lists are concatenated in the c
translation.

for example, there is a runtime

	func indexstring(s string, i int32) (b byte)

right now in 6g those arguments are aligned in one
struct with s at offset 0, i at 16, and b at 20.
soon the b byte will be in its own struct and structs
are 8 aligned, so it will be b at 24.

right now cgo2c generates:

	void indexstring(string s, int32 i, byte b)

this CL makes it generate, in --6g mode:

	void indexstring(string s, int32 i, uint32, byte b)

this is valid 6c input, although not valid gcc input.
(the code is being generated for 6c only anyway.)

also, allow C code to be mixed in among the Go funcs.
every instance of the token `func' is expected to start
a new go func.

R=iant
DELTA=145  (118 added, 0 deleted, 27 changed)
OCL=30949
CL=30963
2009-06-30 20:01:41 -07:00
Russ Cox
d3a412a5ab io.StringBytes -> strings.Bytes
io.ByteBuffer -> bytes.Buffer

left io.ByteBuffer stub around for now,
for protocol compiler.

R=r
OCL=30861
CL=30872
2009-06-29 15:24:23 -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
Kai Backman
111005d32b Add Gobuf.r0 that stores arg0 or return value of
goroutine. arm only.

R=rsc
APPROVED=rsc
DELTA=5  (3 added, 2 deleted, 0 changed)
OCL=30644
CL=30746
2009-06-25 11:26:10 -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
Kai Backman
d281748a6d add arm support to mkasmh
R=rsc
APPROVED=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=30587
CL=30595
2009-06-22 14:08:00 -07:00
Russ Cox
ab7a8d43a4 make pkg/runtime/Makefile behave like the others:
make builds; make install installs.

R=r
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=30489
CL=30491
2009-06-18 13:33:28 -07:00
Russ Cox
f39fcd7e42 fix 386 build.
some day...

TBR=r
OCL=30453
CL=30453
2009-06-17 16:34:13 -07:00
Russ Cox
380200953a Forgot to check in 386/asm.h.
Rather than do that, fix build by
generating asm.h automatically.

R=r
DELTA=97  (48 added, 36 deleted, 13 changed)
OCL=30449
CL=30452
2009-06-17 16:31:02 -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
Russ Cox
7343e03c43 runtime: stack growth adjustments, cleanup
* keep coherent SP/PC in gobuf
	  (i.e., SP that would be in use at that PC)
	* gogocall replaces setspgoto,
	  should work better in presence of link registers
	* delete unused system calls

only amd64; 386 is now broken

R=r
DELTA=548  (183 added, 183 deleted, 182 changed)
OCL=30381
CL=30442
2009-06-17 15:12:16 -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
Russ Cox
8c357ce269 fix another gc bug, one that i have only imagined,
not observed: do not use malloc to allocate stacks
during garbage collection, because it would make the
malloc data structures change underfoot.

R=r
DELTA=6  (3 added, 0 deleted, 3 changed)
OCL=30323
CL=30326
2009-06-15 21:31:56 -07:00
Russ Cox
36835c7a47 fix garbage collection race: save stack trace
when changing process state to Gsyscall, not after.

R=r
DELTA=8  (4 added, 3 deleted, 1 changed)
OCL=30320
CL=30325
2009-06-15 21:30:53 -07:00
Kai Backman
528919520d Adding a batch of missing system calls.
R=rsc
APPROVED=rsc
DELTA=1329  (1264 added, 1 deleted, 64 changed)
OCL=30040
CL=30158
2009-06-10 11:53:07 -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