aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime.c
AgeCommit message (Collapse)Author
2014-11-11[dev.cc] runtime: convert basic library routines from C to GoRuss Cox
float.c held bit patterns for special float64 values, hiding from the real uses. Rewrite Go code not to refer to those values directly. Convert library routines in runtime.c and string.c. LGTM=r R=r, dave CC=austin, dvyukov, golang-codereviews, iant, khr https://golang.org/cl/170330043
2014-10-28runtime: add GODEBUG invalidptr settingRuss Cox
Fixes #8861. Fixes #8911. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/165780043
2014-09-24cmd/cc, cmd/ld, runtime: disallow conservative data/bss objectsRuss Cox
In linker, refuse to write conservative (array of pointers) as the garbage collection type for any variable in the data/bss GC program. In the linker, attach the Go type to an already-read C declaration during dedup. This gives us Go types for C globals for free as long as the cmd/dist-generated Go code contains the declaration. (Most runtime C declarations have a corresponding Go declaration. Both are bss declarations and so the linker dedups them.) In cmd/dist, add a few more C files to the auto-Go-declaration list in order to get Go type information for the C declarations into the linker. In C compiler, mark all non-pointer-containing global declarations and all string data as NOPTR. This allows them to exist in C files without any corresponding Go declaration. Count C function pointers as "non-pointer-containing", since we have no heap-allocated C functions. In runtime, add NOPTR to the remaining pointer-containing declarations, none of which refer to Go heap objects. In runtime, also move os.Args and syscall.envs data into runtime-owned variables. Otherwise, in programs that do not import os or syscall, the runtime variables named os.Args and syscall.envs will be missing type information. I believe that this CL eliminates the final source of conservative GC scanning in non-SWIG Go programs, and therefore... Fixes #909. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/149770043
2014-09-18runtime: fix handling of GOTRACEBACKDavid du Colombier
Since CL 130990043, the GOTRACEBACK variable is only used when the GODEBUG variable is set. This change restores the original behavior. LGTM=rsc R=golang-codereviews, aram, gobot, r, rsc CC=golang-codereviews https://golang.org/cl/132520043
2014-09-12runtime: remove a few untyped allocationsRuss Cox
LGTM=iant, khr, rlh R=khr, iant, bradfitz, rlh CC=dvyukov, golang-codereviews https://golang.org/cl/142030044
2014-09-09runtime: merge mallocgc, gomallocgcRuss Cox
I assumed they were the same when I wrote cgocallback.go earlier today. Merge them to eliminate confusion. I can't tell what gomallocgc did before with a nil type but without FlagNoScan. I created a call like that in cgocallback.go this morning, translating from a C file. It was supposed to do what the C version did, namely treat the block conservatively. Now it will. LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/141810043
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
2009-06-06move src/runtime -> src/lib/runtime;Russ Cox
only automatic g4 mv here. R=r OCL=30002 CL=30007
2009-06-04386-related fixes and guardsRuss Cox
R=r DELTA=44 (19 added, 1 deleted, 24 changed) OCL=29912 CL=29915
2009-05-28detect recursive initializationKen Thompson
R=r OCL=29544 CL=29544
2009-05-20change representation of interface values.Russ Cox
this is not a user-visible change. before, all interface values were struct Itype { Sigt *type; Sigi *inter; void *method[n]; } struct Iface { void *addr; Itype *itype; } the itype is basically a vtable, but it's unnecessary if the static type is interface{ }. for interface values with static type empty, the new representation is struct Eface { void *addr; Sigt *type; } this complicates the code somewhat, but it reduces the number of Itypes that have to be computed and cached, it opens up opportunities to avoid function calls in a few common cases, and it will make it possible to lay out interface{} values at compile time, which i think i'll need for the new reflection. R=ken OCL=28701 CL=29121
2009-05-08move things out of sys into os and runtimeRuss Cox
R=r OCL=28569 CL=28573
2009-04-09change representation of stringsKen Thompson
R=r OCL=27293 CL=27293
2009-03-31test for and fix bug involving reflect v.Interface() and ==.Russ Cox
R=r DELTA=156 (149 added, 2 deleted, 5 changed) OCL=26973 CL=26973
2009-03-31more 386 runtime:Russ Cox
remove use of _subv in vlrt.c darwin/386/signal.c darwin/386/* linux/386/* (forgotten before) can run empty program on darwin/386 now. R=r DELTA=1140 (1021 added, 114 deleted, 5 changed) OCL=26942 CL=26968
2009-03-30more 386 runtime - can run tiny c programs.Russ Cox
R=r DELTA=1926 (1727 added, 168 deleted, 31 changed) OCL=26876 CL=26878
2009-01-26gc #0. mark and sweep collector.Russ Cox
R=r,gri DELTA=472 (423 added, 2 deleted, 47 changed) OCL=23522 CL=23541
2009-01-26interface speedups and fixes.Russ Cox
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-26implement new restrictions on whatRuss Cox
can be compared/hashed. R=r DELTA=351 (201 added, 80 deleted, 70 changed) OCL=23423 CL=23481
2009-01-22move math routines from package sys to package math,Russ Cox
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-16casify, cleanup sysRuss Cox
R=r OCL=22978 CL=22984
2008-12-19chan and map of [] and structRuss Cox
R=r DELTA=192 (145 added, 8 deleted, 39 changed) OCL=21609 CL=21614
2008-12-10string hash function faults w empty stringKen Thompson
fixes maps[""] R=r OCL=20909 CL=20911
2008-12-09chans and maps of interfacesRuss Cox
R=r DELTA=746 (729 added, 1 deleted, 16 changed) OCL=20858 CL=20858
2008-12-05add support for ref counts to memory allocator.Russ Cox
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-11-23delete stack mark stringsRuss Cox
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-20don't print (incorrect anyway) line numbers in panic.Rob Pike
R=rsc DELTA=4 (0 added, 2 deleted, 2 changed) OCL=19757 CL=19763
2008-11-20symbol table changesRuss Cox
* 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-17First pieces of malloc.Russ Cox
R=r DELTA=756 (754 added, 0 deleted, 2 changed) OCL=19266 CL=19378
2008-11-14add cov, prof to default build; clean up compiler warningsRuss Cox
R=r DELTA=8 (1 added, 0 deleted, 7 changed) OCL=19245 CL=19245
2008-11-13mike's map codeKen Thompson
R=r OCL=19146 CL=19146
2008-11-12converting uint bits back into floatsRob Pike
R=rsc DELTA=32 (32 added, 0 deleted, 0 changed) OCL=19084 CL=19091
2008-11-10* accept all NaNs, not just the one sys.NaN() returns.Russ Cox
* 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-10handle Inf, NaN in float printRuss Cox
R=r DELTA=48 (23 added, 14 deleted, 11 changed) OCL=18707 CL=18922
2008-11-06add sys.float32bits, sys.float64bitsRob Pike
R=rsc DELTA=21 (21 added, 0 deleted, 0 changed) OCL=18709 CL=18718
2008-11-05select defaultKen Thompson
R=r OCL=18646 CL=18646
2008-09-22test cleanupRuss Cox
- 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-22now method/interface codeKen Thompson
R=r OCL=15627 CL=15627
2008-09-14methods on any typeKen Thompson
-- but only *struct tested R=r OCL=15326 CL=15326
2008-09-121 got rid if static 'fn wo return' testKen Thompson
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- catch trace trapsRob Pike
- 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-08-11- fix signedness bug in sys.Inf()Rob Pike
- 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-05kill trailing white space.Russ Cox
(apparently my first attempt didn't work.) R=r OCL=13888 CL=13888
2008-08-05* comment, clean up schedulerRuss Cox
* 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-05allow pointers as keys in maps, treating them the same as ints - ptr eq not ↵Rob Pike
value equality R=ken,gri OCL=13879 CL=13879
2008-08-04first cut at multithreading. works on Linux.Russ Cox
* 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-07-28print tracebacks for all goroutines, not just the crashing oneRob Pike
R=ken OCL=13518 CL=13518
2008-07-14synch chanKen Thompson
SVN=127055
2008-07-13chanKen Thompson
SVN=126958
2008-07-12preserve AX across stack jump so C routines return correct value when ↵Rob Pike
triggering morestack. SVN=126935