diff options
author | Björn Gustavsson <[email protected]> | 2018-11-18 06:21:18 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-11-19 16:12:13 +0100 |
commit | b4595a670b159c802489d94d8537a48567967927 (patch) | |
tree | 3341a3576316d4085cd3d271c43291e5157948ed /lib | |
parent | 667e0e1213f69344a57c2eb0427d36cd240e16a5 (diff) | |
download | otp-b4595a670b159c802489d94d8537a48567967927.tar.gz otp-b4595a670b159c802489d94d8537a48567967927.tar.bz2 otp-b4595a670b159c802489d94d8537a48567967927.zip |
beam_ssa_pre_codegen: Improve reuse of Y registers
Enhance the copy_retval/1 optimization to allow Y registers to be
reused in more circumstances. Reusing Y register can often reduce
the size of the stack frame.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_ssa_pre_codegen.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_ssa_pre_codegen.erl b/lib/compiler/src/beam_ssa_pre_codegen.erl index c60c6da9ea..32232e9b9f 100644 --- a/lib/compiler/src/beam_ssa_pre_codegen.erl +++ b/lib/compiler/src/beam_ssa_pre_codegen.erl @@ -1478,6 +1478,10 @@ copy_retval_is([#b_set{op=put_tuple_elements,args=Args0}=I0], false, _Yregs, Copy, Count, Acc) -> I = I0#b_set{args=copy_sub_args(Args0, Copy)}, {reverse(Acc, [I|acc_copy([], Copy)]),Count}; +copy_retval_is([#b_set{op=Op}=I0], false, Yregs, Copy, Count0, Acc0) + when Op =:= call; Op =:= make_fun -> + {I,Count,Acc} = place_retval_copy(I0, Yregs, Copy, Count0, Acc0), + {reverse(Acc, [I]),Count}; copy_retval_is([#b_set{}]=Is, false, _Yregs, Copy, Count, Acc) -> {reverse(Acc, acc_copy(Is, Copy)),Count}; copy_retval_is([#b_set{},#b_set{op=succeeded}]=Is, false, _Yregs, Copy, Count, Acc) -> |