aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
AgeCommit message (Collapse)Author
2014-03-18Don't fail compilation for modules that contain invalid UTF-8Björn Gustavsson
The default encoding for Erlang modules is now UTF-8, and the compilation would fail if a module contained byte sequences that are not valid UTF-8 sequences. In a large project with say many hundreds of Erlang modules with names of developers such as "Björn" or "Håkan" encoded in latin-1, that could mean that many hundreds of files would need to be modified just to get started testing OTP 17. As a temporary measure to ease the transition, automatically fall back to the latin-1 encoding with a warning for any module that contains invalid byte sequences and for which no encoding has been specified. The intention is to remove this workaround in OTP 18 or 19.
2014-02-28compiler: Fix error message printout on compile errorBjörn-Egil Dahlberg
Use correct stack in printout.
2014-02-14compiler: update 'asm' deprecation messageTuncer Ayaz
Adapt 'asm' deprecation message to new version scheme.
2014-02-13Merge branch 'nox/compiler/v3_core-case-arg-opt'Björn Gustavsson
* nox/compiler/v3_core-case-arg-opt: Optimise case arguments in sys_core_fold Run sys_core_fold twice if any inliner is used
2014-02-07compiler: Add debug listing after sys_core_foldBjörn-Egil Dahlberg
2014-02-07Run sys_core_fold twice if any inliner is usedAnthony Ramine
2014-01-28compiler: Format stacktrace on errorBjörn-Egil Dahlberg
2014-01-08Ignore warnings when running sys_core_fold after inliningBjörn Gustavsson
The new inliner (cerl_inline) does not mark inlined code as compiler generated. Therefore, when sys_core_fold is run after inlining, it may generate spurious warnings. The easiest way out (for now, at least) is to discard all warnings found when running sys_core_fold after inlining.
2013-12-18Officially support building assembler filesTuncer Ayaz
erlc is wired to treat *.S files as assembler and build them as compile:file(File, [from_asm]), but this is not documented. There's also a documented compile:file/2 option called 'asm' (mapping to 'from_asm'), but the wording discourages its use. All of this has been in place and in use for a long time. Therefore, it should be supported officially. To fix that, make the following changes: * document erlc handling of *.core files * un-document 'asm' and document 'from_asm' instead * deprecate 'asm' While at it, fix a minor typo in the test suite.
2013-09-12Remove ^L characters hidden randomly in the code. Not those used in text ↵Pierre Fenoll
files as delimiters. While working on a tool that processes Erlang code and testing it against this repo, I found out about those little sneaky 0xff. I thought it may be of help to other people build such tools to remove non-conforming-to-standard characters.
2013-09-05compiler: Conform returned errors to the documented formatBjörn Gustavsson
ErrorInfo is documented to be: {ErrorLine,Module,ErrorDescriptor} but for some errors with line numbers it would look like: {Module,ErrorDescriptor} Ensure that all ErrorInfo tuples have three elements. Use 'none' instead of a line number: {none,Module,ErrorDescriptor} There already are errors that return 'none' when no line number is available, but that convention was not documented. Mention it in the documentation. Also make sure that the compiler will not print 'none' as a line number in error messages (if the 'report_errors' option is given) as that looks stupid. That is, when attempting to compile a non-existing module, the error message should be: non-existing.erl: no such file or directory and not: non-existing.erl:none: no such file or directory
2013-05-20beam_lib, compile: Replace use of deprecated crypto functionsBjörn Gustavsson
Since both the STDLIB and compiler applications turn warnings into errors, we must stop using the old deprecated crypto functions. While we are at it, generalize the format of the key tuple returned by beam_lib:make_crypto_key/2 to facilitate introducing new crypto methods in the future. Change the format to: {Type,Key,IV,BlockSize} where Type, Key, and IV are the first three arguments for either crypto:block_encrypt4/ or crypto:block_decrypt/4, and BlockSize is the block size for the crypto algorithm (it is needed to properly pad the plaintext blocks before encryption).
2013-03-28Add a new option +clint0 to the compilerAnthony Ramine
This option makes the compiler run the Core Erlang linting pass before any optimization pass, which can crash if the given code has unbound variables, something that is detected by core_lint.
2013-02-06compile: Eliminate warnings for unmatched return valuesBjörn Gustavsson
2013-01-25Make adjustments for UnicodeHans Bolinder
2013-01-25Correct recently introduced Unicode related type errorsHans Bolinder
2013-01-18Merge branch 'bjorn/remove-parameterized-modules/OTP-10616'Björn Gustavsson
* bjorn/remove-parameterized-modules/OTP-10616: Remove support for parameterized modules xref_SUITE: Don't test parameterized modules shell_SUITE: Don't test parameterized modules erl_expand_records_SUITE: Don't test parameterized modules erl_eval: Don't test parameterized modules
2013-01-18Remove support for parameterized modulesBjörn Gustavsson
2013-01-16compile: Remove vestiges of package supportBjörn Gustavsson
2013-01-09compiler: Remove support for packagesBjörn Gustavsson
2013-01-02[stdlib, kernel] Introduce Unicode support for Erlang source filesHans Bolinder
Expect modifications, additions and corrections. There is a kludge in file_io_server and erl_scan:continuation_location() that's not so pleasing.
2012-10-09Refactor removal of unused labelsBjörn Gustavsson
Since we always want to remove unused labels directly after code generation (whether we'll run the optimization passes or not), we can simplify the code by doing it in beam_a.
2012-10-09Introduce the mandatory beam_a and beam_z passesBjörn Gustavsson
Introduce the mandary beam_a pass that will be run directly after code generation, and the mandatory beam_z pass that will be run just before beam_asm. Since these passes surround the optimizations, beam_a can (for example) do instruction renaming to simplify the optimization passes and beam_z can undo those renamings.
2012-10-09compile: Fix bug in selection of passesBjörn Gustavsson
2012-10-09compile: Give a friendler error message if a parse transform cannot be foundBjörn Gustavsson
Don't throw the parse tree in the face of the user. OTP-8707
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-08-22Revert "Merge branch 'nox/compile-column-numbers' into maint"Lukas Larsson
Column numbers was merged without understanding all the whole story. See mail on erlang-patches for details. This reverts commit df8e67e203b83f95d1e098fec88ad5d0ad840069, reversing changes made to 0c9d90f314f364e5b1301ec89d762baabc57c7aa.
2012-08-14Merge branch 'nox/compile-column-numbers' into maintFredrik Gustafsson
* nox/compile-column-numbers: Fix messages ordering with column numbers Fix type compile:err_info/0 Test column number reporting in error_SUITE Fix printing of errors with column numbers Create a new "column" option in compile Allow setting of initial position in epp Export type erl_scan:location/0
2012-08-06compiler: Eliminate EXIT messages from the temporary compiler processBjörn Gustavsson
If a process trap exits, calling the compiler would leave an EXIT message in the message queue of the calling process because the compiler spawns a temporary work process. Eliminate the EXIT process by monitoring the temporary process instead of linking to it. Reported-by: Jeremy Heater
2012-06-10Fix messages ordering with column numbersAnthony Ramine
With L1, L2, C1, C2 integers such as L1 < L2 and C1 < C2, locations are ordered like this: L1 < {L1, C1} < {L1, C2} < L2
2012-06-06Fix type compile:err_info/0Anthony Ramine
2012-06-03Fix printing of errors with column numbersAnthony Ramine
There was a colon missing after the column number, it must be an error as it's not missing in list_errors/2.
2012-06-02Create a new "column" option in compileAnthony Ramine
If set, compile will call epp with a full location {1, 1} instead of 1, thus making it keep the column numbers in the parsed AST.
2012-04-10Allow the source to be set when compiling formsJosé Valim
This commit adds a source option to compile:forms() that sets the source value returned by module_info(compile).
2012-01-04Add the beam_except pass to optimize exceptionsBjörn Gustavsson
In order to save space, rewrite suitable calls to erlang:error/{1,2} to special BEAM instructions. This code is probably longer than the code taken out of v3_life and v3_codegen in the previous commit, but it is much easier to understand and maintain since the BEAM assembler format is better understood than the v3_life format.
2011-12-06Teach the compiler the 'no_dead' optionBjörn Gustavsson
To facilitate debugging of compiler bugs, teach the compiler the 'no_dead' option. Since the beam_dead pass used to do the necessary splitting of basic blocks to expose all labels, we must move that splitting into a separate pass that is always run.
2011-11-28Merge branch 'bjorn/compiler/options/OTP-9752'Björn Gustavsson
* bjorn/compiler/options/OTP-9752: filename documentation: Recommend against using filename:find_src/1,2 Teach filename:find_src/1,2 to handle slim or stripped BEAM files filename: Eliminate failing call to Mod:module_info(source_file) filename.erl:filter_options/1: Remove handling of dead options compiler: Don't include {cwd,_} in module_info(compile) compiler: Don't include source code options in module_info(compile) hipe: Teach hipe to handle slim or stripped BEAM files
2011-11-24compiler: Don't include {cwd,_} in module_info(compile)Björn Gustavsson
The {cwd,Dir} option is always included if the module has been compiled by erlc. Since its presence cannot be relied upon and it wastes memory, get rid of it.
2011-11-24compiler: Don't include source code options in module_info(compile)Björn Gustavsson
As far as I know, the purpose of the compiler options included in Mod:module_info(compile) has never been documented. An educated guess is that they are there in case you want to re-compile the module with the same options, and also to aid in debugging when you need to know how a module was compiled. In neither case is there any need to include options given in the source itself in options included in Mod:module_info(compile). Including those options will only waste memory. Therefore, only include in the BEAM file the options that were given to compile:file/2.
2011-11-24Teach the compiler the 'r14' optionBjörn Gustavsson
2011-10-07Add '-callback' attribute to language syntaxStavros Aronis
Behaviours may define specs for their callbacks using the familiar spec syntax, replacing the '-spec' keyword with '-callback'. Simple lint checks are performed to ensure that no callbacks are defined twice and all types referred are declared. These attributes can be then used by tools to provide documentation to the behaviour or find discrepancies in the callback definitions in the callback module.
2011-09-13Merge branch 'dev' into majorHenrik Nord
Conflicts: lib/asn1/doc/src/asn1ct.xml
2011-09-08compile: optimize werror/1Tuncer Ayaz
2011-09-08compile: log warnings as errors if -Werror is enabledTuncer Ayaz
2011-09-08Do not write beam file if Werr and warnings /= []Tuncer Ayaz
2011-08-18compiler: Add no_line_info for suppressing line/1 instructionsBjörn Gustavsson
Also update the r12 and r13 options so that they imply no_line_info.
2011-08-16compiler: Don't create filenames starting with "./"Björn Gustavsson
In the location information tables in the run-time system, source filenames that are the same as the module name plus ".erl" extension are not stored explicitly, thus saving memory. To take advantage of that optimization, avoid complicating the names of files in the current working directory; specifically, make sure that "./" is not prepended to the name.
2011-02-24Merge branch 'bjorn/compiler/refactor-source-options' into devBjörn Gustavsson
* bjorn/compiler/refactor-source-options: compile: Refactor handling of source options (e.g. 'from_core')
2011-02-18Add dependencies Makefile generation to erlc(1) and compile(3)Jean-Sébastien Pédron
This is useful when a project is built with Makefiles and erlc(1) instead of EMakefiles. Tracking dependencies by hand is error-prone and it becomes painful when using external application headers like EUnit's one. A dependencies Makefile will look like this: module.beam: module.erl \ /usr/local/lib/erlang/lib/eunit-2.1.4/include/eunit.hrl \ header.hrl When included in the main Makefile, 'module' will be recompiled only when needed. GCC offers the same feature and new erlc(1) options are compatible with it. More informations at: http://wiki.github.com/dumbbell/otp/dependencies-makefile
2011-02-14compile: Refactor handling of source options (e.g. 'from_core')Björn Gustavsson
The options for compiling from Core Erlang, BEAM assembler files, and BEAM files are handled in several places, making it difficult to change or add more similar options. Refactor the option handling so that each option only need to be handled in one place.