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

3301 Commits

Author SHA1 Message Date
Ken Thompson
e90314d024 pragma textflag
fixes latent bugs in go and defer

R=r
OCL=23613
CL=23613
2009-01-27 14:12:35 -08:00
Russ Cox
53e69e1db5 various race conditions.
R=r
DELTA=43  (29 added, 5 deleted, 9 changed)
OCL=23608
CL=23611
2009-01-27 14:01:20 -08:00
Ken Thompson
47ab1c1e99 spelling
R=r
OCL=23602
CL=23602
2009-01-27 13:23:28 -08:00
Ken Thompson
1e1cc4eb57 defer
R=r
OCL=23592
CL=23592
2009-01-27 12:03:53 -08:00
Russ Cox
1ce17918e3 gc #0. mark and sweep collector.
R=r,gri
DELTA=472  (423 added, 2 deleted, 47 changed)
OCL=23522
CL=23541
2009-01-26 17:37:05 -08:00
Russ Cox
9ed2960de8 in hash implementation, if data >= 8, align to 8.
R=ken
OCL=23519
CL=23521
2009-01-26 15:36:39 -08:00
Russ Cox
9b6d385cb5 interface speedups and fixes.
more caching, better hash functions, proper locking.
fixed a bug in interface comparison too.

R=ken
DELTA=177  (124 added, 10 deleted, 43 changed)
OCL=23491
CL=23493
2009-01-26 12:36:21 -08:00
Russ Cox
a7f6d4066e implement new restrictions on what
can be compared/hashed.

R=r
DELTA=351  (201 added, 80 deleted, 70 changed)
OCL=23423
CL=23481
2009-01-26 09:56:42 -08:00
Ken Thompson
3338c71fc6 bug in async select read
buganizer 1589219
channel is returning same values multiple times

R=r
OCL=23447
CL=23447
2009-01-24 15:58:44 -08:00
Russ Cox
1f8a40d85c move math routines from package sys to package math,
though they still build in src/runtime.

use cgo instead of hand-written wrappers.

R=r
DELTA=740  (289 added, 300 deleted, 151 changed)
OCL=23326
CL=23331
2009-01-22 16:23:44 -08:00
Russ Cox
61590c4c44 disallow P.t for lowercase t and not our package P.
implement hiding lowercase methods m in
signatures by adding in a hash of the package name
to the type hash code.

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

R=ken
OCL=23236
CL=23238
2009-01-21 14:51:57 -08:00
Russ Cox
0183baaf44 * delete export
* rename init functions

R=ken
OCL=23122
CL=23126
2009-01-20 14:40:00 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Ian Lance Taylor
2b57a1124e Add cgo2c program to translate mixed Go/C code into C. This
lets us use a single source file for both 6c and gcc, handling
the incompatible handling of return values.

R=rsc
DELTA=649  (613 added, 35 deleted, 1 changed)
OCL=22682
CL=22730
2009-01-14 08:21:25 -08:00
Ian Lance Taylor
1a0bde24ae Add USED declarations for SysUnused parameters.
R=rsc
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=22640
CL=22642
2009-01-13 10:24:06 -08:00
Ian Lance Taylor
9b8da82d72 Tweak code to make it easier to compile with gcc.
+ Use macros to name symbols with non-ASCII characters.
  + Make some variables unsigned, because they are compared
    against unsigned values.
  + Fix a few void* pointers to be MLink*.

R=rsc
DELTA=94  (44 added, 3 deleted, 47 changed)
OCL=22303
CL=22638
2009-01-13 09:55:24 -08:00
Russ Cox
0c32430534 free(nil)
R=iant
DELTA=3  (3 added, 0 deleted, 0 changed)
OCL=22467
CL=22471
2009-01-09 16:22:13 -08:00
Russ Cox
a3ed4e716a add sys.caller
R=r
DELTA=139  (101 added, 38 deleted, 0 changed)
OCL=22462
CL=22466
2009-01-09 15:52:43 -08:00
Russ Cox
484ba939d2 update sys.reflect and sys.unreflect to accomodate
the possibility of large objects in interface values.

R=r
DELTA=171  (97 added, 22 deleted, 52 changed)
OCL=22382
CL=22382
2009-01-09 00:17:46 -08:00
Russ Cox
20595ac4b0 many interface bug fixes.
also, after
	func g() (int, int)
	func f(int, int)
allow
	f(g())
and
	func h() (int, int) { return g() }

R=ken
DELTA=356  (252 added, 26 deleted, 78 changed)
OCL=22319
CL=22325
2009-01-08 14:30:00 -08:00
Ian Lance Taylor
7843a14df1 Remove duplicate typedef declarations.
R=rsc
DELTA=7  (0 added, 7 deleted, 0 changed)
OCL=22267
CL=22281
2009-01-08 09:45:42 -08:00
Russ Cox
c3077f7606 [] and struct in interfaces.
other [] cleanup.

convert() is gone.

R=r
DELTA=352  (144 added, 68 deleted, 140 changed)
OCL=21660
CL=21662
2008-12-19 17:11:54 -08:00
Russ Cox
eee50ae1ac chan and map of [] and struct
R=r
DELTA=192  (145 added, 8 deleted, 39 changed)
OCL=21609
CL=21614
2008-12-19 12:05:22 -08:00
Russ Cox
da0a7d7b8f malloc bug fixes.
use malloc by default.
free stacks.

