diff options
author | Björn Gustavsson <[email protected]> | 2019-01-21 07:04:46 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-01-21 12:57:54 +0100 |
commit | 990976907841dd3122c82992ba9965ee313e988c (patch) | |
tree | 8ccc4c8a103c6ed5a206912ff2eb3df707ccf674 /erts/emulator/beam/instrs.tab | |
parent | a11ddd5862fa06a3242e548fbd232a4c294ca7a8 (diff) | |
download | otp-990976907841dd3122c82992ba9965ee313e988c.tar.gz otp-990976907841dd3122c82992ba9965ee313e988c.tar.bz2 otp-990976907841dd3122c82992ba9965ee313e988c.zip |
Optimize the is_function/2 guard test
The is_function2 instruction is executed surprisingly
frequently when running dialyzer or the compiler. It
cannot hurt to optimize it a little.
Diffstat (limited to 'erts/emulator/beam/instrs.tab')
-rw-r--r-- | erts/emulator/beam/instrs.tab | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/erts/emulator/beam/instrs.tab b/erts/emulator/beam/instrs.tab index df60e889f3..e55c4a112d 100644 --- a/erts/emulator/beam/instrs.tab +++ b/erts/emulator/beam/instrs.tab @@ -709,12 +709,18 @@ is_function(Fail, Src) { } } -is_function2(Fail, Fun, Arity) { +cold_is_function2(Fail, Fun, Arity) { if (erl_is_function(c_p, $Fun, $Arity) != am_true ) { $FAIL($Fail); } } +hot_is_function2(Fail, Fun, Arity) { + if (!is_function2($Fun, $Arity)) { + $FAIL($Fail); + } +} + is_integer(Fail, Src) { if (is_not_integer($Src)) { $FAIL($Fail); |