gpt4 book ai didi

go - Go汇编中PCDATA是什么意思

转载 作者:行者123 更新时间:2023-12-04 11:32:11 26 4
gpt4 key购买 nike

我正在使用以下命令将 golang 代码编译为程序集:

go build -gcflags -S .

在汇编代码中,我说了很多行,例如:
PCDATA  $2, $1

这是什么意思?在 quick guide to asm它指出

The FUNCDATA and PCDATA directives contain information for use by the garbage collector; they are introduced by the compile



但没有很多细节

最佳答案

正如您在回答中所述,A Quick Guide to Go's Assembler状态:

The FUNCDATA and PCDATA directives contain information for use by the garbage collector; they are introduced by the compiler.


Russ Cox 的文章 "Go 1.2 Runtime Symbol Information"状态:

Similarly, the pseudo-instruction

PCDATA $3, $45

declares that the value with index 3 associated with the current program counter is 45. Each of the pcdata indexes (PCDATA $1, PCDATA $2, and so on) encodes to a separate pc-value table. Just as with funcdata, the index allows the definition of multiple kinds of pcdata for a given function, and there will be a registry for those indexes too.

At run time, the runtime can, from a Func, retrieve the funcdata with a given index or the pcdata with a given index at a given program counter. A pcdata stream may produce an int32 interpreted by reference to corresponding data retrieved as a funcdata pointer.

The struct Func is followed immediately in memory by npcdata int32s giving the offsets to the pcdata tables; if nfuncdata > 0, the npcdata int32s are followed immediately by a possible int32 gap for alignment and then nfuncdata uintptrs giving the funcdata values. If pcsp, pcfile, pcln, or any of the pcdata offsets is zero, that table is considered missing, and all PCs take value -1.

关于go - Go汇编中PCDATA是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53436811/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com