aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/ops.tab
diff options
context:
space:
mode:
authorMichał Muskała <[email protected]>2018-02-25 14:19:48 +0100
committerMichał Muskała <[email protected]>2018-03-26 12:07:10 +0200
commit63e1c58d27ab695a19897423fc75e607f69ff51b (patch)
tree5965bba7175e8cb29596d3cdabb2db8cd86d6cd3 /erts/emulator/beam/ops.tab
parent0217dbfee505ed8c88164c7a4ea5e1834e6ce8cd (diff)
downloadotp-63e1c58d27ab695a19897423fc75e607f69ff51b.tar.gz
otp-63e1c58d27ab695a19897423fc75e607f69ff51b.tar.bz2
otp-63e1c58d27ab695a19897423fc75e607f69ff51b.zip
Compile external fun expressions to literals
The expressions fun M:F/A, when all elements are literals are also treated as a literal. Since they have consistent representation and don't depend on the code currently loaded in the VM, this is safe. This can provide significant performance improvements in code using such functions extensively - a full function call to erlang:make_fun/3 is replaced by a single move instruction and no register shuffling or saving registers to stack is necessary. Additionally, compound data types that contain such external functions as elements can be treated as literals too. The commit also changes the representation of external funs to be a valid Erlang syntax and adds support for literal external funs to core Erlang.
Diffstat (limited to 'erts/emulator/beam/ops.tab')
-rw-r--r--erts/emulator/beam/ops.tab3
1 files changed, 2 insertions, 1 deletions
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 77e375f2c0..6e03f39d97 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -710,7 +710,8 @@ is_boolean Fail=f ac => jump Fail
is_boolean f? xy
%hot
-is_function2 Fail=f acq Arity => jump Fail
+is_function2 Fail=f Literal=q Arity | literal_is_export(Literal) =>
+is_function2 Fail=f c Arity => jump Fail
is_function2 Fail=f Fun a => jump Fail
is_function2 f? S s