aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-07 12:43:06 +0200
committerBjörn Gustavsson <[email protected]>2016-04-08 10:28:42 +0200
commitab03678e87732407625150c202e177a85a025beb (patch)
tree881f543c0f7ca0cb099fe3eec71a7b37b0bf27be /lib/compiler/src/beam_validator.erl
parent3c0f98c1b0e74eb58a4e4e82a3ec89dc7ecdb579 (diff)
downloadotp-ab03678e87732407625150c202e177a85a025beb.tar.gz
otp-ab03678e87732407625150c202e177a85a025beb.tar.bz2
otp-ab03678e87732407625150c202e177a85a025beb.zip
Remove unreachable code after 'raise' instructions
Remove the unreachable instructions after a 'raise' instruction (e.g. a 'jump' or 'deallocate', 'return') to decrease code size.
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index fd38fc0095..1c052789fd 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -509,6 +509,9 @@ valfun_4({bif,element,{f,Fail},[Pos,Tuple],Dst}, Vst0) ->
TupleType = upgrade_tuple_type({tuple,[get_tuple_size(PosType)]}, TupleType0),
Vst = set_type(TupleType, Tuple, Vst1),
set_type_reg(term, Dst, Vst);
+valfun_4({bif,raise,{f,0},Src,_Dst}, Vst) ->
+ validate_src(Src, Vst),
+ kill_state(Vst);
valfun_4({bif,Op,{f,Fail},Src,Dst}, Vst0) ->
validate_src(Src, Vst0),
Vst = branch_state(Fail, Vst0),