From 84adefa331c4159d432d22840663c38f155cd4c1 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Fri, 20 Nov 2009 14:54:40 +0000 Subject: The R13B03 release. --- lib/compiler/doc/src/Makefile | 112 +++ lib/compiler/doc/src/book.xml | 46 + lib/compiler/doc/src/compile.xml | 743 +++++++++++++++ lib/compiler/doc/src/fascicules.xml | 15 + lib/compiler/doc/src/make.dep | 19 + lib/compiler/doc/src/note.gif | Bin 0 -> 1539 bytes lib/compiler/doc/src/notes.xml | 1331 +++++++++++++++++++++++++++ lib/compiler/doc/src/notes_history.xml | 200 ++++ lib/compiler/doc/src/part_notes.xml | 39 + lib/compiler/doc/src/part_notes_history.xml | 39 + lib/compiler/doc/src/ref_man.xml | 38 + lib/compiler/doc/src/user_guide.gif | Bin 0 -> 1581 bytes lib/compiler/doc/src/warning.gif | Bin 0 -> 1498 bytes 13 files changed, 2582 insertions(+) create mode 100644 lib/compiler/doc/src/Makefile create mode 100644 lib/compiler/doc/src/book.xml create mode 100644 lib/compiler/doc/src/compile.xml create mode 100644 lib/compiler/doc/src/fascicules.xml create mode 100644 lib/compiler/doc/src/make.dep create mode 100644 lib/compiler/doc/src/note.gif create mode 100644 lib/compiler/doc/src/notes.xml create mode 100644 lib/compiler/doc/src/notes_history.xml create mode 100644 lib/compiler/doc/src/part_notes.xml create mode 100644 lib/compiler/doc/src/part_notes_history.xml create mode 100644 lib/compiler/doc/src/ref_man.xml create mode 100644 lib/compiler/doc/src/user_guide.gif create mode 100644 lib/compiler/doc/src/warning.gif (limited to 'lib/compiler/doc/src') diff --git a/lib/compiler/doc/src/Makefile b/lib/compiler/doc/src/Makefile new file mode 100644 index 0000000000..ee41a7074f --- /dev/null +++ b/lib/compiler/doc/src/Makefile @@ -0,0 +1,112 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(COMPILER_VSN) +APPLICATION=compiler + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_APPLICATION_FILES = ref_man.xml +XML_REF3_FILES = compile.xml + +XML_PART_FILES = part_notes.xml part_notes_history.xml +XML_CHAPTER_FILES = notes.xml notes_history.xml + +BOOK_FILES = book.xml + +GIF_FILES = \ + warning.gif + +XML_FILES = \ + $(BOOK_FILES) $(XML_CHAPTER_FILES) \ + $(XML_PART_FILES) $(XML_REF3_FILES) $(XML_APPLICATION_FILES) + +# ---------------------------------------------------- + +HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) + +INFO_FILE = ../../info + +MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) + +HTML_REF_MAN_FILE = $(HTMLDIR)/index.html + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +docs: pdf html man + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: gifs $(HTML_REF_MAN_FILE) + +man: $(MAN3_FILES) + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +debug opt: + +clean clean_docs: + rm -rf $(HTMLDIR)/* + rm -f $(MAN3DIR)/* + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(HTMLDIR)/* \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3 + +release_spec: + diff --git a/lib/compiler/doc/src/book.xml b/lib/compiler/doc/src/book.xml new file mode 100644 index 0000000000..fc56a837d5 --- /dev/null +++ b/lib/compiler/doc/src/book.xml @@ -0,0 +1,46 @@ + + + + +
+ + 19972009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compiler + Robert Virding + + 1997-05-02 + 1.1.2 + book.sgml +
+ + + Compiler Application (COMPILER) + + + + + + + + + + + +
+ diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml new file mode 100644 index 0000000000..c39c9b25eb --- /dev/null +++ b/lib/compiler/doc/src/compile.xml @@ -0,0 +1,743 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + compile + Robert Virding + + 1996-11-04 + A + compile.sgml +
+ compile + Erlang Compiler + +

This module provides an interface to the standard Erlang + compiler. It can generate either a new file which contains + the object code, or return a binary which can be loaded directly. +

+
+ + + + file(File) + Compile a file + +

Is the same as + file(File, [verbose,report_errors,report_warnings]). +

+
+
+ + + file(File, Options) -> CompRet + Compile a file + + CompRet = ModRet | BinRet | ErrRet + ModRet = {ok,ModuleName} | {ok,ModuleName,Warnings} + BinRet = {ok,ModuleName,Binary} | {ok,ModuleName,Binary,Warnings} + ErrRet = error | {error,Errors,Warnings} + + +

Compiles the code in the file File, which is an + Erlang source code file without the .erl extension. + Options determine the behavior of the compiler.

+ +

Returns {ok,ModuleName} if successful, or error + if there are errors. An object code file is created if + the compilation succeeds with no errors. It is considered + to be an error if the module name in the source code is + not the same as the basename of the output file.

+ +

Here follows first all elements of Options that in + some way control the behavior of the compiler.

+ + basic_validation + +

This option is fast way to test whether a module will + compile successfully (mainly useful for code generators + that want to verify the code they emit). No code will + generated. If warnings are enabled, warnings generated by + the erl_lint module (such as warnings for unused + variables and functions) will be returned too.

+ +

Use the strong_validation option to generate all + warnings that the compiler would generate.

+
+ + strong_validation + +

Similar to the basic_validation option, no code + will be generated, but more compiler passes will be run + to ensure also warnings generated by the optimization + passes are generated (such as clauses that will not match + or expressions that are guaranteed to fail with an + exception at run-time).

+
+ + binary + +

Causes the compiler to return the object code in a + binary instead of creating an object file. If successful, + the compiler returns {ok,ModuleName,Binary}.

+
+ + bin_opt_info + +

The compiler will emit informational warnings about binary + matching optimizations (both successful and unsuccessful). + See the Efficiency Guide for further information.

+
+ + compressed + +

The compiler will compress the generated object code, + which can be useful for embedded systems.

+
+ + debug_info + + +

Include debug information in the form of abstract code + (see + The Abstract Format + in ERTS User's Guide) in the compiled beam module. Tools + such as Debugger, Xref and Cover require the debug + information to be included.

+ +

Warning: Source code can be reconstructed from + the debug information. Use encrypted debug information + (see below) to prevent this.

+ +

See + beam_lib(3) + for details.

+
+ + {debug_info_key,KeyString} + + {debug_info_key,{Mode,KeyString}} + + +

Include debug information, but encrypt it, so that it + cannot be accessed without supplying the key. (To give + the debug_info option as well is allowed, but is + not necessary.) Using this option is a good way to always + have the debug information available during testing, yet + protect the source code.

+

Mode is the type of crypto algorithm to be used + for encrypting the debug information. The default type -- + and currently the only type -- is des3_cbc.

+

See + beam_lib(3) + for details.

+
+ + encrypt_debug_info + + +

Like the debug_info_key option above, except that + the key will be read from an .erlang.crypt file. +

+ +

See + beam_lib(3) + for details.

+
+ + 'P' + +

Produces a listing of the parsed code after preprocessing + and parse transforms, in the file + .P]]>. No object file is produced. +

+
+ + 'E' + +

