--
---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Just a question about the opaque identifiers for funcdata/pcdata. Are they going to be encoded sparsely or densely? In other words, if a function just hasFUNCDATA $0, $88FUNCDATA $9, $99Does that mean we'll use 10 slots in the funcdata table? Or does the table contain index/value pairs? I'm thinking of some use cases that are pretty sparse (for example, extra info at vararg call sites) and we might not want to keep lots of null entries for all the functions that don't have any information for that identifier.
Why is the function name a pointer to a Go string rather than simply aOn Wed, Jul 10, 2013 at 10:46 AM, Russ Cox <r...@golang.org> wrote:
> I started work on cleaning up the runtime symbol table so that it is less
> cumbersome and also more easily extensible to help with things like garbage
> collection metadata. Design at http://golang.org/s/go12symtab. CL in
> progress. Comments welcome here.
Go string?
There have been CLs for shared libraries. Let's support that clearly
here: the PC values should all be relative to the load address of the
module. The load address of a statically linked executable is 0.
Your doc implies a global table of all file names used in the program,
but doesn't spell out where that is found. Again let's make this
clear for shared libraries. It's a per-module table, and how does the
runtime find it?
You've got an npcdata field but no pcdata field. How does the runtime
find the pcdata tables? Actually I don't see why you need npcdata (or
pcdata). Since we are defining funcdata by convention, it seems that
it would suffice to say that funcdata $3 (say) is (by convention) a
pcdata table. That is, the value of funcdata $3 is the offset
(relative to the start of the Func structure) to a pcdata table. Then
it would be an error to use both FUNCDATA $3 and PCDATA $3.
You say that the runtime should do a binary search in a PC-value
table. But then you describe an encoding that stores PC deltas. I
don't understand how to do a binary search on a table stored using
deltas. For that matter, a binary search doesn't seem to help much
since the values are deltas also.
In order to do a binary search, the runtime needs to know the number
of entries in a table. Where is that stored? Or, if the runtime is
not in fact doing a binary search, how does it know where the end of
the table is, so that it can know that it should stop looking for a PC
value that is out of range?
I started work on cleaning up the runtime symbol table so that it is less cumbersome and also more easily extensible to help with things like garbage collection metadata. Design at http://golang.org/s/go12symtab. CL in progress. Comments welcome here.
it's using variable length encoding, so declaring it as intptr is aWhy the pc-value's value is int32? It's intended to be extensible and
clear win (int64 won't increase binary size but will slowdown ARM).
Why pcsp/pcfile/pcln are embed in Func and not using general pcdata?
However, it does not matter too much. name/entry can be funcdata as
well... but it's probably too general...
Wrt "The new table, being a C struct, is not as compact as the current
Plan 9 symtab encoding". Can you obtain sizes of different parts of
pc/sym info?
For GC we don't want to do any unpacking/allocation. But it is fine
for crash/race reporting, this is where func/file info is needed. If
we use "element index sequences" for func/file, we may not do any
unpacking/allocation, just dump all the parts to runtime.printf.
Go binaries are fat, so any reduction in size is welcome.
Can we make go tool nm/addr2line use this new format later?
Why do we need Func.pcfile? AFAIR currently we have single file for func.
Can we store inlining info in Func.pcdata later?
I also have some concerns about consequences on GC pause. The following change:
https://codereview.appspot.com/9406046/
on the following program:
http://play.golang.org/p/c6M1jwuO8h
changed GC pause from 55ms to 359ms:
before:
gc5(1): 48+0+7 ms, 12 -> 12 MB
after:
gc5(1): 243+0+116 ms, 12 -> 12 MB
Unwinding directly affects GC pause, and it can not be easily recovered.
Do you have any thoughts on how it can affect unwinding performance?
Can we make it faster?
Storing a Func at a known offset from the SP would eliminate the lookup from the non-leaves. It would not eliminate the lookup in the leaves, since a profiling signal might arrive before the frame was initialized, and so it would not eliminate the need for the table.
To find the frame boundaries you need pcsp table...
The pcsp table maps PC to delta-SP since the function entry. There are a few places in Go functions (notably in the implementation of go and defer statements) where it changes, but mostly it is either 0 or the frame size. If we eliminate the few cases that are not, then we could use the "0 or frame size" assumption more directly. We've been doing that already but it's wrong sometimes and now that the stack trace routines are pickier we're starting to see where those arise in practice.
To find the frame boundaries you need pcsp table...
each function will be increased by uintptr (including all assembly andThis may probably have some issues with nosplit functions. Frame of
nosplit functions), this can make some stack traces not fitting into
128 bytes. Not that it's unsolvable.
After these CLs, all that will remain for the transition is to move the Plan 9 symtab into unmapped memory, and then the footprint of a Go binary should actually be a little smaller than a few weeks ago.
Are there be changes to follow that provide an interface for and example of how to use the new funcdata operations?