This should avoid an unnecessary round-trip to the allocator in what I believe to be a very common case.
The way I see this being implemented is:
- Two new superinstructions:
BUILD_TUPLE__RETURN_VALUE and CALL__UNPACK_SEQUENCE
CALL__UNPACK_SEQUENCE sets a flag in the call frame
BUILD_TUPLE__RETURN_VALUE sees if the flag is set:
- If it's set, then it'll return from the function, leaving the stack in the way that
UNPACK_SEQUENCE would have left it
- If it's not set, would behave like the individual instructions
Thoughts on this?