Produces a listing of the code after all source code + transformations have been performed, in the file + .E]]>. No object file is produced. +

+
+ + 'S' + +

Produces a listing of the assembler code in the file + .S]]>. No object file is produced. +

+
+ + report_errors/report_warnings + +

Causes errors/warnings to be printed as they occur.

+
+ + report + +

This is a short form for both report_errors and + report_warnings.

+
+ + return_errors + +

If this flag is set, then + {error,ErrorList,WarningList} is returned when + there are errors.

+
+ + return_warnings + +

If this flag is set, then an extra field containing + WarningList is added to the tuples returned on + success.

+
+ + return + +

This is a short form for both return_errors and + return_warnings.

+
+ + verbose + +

Causes more verbose information from the compiler + describing what it is doing.

+
+ + {outdir,Dir} + +

Sets a new directory for the object code. The current + directory is used for output, except when a directory + has been specified with this option.

+
+ + export_all + +

Causes all functions in the module to be exported.

+
+ + {i,Dir} + +

Add Dir to the list of directories to be searched + when including a file. When encountering an + -include or -include_dir directive, + the compiler searches for header files in the following + directories:

+ + +

".", the current working directory of + the file server;

+
+ +

the base name of the compiled file;

+
+ +

the directories specified using the i option. + The directory specified last is searched first.

+
+
+
+ + {d,Macro} + + {d,Macro,Value} + +

Defines a macro Macro to have the value + Value. The default is true).

+
+ + {parse_transform,Module} + +

Causes the parse transformation function + Module:parse_transform/2 to be applied to the + parsed code before the code is checked for errors.

+
+ + asm + +

