aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorMichał Muskała <[email protected]>2017-08-09 13:51:16 +0200
committerMichał Muskała <[email protected]>2018-06-08 02:57:19 +0200
commitcfc2b4ff4a6a2c46a3e2458eb87fd089e610783a (patch)
tree7af15af6397083c2ec70ca60b50200bb1723f331 /lib/compiler/src/compile.erl
parent8376b2cfcc4ab37ea398c2c564d2ba64d485896a (diff)
downloadotp-cfc2b4ff4a6a2c46a3e2458eb87fd089e610783a.tar.gz
otp-cfc2b4ff4a6a2c46a3e2458eb87fd089e610783a.tar.bz2
otp-cfc2b4ff4a6a2c46a3e2458eb87fd089e610783a.zip
Run the sharing optimisation in beam_jump until fixpoint
This is especially useful after inlining a function with a case. Today the compiler would most probably be able to unify all the leafs of the case during the sharing optimisation, but it would fail to unify the pattern matching itself. Naively running the optimisation multiple times wouldn't be able to find the common code either, because it would differ in jump/fail targets of various instructions. To remedy this, after doing each sharing pass we traverse the code backwards when reversing and update all the jump targets with the new targets that were discovered during the unification pass. This allows running the optimisation until fixpoint and makes sure all sharing opportunities will be discovered. This optimisation also helps with the Elixir's `with/else` construct.
Diffstat (limited to 'lib/compiler/src/compile.erl')
0 files changed, 0 insertions, 0 deletions