aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/ld
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2013-05-28 17:59:10 -0700
committerCarl Shapiro <cshapiro@google.com>2013-05-28 17:59:10 -0700
commit4e0a51c210ededa82809756ca1cc72b1fb1def8d (patch)
tree73e39d7d22cc17088ea10bcd2bc0ce165b45ef0d /src/cmd/ld
parent8bbb08533dab0dcf627db0b76ba65c3fb9b1d682 (diff)
downloadgo-4e0a51c210ededa82809756ca1cc72b1fb1def8d.tar.xz
cmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and use bitmaps of argument pointer locations
With this change the compiler emits a bitmap for each function covering its stack frame arguments area. If an argument word is known to contain a pointer, a bit is set. The garbage collector reads this information when scanning the stack by frames and uses it to ignores locations known to not contain a pointer. R=golang-dev, bradfitz, daniel.morsing, dvyukov, khr, khr, iant, cshapiro CC=golang-dev https://golang.org/cl/9223046
Diffstat (limited to 'src/cmd/ld')
-rw-r--r--src/cmd/ld/lib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 0a6bd3e8f2..42448fe09f 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -1850,6 +1850,7 @@ genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*))
Auto *a;
Sym *s;
int32 off;
+ int32 i;
// These symbols won't show up in the first loop below because we
// skip STEXT symbols. Normal STEXT symbols are emitted by walking textp.
@@ -1910,13 +1911,18 @@ genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*))
put(s, s->name, 'T', s->value, s->size, s->version, s->gotype);
- /* frame, locals, args, auto and param after */
+ /* frame, locals, args, auto, param and pointers after */
put(nil, ".frame", 'm', (uint32)s->text->to.offset+PtrSize, 0, 0, 0);
put(nil, ".locals", 'm', s->locals, 0, 0, 0);
if(s->text->textflag & NOSPLIT)
put(nil, ".args", 'm', ArgsSizeUnknown, 0, 0, 0);
else
put(nil, ".args", 'm', s->args, 0, 0, 0);
+ if(s->nptrs >= 0) {
+ put(nil, ".nptrs", 'm', s->nptrs, 0, 0, 0);
+ for(i = 0; i < s->nptrs; i += 32)
+ put(nil, ".ptrs", 'm', s->ptrs[i / 32], 0, 0, 0);
+ }
for(a=s->autom; a; a=a->link) {
// Emit a or p according to actual offset, even if label is wrong.