R=r
DELTA=424  (333 added, 29 deleted, 62 changed)
OCL=21553
CL=21584
2008-12-19 03:13:39 -08:00
Russ Cox
d47d888ba6 convert *[] to [].
R=r
OCL=21563
CL=21571
2008-12-18 22:37:22 -08:00
Ken Thompson
9786f69f74 print(array)
R=r
OCL=21570
CL=21570
2008-12-18 22:17:05 -08:00
Ken Thompson
4026500d18 arrays
R=r
OCL=21564
CL=21564
2008-12-18 20:06:28 -08:00
Russ Cox
e29ce175ed malloc in runtime (not used by default)
R=r
DELTA=1551  (1550 added, 0 deleted, 1 changed)
OCL=21404
CL=21538
2008-12-18 15:42:28 -08:00
Ken Thompson
61e0fcce8a small bug
new printarray

R=r
OCL=21429
CL=21429
2008-12-17 12:13:19 -08:00
Ken Thompson
8f53bc0612 new convention, direction bit is
always left cleared. changed
compiler generated memcpy and
memset to assume CLD.

R=r
OCL=21215
CL=21215
2008-12-15 15:07:35 -08:00
Russ Cox
7df571aef7 off-by-one error assigning src files to functions
R=r
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=21178
CL=21187
2008-12-15 10:50:41 -08:00
Russ Cox
5bb0c4f88b check printf format strings
R=r
DELTA=18  (16 added, 0 deleted, 2 changed)
OCL=21177
CL=21185
2008-12-15 10:50:33 -08:00
Russ Cox
7ca5a0d323 correct arg register in bsdthread_create
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=21040
CL=21176
2008-12-15 08:56:32 -08:00
Ken Thompson
e956429166 string hash function faults w empty string
fixes maps[""]

R=r
OCL=20909
CL=20911
2008-12-10 13:28:46 -08:00
Russ Cox
3935610e35 chans and maps of interfaces
R=r
DELTA=746  (729 added, 1 deleted, 16 changed)
OCL=20858
CL=20858
2008-12-09 16:16:07 -08:00
Russ Cox
be629138ab use Note sched.stopped correctly
R=r
DELTA=6  (5 added, 0 deleted, 1 changed)
OCL=20777
CL=20779
2008-12-08 17:14:08 -08:00
Ken Thompson
26b357ca5b range statement
R=r
OCL=20667
CL=20667
2008-12-05 18:24:05 -08:00
Russ Cox
3f8aa662e9 add support for ref counts to memory allocator.
mark and sweep, stop the world garbage collector
(intermediate step in the way to ref counting).
can run pretty with an explicit gc after each file.

R=r
DELTA=502  (346 added, 143 deleted, 13 changed)
OCL=20630
CL=20635
2008-12-05 15:24:18 -08:00
Russ Cox
bf3dd3f0ef add mutex.Mutex
R=r
DELTA=349  (348 added, 0 deleted, 1 changed)
OCL=20380
CL=20472
2008-12-04 12:51:36 -08:00
Russ Cox
79e1db2da1 add stub routines stackalloc() and stackfree().
run oldstack on g0's stack, just like newstack does,
so that oldstack can free the old stack.

R=r
DELTA=53  (44 added, 0 deleted, 9 changed)
OCL=20404
CL=20433
2008-12-04 08:30:54 -08:00
Russ Cox
dfa5893d4f preparation for exec.
* syscall:
	add syscall.RawSyscall, which doesn't use sys.entersyscall/sys.exitsyscall
	add syscall.dup2
	add syscall.BytePtrPtr
	add syscall.Rusage, RusagePtr
	add syscall.F_GETFD, F_SETFD, FD_CLOEXEC

* runtime:
	clean up, correct signal handling.
	can now survive (continue running after) a signal.

R=r
DELTA=394  (286 added, 51 deleted, 57 changed)
OCL=20351
CL=20369
2008-12-03 14:21:28 -08:00
Russ Cox
2b39165f1e clean stack trace code.
format is unchanged but shows all frames
(old loop stopped one frame early).

wreck=; 6.out
cannot convert type *main.S·interface2 to interface main.I·interface2: missing method Foo
throw: interface conversion
SIGSEGV: segmentation violation
Faulting address: 0x0
pc: 0x256d

throw+0x46 /home/rsc/go/src/runtime/runtime.c:68
	throw(0x863a, 0x0)
hashmap+0x188 /home/rsc/go/src/runtime/iface.c:167
	hashmap(0x8760, 0x0, 0x85b0, 0x0, 0x0, ...)
sys·ifaceT2I+0xa8 /home/rsc/go/src/runtime/iface.c:201
	sys·ifaceT2I(0x8760, 0x0, 0x85b0, 0x0, 0x0, ...)
main·main+0x4e /home/rsc/go/src/runtime/rt0_amd64_darwin.s:87
	main·main()
mainstart+0xf /home/rsc/go/src/runtime/rt0_amd64.s:70
	mainstart()
sys·goexit /home/rsc/go/src/runtime/proc.c:110
	sys·goexit()