The input file is expected to be assembler code (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.

+
+ + no_strict_record_tests + +

This option is not recommended.

+ +

By default, the generated code for + the Record#record_tag.field operation verifies that + the tuple Record is of the correct size for + the record and that the first element is the tag + record_tag. Use this option to omit + the verification code.

+
+ + no_error_module_mismatch + +

Normally the compiler verifies that the module name + given in the source code is the same as the base name + of the output file and refuses to generate an output file + if there is a mismatch. If you have a good reason (or + other reason) for having a module name unrelated to the + name of the output file, this option disables that verification + (there will not even be a warning if there is a mismatch).

+
+ +
+ +

If warnings are turned on (the report_warnings option + described above), the following options control what type of + warnings that will be generated. + + With the exception of {warn_format,Verbosity} all + options below have two forms; one warn_xxx form to + turn on the warning and one nowarn_xxx form to turn off + the warning. In the description that follows, the form that + is used to change the default value is listed.

+ + + {warn_format, Verbosity} + +

Causes warnings to be emitted for malformed format + strings as arguments to io:format and similar + functions. Verbosity selects the amount of + warnings: 0 = no warnings; 1 = warnings for invalid + format strings and incorrect number of arguments; 2 = + warnings also when the validity could not be checked + (for example, when the format string argument is a + variable). The default verbosity is 1. Verbosity 0 can + also be selected by the option nowarn_format.

+
+ + nowarn_bif_clash + +

By default, there will be a compilation error if a + module contains an exported function with the same name + as an auto-imported BIF (such as size/1) AND + there is a call to it without a qualifying module name. + The reason is that the BIF will be called, not + the function in the same module. The recommended way to + eliminate that warning is to use a call with a module + name - either erlang to call the BIF or + ?MODULE to call the function in the same module. + The warning can also be turned off using this option, + but that is not recommended.

+ +

The use of this option is strongly discouraged, + as code that uses it will probably break in a future + major release (R14 or R15).

+
+ + {nowarn_bif_clash, FAs} + +

Turns off warnings as nowarn_bif_clash but only + for the mentioned local functions. FAs is a tuple + {Name,Arity} or a list of such tuples.

+

The use of this option is strongly discouraged, + as code that uses it will probably break in a future + major release (R14 or R15).

+
+ + warn_export_all + +

Causes a warning to be emitted if the export_all + option has also been given.

+
+ + warn_export_vars + +

Causes warnings to be emitted for all implicitly + exported variables referred to after the primitives + where they were first defined. No warnings for exported + variables unless they are referred to in some pattern, + which is the default, can be selected by the option + nowarn_export_vars.

+
+ + warn_shadow_vars + +

Causes warnings to be emitted for "fresh" variables + in functional objects or list comprehensions with the same + name as some already defined variable. The default is to + warn for such variables. No warnings for shadowed + variables can be selected by the option + nowarn_shadow_vars.

+
+ + nowarn_unused_function + +

Turns off warnings for unused local functions. + By default (warn_unused_function), warnings are + emitted for all local functions that are not called + directly or indirectly by an exported function. + The compiler does not include unused local functions in + the generated beam file, but the warning is still useful + to keep the source code cleaner.

+
+ + {nowarn_unused_function, FAs} + +

Turns off warnings for unused local functions as + nowarn_unused_function but only for the mentioned + local functions. FAs is a tuple {Name,Arity} + or a list of such tuples.

+
+ + nowarn_deprecated_function + +

Turns off warnings for calls to deprecated functions. By + default (warn_deprecated_function), warnings are + emitted for every call to a function known by the compiler + to be deprecated. Note that the compiler does not know + about the -deprecated() attribute but uses an + assembled list of deprecated functions in Erlang/OTP. To + do a more general check the Xref tool can be used. + See also + xref(3) + and the function + xref:m/1 also + accessible through + the c:xm/1 + function.

+
+ + {nowarn_deprecated_function, MFAs} + +

Turns off warnings for calls to deprecated functions as + nowarn_deprecated_function but only for + the mentioned functions. MFAs is a tuple + {Module,Name,Arity} or a list of such tuples.

+
+ + warn_obsolete_guard + +

Causes warnings to be emitted for calls to old type + testing BIFs such as pid/1 and list/1. See + the + Erlang Reference Manual + for a complete list of type testing BIFs and their old + equivalents. No warnings for calls to old type testing + BIFs, which is the default, can be selected by the option + nowarn_obsolete_guard.

+
+ + warn_unused_import + +

Causes warnings to be emitted for unused imported + functions. No warnings for unused imported functions, + which is the default, can be selected by the option + nowarn_unused_import.

+
+ + nowarn_unused_vars + +

By default, warnings are emitted for variables which + are not used, with the exception of variables beginning + with an underscore ("Prolog style warnings"). + Use this option to turn off this kind of warnings.

+
+ + nowarn_unused_record + +

Turns off warnings for unused record types. By + default (warn_unused_records), warnings are + emitted for unused locally defined record types.

+
+
+ +

Another class of warnings is generated by the compiler + during optimization and code generation. They warn about + patterns that will never match (such as a=b), guards + that will always evaluate to false, and expressions that will + always fail (such as atom+42).

+ +

Note that the compiler does not warn for expressions that it + does not attempt to optimize. For instance, the compiler tries + to evaluate 1/0, notices that it will cause an + exception and emits a warning. On the other hand, + the compiler is silent about the similar expression + X/0; because of the variable in it, the compiler does + not even try to evaluate and therefore it emits no warnings. +

+ +

Currently, those warnings cannot be disabled (except by + disabling all warnings).

+ + +

Obviously, the absence of warnings does not mean that + there are no remaining errors in the code.

+
+ +

Note that all the options except the include path + ({i,Dir}) can also be given in the file with a + -compile([Option,...]). attribute. + The -compile() attribute is allowed after function + definitions.

+ +

Note also that the {nowarn_unused_function, FAs}, + {nowarn_bif_clash, FAs}, and + {nowarn_deprecated_function, MFAs} options are only + recognized when given in files. They are not affected by + the warn_unused_function, warn_bif_clash, or + warn_deprecated_function options.

+ +

For debugging of the compiler, or for pure curiosity, + the intermediate code generated by each compiler pass can be + inspected. + A complete list of the options to produce list files can be + printed by typing compile:options() at the Erlang + shell prompt. + The options will be printed in order that the passes are + executed. If more than one listing option is used, the one + representing the earliest pass takes effect.

+ +

Unrecognized options are ignored.

+ +

Both WarningList and ErrorList have + the following format:

+ +[{FileName,[ErrorInfo]}]. + + +

ErrorInfo is described below. The file name has been + included here as the compiler uses the Erlang pre-processor + epp, which allows the code to be included in other + files. For this reason, it is important to know to + which file an error or warning line number refers. +

+
+
+ + + forms(Forms) + Compile a list of forms + +

Is the same as + forms(File, [verbose,report_errors,report_warnings]). +

+
+
+ + + forms(Forms, Options) -> CompRet + Compile a list of forms + + Forms = [Form] + CompRet = BinRet | ErrRet + BinRet = {ok,ModuleName,BinaryOrCode} | {ok,ModuleName,BinaryOrCode,Warnings} + BinaryOrCode = binary() | term() + ErrRet = error | {error,Errors,Warnings} + + +

Analogous to file/1, but takes a list of forms (in + the Erlang abstract format representation) as first argument. + The option binary is implicit; i.e., no object code + file is produced. Options that would ordinarily produce a + listing file, such as 'E', will instead cause the internal + format for that compiler pass (an Erlang term; usually not a + binary) to be returned instead of a binary.

+
+
+ + + format_error(ErrorDescriptor) -> chars() + Format an error descriptor + + ErrorDescriptor = errordesc() + + +

Uses an ErrorDescriptor and returns a deep list of + characters which describes the error. This function is + usually called implicitly when an ErrorInfo structure + is processed. See below.

+
+
+ + + output_generated(Options) -> true | false + Determine whether the compile will generate an output file + + Options = [term()] + + +

Determines whether the compiler would generate a beam + file with the given options. true means that a beam + file would be generated; false means that the compiler + would generate some listing file, return a binary, or merely + check the syntax of the source code.

+
+
+ + + noenv_file(File, Options) -> CompRet + Compile a file (ignoring ERL_COMPILER_OPTIONS) + +

Works exactly like file/2, + except that the environment variable ERL_COMPILER_OPTIONS + is not consulted.

+
+
+ + + noenv_forms(Forms, Options) -> CompRet + Compile a list of forms (ignoring ERL_COMPILER_OPTIONS) + +

Works exactly like forms/2, + except that the environment variable ERL_COMPILER_OPTIONS + is not consulted.

+
+
+ + + noenv_output_generated(Options) -> true | false + Determine whether the compile will generate an output file (ignoring ERL_COMPILER_OPTIONS) + + Options = [term()] + + +

Works exactly like + output_generated/1, + except that the environment variable ERL_COMPILER_OPTIONS + is not consulted.

+
+
+ +
+ +
+ Default compiler options +

The (host operating system) environment variable + ERL_COMPILER_OPTIONS can be used to give default compiler + options. Its value must be a valid Erlang term. If the value is a + list, it will be used as is. If it is not a list, it will be put + into a list.

+ +

The list will be appended to any options given to + file/2, + forms/2, and + output_generated/2. + Use the alternative functions + noenv_file/2, + noenv_forms/2, or + noenv_output_generated/2 + if you don't want the environment variable to be consulted + (for instance, if you are calling the compiler recursively from + inside a parse transform).

+
+ +
+ Inlining +

The compiler can do function inlining within an Erlang + module. Inlining means that a call to a function is replaced with + the function body with the arguments replaced with the actual + values. The semantics are preserved, except if exceptions are + generated in the inlined code. Exceptions will be reported as + occurring in the function the body was inlined into. Also, + function_clause exceptions will be converted to similar + case_clause exceptions.

+ +

When a function is inlined, the original function will be + kept if it is exported (either by an explicit export or if the + export_all option was given) or if not all calls to the + function were inlined.

+ +

Inlining does not necessarily improve running time. + For instance, inlining may increase Beam stack usage which will + probably be detrimental to performance for recursive functions. +

+ +

Inlining is never default; it must be explicitly enabled with a + compiler option or a -compile() attribute in the source + module.

+ +

To enable inlining, either use the inline option to + let the compiler decide which functions to inline or + {inline,[{Name,Arity},...]} to have the compiler inline + all calls to the given functions. If the option is given inside + a compile directive in an Erlang module, {Name,Arity} + may be written as Name/Arity.

+ +

Example of explicit inlining:

+ +
+-compile({inline,[pi/0]}).
+
+pi() -> 3.1416.
+    
+ +

Example of implicit inlining:

+
+-compile(inline).
+    
+ +

The {inline_size,Size} option controls how large functions + that are allowed to be inlined. Default is 24, which will + keep the size of the inlined code roughly the same as + the un-inlined version (only relatively small functions will be + inlined).

+ +

Example:

+
+%% Aggressive inlining - will increase code size.
+-compile(inline).
+-compile({inline_size,100}).
+    
+
+ +
+ Parse Transformations + +

Parse transformations are used when a programmer wants to use + Erlang syntax but with different semantics. The original Erlang + code is then transformed into other Erlang code.

+
+ +
+ Error Information + +

The ErrorInfo mentioned above is the standard + ErrorInfo structure which is returned from all IO modules. + It has the following format:

+ +{ErrorLine, Module, ErrorDescriptor} + + +

A string describing the error is obtained with the following + call:

+ +apply(Module, format_error, ErrorDescriptor) + +
+ +
+ See Also +

+ epp(3), + erl_id_trans(3), + erl_lint(3), + beam_lib(3) +

+
+
+ diff --git a/lib/compiler/doc/src/fascicules.xml b/lib/compiler/doc/src/fascicules.xml new file mode 100644 index 0000000000..43090b4aed --- /dev/null +++ b/lib/compiler/doc/src/fascicules.xml @@ -0,0 +1,15 @@ + + + + + + Reference Manual + + + Release Notes + + + Off-Print + + + diff --git a/lib/compiler/doc/src/make.dep b/lib/compiler/doc/src/make.dep new file mode 100644 index 0000000000..f5c097afad --- /dev/null +++ b/lib/compiler/doc/src/make.dep @@ -0,0 +1,19 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: book.tex compile.tex ref_man.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +book.tex: ref_man.xml + diff --git a/lib/compiler/doc/src/note.gif b/lib/compiler/doc/src/note.gif new file mode 100644 index 0000000000..6fffe30419 Binary files /dev/null and b/lib/compiler/doc/src/note.gif differ diff --git a/lib/compiler/doc/src/notes.xml b/lib/compiler/doc/src/notes.xml new file mode 100644 index 0000000000..7d1913d740 --- /dev/null +++ b/lib/compiler/doc/src/notes.xml @@ -0,0 +1,1331 @@ + + + + +
+ + 20042009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compiler Release Notes + otp_appnotes + nil + nil + nil + notes.xml +
+

This document describes the changes made to the Compiler + application.

+ +
Compiler 4.6.4 + +
Fixed Bugs and Malfunctions + + +

The compiler's 'E' option now works with modules with + types and specifications.

+

+ Own Id: OTP-8238 Aux Id: OTP-8150

+
+ +

+ Certain uses of binary matching in a + begin-end in a list comprehension could + cause the compiler to crash or generate incorrect code.

+

+ Own Id: OTP-8271

+
+
+
+ + +
Improvements and New Features + + +

+ The documentation is now built with open source tools + (xsltproc and fop) that exists on most platforms. One + visible change is that the frames are removed.

+

+ Own Id: OTP-8201

+
+ +

+ The compiler could crash if invalid calls to is_record/2 + was used in (for example) a list comprehension. (Thanks + to Tobias Lindahl.)

+

+ Own Id: OTP-8269

+
+ +

The -on_load() directive can be used to run a function + when a module is loaded. It is documented in the section + about code loading in the Reference Manual.

+

+ Own Id: OTP-8295

+
+
+
+ +
+ +
Compiler 4.6.3 + +
Improvements and New Features + + +

Corrected liveness optimization to eliminate a + compiler crash that could occur when compiling bit syntax + construction code. (Thanks to Mikage Sawatari.)

+

Calling BIFs such as length/1 in guard context + in a try/catch block could cause a compiler crash. + (Thanks to Paul Fisher.)

+

Using filter expressions containing andalso or + orelse in a list comprehension could cause a + compiler crash. (Thanks to Martin Engström.)

+

+ Own Id: OTP-8054

+
+ +

+ A guard with nested 'not' operators could cause the + compiler to crash. (Thanks to Tuncer Ayaz.)

+

+ Own Id: OTP-8131

+
+
+
+ +
+ +
Compiler 4.6.2 + +
Fixed Bugs and Malfunctions + + +

+ The compiler would crash while compiling certain complex + function bodies containing receive after due to a + bug in the jump optimizer (a label that had only had + backward references could still be removed). (Thanks to + Vincent de Phily.)

+

+ Own Id: OTP-7980

+
+
+
+ +
+ +
Compiler 4.6.1 + +
Fixed Bugs and Malfunctions + + +

+ Miscellaneous minor bugs fixed.

+

+ Own Id: OTP-7937

+
+
+
+ + +
Improvements and New Features + + +

+ There will be more efficient code if there is a clause + that matches the empty binary and no other clauses that + matches non-empty binaries.

+

+ Own Id: OTP-7924

+
+ +

There is new option to allow a module to have a module + name other than the filename. Do not use it unless you + know what you are doing.

+

+ Own Id: OTP-7927

+
+
+
+ +
+ +
Compiler 4.6.0.1 + +
Fixed Bugs and Malfunctions + + +

Using andalso/orelse or record access in + a try...catch could cause a compiler + crash.

+

Som large and complex functions could require + extremely long compilation times (hours or days).

+

+ Own Id: OTP-7905

+
+
+
+ +
+ +
Compiler 4.6 + +
Fixed Bugs and Malfunctions + + +

+ For some complex guards which used + andalso/orelse, the compiler would crash. + (Thanks to Hunter Morris.)

+

+ Own Id: OTP-7679

+
+ +

+ Code that (incorrectly) used the the value of nested + applications of setelement/3 in bit syntax + construction could crash the compiler.

+

+ Own Id: OTP-7690

+
+ +

Modules containing huge integers (consisting of + several hundreds of thousands of digits or more) could be + slow to compile. This problem has been corrected.

+

+ Own Id: OTP-7707 Aux Id: seq11129

+
+ +

If the generator in a list comprehension is given a + non-list term, there will now be function_clause + exception instead of a case_clause exception (as + it was in all releases before R12B).

+

+ Own Id: OTP-7844

+
+
+
+ + +
Improvements and New Features + + +

+ The compiler could crash if the size for a binary segment + in matching was a complex literal such as binary or + tuple.

+

+ Own Id: OTP-7650

+
+ +

+ The compiler generates more compact and faster code for + matching of complex constants (such as constant lists and + tuples).

+

+ Own Id: OTP-7655

+
+ +

+ The undocumented, unsupported, and deprecated guard BIF + is_constant/1 has been removed.

+

+ *** INCOMPATIBILITY with R12B ***

+

+ Own Id: OTP-7673

+
+ +

The compiler generates better code for many guard + expressions, and especially for guards that use + andalso/orelse or record fields.

+

(In technical terms, andalso/orelse in a + guard would case the creation of a stack frame and saving + of all x registers that could potentially be alive after + the guard and restoring all x registers before leaving + the guard. For certain guards, far too many x registers + were saved and subsequently restored. In this version of + the compiler, no stack frame is created and no x + registers are saved and restored.)

+

+ Own Id: OTP-7718

+
+ +

The default size for the resulting binary created by a + binary comprehension was 64Kb in R12B (it would grow if + needed). This was often far too much. In this release, + the default is changed to 256 bytes. Furthermore, for + most binary comprehensions without filters, the exact + size of the resulting binary can be calculated beforehand + and the compiler now generates code that does that + calculation.

+

+ Own Id: OTP-7737

+
+ +

The short-circuit operators andalso and + orelse no longer guarantees that their second + argument is either true or false. As a + consequence, andalso/orelse are now + tail-recursive.

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7748

+
+ +

The compiler will refuse to a compile file where the + module name in the file differs from the output file + name.

+

When compiling using erlc, the current working + directory will no be included in the code path (unless + explicitly added using "-pa .").

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7793

+
+ +

There will no longer be any warnings for list + comprehensions without generators, as such list + comprehension have turned out to be useful.

+

+ Own Id: OTP-7846

+
+ +

Warnings for obsolete guard tests are now turned on. + (That is, writing list(L) in a guard instead of + is_list(L) will generate a warning.)

+

The warnings can be turned off using the + nowarn_obsolete_guard option.

+

+ Own Id: OTP-7850

+
+ +

The copyright notices have been updated.

+

+ Own Id: OTP-7851

+
+ +

If a module contains an exported function with the + same name as an auto-imported BIF (such as + length/1), any calls to the BIF must have an + explicit erlang: prefix, or there will be a + compilation error (such calls would only generate a + warning in previous releases).

+

(The reason for the change is to avoid breaking code + in a future major release, R14 or R15, in which we plan + to make calls without a module prefix always call the + local function in the same module even if there is an + auto-imported BIF with the same name.)

+

+ *** POTENTIAL INCOMPATIBILITY ***

+

+ Own Id: OTP-7873

+
+
+
+ +
+ +
Compiler 4.5.5 + +
Fixed Bugs and Malfunctions + + +

Matching on a zero-width segment in the bit syntax + would crash the compiler. (Thanks to Will.)

+

+ Own Id: OTP-7591

+
+
+
+ + +
Improvements and New Features + + +

+ In bit syntax expressions which started with a binary + segment, and was followed by at least two segments of + variable size, too little space could be allocated for + the binary, leading to memory corruption.

+

+ Own Id: OTP-7556

+
+ +

In user-defined attributes, Name/Arity is now + allowed and will be translated to {Name,Arity}. + (An implementation of EEP-24 by Richard O'Keefe.)

+

The module_info/{0,1} functions automatically + inserted into each compiled modules are now documented in + the Modules section in the Reference Manual.

+

+ Own Id: OTP-7586

+
+
+
+ +
+ +
Compiler 4.5.4 + +
Improvements and New Features + + +

+ Certain complex bit syntax matching operations matching + out binaries and having several clauses could give + incorrect results (the matched out binaries were too + short). (Thanks to Christian von Roques for bug report + and correction.)

+

+ Own Id: OTP-7498

+
+
+
+ +
+ +
Compiler 4.5.3 + +
Improvements and New Features + + +

+ New option warn_export_all to warn for a module + using export_all. (Thanks to Richard Carlsson.)

+

+ Own Id: OTP-7392

+
+
+
+ +
+ +
Compiler 4.5.2.1 + +
Fixed Bugs and Malfunctions + + +

+ In rare circumstances, the length/1 BIF (and a few other + guard BIFs) would seem to return an incorrect value (of + any type).

+

+ Own Id: OTP-7345 Aux Id: seq10962

+
+
+
+ +
+
Compiler 4.5.2 + +
Fixed Bugs and Malfunctions + + +

A bug in the old inliner has been fixed. Some + undocumented functionality has been removed.

+

+ Own Id: OTP-7223

+
+ +

Matching several binary patterns in parallel using the + '=' operator is not allowed (an implementation + limitation), but the compiler did not reject all such + attempts (depending on the patterns, the generated code + might or might not work correctly). Now the compiler + rejects all binary patterns joined by '='.

+

+ Own Id: OTP-7227

+
+ +

Complex combinations of record operations and binary + matching could cause the compiler to crash. (Thanks to + Vladimir Klebansky.)

+

+ Own Id: OTP-7233

+
+ +

+ In rare circumstances, mixing binary matching clauses + with clauses matching other data types, the compiler + could crash.

+

+ Own Id: OTP-7240 Aux Id: seq10916

+
+
+
+ +
+ +
Compiler 4.5.1.1 + +
Fixed Bugs and Malfunctions + + +

+ Corrected a compiler bug that could cause a complex + binary matching operation to fail when it shouldn't. + (Thanks to Tomas Stejskal.)

+

+ Own Id: OTP-7188

+
+ +

+ In unusual circumstances, the environment for a fun could + bind wrong values.

+

+ Own Id: OTP-7202 Aux Id: seq10887

+
+ +

Long sequences of list comprehensions without + generators joined by the '++' operator would cause a code + expansion explosion, which could cause the compiler to + run out of memory. To resolve this problem, in + '[...||...]++Expr', Expr is now evaluated + before the list comprehension. This change is + backwards compatible (see the following note about + evaluation order if you have doubts).

+

Note about evaluation order: The Reference manual says + that subexpressions are evaluated in any order + before the expression itself. Therefore, in an expression + such as 'LeftExpr++RightExpr', you should not + depend on LeftExpr being evaluated before + RightExpr or vice versa. The evaluation order is + only important if the expressions contains and/or depends + on operations with side-effects, such as message passing + or ets operations.

+

+ Own Id: OTP-7206

+
+
+
+ +
+ + +
Compiler 4.5.1 + +
Fixed Bugs and Malfunctions + + +

+ A match expression inside a function call could cause a + false "a term is constructed but never used" warning.

+

+ Own Id: OTP-7018 Aux Id: seq10824

+
+ +

The compiler could crash if a binary tail was matched + out, and then used in a binary append operation. (Thanks + to Oleg Avdeev.)

+

Similarly, the compiler could crash if a binary tail + was matched out, and then used (incorrectly) in binary + construction in an integer field. (Thanks to Fredrik + Svahn.) Or was incorrectly used in a float field. Or was + used in a binary field with a given length. (Thanks to + Chih - Wei Yu.)

+

+ Own Id: OTP-7022

+
+ +

+ Matching an empty binary in a record and then using the + same record again could cause a compiler crash. (Thanks + to Fredrik Thulin.)

+

+ Own Id: OTP-7029

+
+ +

In rare circumstances, constants containing floating + points and integers could be confused. Example:

+

f(a) -> [1]; f(b) -> [1.0].

+

Both f(a) and f(b) would return + [1].

+

+ Own Id: OTP-7073

+
+ +

Some bit syntax code such as

+

matching d(_,<$lt;$gt;$gt;) -> one; d(0,<$lt;D$gt;$gt;) + ->two.

+

could crash the compiler. (Thanks to Simon + Cornish.)

+

+ Own Id: OTP-7094

+
+ +

+ In unusual circumstances, a call to a fun could fail due + to an unsafe optimization. (Thanks to Simon Cornish.)

+

+ Own Id: OTP-7102

+
+ +

+ Bit syntax matching with a guard containing two or more + uses of andalso/orelse could cause the compiler to crash. + (Thanks to Mateusz Berezecki.)

+

+ Own Id: OTP-7113

+
+ +

+ This was only a problem if you generated or wrote your + own Core Erlang code: The Core Erlang optimizer code + could move nested calls such as + erlang:'$lt;'(erlang:length(L), 2) as case expression + into a guard, which would change the semantics. (Thanks + to Robert Virding.)

+

+ Own Id: OTP-7117

+
+
+
+ + +
Improvements and New Features + + +

+ The compiler could generate suboptimal code for record + updates if the record update code consisted of multiple + source code lines.

+

+ Own Id: OTP-7101

+
+
+
+ +
+ +
Compiler 4.5 + +
Fixed Bugs and Malfunctions + + +

The compiler used to allow that a binary field without + size could be used in other positions than at the end in + bit syntax pattern. For instance, + > = Bin]]> + used to compile, but now the compilation will fail with + an an error message.

