https://lwn.net/Articles/691932/

https://gcc.gnu.org/wiki/FunctionMultiVersioning

why multi-versioning

This aim of this project is to make it really easy for the developer to specify multiple versions of a function, each catered to a specific target ISA feature. GCC then takes care of creating the dispatching code necessary to execute the right function version.

how this is implemented

When the front-end sees a call (pointer) to a function version, it generates a new dispatcher function decl and replaces the existing call (pointer) to be a call (pointer) to the dispatcher function. The body of the dispatcher function is later generated when building the call graph. The dispatcher function has the logic to determine the right function version at runtime. At run-time, calling the function version, either directly or indirectly, will invoke the dispatcher logic which will execute the right function version.

dispatcher function body

  1. at runtime, use CPU check built-ins to check CPU capability;
  2. IFUNC mechanism so the look up is only needed once.
    IFUNC mechanism reuses existing support from compiler/linker as well as the dynamic linker at runtime. Although we can create a custom version of such indirection, like a function pointer initialized at runtime by checking CPU capabilities.

function multi-versioning in GCC的更多相关文章

  1. GCC的编译和安装 很好的资料

    http://blog.csdn.net/yrj/article/details/492404 1.GCC的编译和安装2.预处理    #define 可以支持不定数量的参数.    例子如下:    ...

  2. DiscuzX /source/function/function_core.php通用核心函数库文件分析

    ... <?php /** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to l ...

  3. C++ Standards Support in GCC - GCC 对 C++ 标准的支持

    C++ Standards Support in GCC - 2019-2-20 GCC supports different dialects of C++, corresponding to th ...

  4. gcc __attribute__关键字举例之visibility【转】

    转自:https://blog.csdn.net/starstarstone/article/details/7493144?utm_source=tuicool&utm_medium=ref ...

  5. GCC生成动态库

    main.c #include <stdio.h> void hello(void); int main(int argc, char ** argv) { printf("Th ...

  6. GCC提供的几个內建函数

    参考 https://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Other-Builtins.html#Other-Builtins https://en.wikipe ...

  7. 〖C语言〗C语言一个函数传递无限制多参数(不确定参数函数)的方法

    /* * ===================================================================================== * * Filen ...

  8. kbuild-(directory)

    -INDEX - this file: info on the kernel build process kbuild.txt - developer information on kbuild kc ...

  9. 玩转JavaScript OOP[4]——实现继承的12种套路

    概述 在之前的文章中,我们借助构造函数实现了"类",然后结合原型对象实现了"继承",并了解了JavaScript中原型链的概念. 理解这些内容,有助于我们更深入 ...

  10. Laravel 数据库读写分离

    config/database.php ... 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localho ...

随机推荐

  1. iOS中对于多个按钮,选中其中一个,其他按钮选中状态为NO

      第一,定义一个全局的按钮变量 /** *  按钮选中,中间值 */ @property (nonatomic,strong) UIButton *selectedBtn; 第二,添加多个按钮到sc ...

  2. Django的标准库django.contrib包介绍(转)

    Django.contrib是啥? 1.它是一个强大的功能包,是Django的标准库.2.Django的标准库存放在 django.contrib 包中.每个子包都是一个独立的附加功能包. 这些子包一 ...

  3. 九度OJ 1036:Old Bill (老比尔) (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2691 解决:1432 题目描述: Among grandfather's papers a bill was found.     72 ...

  4. A good example is a User-Agent switcher which changes User-Agent on every request:

    Configuration | Colly http://go-colly.org/docs/introduction/configuration/

  5. 360手机助手: App上架(提交资料)注意事项

    提交app资料尤其注意: .keystore和密码?由HBuilder提供公有证书: 签名证书KeyStore证书别名:hbuilder证书密码:123456keystore密码:123456 360 ...

  6. Hadoop实战-Flume之Source multiplexing(十五)

    a1.sources = r1 a1.sinks = k1 k2 a1.channels = c1 c2 # Describe/configure the source a1.sources.r1.t ...

  7. subline 的常用命令

    zsh 配置 编辑zsh 命令 vim .zshrc alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/b ...

  8. CodeIgniter底层数据库类继承关系

    1.CI_DB_mysql_driver 继承 CI_DB,  CI_DB这个类是不存在的,每次调用文件中~/CodeIgniter_2.1.3/system/database/DB.php函数&am ...

  9. weblogic开启远程访问的jmx设置

    通过jmx远程访问weblogic获取监控jvm的数据,要在weblogic启动的时候设置一些配置,具体如下: 在weblogic的安装目录:{weblogic_home}/wlserver_10.3 ...

  10. Object.create用法

    用法: Object.create(object, [,propertiesObject]) 创建一个新对象,继承object的属性,可添加propertiesObject添加属性,并对属性作出详细解 ...