这个名称后缀是什么意思

这个名称后缀是什么意思

本文介绍了C ++函数名称解析:这个名称后缀是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我拆解Chromium二进制文件时,我注意到有这个模式命名的函数:
_ZN6webrtc15DecoderDatabase11DecoderInfoD2Ev.part.1

When I disassemble the Chromium binary I notice there are functions named in this pattern:_ZN6webrtc15DecoderDatabase11DecoderInfoD2Ev.part.1

如果我给这个字符串c ++ filt,输出是
webrtc :: DecoderDatabase :: DecoderInfo ::〜DecoderInfo()[clone.part.1]

If I give this string to c++filt, the output iswebrtc::DecoderDatabase::DecoderInfo::~DecoderInfo() [clone .part.1]

这个.part.1后缀是什么意思?如果它指示有相同功能的多个副本,他们为什么需要它?是因为需要独立于位置吗?我使用g ++作为编译器。

So what does this .part.1 suffix really mean? 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.

推荐答案

它表示析构函数是。通过这种优化,函数仅部分内联到另一个函数中,剩余部分被发射到其自身的部分函数中。因为这个新的部分函数没有实现完整的函数,它给了一个不同的名字,所以如果必要,它可以存在于完整函数的定义之外。

It indicates that destructor was the target of a partial inlining optimization by 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.

看起来像是定义如下:

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

我的猜测是删除解码器调用一系列长时间的操作,以便内联到另一个函数中。优化器将相应地将这些操作拆分为部分函数。然后它只会将 if(!external)部分内嵌到其他函数中。

My guess is that delete decoder invokes a long series of operations, too long to be inlined into another function. 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.

这篇关于C ++函数名称解析:这个名称后缀是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 21:25