+

Also, it is now longer permitted to give a literal + string in a binary pattern a type or a size; for + instance, > = Bin]]> will + no longer compile. (In previous releases, there would + always be a badmatch exception at run-time.)

+

+ Own Id: OTP-6885

+
+
+
+ + +
Improvements and New Features + + +

+ Bitstrings (bit-level) binaries and binary comprehensions + are now part of the language. See the Reference Manual.

+

+ Own Id: OTP-6558

+
+ +

+ The 'compressed' option for the compiler has been + documented.

+

+ Own Id: OTP-6801

+
+ +

If the value of a list comprehension is not used, such + as in '[do_something(X) || X <- List], ok', a + result list will no longer be built. For more details, + see the Efficiency Guide.

+

If the value of an expression is not used, and the + expression has no side effects except for possibly + throwing an exception, a warning will be generated. + Examples: 'self(),ok' and + '{error,Reason},ok'.

+

+ Own Id: OTP-6824

+
+ +

+ Three new functions have been added to the compile + module: noenv_file/2, noenv_forms/2, and + noenv_output_generated/1.

+

+ Own Id: OTP-6829

+
+ +

Many bit syntax operations, both construction and + matching, are faster. For further information, see the + Efficiency Guide.

+

+ Own Id: OTP-6838

+
+ +

