标题:哈希表实现的hashmap,支持扩容减容,坛友帮忙测测
只看楼主
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
optimize, what optimize? opcode alignment? register reuse? is all that worth?
becasuse of a stupid compiler tiny architecture, the undefined behavior being a classic reason
thinking in brain, first in first processing, last in last processing, make sense.
2021-09-01 09:03
xyzdwf
Rank: 2
等 级:论坛游民
威 望:1
帖 子:52
专家分:10
注 册:2017-1-9
得分:0 
回复 8楼 rjsp
还和编译优化有关,我的天,看样子还是直接传参要比执行函数靠谱,毕竟能提前控制哪个先执行,谢了,大哥
2021-09-01 11:16
xyzdwf
Rank: 2
等 级:论坛游民
威 望:1
帖 子:52
专家分:10
注 册:2017-1-9
得分:0 
回复 9楼 自由而无用
是不是说我们编写c代码不能依赖这个函数参数的执行顺序,否则就有可能掉入c陷阱中,比如我们可以先执行好函数,把结果传进去

Does that mean that we can't write c code depending on the order in which this function parameter is executed, otherwise we might fall into the c trap, for example, we can execute the function first and pass the results in
2021-09-01 11:28
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
func(S1, S2, S3, S4)
OFFSET  FR2L          FL2R              PIPELINE(R2L)         PIPELINE(L2R)    PIPELINE(OOE)OPTIMIZED 2^(p)
+0x10   S4            S1                S4                    S1               ?S3?S2?...
+0x0C   S3            S2                S3                    S2               ?S2?S4?...
+0x08   S2            S3                S2                    S3               ?S1?S1?...
+0x04   S1            S4                S1                    S4               ?S4?S3?...
ebp/esp


[此贴子已经被作者于2021-9-1 12:54编辑过]

2021-09-01 11:39
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
回复 13楼 xyzdwf
cpu: king
cpu feature: out-of-order execution
compiler: solider
compiler skill: find a way to match cpu feature

gild the lily

resolution: bypass compiler, block the ambiguity code and write asm code instead.

[此贴子已经被作者于2021-9-1 13:03编辑过]

2021-09-01 12:50
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
//online parser: https://www.bccn.net/run/
程序代码:
#include <stdio.h>

#define Force_Sequence volatile

int main(int argc, char *argv[])
{
    Force_Sequence int i = 5;
    int j = 5;
    
    printf("[Sequenced FR2L]\n%d %d %d %d %d\n", i++, i--, ++i, --i, i);
    printf("[non-Sequenced FR2L]\n%d %d %d %d %d", j++, j--, ++j, --j, j);
    
    return 0;
}


[Sequenced FR2L]
4 5 5 4 5
[non-Sequenced FR2L]
4 5 5 5 5
2021-09-01 13:58
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
https://gcc.

GCC 3.0 -> GCC 11.2 how many optimized bugs fixed? why fixed? why not declared as undefined behavior?
from pg viewer, standard undefined behavior is just an excuse, its just a bug, historical issue.
someone like it, someone dislike it, so bullshit standard.
2021-09-01 14:51
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
sorry, not standard bullshit, someone likes to show the bullshit standard, the way of bullshit
2021-09-01 15:04
xyzdwf
Rank: 2
等 级:论坛游民
威 望:1
帖 子:52
专家分:10
注 册:2017-1-9
得分:0 
回复 16楼 自由而无用
看不出结果怎么算出来的,毫无道理
It makes no sense not to see how the results are calculated
2021-09-01 16:32
自由而无用
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:14
帖 子:61
专家分:1456
注 册:2021-8-9
得分:0 
回复 19楼 xyzdwf
thats why optimized is a bug
2021-09-01 17:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506714-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.360549 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved