|
32 | 32 | <p>This document describes the changes made to the Compiler |
33 | 33 | application.</p> |
34 | 34 |
|
| 35 | +<section><title>Compiler 7.2</title> |
| 36 | + |
| 37 | + <section><title>Fixed Bugs and Malfunctions</title> |
| 38 | + <list> |
| 39 | + <item> |
| 40 | + <p>Fixed an error in an optimization pass that caused |
| 41 | + impossible tuple matching.</p> |
| 42 | + <p> |
| 43 | + Own Id: OTP-14855 Aux Id: ERL-549 </p> |
| 44 | + </item> |
| 45 | + <item> |
| 46 | + <p>The exception thrown when a list comprehension was |
| 47 | + given a non-list term was not always correct.</p> |
| 48 | + <p> |
| 49 | + Own Id: OTP-14992 Aux Id: ERL-572 </p> |
| 50 | + </item> |
| 51 | + <item> |
| 52 | + <p>The compiler could produce incorrect code in rare |
| 53 | + circumstances when the <c>[{inline,F/A}]</c> option was |
| 54 | + used.</p> |
| 55 | + <p> |
| 56 | + Own Id: OTP-15115 Aux Id: PR-1831 </p> |
| 57 | + </item> |
| 58 | + </list> |
| 59 | + </section> |
| 60 | + |
| 61 | + |
| 62 | + <section><title>Improvements and New Features</title> |
| 63 | + <list> |
| 64 | + <item> |
| 65 | + <p>Changed the default behaviour of <c>.erlang</c> |
| 66 | + loading: <c>.erlang</c> is no longer loaded from the |
| 67 | + current directory. <c>c:erlangrc(PathList)</c> can be |
| 68 | + used to search and load an <c>.erlang</c> file from user |
| 69 | + specified directories.</p> <p><c>escript</c>, |
| 70 | + <c>erlc</c>, <c>dialyzer</c> and <c>typer</c> no longer |
| 71 | + load an <c>.erlang</c> at all.</p> |
| 72 | + <p> |
| 73 | + *** POTENTIAL INCOMPATIBILITY ***</p> |
| 74 | + <p> |
| 75 | + Own Id: OTP-14439</p> |
| 76 | + </item> |
| 77 | + <item> |
| 78 | + <p>Support for "tuple calls" have been removed from the |
| 79 | + run-time system. Tuple calls was an undocumented and |
| 80 | + unsupported feature which allowed the module argument for |
| 81 | + an apply operation to be a tuple: <c>Var = dict:new(), |
| 82 | + Var:size()</c>. This "feature" frequently caused |
| 83 | + confusion, especially when such call failed. The |
| 84 | + stacktrace would point out functions that don't exist in |
| 85 | + the source code.</p> |
| 86 | + <p>For legacy code that need to use parameterized modules |
| 87 | + or tuple calls for some other reason, there is a new |
| 88 | + compiler option called <c>tuple_calls</c>. When this |
| 89 | + option is given, the compiler will generate extra code |
| 90 | + that emulates the old behavior for calls where the module |
| 91 | + is a variable.</p> |
| 92 | + <p> |
| 93 | + *** POTENTIAL INCOMPATIBILITY ***</p> |
| 94 | + <p> |
| 95 | + Own Id: OTP-14497</p> |
| 96 | + </item> |
| 97 | + <item> |
| 98 | + <p>In code such as <c>example({ok, Val}) -> {ok, |
| 99 | + Val}.</c> a tuple would be built. The compiler will now |
| 100 | + automatically rewrite the code to |
| 101 | + <c>example({ok,Val}=Tuple) -> Tuple.</c> which will |
| 102 | + reduce code size, execution time, and remove GC |
| 103 | + pressure.</p> |
| 104 | + <p> |
| 105 | + Own Id: OTP-14505</p> |
| 106 | + </item> |
| 107 | + <item> |
| 108 | + <p>The optimization of <c>case</c> expression where only |
| 109 | + one of the case arms can execute successfully has been |
| 110 | + improved.</p> |
| 111 | + <p> |
| 112 | + Own Id: OTP-14525</p> |
| 113 | + </item> |
| 114 | + <item> |
| 115 | + <p>Some uses of binary matching has been slightly |
| 116 | + improved, eliminating unnecessary register shuffling.</p> |
| 117 | + <p> |
| 118 | + Own Id: OTP-14594 Aux Id: ERL-444 </p> |
| 119 | + </item> |
| 120 | + <item> |
| 121 | + <p>There is a new <c>{compile_info,Info}</c> option for |
| 122 | + the compiler that allows BEAM-based languages such as |
| 123 | + Elixir and LFE to add their own compiler versions.</p> |
| 124 | + <p> |
| 125 | + Own Id: OTP-14615 Aux Id: PR-1558 </p> |
| 126 | + </item> |
| 127 | + <item> |
| 128 | + <p>Loaded BEAM code in a 64-bit system requires less |
| 129 | + memory because of better packing of operands for |
| 130 | + instructions.</p> |
| 131 | + <p>These memory savings were achieved by major |
| 132 | + improvements to the <c>beam_makeops</c> scripts used when |
| 133 | + building the run time system and BEAM compiler. There is |
| 134 | + also new for documentation for <c>beam_makeops</c> that |
| 135 | + describes how new BEAM instructions and loader |
| 136 | + transformations can be implemented. The documentation is |
| 137 | + found in here in a source directory or git repository: |
| 138 | + erts/emulator/internal_doc/beam_makeops.md. An online |
| 139 | + version can be found here: |
| 140 | + https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/beam_makeops.md</p> |
| 141 | + <p> |
| 142 | + Own Id: OTP-14626</p> |
| 143 | + </item> |
| 144 | + <item> |
| 145 | + <p>Size calculations for binary constructions has been |
| 146 | + somewhat optimized, producing smaller code.</p> |
| 147 | + <p> |
| 148 | + Own Id: OTP-14654</p> |
| 149 | + </item> |
| 150 | + <item> |
| 151 | + <p>When the value returned from a '<c>catch</c>' |
| 152 | + expression is ignored, no stacktrace will be built if an |
| 153 | + exception is caught. That will save time and produce less |
| 154 | + garbage. There are also some minor optimizations of |
| 155 | + '<c>try</c>/<c>catch</c>' both in the compiler and |
| 156 | + run-time system.</p> |
| 157 | + <p> |
| 158 | + Own Id: OTP-14683</p> |
| 159 | + </item> |
| 160 | + <item> |
| 161 | + <p>There is a new syntax in '<c>try/catch</c>' for |
| 162 | + retrieving the stacktrace without calling |
| 163 | + '<c>erlang:get_stacktrace/0</c>'. See the reference |
| 164 | + manual for a description of the new syntax. The |
| 165 | + '<c>erlang:get_stacktrace/0</c>' BIF is now |
| 166 | + deprecated.</p> |
| 167 | + <p> |
| 168 | + Own Id: OTP-14692</p> |
| 169 | + </item> |
| 170 | + <item> |
| 171 | + <p>The following is an internal change in the compiler, |
| 172 | + that is not noticeable for normal use of the compiler: |
| 173 | + The module <c>v3_life</c> has been removed. Its |
| 174 | + functionality has been simplified and integrated into |
| 175 | + <c>v3_codegen</c>.</p> |
| 176 | + <p> |
| 177 | + Own Id: OTP-14712</p> |
| 178 | + </item> |
| 179 | + <item> |
| 180 | + <p>The optimization of binary matching that delays |
| 181 | + creation of sub binaries (see the Efficiency Guide) could |
| 182 | + be thwarted by the argument order and could be necessary |
| 183 | + to change the argument order. The compiler has now become |
| 184 | + smarter and can handle any argument order.</p> |
| 185 | + <p> |
| 186 | + Own Id: OTP-14774</p> |
| 187 | + </item> |
| 188 | + <item> |
| 189 | + <p>When the compiler was faced with complex case |
| 190 | + expressions it would unnecessarily allocate stack |
| 191 | + elements and shuffle data between x and y registers. |
| 192 | + Improved code generation to only allocate a stack frame |
| 193 | + when strictly necessary.</p> |
| 194 | + <p> |
| 195 | + Own Id: OTP-14808 Aux Id: ERL-514 </p> |
| 196 | + </item> |
| 197 | + <item> |
| 198 | + <p>There is a new option '<c>makedep_side_effect</c>' for |
| 199 | + the compiler and <c>-MMD</c> for '<c>erlc</c>' that |
| 200 | + generates dependencies and continues to compile as |
| 201 | + normal.</p> |
| 202 | + <p> |
| 203 | + Own Id: OTP-14830</p> |
| 204 | + </item> |
| 205 | + <item> |
| 206 | + <p>When compiling modules with huge functions, the |
| 207 | + compiler would generate a lot of atoms for its internal, |
| 208 | + sometimes so many that the atom table would overflow. The |
| 209 | + compiler has been rewritten to generate far less internal |
| 210 | + atoms to avoid filling the atom table.</p> |
| 211 | + <p> |
| 212 | + Own Id: OTP-14968 Aux Id: ERL-563 </p> |
| 213 | + </item> |
| 214 | + <item> |
| 215 | + <p>External funs with literal values for module, name, |
| 216 | + and arity (e.g. <c>erlang:abs/1</c>) are now treated as |
| 217 | + literals. That means more efficient code that produces |
| 218 | + less garbage on the heap.</p> |
| 219 | + <p> |
| 220 | + Own Id: OTP-15003</p> |
| 221 | + </item> |
| 222 | + <item> |
| 223 | + <p>Two new guards BIFs operating on maps have been added: |
| 224 | + <c>map_get/2</c> and <c>is_map_key/2</c>. They do the |
| 225 | + same as <c>maps:get/2</c> and <c>maps:is_key/2</c>, |
| 226 | + respectively, except that they are allowed to be used in |
| 227 | + guards.</p> |
| 228 | + <p> |
| 229 | + Own Id: OTP-15037 Aux Id: PR-1784, PR-1802 </p> |
| 230 | + </item> |
| 231 | + <item> |
| 232 | + <p>A call or apply of a literal external fun will be |
| 233 | + replaced with a direct call.</p> |
| 234 | + <p> |
| 235 | + Own Id: OTP-15044 Aux Id: ERL-614 </p> |
| 236 | + </item> |
| 237 | + <item> |
| 238 | + <p>Part of EEP-44 has been implemented.</p> |
| 239 | + <p>There is a new predefined macro called |
| 240 | + <c>OTP_RELEASE</c> which is an integer indicating the OTP |
| 241 | + release number (its value is <c>21</c> in this |
| 242 | + release).</p> |
| 243 | + <p>There are new preprocessor directives |
| 244 | + <c>-if(Condition).</c> and <c>-elif(Condition).</c>. The |
| 245 | + <c>if/elif</c> supports the builtin function |
| 246 | + <c>defined(Symbol)</c>.</p> |
| 247 | + <p> |
| 248 | + Own Id: OTP-15087 Aux Id: PR-1810 </p> |
| 249 | + </item> |
| 250 | + </list> |
| 251 | + </section> |
| 252 | + |
| 253 | +</section> |
| 254 | + |
35 | 255 | <section><title>Compiler 7.1.5</title> |
36 | 256 |
|
37 | 257 | <section><title>Fixed Bugs and Malfunctions</title> |
|
0 commit comments