Literal lists, tuples, and binaries are no longer + constructed at run-time as they used to be, but are + stored in a per-module constant pool. Literals that are + used more than once are stored only once.

+

This is not a change to the language, only in the + details of its implementation. Therefore, the + implications of this change is described in the + Efficiency Guide.

+

Example 1: In the expression element(BitNum-1, + {1,2,4,8,16,32,64,128}), the tuple used to be + constructed every time the expression was executed, which + could be detrimental to performance in two ways if the + expression was executed in a loop: the time to build the + tuple itself and the time spent in garbage collections + because the heap filled up with garbage faster.

+

Example 2: Literal strings, such as "abc", used + to be stored in the compiled code compactly as a byte + string and expanded to a list at run-time. Now all + strings will be stored expanded to lists (such as + [$a,$b,$c]) in the constant pool. That means that + the string will be faster to use at run-time, but that it + will require more space even when not used. If space is + an issue, you might want to use binary literals (that is, + <<"abc"<<) instead of string literals for + infrequently used long strings (such as error + messages).

+

+ Own Id: OTP-6850

+
+ +

+ Recursive calls now usually consume less stack than in + R11B. See the Efficiency Guide.

+

+ Own Id: OTP-6862 Aux Id: seq10746

+
+ +

Two new guard BIFs have been introduced as a + recommended replacement for size/1. (The + size/1 BIF will be removed no earlier than in + R14B.) The BIFs are tuple_size/1 to calculate the + size of a tuple and byte_size/1 to calculate the + number of bytes needed for the contents of the binary or + bitstring (rounded up to the nearest number of bytes if + necessary).

