aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-11-26 12:15:25 +0100
committerBjörn Gustavsson <[email protected]>2012-11-26 12:15:25 +0100
commit4b01f5b318a866fc5fb9392ddadd1fa54f862692 (patch)
tree22d16c35dac6b4d6c57411afa9528c8b85872c54 /lib/compiler/src
parent871a67b5f2696cca6124e85a9b3ad9355a041ba6 (diff)
downloadotp-4b01f5b318a866fc5fb9392ddadd1fa54f862692.tar.gz
otp-4b01f5b318a866fc5fb9392ddadd1fa54f862692.tar.bz2
otp-4b01f5b318a866fc5fb9392ddadd1fa54f862692.zip
beam_bsm: Make the optimization applicable in more circumstances
When determining whether the delayed creation of sub-binaries optimizations is applicable, this module some tests whether the register containg the match state is killed. That is actually a stronger condition than necessary; since the register is initialized, it suffices to test whether the register is unused.
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/beam_bsm.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/compiler/src/beam_bsm.erl b/lib/compiler/src/beam_bsm.erl
index 37053e1cc4..c9c5b59bf2 100644
--- a/lib/compiler/src/beam_bsm.erl
+++ b/lib/compiler/src/beam_bsm.erl
@@ -287,11 +287,11 @@ btb_reaches_match_2([{bs_restore2,Src,_}=I|Is], Regs0, D) ->
btb_reaches_match_1(Is, Regs0, D);
true ->
%% Check that all other copies of the context registers
- %% are killed by the following instructions.
+ %% are unused by the following instructions.
Regs = btb_kill([Src], Regs0),
CtxRegs = btb_context_regs(Regs),
- case btb_are_all_killed(CtxRegs, Is, D) of
- false -> btb_error({CtxRegs,not_all_killed_after,I});
+ case btb_are_all_unused(CtxRegs, Is, D) of
+ false -> btb_error({CtxRegs,not_all_unused_after,I});
true -> D#btb{must_not_save=true}
end
end;
@@ -301,11 +301,11 @@ btb_reaches_match_2([{bs_context_to_binary,Src}=I|Is], Regs0, D) ->
btb_reaches_match_1(Is, Regs0, D);
true ->
%% Check that all other copies of the context registers
- %% are killed by the following instructions.
+ %% are unused by the following instructions.
Regs = btb_kill([Src], Regs0),
CtxRegs = btb_context_regs(Regs),
- case btb_are_all_killed(CtxRegs, Is, D) of
- false -> btb_error({CtxRegs,not_all_killed_after,I});
+ case btb_are_all_unused(CtxRegs, Is, D) of
+ false -> btb_error({CtxRegs,not_all_unused_after,I});
true -> D#btb{must_not_save=true}
end
end;
@@ -343,7 +343,7 @@ btb_call(Arity, Lbl, Regs0, Is, D0) ->
%% tucked away in a y register.
RegList = btb_context_regs(Regs),
YRegs = [R || {y,_}=R <- RegList],
- case btb_are_all_killed(YRegs, Is, D) of
+ case btb_are_all_unused(YRegs, Is, D) of
true -> D;
false -> btb_error({multiple_uses,RegList})
end;
@@ -426,11 +426,11 @@ btb_reaches_match_block([], Regs) ->
Regs.
%% btb_are_all_killed([Register], [Instruction], D) -> true|false
-%% Test whether all of the register are killed in the instruction stream.
+%% Test whether all of the register are unused in the instruction stream.
-btb_are_all_killed(RegList, Is, #btb{index=Li}) ->
+btb_are_all_unused(RegList, Is, #btb{index=Li}) ->
all(fun(R) ->
- beam_utils:is_killed(R, Is, Li)
+ beam_utils:is_not_used(R, Is, Li)
end, RegList).
%% btp_regs_from_list([Register]) -> RegisterSet.