aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
AgeCommit message (Collapse)Author
2015-06-18Change license text to APLv2Bruce Yinhe
2015-05-21Don't make 'compiler' dependent on 'tools'Björn Gustavsson
In a5d724cf240a, a debug option for running eprof on a specific compiler pass was added. That commit added a direct call to the eprof module in the tools application, and therefore the test case otp_SUITE:runtime_dependencies/1 would fail because xref would find a call to the tools application, but tools is not listed as a runtime dependency in compiler.app. Since the 'eprof' option is only likely to be used by compiler maintainers, we don't want a real dependency to the tools application. Therefore, use c:appcall/4 to hide the call to the eprof module (and to report the error nicely if the tools application is missing).
2015-05-08Merge branch 'nox/compiler/parse_transform-undef/OTP-12723'Björn Gustavsson
* nox/compiler/parse_transform-undef/OTP-12723: Properly report unknown parse transforms
2015-04-30compiler: Use module erl_annoHans Bolinder
2015-04-27Merge branch 'bjorn/use-monotonic-time'Björn Gustavsson
* bjorn/use-monotonic-time: supervisor: Correct restart handling test_server: Use erlang:monotonic_time/0 compile: Teach 'time' option to show three significant decimals timer: Use monotonic_time/0 in tc/1,2,3
2015-04-22compile: Add the {eprof,Pass} option for easy eprof runningBjörn Gustavsson
To run eprof for a compiler pass: erlc +'{eprof,beam_asm}' file.erl The name of the compiler pass is the name as printed when 'time' option is used. It is usually, but not always, the module name for the compiler pass.
2015-04-22compile: Eliminate unnecessary wrappers for compiler passesBjörn Gustavsson
Several compiler passes have unnecessary wrapper functions that can be easily eliminated.
2015-04-20compile: Teach 'time' option to show three significant decimalsBjörn Gustavsson
The 'time' option currently uses statistics(runtime) to measure execution times. Typically, statistics(runtime) only returns result with two significant figures. Use the new erlang:monotonic_time/0 function to get three significant figures.
2015-03-26Properly report unknown parse transformsAnthony Ramine
We don't want undef errors coming from the parse transform itself to be confused with undef errors caused by the absence of the parse transform. Reported-by: Klas Johansson
2015-03-20Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: (22 commits) Update primary bootstrap inets: Suppress deprecated warning on erlang:now/0 inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules inets: Update comments Suppress deprecated warning on erlang:now/0 Use new time API and be back-compatible in inets Remove unused functions and removed redundant test asn1 test SUITE: Eliminate use of now/0 Disable deprecated warning on erlang:now/0 in diameter_lib Use new time API and be back-compatible in ssh Replace all calls to now/0 in CT with new time API functions test_server: Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API otp_SUITE: Warn for calls to erlang:now/0 Replace usage of erlang:now() with usage of new API Multiple timer wheels Erlang based BIF timer implementation for scalability Implement ethread events with timeout ... Conflicts: bootstrap/bin/start.boot bootstrap/bin/start_clean.boot bootstrap/lib/compiler/ebin/beam_asm.beam bootstrap/lib/compiler/ebin/compile.beam bootstrap/lib/kernel/ebin/auth.beam bootstrap/lib/kernel/ebin/dist_util.beam bootstrap/lib/kernel/ebin/global.beam bootstrap/lib/kernel/ebin/hipe_unified_loader.beam bootstrap/lib/kernel/ebin/inet_db.beam bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/kernel/ebin/inet_res.beam bootstrap/lib/kernel/ebin/os.beam bootstrap/lib/kernel/ebin/pg2.beam bootstrap/lib/stdlib/ebin/dets.beam bootstrap/lib/stdlib/ebin/dets_utils.beam bootstrap/lib/stdlib/ebin/erl_tar.beam bootstrap/lib/stdlib/ebin/escript.beam bootstrap/lib/stdlib/ebin/file_sorter.beam bootstrap/lib/stdlib/ebin/otp_internal.beam bootstrap/lib/stdlib/ebin/qlc.beam bootstrap/lib/stdlib/ebin/random.beam bootstrap/lib/stdlib/ebin/supervisor.beam bootstrap/lib/stdlib/ebin/timer.beam erts/aclocal.m4 erts/emulator/beam/bif.c erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_db_hash.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_thr_progress.c erts/emulator/beam/utils.c erts/emulator/sys/unix/sys.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam erts/preloaded/src/erts_internal.erl lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl lib/diameter/src/base/diameter_lib.erl lib/kernel/src/os.erl lib/ssh/test/ssh_basic_SUITE.erl system/doc/efficiency_guide/advanced.xml
2015-03-20Replace usage of erlang:now() with usage of new APIRickard Green
2014-08-14compiler: finalize 18.x 'asm' deprecationTuncer Ayaz
'asm' was deprecated in 18315c16, to be removed in 18.x.
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.