R=r
DELTA=44  (5 added, 15 deleted, 24 changed)
OCL=20358
CL=20368
2008-12-03 14:20:23 -08:00
Russ Cox
d040d26863 new stacktrace format
sys·gosched+0x25 /home/rsc/go/src/runtime/proc.c:477
	sys·gosched()
chanrecv+0x29e /home/rsc/go/src/runtime/chan.c:277
	chanrecv(0x4be80, 0x0, 0x4cf88, 0x0, 0x0, ...)
sys·chanrecv1+0x5b /home/rsc/go/src/runtime/chan.c:355
	sys·chanrecv1(0x4be80, 0x0)
once·Server+0x26 /home/rsc/go/src/lib/strconv/atoi.go:-41
	once·Server()

the last line is broken (atoi.go:-41) but that's not new.

R=r
DELTA=46  (19 added, 14 deleted, 13 changed)
OCL=20018
CL=20026
2008-11-25 17:17:54 -08:00
Russ Cox
efc86a74e4 change meaning of $GOMAXPROCS to number of cpus to use,
not number of threads.  can still starve all the other threads,
but only by looping, not by waiting in a system call.

fix darwin syscall.Syscall6 bug.

fix chanclient bug.

delete $GOMAXPROCS from network tests.

add stripped down printf, sys.printhex to runtime.

R=r
DELTA=355  (217 added, 36 deleted, 102 changed)
OCL=20017
CL=20019
2008-11-25 16:48:10 -08:00
Russ Cox
a5433369aa use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
	main·g(4195177, 0, 4205661, ...)
	main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
	main·f(4205661, 0, 4210249, ...)
	main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
	main·main(4210249, 0, 1, ...)
	main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
	mainstart(1, 0, 2643020760, ...)
	mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;

