aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-08-09 10:38:07 +0200
committerBjörn Gustavsson <[email protected]>2012-10-09 09:38:19 +0200
commitc3b60f86c622ba6978564aa059d4d881b9549936 (patch)
treea447301e438f92ba9fa9ea640e821da9c8091cb8 /lib/compiler/test
parent65dd6a4e10c5e1fed90d9a859454b1bf0040dc2c (diff)
downloadotp-c3b60f86c622ba6978564aa059d4d881b9549936.tar.gz
otp-c3b60f86c622ba6978564aa059d4d881b9549936.tar.bz2
otp-c3b60f86c622ba6978564aa059d4d881b9549936.zip
beam_utils: Extend live_opt/1 to recalculate live registers in allocs
The code generator uses conservative liveness information. Therefore the number of live registers in allocation instructions (such as test_heap/2) may be too high. Use the actual liveness information to lower the number of live register if it's too high. The main reason we want to do this is to enable more optimizations that depend on liveness analysis, such as the beam_bool and beam_dead passes.
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/bs_construct_SUITE.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl
index 9ab76449c7..a393aaeffd 100644
--- a/lib/compiler/test/bs_construct_SUITE.erl
+++ b/lib/compiler/test/bs_construct_SUITE.erl
@@ -360,6 +360,11 @@ in_catch(Config) when is_list(Config) ->
?line <<255>> = small(255, <<1,2,3,4,5,6,7,8,9>>),
?line <<1,2>> = small(<<7,8,9,10>>, 258),
?line <<>> = small(<<1,2,3,4,5>>, <<7,8,9,10>>),
+
+ <<15,240,0,42>> = small2(255, 42),
+ <<7:20>> = small2(<<1,2,3>>, 7),
+ <<300:12>> = small2(300, <<1,2,3>>),
+ <<>> = small2(<<1>>, <<2>>),
ok.
small(A, B) ->
@@ -381,6 +386,25 @@ small(A, B) ->
end,
<<ResA/binary,ResB/binary>>.
+small2(A, B) ->
+ case begin
+ case catch <<A:12>> of
+ {'EXIT',_} -> <<>>;
+ ResA0 -> ResA0
+ end
+ end of
+ ResA -> ok
+ end,
+ case begin
+ case catch <<B:20>> of
+ {'EXIT',_} -> <<>>;
+ ResB0 -> ResB0
+ end
+ end of
+ ResB -> ok
+ end,
+ <<ResA/binary-unit:1,ResB/binary-unit:1>>.
+
nasty_literals(Config) when is_list(Config) ->
case erlang:system_info(endian) of
big ->