1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111
|
<HTML>
<HEAD>
<TITLE>COMPILER Release Notes (Old)</TITLE>
<style type="text/css">
<!--
body { background: white; margin: 3em }
body { font-family: Verdana, Arial, Helvetica, sans-serif }
h1 h2 h3 h4 { font-family: Verdana, Arial, Helvetica, sans-serif }
h1 { font-size: 48 }
p li { font-family: Verdana, Arial, Helvetica, sans-serif }
-->
</style>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<BLOCKQUOTE>
<P>These document describes the release notes for older versions of the <CODE>compiler</CODE> application.
<!--- ################################################################# --->
<h2>Compiler 4.2</h2>
<!--- ----------------------------------------------------------------- --->
<h3>Fixed errors and malfunctions</h3>
<ul>
<li>
Three compiler problems fixed: 1) Constant expression were not
evaluated at compile time as they should be (unless inlining was turned
on). 2) In unusual cases, incorrect code would be generated for "," or
"and" in guards. 3) A floating point expressions that failed (e.g. with
overflow) and whose value was not used would cause the next floating
point expression to fail on some Pentium platforms (Linux, possibly
FreeBSD; not on Windows).<br>
(Own Id: OTP-4557)<p>
</li>
<li>
Misspelled atom names which looks like arithmetic expressions no longer
causes compiler crashes.<br>
(Own Id: OTP-4617)<br>
(Aux Id: seq7626)<p>
</li>
<li>
Several minor compiler crash problems have been fixed.<br>
(Own Id: OTP-4765)<p>
</li>
<li>
Errors discovered by the Erlang pre-processor, such as re-definitions
of macros, are now correctly reported. They used to be reported as
"unknown POSIX error".<br>
(Own Id: OTP-4768)<p>
</li>
<li>
Under rare circumstances, a catch nested inside
a catch in the same function would cause an emulator
crash with the reason "Catch not found".<br>
(Own Id: OTP-4769)<p>
</li>
</ul>
<!--- ----------------------------------------------------------------- --->
<h3>Improvements and new features</h3>
<ul>
<li>For the bit syntax, it is now supported to match with a sizefield
that is bound (from left to right) during the same matching. Example: <br>
<code><<Size, B:Size/binary,Rest/binary>> = <<2,"AB",3,"CDE">></code><br>
During the matching Size is bound to 2 and then used as the size for
B which will be bound to "AB" etc.<br>
</li>
<li>
The compiler will issue an warning for list comprenhensions without any
generators.<br>
(Own Id: OTP-4618)<p>
</li>
<li>
The format of the debug information stored in beam files when the
<code>debug_info</code> option is given has been changed. The debugger,
xref, and cover tools in R9C have been updated to handle the new format
(as well as the previous format). The R9B version of those tools
<code>cannot</code> handle the new format.<br>
(Own Id: OTP-4688)<p>
</li>
<li>
When updating a record, the record is now always checked for the
correct record tag and size. Earlier versions of the compiler did not
consistently add such a test (depending on the size of the record and
the number of fields updated).<br>
(*** POTENTIAL INCOMPATIBILITY ***)<br>
(Own Id: OTP-4764)<p>
</li>
<li>
The compiler produces slightly smaller and faster code for certain
language features, such as 'andalso' and 'orelse'.<br>
(Own Id: OTP-4766)<p>
</li>
</ul>
<!--- ################################################################# --->
<h2>Compiler 4.1</h2>
<!--- ----------------------------------------------------------------- --->
<h3>Fixed errors and malfunctions</h3>
<ul>
<li>
Fixed problem in optimizing of case patterns containing tuples.<br>
(Own Id: OTP-3973)<br>
(Aux Id: Seq 5243, Seq 7025)<p>
</li>
<li>
Using the 'not' operator in guards could crash the emulator.<br>
(Own Id: OTP-4194)<br>
(Aux Id: seq7196, seq7232, seq7253)<p>
</li>
<li>
A bug in the compilation of bit syntax matching could cause parts of
the binary to be skipped.<br>
(Own Id: OTP-4219)<br>
(Aux Id: seq7218)<p>
</li>
</ul>
<!--- ----------------------------------------------------------------- --->
<h3>Improvements and new features</h3>
<ul>
<li>
The documentation for the 'compile' module now lists several options
that were previously undocumented or only documented in the 'erl_lint'
documentation (such as the highly useful <tt>warn_unused_vars</tt>).<br>
(Own Id: OTP-4240)<p>
</li>
<li>
The <code>-include</code> and <code>-include_dir</code> directives
substitute environment variable values for first path components
beginning with a <code>$</code> (dollar) sign.<br>
(Own Id: OTP-4385)<br>
(Aux Id: seq7349)<p>
</li>
<li>
The endianess specification 'native' has been added to the bit syntax.
It will resolve to either big or little endian at load time. It is
specially useful for communcating with linked-in drivers.<br>
(Own Id: OTP-4458)<p>
</li>
<li>
'try' and 'cond' are keywords in R9 and must not be used as atom names
or field names in records (unless they are single-quoted). In the R9
release, the compiler options 'disable_try' and 'disable_cond' can be
used to allow 'try' and 'cond' to be used as in previous releases (to
allow compilation of old Erlang code). <br> The
'disable_try'/'disable_cond' options will be removed in the R10
release.<br>
(*** POTENTIAL INCOMPATIBILITY ***)<br>
(Own Id: OTP-4464)<p>
</li>
</ul>
<!--- ################################################################# --->
<h2>Compiler 4.0</h2>
<!--- ----------------------------------------------------------------- --->
<h3>Fixed errors and malfunctions</h3>
<ul>
<li>
If records happened to be defined with initializers so that they
included each other recursively, the compilation would eat up all
memory and then crash. Now, an error message is given instead.<br>
(Own Id: OTP-2677)<p>
</li>
<li>
When using the <code>warn_unused_vars</code> option to the compiler,
warnings could previously be incorrectly given for variables used
within list comprehensions.<br>
(Own Id: OTP-3412)<p>
</li>
<li>
When using the option <code>warn_unused_vars</code> when compiling,
unused variables introduced inside a <code>case</code>,
<code>receive</code> or <code>if</code> were not always reported.<br>
(Own Id: OTP-3729)<p>
</li>
</ul>
<!--- ----------------------------------------------------------------- --->
<h3>Improvements and new features</h3>
<ul>
<li>
The guard tests <CODE>list/1</CODE>, <CODE>atom/1</CODE> etc. now also
have the names <CODE>is_list/1</CODE>, <CODE>is_atom/1</CODE>. All
these guard tests are also BIFs that can be used in expression in
function bodies, too.<br>
(Own Id: OTP-3791)<p>
</li>
<li>
There are more compiler optimisations. In particular, lists
comprenhensions and record updates are faster.<br>
(Own Id: OTP-4142)<p>
</li>
<li>
Floating point operations are significantly faster if the compiler
knows that floating point is involved. The guard bif
<code>is_float/1</code> can be used ensure that the compiler knows the
type.<br>
(Own Id: OTP-4143)<p>
</li>
<li>
To faciliate constructing records containing wildcards for functions
such as <code>ets:match/2</code> and
<code>mnesia:match_object/3</code>, a special field named
<code>_</code> can now be assigned, meaning that all fields not
explicitly assigned in the same record update will be assigned.
Example: <code>#person{name = "Nisse", _ = '_'}</code><br>
(Own Id: OTP-4147)<p>
</li>
<li>
New short-circuit versions of <code>and</code> and <code>or</code>
called <code>andalso</code> and <code>orelse</code> have been added.
They terminate evaluation of the boolean expression as soon as the
truth value is known. The new operators cannot be used in guards.<br>
(Own Id: OTP-4148)<p>
</li>
<li>
The boolean operators <code>and</code>, <code>or</code>, and
<code>not</code> can now be used in guards.<br>
(Own Id: OTP-4149)<p>
</li>
<li>
The compiler in R8 will issue a warnings when the atoms or functions
<code>try</code> or <code>cond</code> are used, as these will be
keywords in a future version of Erlang.
<br>
(Own Id: OTP-4150)<p>
</li>
<li>
In the Open-Source release of Erlang/OTP, the HiPE (High Performance
Erlang) extension can be enabled. (Using <code>./configure
--enable-hipe</code> when building.) If the runtime-system is
hipe-enabled, a module can be native-code compiled like this: <br>
<p><code>c(Module, [native|OtherOptions])</code>. <br> <p>Compiling in
this way, the beam file will contain both standard beam byte-code and
the native code. If loaded on a hipe-enabled system the native code
will be loaded; otherwise the beam-code will be loaded. <br> <p>HiPE is
supported for Ultra Sparc and Intel Pentium.<br>
(Own Id: OTP-4153)<p>
</li>
</ul>
<H2>Compiler 3.0.1.2</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
The compiler would sometimes reorder bit syntax clauses
causing them to be execute in the wrong order.
This has been corrected.
<br>Own Id: OTP-3748<br>
Aux Id: Seq 4954
<LI>
Modules containing long literals string concatenated with
variables would take long time to compile and the beam module
would be unecesserialy large. Both problems have been
corrected.
<br>Own Id: OTP-3831<br>
Aux Id: Seq 5085
<LI>
By default, debug information is no longer included in
beam modules. Use the compiler option <CODE>debug_info</CODE>
to include debug information.
<br>Own Id: OTP-3885
</UL>
<H2>Compiler 3.0.1</H2>
<H3>Improvements and new features</H3>
<UL>
<LI>
Several minor compiler bugs corncerning the bit syntax
were corrected.
<br>Own Id: OTP-3707
</UL>
<H2>Compiler 3.0</H2>
<H3>Known problems</H3>
<UL>
<LI>
Use of recursively defined records causes the compiler to
crash instead of reporting an error.
<br>Own Id: OTP-2677
</UL>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
The Erlang compiler builds lists and tuples in a smarter
way than previous compilers, meaning that literal lists and tuples
practically any size can now be built.
<br>Own Id: OTP-2388<br>
Aux Id: seq 821
<LI>
Using a literal atom in a call to atom_to_list/1 resulted
in a compiled module that could not be loaded. This has been corrected.
<br>Own Id: OTP-3438
</UL>
<H3>Improvements and new features</H3>
<UL>
<LI>
We have made several changes to the garbage collector
and internal memory allocation routines to reduce
memory consumption and memory fragmentation.
Also, the compiler now makes sure that references
to any data that will not be used again will be killed,
so that the garbage collector can discard it as soon
as possible.
(Thanks to Claes Wickstrom at Bluetail who suggested
most of the changes to the garbage collector.)
<br>Own Id: OTP-2375<br>
Aux Id: seq 816, HA81951
<LI>
It is now allowed to use an expression within a pattern,
if the expression uses only numeric or bitwise operators,
and can
be evaluated to a constant at compile-time. E.g.,
<CODE>
case X of
{1+2, T} -> T
end.
</CODE>
<br>Own Id: OTP-3144<br>
Aux Id: OTP-3143
<LI>
There now exists syntax for constructing and matching
binaries. For more infomation, see Extensions to Erlang.
Also, the handling of small binaries (up to 64 bytes) has
been optimised, as well as splitting of binaries.
<br>Own Id: OTP-3376
<LI>
The construction <CODE>??Arg</CODE> for an argument to a macro
expands to a string containing the tokens of the argument,
similar to the <CODE>#arg</CODE> stringifying construction in C.
<br>Own Id: OTP-3425
<LI>
The compiler now supports inlining within a module
(see the compiler documentation). Numerous known
problems and limitations have been corrected, and
the optimisation is better (for instance, tuples
used in cases for grouping are no longer built).
The earlier compiler versions v1 (R5) and v2 (R6)
have been discontinued because there are no longer
any reason to use them.
<br>Own Id: OTP-3672
</UL>
<H2>Compiler 2.1</H2>
<H3>Improvements and new features</H3>
<UL>
<LI>
The old compiler from R5 is included as well as the new compiler.
The new compiler (<CODE>v2</CODE>) is the default. The old compiler
can be chosen by giving a <CODE>v1</CODE> option to the compiler.
The compiler will also read default compiler options from
the ERL_COMPILER_OPTIONS environment variables.
<br>
<p>
The <CODE>v2</CODE> compiler, which is default, generates smaller and
faster code than the <CODE>v1</CODE> compiler, but in one case the
compilation can be extremly slow: on pattern matching on long literal
strings. The <CODE>v2</CODE> compiler in R6A also compiled huge list
and/or tuple literals slowly. The <CODE>v2</CODE> compiler in R6B
compiles these literals much faster.
<br>Own Id: OTP-3363
</UL>
<H2>Compiler 2.0</H2>
<H3>Known problems</H3>
<UL>
<LI>
Use of recursively defined records causes the compiler to
crash instead of reporting an error.
<br>Own Id: OTP-2677
<LI>
All current versions of the Beam compiler (both the <CODE>v1</CODE>
and the <CODE>v2</CODE> versions) have a hard limit on the size of
list and tuple literals in Beam modules. This limit 1024,
which is the number of registers in the Beam virtual machine.
When building a list whose elements are not small integers
or atoms, the compiler generates code that builds all list
elements from left to right (as the Erlang standard prescribes)
saving the built elements in registers. When all elements has
been built, the list itself is built. This effectively limits
the size of a literal list to 1024 elements.
<br>
<p>
This limitation will be removed in a future version of the
compiler.
<br>
<p>
Note 1: This only applies to list literals in Beam modules,
not to list literals read from data files by <CODE>file:consult/X</CODE>
or other means, or lists built dynamically by Erlang code or
BIFs. The only practial limit on the list size is the available
memory.
<br>
<p>
Note 2: Literals list with elements that don't need to be built
beforehand (such as numbers and atoms) can be of any length.
<br>
<p>
Note 3: The same rules apply to tuples.
<br>Own Id: OTP-3367
</UL>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
In earlier Beam releases, the result of the
match operator '=' in a function body was wrong.
For instance, in '<CODE>io:format("~p\n", [[X]=[a]])</CODE>',
the result of the match expression '<CODE>[X]=[a]</CODE>' should
be '<CODE>[a]</CODE>', but in Beam it was '<CODE>a</CODE>'.
This all means that multiple patterns in function bodies
such as '<CODE>[X] = [Y] = [a]</CODE>' would fail with a badmatch exception
in Beam releases before R6.
This has been corrected in the new Beam compiler.
Incorrect code like '<CODE>a = [X] = [a]</CODE>' which depended
on the incorrect behaviour will now fail with a badmatch.
<br>(*** POTENTIAL INCOMPATIBILITY ***)
<br>Own Id: OTP-3176
</UL>
<H3>Improvements and new features</H3>
<UL>
<LI>
Where previously only one comma-separated sequence of guard
tests was allowed, now a guard can be written as a
disjunction of sequences, using
<CODE>;</CODE> as separator. This is syntactic sugar which removes
the bother of writing the same body after several guards.
<br>Own Id: OTP-3182
<LI>
The compiler has been entirely rewritten for this release.
It generally generates smaller and faster code
than the old compiler. The compiler itself, however, may
be slower than the older compiler, depending on the input.
<br>Own Id: OTP-3335
</UL>
<H2>Compiler 1.3</H2>
<H3>Known problems</H3>
<UL>
<LI>
When the macro <code>?MACHINE</code> is encountered by the
compiler, it
is expanded to the machine which is running the compiler,
not the machine for which the code is compiled. The latter is
almost always more useful.
<br>Own Id: OTP-2517
<LI>
<CODE>c:c(File, 'P')</CODE> does produce a .P file, but yields an
ugly error message in the process.
<br>Own Id: OTP-3054
</UL>
<H2>Compiler 1.3</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
Use of macros with circular definitions now gives an
error message,
instead of causing the compiler (or <CODE>epp</CODE>) to
hang or crash. (Checking is not done for macros which
exploit the fact that macros may end in a lone '<CODE>?</CODE>' -
use of this feature is not recommended.)
<br>Own Id: OTP-1398<br>
Aux Id: OTP-1103,OTP-1180
<LI>
Some error conditions when compiling (for example, attempting
to create a literal tuple with more than 256 elements in JAM)
were not reported as errors, but only printed on the terminal,
therefore making it appear as if the compilation succeeded.
They are now reported properly.
<br>Own Id: OTP-2620
<LI>
BEAM only: the beam compiler generates wrong code when there is
several function clauses with a common first part of a pattern
and
then a different second part of the pattern where this second
part of the pattern is built on the heap. Examples of code that
is generated wrong are:
<pre>
-module(beamfel3).
-export([handle_cast/2]).
-record(state,{e1,e2}).
<br>
handle_cast({a,DpId},State) when State ==
#state{e1=true,
e2=a} ->
process_info(DpId);
<br>
handle_cast({a,DpId},State) when State ==
#state{e1=true,
e2=b} ->
process_info(DpId).
<br>
</pre>
or like this:
<pre>
-module(beamfel2).
-export([f/2]).
<br>
f({a,DpId},16#7fffffff) ->
process_info(DpId);
<br>
f({a,DpId},16#80000000) ->
process_info(DpId).
<br>
</pre>
This codegeneration error could cause the Erlang emulator to terminate
with the message "Overrun heap and stack ...".
This is now corrected. This has also been corrected in patch erl_077
for
OTP R4B.
<br>Own Id: OTP-2821<br>
Aux Id: Seq 1271
<LI>
Failing parse transforms were confusing; now the error
message is better.
<br>Own Id: OTP-2839
<LI>
BEAM only: If the '<CODE><</CODE>' operator was used in a body context
(<CODE>Bool = Expr1 < Expr</CODE>), the compiler could crasch
or generate incorrect code. This has been corrected.
<br>Own Id: OTP-2871<br>
Aux Id: seq 1343
</UL>
<H3>Improvements and new features</H3>
<UL>
<LI>
Two functions have been added to the <CODE>compile</CODE>
module: <CODE>compile:forms/1</CODE> and
<CODE>compile:forms/2</CODE>, which are analogous to
<CODE>compile:file/[1,2]</CODE>, but take a list of forms as
their first argument (such as is returned by the
function <CODE>epp:parse_file/3</CODE>). The option
<CODE>binary</CODE> is implicit; i.e., a binary is produced,
never an object code file. If a listing file is
requested (e.g., using the option 'E'), the module
name is taken as the file name.
<br>Own Id: OTP-2621<br>
Aux Id: seq 961
<LI>
For two kinds of errors, error messages from the
compiler/linter/scanner now report the errors at the line
where they occurred instead of at the end of the file:
unterminated atoms and strings; and undefined
functions.
(For unterminated atoms and strings, the line
does not point out the start of the string, but the
line where scanning of the current form or expression began.)
<br>Own Id: OTP-2726<br>
Aux Id: seq 1156
<LI>
The compiler now evaluates expressions at
compile-time when their values are known, also eliminating
dead code from <CODE>if</CODE> and <CODE>case</CODE> expressions when only
one branch can ever be selected.
<br>Own Id: OTP-2820<br>
Aux Id: OTP-2794 WP37
<LI>
For a node A to be able to create a fun, send it to a node B
and let it execute there, it used to be the case that
the object code loaded in both nodes had to be produced
by the same compilation.
Now it is possible to use object code files produced from
the same Erlang source file, but compiled on different
occasions.
The compiler attempts to ensure that a fun produced by
one version of a module cannot be used with a different
version of the module if the source code of the modules differ.
<br>Own Id: OTP-2842<br>
Aux Id: Seq 1233
<LI>
A new construction has been added to the language: the
match operator (i.e., the = operator) can now be used
within patterns. For example, the following is now valid:
<pre> f({'+',X,Y}=T) -> {X+Y,T}.
</pre>
This often makes it possible to avoid rebuilding a term
which is already present but has no name, since it was
matched with a complex pattern. It also makes it possible
to rewrite the construction
<pre> f(X) when X == #rec{x=1, y=a} -> ...
</pre>
as
<pre> f(#rec{x=1, y=a} = X) -> ...
</pre>
In the absence of optimization for the former case, the
latter case is more efficient.
<br>
The new language feature uses no new addition to the
virtual Erlang machine, which means that a compiled module
using the new feature can be used in an old Erlang release,
provided it is not incompatible for some other reason.
<br>
The abstract representation of Erlang source code has been
augmented accordingly.
<br>Own Id: OTP-2983
<LI>
A new option <CODE>asm</CODE> expects the input file to be
a previously produced Erlang assembler file (default
file suffix ".S"). Note that the format of assembler files
is not documented, and may change between releases - this
option is primarily for internal debugging use.
The <CODE>asm</CODE> option only works for BEAM.
<br>Own Id: OTP-2988
<LI>
The <CODE>export_all</CODE> compilation option no longer produces one
warning for each function defined in a module; it produces
one single warning (since <CODE>export_all</CODE> shouldn't be used
in production code).
<br>Own Id: OTP-3020
<LI>
When compiling, warnings for functions which are not used
are now given also for functions which call only themselves.
<br>Own Id: OTP-3021<br>
Aux Id: OTP-1007
<LI>
New compiler options have been added for stopping compilation
and outputting the code at certain points. 'E' still produces
the last stage of Erlang code transformation. New options
are <CODE>dexp</CODE> and <CODE>dpe</CODE>, which produce files with
extension "<CODE>expand</CODE>" and "<CODE>parteval</CODE>",
respectively. To pass these options to the compiler via
<CODE>erlc</CODE>, prefix them with a '+'. For Beam, the new
options <CODE>dcg</CODE> and <CODE>dopt</CODE> produce files with
extension "<CODE>codegen</CODE>" and "<CODE>optimize</CODE>", respectively.
<br>Own Id: OTP-3040
<LI>
Due to an oversight, the following improvements were
left out of the documentation in previous releases:
<p>
Two adjacent literal string tokens are concatenated into
one string at compile-time (actually, by the parser).
For example, <CODE>"abc" "def"</CODE> becomes <CODE>"abcdef"</CODE>.
<p>
The compiler directives <CODE>-include(File)</CODE> and
<CODE>-include_lib(File)</CODE> are available for including header
files.
<br>Own Id: OTP-3051
<LI>
A new construction is allowed in patterns, namely a literal
string as the first operand of the ++ operator. Example:
<pre> f("prefix" ++ L) -> ...
</pre>
This is syntactic sugar for the equivalent, but harder to read
<pre> f([$p,$r,$e,$f,$i,$x | L]) -> ...
</pre>
<br>Own Id: OTP-3069
</UL>
<H2>Compiler 1.2.1</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
An incorrect reference to <CODE>asm</CODE> is removed from the
<CODE>compile</CODE> reference manual.
<br>Own Id: OTP-2619
</UL>
<H3>Improvements and new features</H3>
<UL>
<LI>
It used to be the case that ?P and ?'P' (i.e., macro names
starting with an uppercase letter) were references
to different macros. This had the consequence that the
form without quotes, which is the natural form to use,
could not be set from outside the source file (for example,
using the -D option to 'erlc'). Now, ?P and ?'P' have been
made equivalent, so that "erl -DP=1" causes both ?P and
?'P' to expand to 1.
<br>Own Id: OTP-2608
</UL>
<H2>Compiler 1.2</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
Giving floating points attributes in module attributes
(like <CODE>-vsn(1.0)</CODE>) used to crash the Erlang compiler.
This has been corrected.
<br>Own Id: OTP-2141<br>
Aux Id: seq 623, OTP-2302
</UL>
<H3>Improvements and new features</H3>
<UL>
<LI>
The <CODE>fast</CODE> option has been removed.
<br>
The object code format is partly documented
(see the <CODE>compile</CODE> module).
With the help of this documentation, tools can be written
to inspect, change, delete, or add module attributes.
Also, function call tracing can be enabled or disabled
by changing a single bit in the header of the object code.
<br>Own Id: OTP-2262<br>
Aux Id: seq 718
<LI>
The escape sequences \s in strings and $\s outside strings
now give the ASCII code for space. It is recommended to
use $\s instead of dollar followed by space, for readability
reasons. Note that $\s in earlier releases was equivalent
to $s.
<br>Own Id: OTP-2522
</UL>
<H2>R3B02 (Compiler 1.1.5)</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
A <CODE>fun</CODE> could not be used in a record initializer.
<br>Own Id: OTP-2173<br>
Aux Id: seq 649
<LI>
The compiler sometimes failed to compile modules where conditions
were invariably false (e.g. <CODE>case 1 of [X] -> ...</CODE>).
<br>Own Id: OTP-2330<br>
Aux Id: seq 791
<LI>
Using a literal atom as case expression and more than five
matching atoms, the compiler would generate a module which
cannot be loaded. This has been corrected.
<br>Own Id: OTP-2380<br>
Aux Id: seq 701,HA77209
</UL>
<H2>R3B (Compiler 1.1.4)</H2>
<H3>Improvements and new features</H3>
<UL>
<LI>
The BEAM compiler will give a diagnostic if the trace and
fast options are combined (earlier it silently ignored
the trace flag, producing fast code which couldn't trace BIFs).
<br>(*** POTENTIAL INCOMPATIBILITY ***)
<br>Own Id: OTP-1954<br>
Aux Id: seq 442
</UL>
<H2>R3A (Compiler 1.1.3)</H2>
<H3>Fixed errors and malfunctions</H3>
<UL>
<LI>
An error in the beam-compiler which caused an internal error
when compiling e.g. a list match like this: <br>
<CODE>[H | T] = foo(), </CODE> where H is not used in the function
is corrected.
<br>Own Id: OTP-1476
<LI>
In the Beam compiler, the calculation of heap usage for a
<CODE>case</CODE> or <CODE>receive</CODE> statement was overly pessimistic
in some cases, resulting in the allocation of unnecessary large
process heaps or in the extreme case a load error for the module
("Error while loading -PASS 2-").
This has been corrected.
<br>Own Id: OTP-1713
<LI>
The beam-compiler is corrected regarding a catch inside a
catch (in the same function). All exits ended up in the
outermost catch, which was wrong.
<br>Own Id: OTP-1834<br>
Aux Id: SEQ 400
</UL>
<H3>Known problems</H3>
<UL>
<LI>
Giving floating points attributes in module attributes
(like <code>-vsn(1.0)</code>) crashes the Erlang compiler.
<br>Own Id: OTP-2141
</UL>
<A NAME="2"><!-- Empty --></A><H2>2 Compiler 1.1.2</H2><P> <A NAME="2.1"><!-- Empty --></A><H3>2.1 Incompatibilities with Compiler 1.1.1</H3><P>Due to corrections listed below, all BEAM code must be
recompiled (see also release notes for ERTS).
<A NAME="2.2"><!-- Empty --></A><H3>2.2 Fixed bugs and malfunctions</H3><P><UL>
<LI> Wrong restart of send at busy or garbage collect (BEAM, fast
compiled code).
<BR>
Own Id:OTP-1420
<BR>
<LI> Bad arithmetic in guard fails instead of matching the next
clause (BEAM).
<BR>
Own Id:OTP-1422
<BR>
</UL>
<A NAME="2.3"><!-- Empty --></A><H3>2.3 Known bugs and problems</H3><P><UL>
<LI> The BEAM compiler terminates with error <CODE>beam_asm_int: EXIT</CODE>
when a list match is performed as in <CODE>[H| T] = foo()</CODE>, in case
variable <CODE>T</CODE> is subsequently used, while <CODE>H</CODE> is not.
The work-around is to write <CODE>T = tl(foo())</CODE> instead.
<BR>
Own Id: OTP-1476
<BR>
</UL>
<A NAME="3"><!-- Empty --></A><H2>3 Compiler 1.1.1</H2><P> <A NAME="3.1"><!-- Empty --></A><H3>3.1 Incompatibilities with Compiler 1.1</H3><P>Due to corrections listed below, all BEAM code must be
recompiled (see also release notes for ERTS).
<A NAME="3.2"><!-- Empty --></A><H3>3.2 Fixed bugs and malfunctions</H3><P><UL>
<LI> Correction of register allocation error in creation of tuples
in guards in BEAM.
<BR>
Own Id:OTP-1390
<BR>
<LI> Correction of compiler error for BEAM which caused <CODE>ig</CODE>
to generate erroneous code (error in nested case statements).
<BR>
Own Id:OTP-1392
<BR>
Aux Id:HA48119
<BR>
</UL>
<A NAME="4"><!-- Empty --></A><H2>4 Compiler 1.1</H2><P> <A NAME="4.1"><!-- Empty --></A><H3>4.1 Improvements and new features</H3><P><UL>
<LI>To simplify maintenance and cross compilations the two compiler
directories, compiler_jam and compiler_beam, has been merged into a
single compiler directory. Most modules names have been changed to
avoid confusion and name collisions. The only user visible change is
that the compilation target (jam or beam) can be specified in the list
of arguments. E.g.<BR>
<PRE>compile:file(foo, [beam, verbose, report]).</PRE>
</UL>
<A NAME="4.2"><!-- Empty --></A><H3>4.2 Incompatibilities with Compiler 1.0</H3><P> -
<A NAME="4.3"><!-- Empty --></A><H3>4.3 Fixed bugs and malfunctions</H3><P><UL>
<LI>Compiler crashed on "silly" record update like this:<BR>
<PRE>-record(bar, {hello}).
compilerCrash() ->
R1 = #bar{},
R2 = R1#bar{}, % <--- This causes the compiler to crash with the not_ok.</PRE>
Own Id:OTP-1204,OTP-1208
<BR>
<LI>The compiler does not check that record fields in a match are
unique. Example:<BR>
<PRE>-module(compiler_6_SUITE).
-record(foo, {bar}).
f() ->
#foo{bar = X,bar = Y} = x,
Y.
56> c(compiler_6_SUITE).
*** unset variable:'Y' in line:7</PRE>
<CODE>bar</CODE> is repeated twice in the above example and the compiler
does not detect that as an error which causes the assignment of <CODE>Y</CODE> to be silently ignored ...
<BR>
Own Id:OTP-1231
<BR>
</UL>
<A NAME="5"><!-- Empty --></A><H2>5 Compiler 1.0.1</H2><P> <A NAME="5.1"><!-- Empty --></A><H3>5.1 Improvements and new features</H3><P> -
<A NAME="5.2"><!-- Empty --></A><H3>5.2 Incompatibilities with Compiler 1.0</H3><P> -
<A NAME="5.3"><!-- Empty --></A><H3>5.3 Fixed bugs and malfunctions</H3><P><UL>
<LI> The compiler no longer crashes on too long atoms (> 255).
<BR>
Own Id: OTP-1012
<BR>
<LI> The compiler <CODE>erl_lint</CODE> did earlier assume that some
language constructs aways resided on the same line in the
source code which caused a white space to be significant
when determing an error or not. This is corrected.
<BR>
Example:
<BR>
<PRE>-module(test).
-compile(export_all).
-record(test, {a,b}).
rectest(R) when record(R, test) ->
ok.
rectest2(R) when record(R,
test) ->
ok.
(test@etxbc29)3> c(test).
./test.erl:7: illegal guard expression
</PRE>
Own Id: OTP-1077
<BR>
<LI> The compiler crashes on unsafe variable in nested case.
This is corrected.
<BR>
Own Id: OTP-1104
<BR>
</UL>
<A NAME="6"><!-- Empty --></A><H2>6 Compiler 1.0</H2><P> <A NAME="6.1"><!-- Empty --></A><H3>6.1 Improvements and new features</H3><P> <P><UL>
<LI> A new include directive <CODE>-include_lib()</CODE> is introduced.
Example:
<BR>
<PRE>-include_lib("mnesia/include/mnemosyne.hrl").
</PRE>
This instructs the compiler (preprocessor) to look for the
directory where the application called <CODE>mnesia</CODE> is
installed and then looks in the subdirectory <CODE>include</CODE>
for the file <CODE>mnemosyne.hrl</CODE>. The preprocessor first
looks in the orinary preprocessor search path to allow
explicit overloading of the include files.
<BR>
<LI> The new compiler options <CODE>{i, IncludeDir}</CODE> and {d, Def}
are introduced.
<BR>
</UL>
<A NAME="6.2"><!-- Empty --></A><H3>6.2 Incompatibilities with Compiler P1C</H3><P> There are two new reserved words <CODE>let</CODE> and <CODE>query</CODE>.
<P><UL>
<LI> <CODE>let</CODE> will be used in the future when a language construction similar to let in Lisp will be implemented.
<BR>
<LI> <CODE>query</CODE> is used when making queries to Mnesia tables
with the Mnemosyne query language.
<BR>
</UL>
<A NAME="6.3"><!-- Empty --></A><H3>6.3 Fixed bugs and malfunctions</H3><P>-
</BLOCKQUOTE>
<CENTER>
<HR>
<FONT SIZE=-1>
Copyright © 1991-99
<A HREF="http://www.ericsson.se">Ericsson Utvecklings AB</A><BR>
<!--#include virtual="/ssi/otp_footer.html"-->
</FONT>
</CENTER>
</BODY>
</HTML>
|