This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
use a volatile pointer to call slp_switch #183
Closed
Description
If the internal stack transfer function slp_switch()
is implemented using gcc/clang inline assembly, the inline assembly depends on the register allocation rules defined in the ABI-specification of the respective platform. Now if compiler inlines the function, the register allocation rules no longer apply and the behaviour is undefined.
Experiments show that the only reliable way to prevent inlining is to call slp_switch()
using a volatile pointer. Here is the patch.
This has the additional advantage that slp_switch()
now can be declared static, which reduces namespace pollution.