我发现 M2 MBA 开 Telegram 会议,对方分享了屏幕,这时候我切到别的 App 滚动屏幕(比如浏览网页)会有拖影和掉帧,但此时 CPU/GPU 占用并不高,难以理解。
ksco 的工作日志
啊我终于修好了所有已知的 bug,现在又撞到 ASSERT_NOT_IMPLEMENTED 了
怎么回事,半个月没做,刚刚怎么复现不了这条日志了
ksco 的工作日志
怎么回事,半个月没做,刚刚怎么复现不了这条日志了
具体的问题是在一个奇怪的地方 assert 失败了,debug 发现竟然是 build system 的问题,我就觉得事有蹊跷。
现在猜测大概问题是因为 ccache 和 cmake 没有配合好(?)。加上现在某个 python 生成的 C header 文件中的枚举值不太 reproducible,导致不同的 compile unit #include 了不同版本的头文件(?)。都是猜测, dr 的 build system 过于复杂,先不 debug 了,重新编译后暂时正常了。
现在猜测大概问题是因为 ccache 和 cmake 没有配合好(?)。加上现在某个 python 生成的 C header 文件中的枚举值不太 reproducible,导致不同的 compile unit #include 了不同版本的头文件(?)。都是猜测, dr 的 build system 过于复杂,先不 debug 了,重新编译后暂时正常了。
继续运行 libc 程序,遇到了这样一条指令:
spill state 中有 5 个槽位:
1. 找一个 scratch reg,要求是 scratch reg 不能出现在被 mangle 的指令中。
2. 把 scratch reg 的值存到 spill state a0 slot。
3. 把 tp 的值放到 scratch reg。
4. 通过 scratch reg 把 spill state 中的 tp slot 取出来放到 tp。此时 tp 中的值由 spill state address 变成了 app tls。
5. 运行 mv tp,s0。
6. 通过 scratch reg 把 tp 保存回 spill state tp slot。
7. 把 scratch reg 的值 mv 到 tp。此时 tp 的值变回了 spill state address。
8. 通过 tp 把 spill state a0 slot 加载到 scratch reg 恢复它的值。
> 可见如果 tp 只是 rd 的话,第 4 步是不需要的;如果 tp 只是 rs 的话,第 6 步是不需要的,但这个后面再优化吧
mv tp,s0 。因为使用了 tp,所以需要 mangle 这条指令:当前 tp 指向 spill state,而要正确运行的话,应该让 tp 指向 app tls,运行完这条指令后,再把 tp 指回 spill state。spill state 中有 5 个槽位:
a0, a1, a2, a3, tp ,我们会用到 a0 slot 和 tp slot,其中 tp slot 放的是 app tls。1. 找一个 scratch reg,要求是 scratch reg 不能出现在被 mangle 的指令中。
2. 把 scratch reg 的值存到 spill state a0 slot。
3. 把 tp 的值放到 scratch reg。
4. 通过 scratch reg 把 spill state 中的 tp slot 取出来放到 tp。此时 tp 中的值由 spill state address 变成了 app tls。
5. 运行 mv tp,s0。
6. 通过 scratch reg 把 tp 保存回 spill state tp slot。
7. 把 scratch reg 的值 mv 到 tp。此时 tp 的值变回了 spill state address。
8. 通过 tp 把 spill state a0 slot 加载到 scratch reg 恢复它的值。
> 可见如果 tp 只是 rd 的话,第 4 步是不需要的;如果 tp 只是 rs 的话,第 6 步是不需要的,但这个后面再优化吧