相关疑难解决方法(0)

Why does Windows64 use a different calling convention from all other OSes on x86-64?

AMD has an ABI specification that describes the calling convention to use on x86-64. All OSes follow it, except for Windows which has it's own x86-64 calling convention. Why?

Does anyone know the technical, historical, or political reasons for this difference, or is it purely a matter of NIHsyndrome?

I understand that different OSes may have different needs for higher level things, but that doesn't explain why for example the register parameter passing order on Windows is rcx - rdx …

windows x86-64 calling-convention

97
推荐指数
4
解决办法
2万
查看次数

为什么fastcall比stdcall慢?

我发现了以下问题:fastcall真的更快吗?

没有给出x86的明确答案所以我决定创建基准.

这是代码:

#include <time.h>

int __fastcall func(int i)
{   
    return i + 5;
}

int _stdcall func2(int i)
{   
    return i + 5;
}

int _tmain(int argc, _TCHAR* argv[])
{
    int iter = 100;
    int x = 0;
    clock_t t = clock();
    for (int j = 0; j <= iter;j++)
        for (int i = 0; i <= 1000000;i++)
            x = func(x & 0xFF);
    printf("%d\n", clock() - t);
    t = clock();
    for (int j = 0; j <= iter;j++) …
Run Code Online (Sandbox Code Playgroud)

c++ optimization

23
推荐指数
4
解决办法
1万
查看次数

"存储缓冲区转发"在英特尔开发人员手册中的含义是什么?

英特尔64和IA-32架构软件开发人员手册说,大约由单一处理器的行动("在P6更多最近的处理器系列内存排序和"第8.2.2节)重新排序如下:

读取可以使用较旧的写入到不同位置进行重新排序,但不能使用较旧的写入到同一位置.

接下来讨论与早期处理器相比放松的点时,它说:

存储缓冲区转发,当读取将写入传递到同一存储器位置时.

据我所知,"存储缓冲区转发"并未在任何地方精确定义(也不是"通过").读取将写入传递到同一位置是什么意思,因为上面说它不能通过写入同一位置来重新排序?

concurrency assembly intel cpu-architecture memory-model

12
推荐指数
2
解决办法
1965
查看次数

我为什么不使用__fastcall而不是标准__cdecl?

我会听一些人说__fastcall比这更快__cdecl并且__stdcall导致它将两个参数放入寄存器,而不是其他一个调用; 但是,另一方面,这不是C中使用的标准.

我想知道什么是__fastcall不合适的,就像C中的标准,以及何时我将在我的代码中使用它.

c c++ function-calls cdecl fastcall

10
推荐指数
1
解决办法
3588
查看次数

visual c中使用的fastcall关键字是什么?

fastcall在许多函数之前看过附加的符号.为什么用它?

calling-convention visual-c++ fastcall

8
推荐指数
1
解决办法
2966
查看次数

c#中的__fastcall约定

考虑到:

微软特定

__fastcall调用约定指定函数的参数尽可能在寄存器中传递.以下列表显示了此调用约定的实现.

并且寄存器中的读/写时间比堆栈中的更快,我们在C#中是否有任何__fastcall等价物?

c# c++ calling-convention

4
推荐指数
1
解决办法
1611
查看次数