+

There is also a new bit_size/1 BIF that returns + the exact number of bits that a binary or bitstring + contains.

+

+ Own Id: OTP-6902

+
+ +

+ The two internal functions erl_bifs:is_bif/3 and + erl_bifs:is_guard/3 have been removed. They were + unsupported, undocumented, and unmaintained.

+

+ Own Id: OTP-6966

+
+
+
+ +
+ +
+ Compiler 4.4.5 + +
+ Fixed Bugs and Malfunctions + + +

The compiler would crash if you tried to combine to + non-list literals with '' (for instance, + ).

+

Own Id: OTP-6630 Aux Id: seq10635

+
+
+
+ +
+ Improvements and New Features + + +

Minor Makefile changes.

+

Own Id: OTP-6689

+
+
+
+
+ +
+ Compiler 4.4.4 + +
+ Fixed Bugs and Malfunctions + + +

Incorrect code could be generated for bit syntax matching + if the old inliner was used with aggressive settings.

+

Own Id: OTP-6461

+
+
+
+
+ +
+ Compiler 4.4.3 + +
+ Fixed Bugs and Malfunctions + + +

The R10B compiler could generate unsafe + instructions that could cause + memory corruption. (The R11B compiler does not have that + problem.) The erlang emulator will now refuse to load + R10B-compiled modules that contain such unsafe + instructions. In addition, the + beam_validator module in the compiler will also reject + such instructions (in case it is used to validate R10B + code). (Thanks to Matthew Reilly.)

+

Own Id: OTP-6386

+
+
+
+ +
+ Improvements and New Features + + +

Directives for parse transforms that have been run are + now removed from the abstract code stored when the + debug_info option is given, to prevent the parse + transforms to be run again.

+

Own Id: OTP-5344

+
+ +

Minor improvements in code generation for some guards + expression involving boolean expressions.

+

Own Id: OTP-6347

+
+
+
+
+ +
+ Compiler 4.4.2.1 + +
+ Fixed Bugs and Malfunctions + + +

The compiler could generate incorrect code for bit syntax + matching consisting of several clauses.

+

Own Id: OTP-6392 Aux Id: seq10539

+
+
+
+
+ +
+ Compiler 4.4.2 + +
+ Fixed Bugs and Malfunctions + + +

Defining a fun itself containing a fun in an + block of a would cause the + compiler to crash or generate incorrect code. (Thanks to + Tim Rath.)

+

Shorter compilation times for modules containing with + an extreme number of functions (10000 functions or more).

+

(The compiled could generate deprecated instructions + for certain bit syntax matching operations.)

+

Own Id: OTP-6212 Aux Id: seq10446

+
+ +

Fixed several bugs that would cause warnings to be shown + without file name and line number.

+

Own Id: OTP-6260 Aux Id: seq10461

+
+
+
+ +
+ Improvements and New Features + + +

The option is now default; + that is, reading a field from a record using the + syntax will fail if + is not a record of the correct type.

+

If necessary, the record tests can be turned off by + giving the option. To avoid + editing Makefiles, the environment variable + can be set to + "".

+

The option will probably + be removed in the R12B release.

+

*** POTENTIAL INCOMPATIBILITY ***

+

Own Id: OTP-6294

+
+
+
+
+ +
+ Compiler 4.4.1 + +
+ Fixed Bugs and Malfunctions + + +

The compiler used to crash if a module contained code + similar to ' ok end]]>'. (Thanks to + Richard Carlsson.)

+

The compiler would spend really long time compiling + bit syntax expressions such as + '>]]>' and produce a huge .beam + file. Corrected.

+

The compiler would compile list comprehensions with + many generators really, really slow. (Thanks to Thomas + Raes.)

+

Module attributes would be stored in reverse order + compared to the order in the source code. (Thus, + would also return the + attributes in reversed order.)

+

Defining a fun in an block of a + would cause the compiler to crash or generate + incorrect code. (Thanks to Martin Bjorklund.)

+

The combination of binary pattern and a guard with + andalso/orelse could cause the compiler to crash.

+

Own Id: OTP-6121 Aux Id: seq10400

+
+
+
+
+ +
+ Compiler 4.4 + +
+ Fixed Bugs and Malfunctions + + +

When a file is included using + , the include path is temporarily + updated to include the directory the file was + found in, which will allow that file to itself + include files from the same directory using + . (Thanks to Richard Carlsson.)

+

Own Id: OTP-5944

+
+
+
+ +
+ Improvements and New Features + + +

The and operators are + now allowed to be used in guards. That also applies to + match specifications.

+

Own Id: OTP-5894 Aux Id: OTP-5149

+
+ +

When given the new option + , the compiler will generate + code that verifies the record type for + operations in guards. Code that + verifies record types in bodies has already been + generated since R10B, but in this release there will be a + instead of a + if the record verification test fails. + See for more information.

+

The Erlang shell always applies strict record tests.

+

Own Id: OTP-5915 Aux Id: OTP-5714

+
+ +

The BIF can now be used in guards. + Also, can now be called without an + module prefix for consistency with the other + functions.

+

Own Id: OTP-5916

+
+ +

The compiler options and + , which allowed code that used + unquoted or as atoms or record + tags, has been removed. Old code that depended on the + options need to be revised to have occurrences of + or as atom or record tags + single-quoted. (Note: Although is a reserved + keyword, there is no statement. It might be + introduced in a future release.)

+

*** POTENTIAL INCOMPATIBILITY ***

+

Own Id: OTP-6058

+
+
+
+
+ +
+ Compiler 4.3.12 + +
+ Improvements and New Features + + +

The following code would crash the compiler: T #r{s = "x"} end]]>. (Thanks to + Richard Carlsson.)

+

The compiler could crash if binaries were constructed + in certain guards involving boolean operators (including + semicolon). (Thanks to Torbjorn Tornkvist.)

+

Own Id: OTP-5872

+
+ +

The compiler will now warn that the + function is deprecated.

+

Own Id: OTP-5976

+
+
+
+
+ +
+ Compiler 4.3.11 + +
+ Improvements and New Features + + +

