简体   繁体   English

C ++函数名称demangling:这个名称后缀是什么意思?

[英]C++ function name demangling: What does this name suffix mean?

When I disassemble the Chromium binary I notice there are functions named in this pattern: _ZN6webrtc15DecoderDatabase11DecoderInfoD2Ev.part.1 当我反汇编Chromium二进制文件时,我注意到有这种模式中命名的函数: _ZN6webrtc15DecoderDatabase11DecoderInfoD2Ev.part.1

If I give this string to c++filt, the output is webrtc::DecoderDatabase::DecoderInfo::~DecoderInfo() [clone .part.1] 如果我将此字符串赋予c ++ filt,则输出为webrtc::DecoderDatabase::DecoderInfo::~DecoderInfo() [clone .part.1]

So what does this .part.1 suffix really mean? 那么.part.1后缀究竟是什么意思呢? If it indicates there are multiple copies of the same function, why do they need that? 如果它表明有相同功能的多个副本,为什么需要它? Is it due to the requirement of being position independent? 是否由于要求与职位无关? I used g++ as the compiler. 我使用g ++作为编译器。

It indicates that destructor was the target of a partial inlining optimization by GCC. 它表明析构函数是GCC 部分内联优化的目标。 With this optimization the function is only partially inlined into another function, the remainder gets emitted into its own partial function. 通过这种优化,该函数仅部分内联到另一个函数中,其余函数被发送到它自己的部分函数中。 Since this new partial function doesn't implement the complete function it's given a different name, so it can exist beside a definition of the complete function if necessary. 由于这个新的部分函数没有实现完整的函数,因此它给出了一个不同的名称,因此如果需要它可以存在于完整函数的定义旁边。

So for example it appears that DecoderDatabase::DecoderInfo::~DecoderInfo is defined like this: 例如,似乎DecoderDatabase :: DecoderInfo :: ~DecoderInfo的定义如下:

DecoderDatabase::DecoderInfo::~DecoderInfo() {
    if (!external) delete decoder;
}

My guess is that delete decoder invokes a long series of operations, too long to be inlined into another function. 我的猜测是delete decoder调用很长的一系列操作,这些操作太长而无法内联到另一个函数中。 The optimizer would accordingly split those operations into a partial function. 优化器会相应地将这些操作拆分为部分函数。 It would then only inline the if (!external) part of the function into other functions. 然后它只会将函数的if (!external)部分内联到其他函数中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM