summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrej Drejhammar <frej.drejhammar@gmail.com>2021-01-14 14:05:07 +0100
committerFrej Drejhammar <frej.drejhammar@gmail.com>2021-01-18 13:48:17 +0100
commit30875c1d7c7381e42acdeb342fe177b06b34cb65 (patch)
tree95247bfe000701046c47ac482beda42259bb7211
parent6378a0c825db64df91e01ee39e3a268f4ba050b7 (diff)
downloaderlang-30875c1d7c7381e42acdeb342fe177b06b34cb65.tar.gz
diffable: Stop diffable --dis from crashing when the JIT is used
When testing the JIT code generator it is useful to run it on a large number of functions. Running `diffable --dis` does just that, but as disassembly of loaded code is not supported by the JIT, diffable unfortunately crashes when trying to find labels in the empty output. This patch changes diffable:find_labels/3 to not crash on empty input, thus making diffable useful for exercising the JIT's code generator.
-rwxr-xr-xscripts/diffable2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/diffable b/scripts/diffable
index 9996d84c80..ce192b375b 100755
--- a/scripts/diffable
+++ b/scripts/diffable
@@ -538,6 +538,8 @@ rejoin_atoms([Op|Ops]) ->
rejoin_atoms([]) ->
[].
+find_labels([], _Name, _Arity) ->
+ #{};
find_labels(Is, Name, Arity) ->
[_,[Entry|_]|_] = Is,
EntryLabel = iolist_to_binary(io_lib:format("~p/~p", [Name,Arity])),