The compiler would assume that some patterns with + aliases ('=') would not match if they were split into + several lines. (Thanks to Peter Nagy/Mats Cronqvist.)

+

Minor cleanups to eliminate Dialyzer warnings.

+

Own Id: OTP-5791 Aux Id: seq10141

+
+
+
+
+ +
+ Compiler 4.3.10 + +
+ Fixed Bugs and Malfunctions + + +

When given the new option + , the compiler will generate + code that verifies the record type for + operations (in body context only, + not in guards). See the documentation for the + module for more information.

+

The beam validator pass of the compiler could crash + given in rare circumstances when given certain + combinations of catches and record operations. (Thanks to + Mats Cronqvist.)

+

Attributes containing binaries (such as -a(<<1,2,3>>)) + would crash the compiler. (Thanks to Roger Price.)

+

Multiple behaviours in the same module will no longer + generate a warning, unless one or more callbacks for the + behaviours overlap. For instance, using both the + and behaviours + in the same module will NOT generate any warning, but + using and will.

+

Own Id: OTP-5714 Aux Id: seq10073

+
+ +

The pre-processor used to complain that the macro + definition was circular, + which it isn't. (Thanks to Richard Carlsson.)

+

Own Id: OTP-5777

+
+
+
+
+ +
+ Compiler 4.3.9 + +
+ Fixed Bugs and Malfunctions + + +

Updating at least two fields of a record with a literal + string could cause the compiler to generate dangerous + code that could cause a crash at run-time (e.g. + ). (Thanks to Mikael Karlsson.)

+

Unecessary tests (such as a 'case' with two case + branches that were identical) could cause the compiler to + crash. (Thanks to Fredrik Thulin.)

+

The validation pass of the compiler could generate an + error for correct code when floating point operations + were used in try/catch statements.

+

In bit syntax construction, any field following a + binary field would always be marked as "aligned" (which + may or may not be correct). That would cause the hipe + native compiler to generate incorrect code if the field + was in fact unaligned. (Thanks to Per Gustafsson.)

+

Some complex guard expressions (such as ) would crash the compiler. (Thanks + to Sean Hinde.)

+

Compilation speed has been increased for modules with + many functions and/or atoms (such as modules generated by + the Asn1 application or other code generators).

+

Own Id: OTP-5632 Aux Id: seq10057

+
+
+
+
+ +
+ Compiler 4.3.8 + +
+ Fixed Bugs and Malfunctions + + +

In some circumstances, having two try/catch constructs + following each in a function body, would cause an + internal error to be generated (when in fact the + generated code was correct). (Thanks to Fredrik Thulin.)

+

Incorrect calls such as would crash the + compiler. The compiler now generates a warning. (Thanks + to Ulf Wiger.)

+

Own Id: OTP-5553

+
+
+
+ +
+ Improvements and New Features + + +

The new construct creates a fun that + refers to the latest version of . This syntax is + meant to replace tuple funs which have many + problems.

+

The new type test (which may be + used in guards) test whether is a fun that can be + applied with arguments. (Currently, can + also be a tuple fun.)

+

Own Id: OTP-5584

+
+
+
+
+ +
+ Compiler 4.3.7 + +
+ Improvements and New Features + + +

Further improvements of encrypted debug info: New option + for compiler.

+

Own Id: OTP-5541 Aux Id: seq9837

+
+
+
+
+ +
+ Compiler 4.3.6 + +
+ Fixed Bugs and Malfunctions + + +

Fixed a bug in the validator of the generated code + (beam_validator) which caused an internal compiler error + even though the generated code was indeed correct.

+

Own Id: OTP-5481 Aux Id: seq9798

+
+
+
+ +
+ Improvements and New Features + + +

It is now possible to encrypt the debug information in + Beam files, to help keep the source code secret. See the + documentation for on how to provide the key + for encrypting, and the documentation for + on how to provide the key for decryption so that tools such + as the Debugger, Xref, or Cover can be used.

+

The functions now accepts an + additional chunk type to retrieve + the compilation information directly as a term. (Thanks + to Tobias Lindahl.)

+

Own Id: OTP-5460 Aux Id: seq9787

+
+
+
+
+ +
+ Compiler 4.3.5 + +
+ Fixed Bugs and Malfunctions + + +

Complex functions could cause the internal validator in + the compiler to generate an internal error even though + the generated code was correct.

+

Own Id: OTP-5436 Aux Id: seq9781

+
+
+
+
+ +
+ Compiler 4.3.4 + +
+ Fixed Bugs and Malfunctions + + +

In rare circumstances, incorrect code for record or + tuple access could be generated. The incorrect code would + either trigger an internal error in the compiler or cause + an exception at run time. (Thanks to Martin Bjorklund.)

+

Corrected a bug in in bit syntax matching where + clauses could match in the wrong order. (Thanks to Ulf + Wiger.)

+

Own Id: OTP-5404 Aux Id: seq9767

+
+
+
+
+ +
+ Compiler 4.3.3 + +
+ Improvements and New Features + + +

Given bit syntax construction in certain complex + contexts involving a catch, the compiler would either + crash or terminate due to failure in an internal + consistency check. (Thanks to Fredrik Thulin.)

+

Matches such as + > = <<103133:64/float>>]]> + used to fail. Now they succeed.

+

Shadowing of variables in bit syntax matches in fun heads + such as in + >) -> B end]]> was + handled incorrectly by the compiler. The fun used to be + compiled as if it was written + 'fun(<<8:8,B:8>>)]]>, while it should be + compiled in the same way as >)]]>.

+

A bug in the validation pass has been corrected. It + sometimes occurred when the compiler optimized by reusing + code for causing an exception when the reused code was + called from within catch or try-catch statements. Then the + validator refused to approve the code and complained about + >) -> B end]]> was handled + incorrectly by the in the same way as + >)]]>.

+

A bug in the unknown_catch_try_state.

+

Corrected a bug in the optimizer that would cause + the compiler to crash. (Thanks to Peter-Henry Mander.)

+

There are now warnings generated if a bit syntax + construction will fail at run-time because of a type + mismatch (e.g. >]]>).

+

Own Id: OTP-5342 Aux Id: OTP-5118, OTP-5270, OTP-5323

+
+ +

Binary pattern matching such as + > = <)]]> used to silently + fail at runtime (i.e. never match). The compiler now + generates an error for any such patterns.

+

Own Id: OTP-5371

+
+
+
+
+ +
+ Compiler 4.3.2 + +
+ Fixed Bugs and Malfunctions + + +

In rare cases, the code compiler code generate code + for a tuple match that could crash the emulator if passed + a term that was not a tuple.

+

If a bit syntax construction failed within a catch, + previously assigned variables could get the wrong value.

+

The compiler now runs a validation pass on the + generated code and aborts before writing a Beam file if + any suspect code is found. In particular, the validation + pass checks for incorrect code that may cause emulator + crashes or other strange symptoms in the emulator.

+

Some corrections to the unsupported feature + parameterized modules by Richard Carlsson (HiPE).

+

Own Id: OTP-5247 Aux Id: OTP-5235

+
+
+
+
+ +
+ Compiler 4.3.1 + +
+ Fixed Bugs and Malfunctions + + +

Corrected the release note regarding below. + DOES work in the initial R10B release.

+

