[erlang-questions] Tuple values returned in registers, without using heap space?

Robert Virding rvirding@REDACTED
Mon Oct 19 17:06:33 CEST 2009

2009/10/19 James Hague <james.hague@REDACTED>

> I *thought* I remember reading about this in the release notes at one time,
> but I haven't been able to track it down. The gist was that if it could be
> determined that a non-exported function always returned a tuple of a fixed
> size, then those values were returned directly in BEAM registers without
> actually creating a tuple.
> Any pointers?

Yes, this could be done in the compiler, the basic mechanisms are there but
it is not done today. Except *within* functions when it is safe. To do so
between non-exported functions in a module would be possible but require
more analysis. Apart from checking that a function always returned a tuple
of fixed size you would need to analyze the calls to such that function and
fix the handling of the return tuple values. Not impossible of course but
not done.


More information about the erlang-questions mailing list