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. T-SQL简单查询语句(模糊查询)

    T-SQL简单查询语句 简单查询: 1.最简单查询(查所有数据) select * from 表名: 注:* 代表所有列 select * from info 2.查询指定列 select code, ...

  2. 【BZOJ2626】JZPFAR kd-tree+堆

    [BZOJ2626]JZPFAR Description 平面上有n个点.现在有m次询问,每次给定一个点(px, py)和一个整数k,输出n个点中离(px, py)的距离第k大的点的标号.如果有两个( ...

  3. js闭包实际用途

    闭包例:防止双击 在线商店的购物车里,为防止“多重购买”,需要防止按钮被双击. 下面用“jQuery + 闭包”来实现这一功能. HTML <form name="frm" ...

  4. 线程(while 和 if 剖析)

    那存钱取钱为例: 要求实现一次存一次取的操作 不可出现连续存或连续取: 如果只有存钱和取钱各自只有一个线程在操作使用 if 的话可以满足要求: package com.thread; /** * 模拟 ...

  5. js 获取地理位置经纬度

    1. 加载百度API的核心js,ak表示获取百度地图的开发密钥,免费的需要申请下 <script type="text/javascript" src="http: ...

  6. 在java项目中使用protobuf

    1 通用方式 第一步,定义数据结构 第二步,使用protoc.exe生成java代码 第三步,序列化 第四步,反序列化 2 grpc方式 grpc官方推荐的方式,通过maven插件来生成java代码. ...

  7. special points about git

    1 about "origin/master tracks the remote branch" 1.1 what does tracking mean? after " ...

  8. 【题解】CJOI2019 登峰造鸡境 (Prufer序列+斯特林数)

    [题解]CJOI2019 登峰造鸡境 (Prufer序列+斯特林数) 题目背景 舒服了. 题目描述 你有一颗n个点的无根树,每个点有有一个标号(1~n). 现在你知道,总共有m个叶子节点,求不同的树的 ...

  9. Android进程的生命周期

    Android系统想要永久的保留一个应用进程差点儿是不可能的.所以系统就须要不断的释放老的或者不太重要的进程以便腾出足够的内存空间来执行新的或者更重要的进程,那么系统怎样决定哪个进程应该保留哪个应该杀 ...

  10. 线程池ThreadPoolExcecutor介绍

    线程池ThreadPoolExecutor 使用Executors和ThreadPoolExecutor 并发新特性—Executor 框架与线程池