aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_trim.erl
AgeCommit message (Collapse)Author
2019-05-22Make the swap instruction known to the compilerBjörn Gustavsson
BEAM has had a `swap` instruction for several releases, but it was not known to the compiler. The loader would translate a sequence of three `move` instructions to the `swap` instructions, but only when it was possible to determine that it would be safe. By making `swap` known to the compiler, it can be applied in more situations since it is easier for the compiler than for the loader to ensure that the usage is safe, and the loader shenanigans can be eliminated.
2019-01-24beam_trim: Ignore type annotationsJohn Högberg
The type annotations inserted by beam_ssa_type and beam_ssa_bsm would inadvertently disable stack trimming, as unknown instructions are considered unsafe.
2018-11-06beam_trim: Add comments about how all this worksBjörn Gustavsson
Also rename a few functions in attempt to make it clearer.
2018-11-06beam_trim: Recognize more safe labelsBjörn Gustavsson
Recognize more safe labels to enable stack trimming in more circumstances.
2018-11-06beam_trim: Handle the new binary matching instructionsBjörn Gustavsson
2018-11-06beam_trim: Stop using beam_utils:is_not_used/3Björn Gustavsson
Eliminate the use of beam_utils:is_not_used/3 by implementing a simple is_not_used() function in beam_trim itself. The new version actually makes trimming possible in more circumstances, because beam_utils:is_not_used/3 was too conservative for the purpose of stack trimming (it was previously used for optimizations where it was necessary to be more conservative). Alternatives considered: I tried to implement stack trimming in beam_ssa_codegen but it turned out to be a total mess. Not surprisingly, it turns out that an optimization that renumbers Y registers is hard to do on an intermediate representation that still use variables instead of BEAM registers.
2018-11-06beam_trim, beam_jump: Print Name/Arity if there is a crashBjörn Gustavsson
This will help investigation of compiler bugs.
2018-11-06beam_trim: Use maps/cerl_sets instead of gb_trees/gb_setsBjörn Gustavsson
2018-08-17beam_trim: Handle an empty list of instructionsBjörn Gustavsson
2017-01-12beam_trim: Add types and specsBjörn Gustavsson
2016-09-21Simplify beam_utilsBjörn Gustavsson
When beam_utils was first written, it did not have the functions for testing whether a register was not used. Those were added later, in sort of a hacky way. Also, is_killed*() and is_not_used*() for Y registers would return the same answer. Fix that to make the API more consistent (an Y register can only be killed by a deallocate/1 instruction). We will need to change beam_trim to call beam_utils:is_not_used/3 instead of beam_utils:is_killed/3.
2016-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2015-04-29Teach beam_trim to handle map instructionsBjörn Gustavsson
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2012-10-10Break apart tail-recursive call instructionsBjörn Gustavsson
Somewhat reduce the code bloat by eliminating special cases.
2012-10-10Represent the 'send' instruction as a call_ext/2 instructionBjörn Gustavsson
Somewhat reduce code bloat.
2012-10-09Rewrite binary creation instructions to bs_init instructionsBjörn Gustavsson
Rewrite the five binary creation instructions to a bs_init instruction, in order to somewhat reduce code bloat.
2012-10-09Rewrite bs_add, bs_utf*_size to BIF instructions in optimizationsBjörn Gustavsson
We can remove some code bloat by handling the special instructions as BIF instructions in the optimization passes. Also note that bs_utf*_size was not handled by beam_utils:check_liveness/3 (meaning the conservative answer instead of the correct answer would be returned).
2012-10-09Rewrite bs_put* instructions to a generic bs_put instructionBjörn Gustavsson
Seven bs_put_* instructions can be combined into one generic bs_put instruction to avoid some code bloat. That will also improve some optimizations (such as beam_trim) that did not handle all bs_put* variants.
2011-12-09Update copyright yearsBjörn-Egil Dahlberg
2011-08-16compiler: Generate line instructionsBjörn Gustavsson
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP