The case was found handling the DocumentPath functions (which return std::string) in the ResourceManager.
Functions that use Return Value Optimization receive their proper call convention (hidden additional stack ptr to receive the object), but their return object can not be ellided, even if the function is active.
This results in an additional receiver object on the stack.
Only using the member function directly worked in my cases.
It is likely that solving this might be impossible:
The compiler is restricted in its optimization. Any kind of indirection does not optimize the return value, only a direct function call does.
Additionally, making the logic of RVO explicit (receiving a string/mem, returning the ptr to it also) does not work either.
At the moment, I have no idea if this could be resolved in any way. The issue functions as a reminder.
The case was found handling the
DocumentPathfunctions (which returnstd::string) in theResourceManager.Functions that use Return Value Optimization receive their proper call convention (hidden additional stack ptr to receive the object), but their return object can not be ellided, even if the function is active.
This results in an additional receiver object on the stack.
Only using the member function directly worked in my cases.
It is likely that solving this might be impossible:
The compiler is restricted in its optimization. Any kind of indirection does not optimize the return value, only a direct function call does.
Additionally, making the logic of RVO explicit (receiving a string/mem, returning the ptr to it also) does not work either.
At the moment, I have no idea if this could be resolved in any way. The issue functions as a reminder.