R=r
DELTA=251  (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 09:23:36 -08:00
Russ Cox
3aa063d79c delete stack mark strings
in favor of using in-memory copy of symbol table.

$ ls -l pretty pretty.big
-rwxr-xr-x  1 rsc  eng  439516 Nov 21 16:43 pretty
-rwxr-xr-x  1 rsc  eng  580984 Nov 21 16:20 pretty.big
$

R=r
DELTA=446  (238 added, 178 deleted, 30 changed)
OCL=19851
CL=19884
2008-11-23 17:08:55 -08:00
Rob Pike
60db3d6d3f don't print (incorrect anyway) line numbers in panic.
R=rsc
DELTA=4  (0 added, 2 deleted, 2 changed)
OCL=19757
CL=19763
2008-11-20 23:16:31 -08:00
Russ Cox
67addd4e11 symbol table changes
* add gotype string to symbol table
	* fill in gotype in 6l for known funcs/vars
	* print gotype with nm -t

	* load symbol and pc/ln tables into memory at magic address 0x99<<32.
	* add sys.symdat() to retrieve raw bytes of symbol table
	  and pc/ln table.

most of this should be considered experimental
and subject to change.

R=r
DELTA=157  (128 added, 0 deleted, 29 changed)
OCL=19746
CL=19750
2008-11-20 17:32:18 -08:00
Rob Pike
ec913c42b3 tweak pcs in traceback so they point to calling line instead of line after call.
R=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=19745
CL=19745
2008-11-20 17:19:45 -08:00
Russ Cox
9b8a6dc7da change array slice error to include bounds
$ 6.out
slice[5:12] of [10] array
throw: array slice
SIGSEGV: segmentation violation

R=r
DELTA=15  (13 added, 0 deleted, 2 changed)
OCL=19540
CL=19580
2008-11-19 09:35:36 -08:00
Russ Cox
75647d2024 First pieces of malloc.
R=r
DELTA=756  (754 added, 0 deleted, 2 changed)
OCL=19266
CL=19378
2008-11-17 12:32:35 -08:00
Ken Thompson
e875055461 switch
R=r
OCL=19288
CL=19288
2008-11-14 16:24:27 -08:00
Russ Cox
f8b20e4083 add cov, prof to default build; clean up compiler warnings
R=r
DELTA=8  (1 added, 0 deleted, 7 changed)
OCL=19245
CL=19245
2008-11-14 10:57:48 -08:00
Ken Thompson
9795c9e727 temp fix for map not multiple of 8
R=r
OCL=19166
CL=19166
2008-11-13 13:20:18 -08:00
Ken Thompson
bc0b4f0d2a mike's map code
R=r
OCL=19146
CL=19146
2008-11-13 10:35:44 -08:00
Rob Pike
2f4d35ffb9 converting uint bits back into floats
R=rsc
DELTA=32  (32 added, 0 deleted, 0 changed)
OCL=19084
CL=19091
2008-11-12 11:51:34 -08:00
Russ Cox
600ee088b6 * accept all NaNs, not just the one sys.NaN() returns.
* use union, not cast, to convert between uint64 and float64,
  to avoid possible problems with gcc in future.

R=r
DELTA=75  (39 added, 15 deleted, 21 changed)
OCL=18926
CL=18926
2008-11-10 15:17:56 -08:00
Russ Cox
e8766354a4 handle Inf, NaN in float print
R=r
DELTA=48  (23 added, 14 deleted, 11 changed)
OCL=18707
CL=18922
2008-11-10 14:54:10 -08:00
Ken Thompson
9b827cf9a0 bug in select default
R=r
OCL=18741
CL=18741
2008-11-06 17:50:28 -08:00
Rob Pike
335a5236e7 add sys.float32bits, sys.float64bits
R=rsc
DELTA=21  (21 added, 0 deleted, 0 changed)
OCL=18709
CL=18718
2008-11-06 15:48:36 -08:00
Ken Thompson
79fbbe37a7 select default
R=r
OCL=18646
CL=18646
2008-11-05 21:50:28 -08:00
Russ Cox
a6af484328 more runtime support for chan select default
R=ken
OCL=18630
CL=18630
2008-11-05 18:04:24 -08:00
Russ Cox
b69e80d8dd runtime support for default in select.
assumes cas->send == 2 for default case.

R=ken
OCL=18628
CL=18628
2008-11-05 17:57:18 -08:00
Russ Cox
d6a7cefd1e allow any type at all in sys.unreflect;
accomodate empty type table in 6l.

R=r
DELTA=10  (2 added, 8 deleted, 0 changed)
OCL=18601
CL=18605
2008-11-05 16:09:12 -08:00
Russ Cox
6f07ec721a new interface error messages
package main
	func main() {
		var i interface { } = 1;
		a := i.(*[]byte);
	}

interface { } is int, not *[]uint8
throw: interface conversion

	package main
	func main() {
		var i interface { };
		a := i.(*[]byte);
	}

interface is nil, not *[]uint8
throw: interface conversion

	package main
	func main() {
		i := sys.unreflect(0, "*bogus");
		a := i.(*[]byte);
	}

interface { } is *bogus, not *[]uint8
throw: interface conversion

R=r
DELTA=30  (24 added, 2 deleted, 4 changed)
OCL=18548
CL=18565
2008-11-05 13:05:01 -08:00
Russ Cox
1983121bbb 6g interface changes:
* allow conversion between nil interface and any type.
	* mark signatures as DUPOK so that multiple .6 can
	  contain sigt.*[]byte and only one gets used.

R=ken
OCL=18538
CL=18542
2008-11-05 11:27:50 -08:00
Russ Cox
e5d9a5c9f0 runtime support for interface ok,
whatever the final syntax ends up being.

R=ken
OCL=18414
CL=18414
2008-11-03 17:34:37 -08:00
Russ Cox
47caf6424c 6l: generate gotypesigs on demand.
add sys.unreflect, which uses gotypesigs.

R=r
DELTA=170  (152 added, 12 deleted, 6 changed)
OCL=18396
CL=18404
2008-11-03 16:03:12 -08:00
Russ Cox
c249a8de32 rename various magic names.
sigi and sigt:
	sys·sigi_inter -> sigi·inter
	sys·sigt_int -> sigt·int
	Package·sigt_Type -> sigt·Package.Type

	local type T in file x.go T_x -> T·x
	second one T_x_1 -> T·x·1

	method names M on T  T_M -> T·M

correctly handle local embedded types

init functions are the only place left that use underscores

R=ken
OCL=18377
CL=18377
2008-11-03 15:36:08 -08:00
Rob Pike
63f38d62ac in traceback, handle the case where we've called through a nil function pointer
R=rsc
DELTA=7  (7 added, 0 deleted, 0 changed)
OCL=18372
CL=18372
2008-11-03 15:22:15 -08:00
Ken Thompson
2f5a05a859 bug 113
R=r
OCL=18081
CL=18081
2008-10-29 16:55:52 -07:00
Russ Cox
44b0ecc5ca 6g: use full type in sigt[0].name
sys: add sys.reflect
runtime: add canfail flag for later

R=ken
OCL=17583
CL=17583
2008-10-21 15:38:26 -07:00
Ken Thompson
1bf38484d1 interface on arbitrary types
global signatures for basic types

R=r
OCL=17238
CL=17240
2008-10-15 17:08:10 -07:00
Rob Pike
5933dbda3a delete hack for interface equality now that it supported by the 6g compiler
R=rsc
DELTA=21  (0 added, 21 deleted, 0 changed)
OCL=17123
CL=17136
2008-10-14 16:33:11 -07:00
Ken Thompson
e2e8aa0ee1 interface equality (strings specifically)
R=r
OCL=17134
CL=17134
2008-10-14 16:10:44 -07:00
Ken Thompson
edb1412c50 interface equality
R=r
OCL=17116
CL=17118
2008-10-14 15:08:23 -07:00
Russ Cox
900e076d21 handle zeroed interface in ifaceI2I
R=r
OCL=16938
CL=16938
2008-10-10 16:21:50 -07:00
Russ Cox
827dcb86b7 add sys.BUG_intereq to compare interfaces for equality
R=r
OCL=16929
CL=16929
2008-10-10 15:30:32 -07:00
Russ Cox
b4f8e01acb more interface checks:
- pointer to interface cannot have methods
	- record type names for better runtime error

R=r,ken
DELTA=85  (80 added, 0 deleted, 5 changed)
OCL=16658
CL=16722
2008-10-08 09:21:57 -07:00
Rob Pike
7ee60b174d sys.stringtorune doesn't need a length parameter.
R=rsc
DELTA=7  (0 added, 0 deleted, 7 changed)
OCL=16600
CL=16630
2008-10-07 10:03:34 -07:00
Ken Thompson
8877d27b40 interfaces of all types
R=r
OCL=16462
CL=16462
2008-10-03 16:12:21 -07:00
Ken Thompson
f21e731c71 added printn and panicn
prints that insert spaces and new line

R=r
OCL=16370
CL=16370
2008-10-02 14:38:07 -07:00
Russ Cox
1f1ae404f8 for loops in hashmap.
a few missing FLUSH.

R=ken
OCL=16221
CL=16221
2008-09-30 14:02:53 -07:00
Ken Thompson
89ac5618ac toward methods on any type
R=r
OCL=16068
CL=16068
2008-09-28 20:22:31 -07:00
Ken Thompson
ce0f1dee6f change print(float) from 5 to 7 sig digits
R=r
OCL=16045
CL=16045
2008-09-27 13:33:50 -07:00
Russ Cox
72154b042f go/acid/go
R=r
DELTA=99  (95 added, 1 deleted, 3 changed)
OCL=15983
CL=15992
2008-09-26 14:10:26 -07:00
Russ Cox
d448d18cb4 test and fix non-blocking chan ops on buffered chans
R=ken
DELTA=68  (19 added, 0 deleted, 49 changed)
OCL=15966
CL=15969
2008-09-26 11:47:04 -07:00
Russ Cox
afd04fdb98 cleanup; sys.sleep can go.
R=r
OCL=15786
CL=15792
2008-09-24 15:28:03 -07:00
Russ Cox
a61bb95497 get rid of per-G Note, avoids per-G kernel semaphore on Mac.
2.14u 19.82s 22.17r 	 6.out 100000	# old
1.87u 0.43s 2.31r 	 6.out 100000	# new

R=r
OCL=15762
CL=15772
2008-09-24 14:13:07 -07:00
Russ Cox
5ff12f871f only use mach kernel semaphores for actual contention.
running rob's powser p.go:

3.21u 2.58s 5.80r 	 6.out	# old
1.48u 0.05s 1.54r 	 6.out	# new

R=r
OCL=15748
CL=15750
2008-09-24 10:25:28 -07:00
Russ Cox
5383e28ea0 change string([]byte) to pass array, rather than &a[0],
to string convert.  if the byte array has length 0,
the computation of &a[0] throws an index bounds error.

for fixed size arrays, this ends up invoking arrays2d
unnecessarily, but it works.

R=ken
DELTA=304  (44 added, 28 deleted, 232 changed)
OCL=15674
CL=15678
2008-09-22 20:12:15 -07:00
Ken Thompson
adaec0c4f4 vectors bug
R=r
OCL=15664
CL=15664
2008-09-22 16:58:30 -07:00
Russ Cox
ebd1eef41e implement spec: when main.main returns, the program exits
R=r
DELTA=9  (7 added, 2 deleted, 0 changed)
OCL=15628
CL=15643
2008-09-22 13:47:59 -07:00
Russ Cox
fb40f88c40 test cleanup
- do not print tracebacks if $GOTRACEBACK=0
	- set GOTRACEBACK=0 during tests
	- filter out pc numbers in errors

R=r
DELTA=70  (22 added, 30 deleted, 18 changed)
OCL=15618
CL=15642
2008-09-22 13:47:53 -07:00
Ken Thompson
8231e94520 now method/interface code
R=r
OCL=15627
CL=15627
2008-09-22 12:16:19 -07:00
Ken Thompson
8a9752dcfb another async select bug
R=r
OCL=15599
CL=15599
2008-09-20 19:56:40 -07:00
Ken Thompson
1da727a31f fix bugs in asynch select
R=r
OCL=15586
CL=15586
2008-09-19 20:43:30 -07:00
Russ Cox
72e3b204e4 add gobuild.
use gobuild-generated Makefile for math and os.
other makefile tweaks.
move math/main.go to test/math.go

R=r
OCL=15529
CL=15537
2008-09-19 11:55:46 -07:00
Russ Cox
a67258f380 proper handling of signals.
do not run init on g0.

R=r
DELTA=161  (124 added, 23 deleted, 14 changed)
OCL=15490
CL=15497
2008-09-18 15:56:46 -07:00
Russ Cox
68209ed5e3 fix printing of -(1<<63)
R=r
OCL=15441
CL=15445
2008-09-17 14:08:52 -07:00
Russ Cox
9350ef4eea add network listening & tests
R=r,presotto
OCL=15410
CL=15440
2008-09-17 13:49:23 -07:00
Ken Thompson
2119294af9 methods on any type
-- but only *struct tested

R=r
OCL=15326
CL=15326
2008-09-14 16:57:55 -07:00
Ken Thompson
1ae08bee90 Automated g4 rollback of changelist 15312.
*** Reason for rollback ***

  <enter reason for rollback>

*** Original change description ***

correct signal name thru package rename

R=r
OCL=15313
CL=15313
2008-09-13 14:49:36 -07:00
Ken Thompson
28b9702741 correct signal name thru package rename
R=r
OCL=15312
CL=15312
2008-09-13 14:46:19 -07:00
Rob Pike
c1ad0509ee remove special trap-handling code for array out of bounds -
compiler doesn't generate them any more

R=ken
OCL=15309
CL=15309
2008-09-13 13:13:36 -07:00
Ken Thompson
904d4045d3 1 got rid if static 'fn wo return' test
2 added dynamic calls to throw for array bounds
  and 'fn wo return'
3 small optimization on index[constant]

R=r
OCL=15281
CL=15281
2008-09-12 16:48:35 -07:00
Rob Pike
ab9f27b227 fix up linux trap handling - INTB 5 gives SEGV
R=rsc
OCL=15244
CL=15244
2008-09-12 12:35:06 -07:00
Rob Pike
e9047d1fc2 fix silly portability bug
R=gri
OCL=15238
CL=15238
2008-09-12 12:17:13 -07:00
Rob Pike
6e8dbc2051 - catch trace traps
- disassemble the instructions in a trace trap to see if it's a run-time trap
- if so, print relevant info
- avoid double-printing traceback on panic

R=ken,rsc
DELTA=66  (50 added, 7 deleted, 9 changed)
OCL=15199
CL=15224
2008-09-12 09:44:41 -07:00
Ken Thompson
47580f79b4 bug075
R=r
OCL=15192
CL=15192
2008-09-11 19:09:25 -07:00
Russ Cox
376898ca8b go threads for OS X
R=r
OCL=14944
CL=15013
2008-09-09 11:50:14 -07:00
Rob Pike
24838a2df6 fix bug in stack limit calculation - was setting limit reg in wrong place.
R=ken
OCL=14981
CL=14981
2008-09-08 19:30:14 -07:00
Ken Thompson
66a603c986 arrays
R=r
OCL=14603
CL=14603
2008-08-27 17:28:30 -07:00
Rob Pike
968701beb1 - fix signedness bug in sys.Inf()
- add NaN, Inf printing to fmt
- fix a couple of bugs in fmt
- add a test for fmt

R=ken
OCL=14092
CL=14092
2008-08-11 15:04:54 -07:00
Russ Cox
f7f6329e26 kill trailing white space.
(apparently my first attempt didn't work.)

R=r
OCL=13888
CL=13888
2008-08-05 14:21:42 -07:00
Russ Cox
96824000ed * comment, clean up scheduler
* rewrite lock implementation to be correct
  (tip: never assume that an algorithm you found
  in a linux man page is correct.)
* delete unneeded void* arg from clone fn
* replace Rendez with Note
* comment mal better
* use 6c -w, fix warnings
* mark all assembly functions 7

R=r
DELTA=828  (338 added, 221 deleted, 269 changed)
OCL=13884
CL=13886
2008-08-05 14:18:47 -07:00
Rob Pike
5adbacb8e7 allow pointers as keys in maps, treating them the same as ints - ptr eq not value equality
R=ken,gri
OCL=13879
CL=13879
2008-08-05 11:14:35 -07:00
Russ Cox
c8dee2770d acid. works only on Linux for now
R=r
DELTA=7031  (6906 added, 113 deleted, 12 changed)
OCL=13847
CL=13852
2008-08-04 17:24:25 -07:00
Russ Cox
d28acc42ec first cut at multithreading. works on Linux.
* kick off new os procs (machs) as needed
* add sys·sleep for testing
* add Lock, Rendez
* properly lock mal, sys·newproc, scheduler
* linux syscall arg #4 is in R10, not CX
* chans are not multithread-safe yet
* multithreading disabled by default;
  set $gomaxprocs=2 (or 1000) to turn it on

This should build on OS X but may not.
Rob and I will fix soon after submitting.

TBR=r
OCL=13784
CL=13842
2008-08-04 16:43:49 -07:00
Russ Cox
873ba78b79 Remove doubled #else
R=r
DELTA=4  (2 added, 2 deleted, 0 changed)
OCL=13775
CL=13779
2008-08-03 00:34:05 -07:00
Russ Cox
4feda71b7d slightly gratuitous reorg of scheduler code
* rename select (very loaded word) nextgoroutine
	* separate out "enter scheduler" (sys·gosched)
	  from the scheduler itself (scheduler)

R=r
APPROVED=r
DELTA=36  (17 added, 15 deleted, 4 changed)
OCL=13772
CL=13774
2008-08-02 22:34:04 -07:00
Rob Pike
ebec99179f fix a comment
fix a register name

R=gri
OCL=13548
CL=13548
2008-07-29 15:17:27 -07:00
Rob Pike
3835e01d97 print tracebacks for all goroutines, not just the crashing one
R=ken
OCL=13518
CL=13518
2008-07-28 11:29:41 -07:00
Ken Thompson
120827284e select/chan
R=r
DELTA=517  (137 added, 98 deleted, 282 changed)
OCL=13495
CL=13495
2008-07-26 14:21:21 -07:00
Ken Thompson
949ab5c7ff select
R=r
APPROVED=r
DELTA=41  (24 added, 13 deleted, 4 changed)
OCL=13480
CL=13480
2008-07-25 17:03:27 -07:00
Ken Thompson
e963cba8a1 select
R=r
APPROVED=r
DELTA=147  (94 added, 14 deleted, 39 changed)
OCL=13477
CL=13477
2008-07-25 15:55:12 -07:00
Ken Thompson
ece3e57c85 read select
R=r
APPROVED=r
DELTA=120  (108 added, 0 deleted, 12 changed)
OCL=13468
CL=13468
2008-07-25 11:58:26 -07:00
Ken Thompson
cb9b1038db select
R=r
APPROVED=r
DELTA=638  (433 added, 21 deleted, 184 changed)
OCL=13426
CL=13438
2008-07-24 15:57:30 -07:00
Ken Thompson
b78676a49d start of select
random bugs fixed

SVN=128149
2008-07-20 20:13:07 -07:00
Ken Thompson
90da636c15 init filename vs pkgname
SVN=128117
2008-07-19 14:20:46 -07:00
Ken Thompson
fb3af53f4e initialization
SVN=128115
2008-07-19 13:38:29 -07:00
Ken Thompson
9e2d185040 div bug
[]ptr bug
proc reuses old g* structures
differnt assignment of offsets to parameters

SVN=127888
2008-07-17 15:03:39 -07:00
Ken Thompson
e7d549fbd7 new (more fifo) schedulint algorithm
newproc will reuse dead procs

SVN=127565
2008-07-16 13:50:23 -07:00
Ken Thompson
44b8934d35 back out last chan fix
allow print of pointers

SVN=127548
2008-07-16 12:44:21 -07:00
Ken Thompson
90da10d7ac chan bool offset bug
SVN=127537
2008-07-16 11:46:33 -07:00
Ken Thompson
ac048ce7f4 new chan syntax
SVN=127437
2008-07-15 21:07:59 -07:00
Rob Pike
cbdaa10f8c add linkage for writefile on darwin
SVN=127208
2008-07-15 08:27:50 -07:00
Rob Pike
c870ac239e add sys.writefile; support for darwin only in this CL
SVN=127153
2008-07-14 20:54:55 -07:00
Ken Thompson
2d9ff40774 chan asynch
SVN=127121
2008-07-14 17:41:38 -07:00
Rob Pike
bad8c3d5dd stop traceback when pc leaves text segment
SVN=127088
2008-07-14 16:00:44 -07:00
Ken Thompson
af58f17af9 synch chan
SVN=127057
2008-07-14 14:34:27 -07:00
Ken Thompson
526200345c synch chan
SVN=127055
2008-07-14 14:33:39 -07:00
Ken Thompson
97cab903af chan
SVN=126959
2008-07-13 16:20:27 -07:00
Ken Thompson
594175d0b5 chan
SVN=126958
2008-07-13 14:29:46 -07:00
Ken Thompson
3f982aeaf6 morestack magic number
automatically generated in 6g and 6c,
manually set in 6a. format is
	TEXT	a(SB),, $a-b
where a is auto size and b is parameter size

SVN=126946
2008-07-12 17:16:22 -07:00
Rob Pike
2da9783e2b preserve AX across stack jump so C routines return correct value when triggering morestack.
SVN=126935
2008-07-12 11:30:53 -07:00
Rob Pike
b07e084a99 delete dead code
SVN=126932
2008-07-11 19:40:03 -07:00
Rob Pike
c8bce425b0 fix comment
SVN=126931
2008-07-11 19:37:47 -07:00
Rob Pike
44f65c8f08 fix traceback to know about new segmenting
SVN=126930
2008-07-11 19:35:14 -07:00
Ken Thompson
751ce3a77a segmented stacks AND goroutines
SVN=126929
2008-07-11 19:16:39 -07:00
Ken Thompson
7b454bb1d9 defined external registers g and m
SVN=126521
2008-07-09 11:35:26 -07:00
Rob Pike
41b9617be4 fix ldexp, frexp, and make math package compile and test correctly
SVN=126423
2008-07-08 17:26:10 -07:00
Ken Thompson
4528854308 unique import/export names
more on go statement

SVN=126421
2008-07-08 17:19:17 -07:00
Rob Pike
6db99de606 add bytestorune and stringtorune to sys.
SVN=126321
2008-07-08 10:36:43 -07:00
Ken Thompson
1d31a25d83 more coroutine
fixed a,b,c := x,x,x

SVN=126250
2008-07-07 17:59:32 -07:00
Rob Pike
5b904a3bde update to Unicode 5
SVN=126184
2008-07-07 14:07:46 -07:00
Ken Thompson
ac5a887d5d floating point print
SVN=126038
2008-07-04 18:01:35 -07:00
Rob Pike
ef12ae4631 drop some superfluous file prefixes in runtime
SVN=125956
2008-07-03 13:42:04 -07:00
Rob Pike
6973e3813f update golden
fix a comment

SVN=125405
2008-06-30 16:30:53 -07:00
Rob Pike
03febb6773 clean up rearrangement of runtime functions in the source
add isNaN, isInf, NaN, Inf

SVN=125389
2008-06-30 15:30:47 -07:00
Rob Pike
d3204ef19f makes stack traces work for segmented stacks
SVN=125371
2008-06-30 14:39:47 -07:00
Rob Pike
8e82a673db Break runtime.c into separate pieces for maps, strings, print, etc.
Share common assembler for amd64 runtime

SVN=125317
2008-06-30 11:50:36 -07:00
Ken Thompson
b987f7a757 segmented stacks
SVN=125267
2008-06-29 20:40:08 -07:00
Rob Pike
34cb7c299e export sys.exit
update tests to use exit rather than return
ignore return value from main (actually done in prior CL)

SVN=125173
2008-06-27 14:15:06 -07:00
Rob Pike
3719aa4d9a update darwin for segmented stacks
SVN=125154
2008-06-27 13:10:56 -07:00
Ken Thompson
1f6828bcdf segmented stack
SVN=125151
2008-06-27 13:03:19 -07:00
Rob Pike
f977e251fa add a test
fix make.bash for runtime - sysfile.6 depends on OS so simplest thing is to build just our own version

SVN=125130
2008-06-27 11:36:40 -07:00
Rob Pike
bcfd31f0e9 repair struct definition
SVN=124985
2008-06-26 15:35:43 -07:00
Rob Pike
f28ec1af7f slight change to file names
SVN=124982
2008-06-26 15:27:21 -07:00
Rob Pike
66b240c7a4 make readfile work on darwin
parameterize the system interface a bit

SVN=124981
2008-06-26 15:26:27 -07:00
Ken Thompson
e42d6a5fe2 add pointer to val type of maps
SVN=124971
2008-06-26 14:58:23 -07:00
Rob Pike
3e4e83ab1e add sys.readfile()
add args to linux runtime

SVN=124961
2008-06-26 14:09:26 -07:00
Rob Pike
9ff0e6288e runtime needs runtime.c
6l needs to know that there is no rt_amd64.6

SVN=124766
2008-06-25 21:31:17 -07:00
Rob Pike
c87597de2c put a makefile into runtime
make the runtime library an archive (rt0 is still separate)
update 6l to use the archive
add fakeobj.c, missing from prior change

SVN=124762
2008-06-25 21:19:05 -07:00
Robert Griesemer
3311e1b673 - dump registers in case of signal (linux)
SVN=124702
2008-06-25 17:07:22 -07:00
Rob Pike
1bef250f33 center dots into argument code
SVN=124433
2008-06-24 18:00:24 -07:00
Rob Pike
1e774d9e6a put center dot into main_main
restore smashed arg code, lost in incorrect resolve

SVN=124432
2008-06-24 17:58:18 -07:00
Ken Thompson
7d11924c13 middle dot as alpha package separator
SVN=124419
2008-06-24 17:16:06 -07:00
Robert Griesemer
206daeabda - added access to thread state info from the signal handler
SVN=124404
2008-06-24 16:48:54 -07:00
Rob Pike
2987c8434b arguments available
argc, argv, envc, envv all in sys now
sys.argc() etc.

SVN=124398
2008-06-24 15:31:03 -07:00
Ken Thompson
87dae02a63 string nil same as string ""
SVN=124381
2008-06-24 14:11:20 -07:00
Ken Thompson
90846cd447 map[int] bug
SVN=124332
2008-06-24 11:10:47 -07:00
Rob Pike
d4c2da409b safety checks, waiting for gri's real tracking of PC and SP
extant code is too fragile

SVN=124223
2008-06-23 20:12:39 -07:00
Rob Pike
7b210c5b2f add signal handling to mac runtime
SVN=124184
2008-06-23 16:34:17 -07:00
Ken Thompson
dee07c884e maps
SVN=124030
2008-06-22 21:02:06 -07:00
Rob Pike
12c2864e4f more nearly correct interface code for signals on linux
SVN=124021
2008-06-21 17:28:37 -07:00
Rob Pike
aeb43984ec add signal handling and traceback support therein.
factor the runtime into architecture-dependent and -independent pieces.
ditto for the OS dependence.

SVN=124020
2008-06-21 15:36:23 -07:00
Rob Pike
85785fe577 delete incorrect offset print
SVN=123857
2008-06-20 10:55:53 -07:00
Rob Pike
1a2421e406 improved formatting of traceback
SVN=123527
2008-06-18 23:25:37 -07:00
Rob Pike
d6f25597bb print rudimentary stack traceback after panic
SVN=123524
2008-06-18 23:17:39 -07:00
Ken Thompson
4e8142c929 maps
SVN=123089
2008-06-16 22:34:50 -07:00
Rob Pike
88a3371a91 print pc on faults
SVN=123030
2008-06-16 17:04:30 -07:00
Ken Thompson
e1a06ccc80 now checks for lvalue/rvalue context of
expressions.
start of generics for calling builtin
     functions
start of map type
'any' demoted from reserved word to type

SVN=122808
2008-06-15 20:24:30 -07:00
Rob Pike
54bca54655 make paths explicit for easier installation
SVN=122488
2008-06-12 13:43:47 -07:00
Rob Pike
69b74c3953 import the plan 9 libraries libc (lib9) and libbio into the tree.
remove the dependency on /home/r.

SVN=122482
2008-06-12 13:26:16 -07:00
Ken Thompson
0b3093f0a5 debugging to get fmt to run
SVN=122046
2008-06-10 21:29:57 -07:00
Ken Thompson
fa259ff89c fix different ANON flag between
darwin and linux

SVN=121371
2008-06-05 21:02:55 -07:00
Ken Thompson
959f9fb3d4 goos garch
SVN=121368
2008-06-05 19:53:15 -07:00
Ken Thompson
bbb2073223 goos garch
SVN=121367
2008-06-05 19:38:39 -07:00
Ken Thompson
28429aaaa6 goos and goarch
SVN=121346
2008-06-05 16:55:06 -07:00
Ken Thompson
2b77d87fca goos and goarch
SVN=121345
2008-06-05 16:54:34 -07:00