[Continuation] Fix setJmp() by adding 'rax' to clobber list
The previously used 'membar' macro does not have 'rax' in its clobber list. As result, a compiler may not reload the contents of 'rax' after the setJmp() call and instead 'cache' eax's value. However, 'rax' is used to pass the jump's value once we perfrom a long jump. Therefore, it should be part of the clobber list of setJmp(). In fact, GCC 14 started to perform an optimization in this case, causing Fibril synchronization to fail, as the passed fibrilResumeValue became 0. Compare the following code of ContextManager::start() GCC 13: 3f40d: e8 2e e8 fd ff call 1dc40 <Continuation::setJmp()::{lambda(Continuation*)#1}::operator()(Continuation*) const@plt> 3f412: 89 44 24 04 mov %eax,0x4(%rsp) 3f416: 48 98 cltq 3f418: 48 89 44 24 08 mov %rax,0x8(%rsp) 3f41d: 90 nop GCC 14: 3f8ea: e8 81 e2 fd ff call 1db70 <Continuation::setJmp()::{lambda(Continuation*)#1}::operator()(Continuation*) const@plt> 3f8ef: 90 nop As we can see, GCC 14 does not (re-)load eax back to its stack position after the setJmp().
parent
7c859457
No related branches found
No related tags found