aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_jump.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-11-01 06:19:52 +0100
committerBjörn Gustavsson <[email protected]>2018-11-06 10:16:53 +0100
commite7b3dcde36969be9442e05b18919ecb5b61bf6a4 (patch)
tree665c241adbc1a24dbae62a4b3339cfbc1d827c23 /lib/compiler/src/beam_jump.erl
parent9212ce67e22e3f45190ded62bea82291d084351d (diff)
downloadotp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.tar.gz
otp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.tar.bz2
otp-e7b3dcde36969be9442e05b18919ecb5b61bf6a4.zip
beam_trim, beam_jump: Print Name/Arity if there is a crash
This will help investigation of compiler bugs.
Diffstat (limited to 'lib/compiler/src/beam_jump.erl')
-rw-r--r--lib/compiler/src/beam_jump.erl20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl
index edc4522cc7..40a2211325 100644
--- a/lib/compiler/src/beam_jump.erl
+++ b/lib/compiler/src/beam_jump.erl
@@ -144,13 +144,19 @@ module({Mod,Exp,Attr,Fs0,Lc0}, _Opt) ->
%%
%% NOTE: This function assumes that there are no labels inside blocks.
function({function,Name,Arity,CLabel,Asm0}, Lc0) ->
- Asm1 = eliminate_moves(Asm0),
- {Asm2,Lc} = insert_labels(Asm1, Lc0, []),
- Asm3 = share(Asm2),
- Asm4 = move(Asm3),
- Asm5 = opt(Asm4, CLabel),
- Asm = remove_unused_labels(Asm5),
- {{function,Name,Arity,CLabel,Asm},Lc}.
+ try
+ Asm1 = eliminate_moves(Asm0),
+ {Asm2,Lc} = insert_labels(Asm1, Lc0, []),
+ Asm3 = share(Asm2),
+ Asm4 = move(Asm3),
+ Asm5 = opt(Asm4, CLabel),
+ Asm = remove_unused_labels(Asm5),
+ {{function,Name,Arity,CLabel,Asm},Lc}
+ catch
+ Class:Error:Stack ->
+ io:fwrite("Function: ~w/~w\n", [Name,Arity]),
+ erlang:raise(Class, Error, Stack)
+ end.
%%%
%%% Scan instructions in execution order and remove redundant 'move'