Date: Sun, 18 May 2025 20:45:52 +0100
On Sun, May 18, 2025 at 8:41 PM Jeremy Rifkin wrote:
>
> > well on x86_64 when a member function is invoked, the
> 'this' pointer is placed in the RDI
>
> By the time std::recurse is called it could be anywhere (or nowhere).
Put the embedded assembler at the very beginning of the lambda before
anything might alter the value of RDI.
> Keep in mind lambdas operator()'s might be static, too, and normal functions won't have `this` pointers.
Actually as Pavel said earlier in this thread, you can just have an
'explicit this' parameter to the lambda.
>
> > well on x86_64 when a member function is invoked, the
> 'this' pointer is placed in the RDI
>
> By the time std::recurse is called it could be anywhere (or nowhere).
Put the embedded assembler at the very beginning of the lambda before
anything might alter the value of RDI.
> Keep in mind lambdas operator()'s might be static, too, and normal functions won't have `this` pointers.
Actually as Pavel said earlier in this thread, you can just have an
'explicit this' parameter to the lambda.
Received on 2025-05-18 19:45:49