A few minor issues code generation issues were corrected. + Although the generated code was correct, it was slightly + slower and larger than it needed to be.

+

A debug printout (that could be seen in rare + circumstances) has been removed.

+

and + similar expressions in a guard would fail.

+

New options and + to do a quick check of the code + of a module.

+

The option was not recognized if it + appeared in a directive inside the + module.

+

Corrected some bugs in the undocumented feature + "parameterized modules".

+

Own Id: OTP-5198

+
+ +

When the undocumented feature "parameterized modules" was + used, the macro did not work correctly.

+

Own Id: OTP-5224

+
+
+
+
+
+ diff --git a/lib/compiler/doc/src/notes_history.xml b/lib/compiler/doc/src/notes_history.xml new file mode 100644 index 0000000000..db0dc2f683 --- /dev/null +++ b/lib/compiler/doc/src/notes_history.xml @@ -0,0 +1,200 @@ + + + + +
+ + 20062009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compiler Release Notes History + otp_appnotes + nil + nil + nil +
+ +
+ Compiler 4.3 + +
+ Fixed Bugs and Malfunctions + + +

The semantics for boolean operators in guards have + been changed to be more consistent.

+

All boolean operators will fail if given non-boolean + arguments; '' used to succeed but + will now fail. Also, failure in the evaluation of + the operands will also cause the guard to fail; + '' used to succeed but will + now fail.

+

Semicolon will behave as it used to. If a failure as + described above occurs, evaluation will continue with + the right operand of the semicolon.

+

*** POTENTIAL INCOMPATIBILITY ***

+

Own Id: OTP-4623

+
+ +

attributes inside an Erlang module + can now contain compiler options that control warnings + (such as ). They used to be ignored.

+

Own Id: OTP-4911

+
+ +

When a record was updated, and the record given as an + expression (such as function call), the record could be + evaluated more than once.

+

Own Id: OTP-4933

+
+ +

Compilation of modules with long strings could be + extremely slow.

+

Own Id: OTP-4960 Aux Id: seq8310

+
+ +

In bit syntax matching with clauses having guards, + sometimes the following clauses would never match if a + guard was evaluated (and failed).

+

Own Id: OTP-4961 Aux Id: seq8338, OTP-4891

+
+ +

Using multiple matching ('=') in the pattern for a + generator in list comprehension would cause an internal + compiler error.

+

Example:

+ +

Own Id: OTP-5076 Aux Id: OTP-5092

+
+ +

List and string literals, and integer and character + literals were not equivalent in matching as they should + be. For instance, would never match.

+

Own Id: OTP-5092 Aux Id: OTP-5076

+
+
+
+ +
+ Improvements and New Features + + +

The compiler used to warn for definition of functions + having the same name as an auto-imported BIF (such as + ). In the R10B release, such warnings will + only be emitted if the function is NOT exported (because it + will be impossible to call it). Instead, there will be a + warning for any local call (call without module prefix) + to any (exported) function in the same module that is + also the name of an auto-imported BIF. To avoid the + warning, insert a module prefix (either to + call the BIF, or the name of the module to call function in + the module).

+

Own Id: OTP-4909

+
+ +

The unary '+' operator has been changed to throw an + exception if its argument is not numeric (or + fail in a guard). It used its argument unchanged whatever + the type. Given the new meaning, unary '+' can now be + used to test whether a term is numeric.

+

*** POTENTIAL INCOMPATIBILITY ***

+

Own Id: OTP-4928

+
+ +

The compiler now warns for more types of suspect code, + such as expressions that will fail at run-time (such as + ), guards that are always false, or + patterns that cannot match.

+

Own Id: OTP-5098 Aux Id: seq8965, OTP-2456

+
+ +

The long-awaited ... construction + is included in this release. See the reference manual + for how to use it.

+

Own Id: OTP-5150

+
+
+
+
+ +
+ Compiler 4.2.3 + +
+ Fixed Bugs and Malfunctions + + +

The compiler could generate incorrect code for receive + clauses did not use the message in any way, for instance + if a guard would ignore message depending on some + condition not based on the contents of the message (e.g. + a state variable in the "loop data").

+

Own Id: OTP-5050

+
+
+
+
+ +
+ Compiler 4.2.2 + +
+ Fixed Bugs and Malfunctions + + +

Compilation of modules with long strings could be + extremely slow.

+

Own Id: OTP-4960 Aux Id: seq8310

+
+ +

In bit syntax matching with clauses having guards, + sometimes the following clauses would never match if a + guard was evaluated (and failed).

+

Own Id: OTP-4961 Aux Id: seq8338, OTP-4891

+
+ +

In , would be + evaluated more than once.

+

Own Id: OTP-4962 Aux Id: seq8292

+
+
+
+
+ +
+ Compiler 4.2.1 + +
+ Improvements and New Features + + +

In rare circumstances, the compiler could optimize away + test that would verify that a tuple or record argument + indeed was of the correct type (resulting in an emulator + crash if the argument was not of the correct type/size). + Wrong code could also be generated for floating point + expressions.

+

Own Id: OTP-4790

+
+
+
+
+
+ diff --git a/lib/compiler/doc/src/part_notes.xml b/lib/compiler/doc/src/part_notes.xml new file mode 100644 index 0000000000..e730e3f7e2 --- /dev/null +++ b/lib/compiler/doc/src/part_notes.xml @@ -0,0 +1,39 @@ + + + + +
+ + 20042009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compiler Release Notes + + + 2004-09-07 + 1.0 +
+ +

The Compiler application compiles Erlang + code to byte-code. The highly compact byte-code is executed by + the Erlang emulator.

+

For information about older versions, see + Release Notes History.

+
+ +
+ diff --git a/lib/compiler/doc/src/part_notes_history.xml b/lib/compiler/doc/src/part_notes_history.xml new file mode 100644 index 0000000000..cd17c4285e --- /dev/null +++ b/lib/compiler/doc/src/part_notes_history.xml @@ -0,0 +1,39 @@ + + + + +
+ + 2006 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + Compiler Release Notes History + + + + +
+ +

The Compiler application compiles Erlang + code to byte-code. The highly compact byte-code is executed by + the Erlang emulator.

+
+ +
+ diff --git a/lib/compiler/doc/src/ref_man.xml b/lib/compiler/doc/src/ref_man.xml new file mode 100644 index 0000000000..74fe45aa77 --- /dev/null +++ b/lib/compiler/doc/src/ref_man.xml @@ -0,0 +1,38 @@ + + + + +
+ + 19962009 + Ericsson AB. All Rights Reserved. + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + + + Compiler Reference Manual + Robert Virding + + 1997-05-02 + 1.1.2 + application.sgml +
+ +

The Compiler application compiles Erlang + code to byte-code. The highly compact byte-code is executed by + the Erlang emulator.

+
+ +
+ diff --git a/lib/compiler/doc/src/user_guide.gif b/lib/compiler/doc/src/user_guide.gif new file mode 100644 index 0000000000..e6275a803d Binary files /dev/null and b/lib/compiler/doc/src/user_guide.gif differ diff --git a/lib/compiler/doc/src/warning.gif b/lib/compiler/doc/src/warning.gif new file mode 100644 index 0000000000..96af52360e Binary files /dev/null and b/lib/compiler/doc/src/warning.gif differ -- cgit v1.2.3