aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/mfinal.c
AgeCommit message (Collapse)Author
2014-01-07runtime: use special records hung off the MSpan toKeith Randall
record finalizers and heap profile info. Enables removing the special bit from the heap bitmap. Also provides a generic mechanism for annotating occasional heap objects. finalizers overhead per obj old 680 B 80 B avg new 16 B/span 48 B profile overhead per obj old 32KB 24 B + hash tables new 16 B/span 24 B R=cshapiro, khr, dvyukov, gobot CC=golang-codereviews https://golang.org/cl/13314053
2013-08-23runtime: rename FlagNoPointers to FlagNoScan. Better representsKeith Randall
the use of the flag, especially for objects which actually do have pointers but we don't want the GC to scan them. R=golang-dev, cshapiro CC=golang-dev https://golang.org/cl/13181045
2013-08-14runtime: make SetFinalizer(x, f) accept any f for which f(x) is validRuss Cox
Originally the requirement was f(x) where f's argument is exactly x's type. CL 11858043 relaxed the requirement in a non-standard way: f's argument must be exactly x's type or interface{}. If we're going to relax the requirement, it should be done in a way consistent with the rest of Go. This CL allows f's argument to have any type for which x is assignable; that's the same requirement the compiler would impose if compiling f(x) directly. Fixes #5368. R=dvyukov, bradfitz, pieter CC=golang-dev https://golang.org/cl/12895043
2013-07-29runtime: allow SetFinalizer with a func(interface{})Pieter Droogendijk
Fixes #5368. R=golang-dev, dvyukov CC=golang-dev, rsc https://golang.org/cl/11858043
2013-07-26runtime: refactor mallocgcDmitriy Vyukov
Make it accept type, combine flags. Several reasons for the change: 1. mallocgc and settype must be atomic wrt GC 2. settype is called from only one place now 3. it will help performance (eventually settype functionality must be combined with markallocated) 4. flags are easier to read now (no mallocgc(sz, 0, 1, 0) anymore) R=golang-dev, iant, nightlyone, rsc, dave, khr, bradfitz, r CC=golang-dev https://golang.org/cl/10136043
2013-02-21cmd/gc, reflect, runtime: switch to indirect func value representationRuss Cox
Step 1 of http://golang.org/s/go11func. R=golang-dev, r, daniel.morsing, remyoudompheng CC=golang-dev https://golang.org/cl/7393045
2012-09-24runtime: prepare for 64-bit intsRuss Cox
This CL makes the runtime understand that the type of the len or cap of a map, slice, or string is 'int', not 'int32', and it is also careful to distinguish between function arguments and results of type 'int' vs type 'int32'. In the runtime, the new typedefs 'intgo' and 'uintgo' refer to Go int and uint. The C types int and uint continue to be unavailable (cause intentional compile errors). This CL does not change the meaning of int, but it should make the eventual change of the meaning of int on amd64 a bit smoother. Update #2188. R=iant, r, dave, remyoudompheng CC=golang-dev https://golang.org/cl/6551067
2012-05-30runtime: do not unset the special bit after finalization.Rémy Oudompheng
A block with finalizer might also be profiled. The special bit is needed to unregister the block from the profile. It will be unset only when the block is freed. Fixes #3668. R=golang-dev, rsc CC=golang-dev, remy https://golang.org/cl/6249066
2011-12-16runtime: make more build-friendlyRuss Cox
Collapse the arch,os-specific directories into the main directory by renaming xxx/foo.c to foo_xxx.c, and so on. There are no substantial edits here, except to the Makefile. The assumption is that the Go tool will #define GOOS_darwin and GOARCH_amd64 and will make any file named something like signals_darwin.h available as signals_GOOS.h during the build. This replaces what used to be done with -I$(GOOS). There is still work to be done to make runtime build with standard tools, but this is a big step. After this we will have to write a script to generate all the generated files so they can be checked in (instead of generated during the build). R=r, iant, r, lucio.dere CC=golang-dev https://golang.org/cl/5490053
2011-10-06runtime: faster finalizersDmitriy Vyukov
Linux/amd64, 2 x Intel Xeon E5620, 8 HT cores, 2.40GHz benchmark old ns/op new ns/op delta BenchmarkFinalizer 420.00 261.00 -37.86% BenchmarkFinalizer-2 985.00 201.00 -79.59% BenchmarkFinalizer-4 1077.00 244.00 -77.34% BenchmarkFinalizer-8 1155.00 180.00 -84.42% BenchmarkFinalizer-16 1182.00 184.00 -84.43% BenchmarkFinalizerRun 2128.00 1378.00 -35.24% BenchmarkFinalizerRun-2 1655.00 1418.00 -14.32% BenchmarkFinalizerRun-4 1634.00 1522.00 -6.85% BenchmarkFinalizerRun-8 2213.00 1581.00 -28.56% BenchmarkFinalizerRun-16 2424.00 1599.00 -34.03% Darwin/amd64, Intel L9600, 2 cores, 2.13GHz benchmark old ns/op new ns/op delta BenchmarkChanCreation 1451.00 926.00 -36.18% BenchmarkChanCreation-2 3124.00 1412.00 -54.80% BenchmarkChanCreation-4 6121.00 2628.00 -57.07% BenchmarkFinalizer 684.00 420.00 -38.60% BenchmarkFinalizer-2 11195.00 398.00 -96.44% BenchmarkFinalizer-4 15862.00 654.00 -95.88% BenchmarkFinalizerRun 2025.00 1397.00 -31.01% BenchmarkFinalizerRun-2 3920.00 1447.00 -63.09% BenchmarkFinalizerRun-4 9471.00 1545.00 -83.69% R=golang-dev, cw, rsc CC=golang-dev https://golang.org/cl/4963057
2011-03-02runtime: fix unused variable warningDave Cheney
R=rsc CC=golang-dev https://golang.org/cl/4188043
2011-02-16runtime: minor cleanupRuss Cox
implement runtime.casp on amd64. keep simultaneous panic messages separate. R=r CC=golang-dev https://golang.org/cl/4188053
2011-02-02runtime: faster allocator, garbage collectorRuss Cox
GC is still single-threaded. Multiple threads will happen in another CL. Garbage collection pauses are typically about half as long as they were before this CL. R=brainman, iant, r CC=golang-dev https://golang.org/cl/3975046
2010-11-04runtime: ,s/[a-zA-Z0-9_]+/runtime·&/g, almostRuss Cox
Prefix all external symbols in runtime by runtime·, to avoid conflicts with possible symbols of the same name in linked-in C libraries. The obvious conflicts are printf, malloc, and free, but hide everything to avoid future pain. The symbols left alone are: ** known to cgo ** _cgo_free _cgo_malloc libcgo_thread_start initcgo ncgocall ** known to linker ** _rt0_$GOARCH _rt0_$GOARCH_$GOOS text etext data end pclntab epclntab symtab esymtab ** known to C compiler ** _divv _modv _div64by32 etc (arch specific) Tested on darwin/386, darwin/amd64, linux/386, linux/amd64. Built (but not tested) for freebsd/386, freebsd/amd64, linux/arm, windows/386. R=r, PeterGo CC=golang-dev https://golang.org/cl/2899041
2010-04-09runtime: delete malx, skip_depth argument to mallocRuss Cox
remove internal functions from traces in gopprof instead. R=r CC=golang-dev https://golang.org/cl/855046
2010-03-26runtime: run all finalizers in a single goroutine.Russ Cox
eliminate second pass of mark+sweep by scanning finalizer table specially. R=r CC=golang-dev https://golang.org/cl/782041
2010-03-23runtime: add memory profiling, disabled.Russ Cox
no way to get the data out yet. add prototype for runtime.Callers, missing from last CL. R=r CC=golang-dev https://golang.org/cl/713041
2010-03-15runtime: lock finalizer table accessesRuss Cox
R=r CC=golang-dev https://golang.org/cl/462043
2010-02-10runtime: delete MHeapMapCache, which is uselessRuss Cox
because free needs to mark the block as freed to coordinate with the garbage collector. (in C++ free can blindly put the block on the free list, no questions asked, so the cache saves some work.) R=iant CC=golang-dev https://golang.org/cl/206069
2010-02-10runtime: garbage collection + malloc performanceRuss Cox
* add bit tracking finalizer status, avoiding getfinalizer lookup * add ability to allocate uncleared memory R=iant CC=golang-dev https://golang.org/cl/207044
2010-02-08runtime: allow arbitrary return type in SetFinalizer.Russ Cox
finalize chan, to free OS X semaphore inside Lock. os: finalize File, to close fd. Fixes #503. R=ken2 CC=golang-dev https://golang.org/cl/204065
2010-02-03finalizers; merge package malloc into package runtimeRuss Cox
R=r, cw CC=golang-dev https://golang.org/cl/198085