Skip to content

[FUNCTION_RESOLVER] Return value optimization/Copy Elision not compatible with resolver approach #190

Description

@TheRedDaemon

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions