aboutsummaryrefslogtreecommitdiffstats
path: root/HOWTO
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-09-22 10:40:06 +0200
committerBjörn Gustavsson <[email protected]>2015-09-28 10:26:39 +0200
commit105c5b0071056dc062797e58772e098d2a3a4627 (patch)
tree4fee14610caff25589ea27bad9b4fc37991681d0 /HOWTO
parent58a0c1c6c7efdb1f1250edec1b5fcd5eb72e99b9 (diff)
downloadotp-105c5b0071056dc062797e58772e098d2a3a4627.tar.gz
otp-105c5b0071056dc062797e58772e098d2a3a4627.tar.bz2
otp-105c5b0071056dc062797e58772e098d2a3a4627.zip
beam_dead: Improve optimization of literal binary matching
When the bit syntax is used to match a single binary literal, the bit syntax instructions will be replaced with a comparison to a binary literal. The only problem is that the bs_context_to_binary instruction will not be eliminated. Example: f(<<"string">>) -> ok. This function would be translated to: {function, f, 1, 2}. {label,1}. {line,...}. {func_info,...}. {label,2}. {test,is_eq_exact,{f,3},[{x,0},{literal,<<"string">>}]}. {move,{atom,ok},{x,0}}. return. {label,3}. {bs_context_to_binary,{x,0}}. {jump,{f,1}}. The bs_context_to_binary instruction serves no useful purpose, since {x,0} can never be a match context. Eliminating the instruction, the resulting code will be: {function, f, 1, 2}. {label,1}. {line,...}. {func_info,...}. {label,2}. {test,is_eq_exact,{f,1},[{x,0},{literal,<<"string">>}]}. {move,{atom,ok},{x,0}}. return.
Diffstat (limited to 'HOWTO')
0 files changed, 0 insertions, 0 deletions