aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2011-03-30Merge branch 'hw/call-chmod-without-f' into devHenrik Nord
* hw/call-chmod-without-f: Call chmod without the "-f" flag Conflicts: erts/emulator/test/Makefile lib/asn1/test/Makefile lib/crypto/test/Makefile lib/debugger/test/Makefile lib/docbuilder/test/Makefile lib/edoc/test/Makefile lib/erl_interface/test/Makefile lib/inviso/test/Makefile lib/parsetools/test/Makefile lib/percept/test/Makefile lib/ssl/test/Makefile lib/syntax_tools/test/Makefile lib/test_server/test/Makefile lib/tools/test/Makefile OTP-9170
2011-03-29beam_dict: Eliminate the redundant next_atom record elementBjörn Gustavsson
It is not needed because it can be trivially calculated using gb_trees:size/1.
2011-03-29beam_dict: Fix typo in commentBjörn Gustavsson
2011-03-25sys_core_fold: Eliminate incorrect warningBjörn Gustavsson
The compiler (sys_core_fold) tries to avoid constructing tuples in case expressions. The following code: c(A, B) -> case {A,B} of {ok,X} -> X; {_,_} -> error end. will be rewritten so that no tuple is built. If a clause requires a tuple to be built as in this code: c(A, B) -> case {A,B} of {ok,X} -> X; V -> V %The tuple will be built here end. the tuple will be built in the clause(s) in which it is needed. If the value returned from the case is not used as in this code: c(A, B) -> case {A,B} of V -> V %Warning: a term is constructed, but never used end, ok. there will be an incorrect warning. Basically, what happens is that the code is reduced to: c(A, B) -> {A,B}, %Warning: a term is constructed, but never used ok. and the optimizer sees that the {A,B} tuple can't possibly be used. Eliminate the warning by adding a 'compiler_generated' annotation to the tuple. Reported-by: Kostis Sagonas
2011-03-25sys_core_fold: Be careful to preserve annotations while optimizingBjörn Gustavsson
2011-03-23v3_core: Fix variable incorrectly unbound after binary matchBjörn Gustavsson
In the following code: m(<<Sz:8,_:Sz/binary>>) -> Sz = wrong. the Sz variable is supposed to be bound in the function header and the matching "Sz = wrong" should cause a badarg exception. But what happens is that the Sz variables seems to be unbound and the matching succeds and the m/1 function returns 'wrong'. If the Sz variable is used directly (not matched), it will have the expected value. Thus the following code: m(<<Sz:8,_:Sz/binary>>) -> Sz. will correctly return the value of Sz that was matched out from the binary. Reported-by: Bernard Duggan
2011-03-23v3_core: Fix style and indentationBjörn Gustavsson
2011-03-14Prepare releaseOTP_R14B02Erlang/OTP
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2011-02-24Merge branch 'bjorn/fix-dialyzer-warnings' into devBjörn Gustavsson
* bjorn/fix-dialyzer-warnings: v3_kernel_pp: Eliminate dialyzer warning inet6_tcp_dist: Eliminate dialyzer warning for "tuple fun"
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-23v3_kernel_pp: Eliminate dialyzer warningBjörn Gustavsson
Use conditional compilation instead of a run-time test. Will also improve the coverage of the code.
2011-02-23compiler: Eliminate some warningsBjörn Gustavsson
2011-02-18Merge branch 'jp/dependencies_makefile' into devBjörn Gustavsson
* jp/dependencies_makefile: Add dependencies Makefile generation to erlc(1) and compile(3) Conflicts: lib/compiler/test/compile_SUITE.erl OTP-9065
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-17Rename Suite Callback to Common Test HookLukas Larsson
2011-02-17Update and add cover spec files to work with common_testLukas Larsson
2011-02-17Update all test specsLukas Larsson
2011-02-17Fix formatting for compilerLukas Larsson
2011-02-17Add init_per_suite and end_per_suiteLukas Larsson
2011-02-17Add ts_install_scb to suite/0Lukas Larsson
2011-02-17Update compiler tests to conform with common_test standardLukas Larsson
2011-02-17Update all fin_per_testcase to end_per_testcase.Lukas Larsson
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.
2011-02-09Merge branch 'bjorn/compiler/eliminate-warnings' into devBjörn Gustavsson
* bjorn/compiler/eliminate-warnings: compiler Makefile: Turn warnings into errors v3_kernel_pp: Add support for pretty-printing #k_literal{} records v3_kernel_pp: Eliminate warning
2011-02-07v3_codegen: Use the latest instance of StBjörn Gustavsson
By accident a previous instance of St is used, which is harmless in this case, but leads to worse quality of the generated code.
2011-02-02compiler Makefile: Turn warnings into errorsBjörn Gustavsson
We want to ensure that the compiler applications is kept free of warnings.
2011-02-02v3_kernel_pp: Add support for pretty-printing #k_literal{} recordsBjörn Gustavsson
2011-02-02v3_kernel_pp: Eliminate warningBjörn Gustavsson
2010-12-21compiler: Don't include -export_type as attributes in BEAM filesBjörn Gustavsson
Similar to -spec and -type, -export_type should be not be included as attributes (and therefore loaded) in BEAM files, but only in the abstract code chunk.
2010-12-06Prepare releaseErlang/OTP
2010-12-02Merge branch 'bjorn/fix-compiler-bugs/OTP-8949' into devBjörn Gustavsson
* bjorn/fix-compiler-bugs/OTP-8949: beam_utils: Fix check_liveness/3 for receive loops beam_utils: Fix liveness analysis for gc_bif instructions
2010-12-02beam_utils: Fix check_liveness/3 for receive loopsBjörn Gustavsson
Sometimes the beam_bool pass wants to know whether an y register will be killed by the code that follows and will do (effectively): beam_utils:is_killed({y,Y}, Code, L) When asked to calculate the liveness for an y register, beam_utils:is_killed/3 will loop forever if the code includes a receive loop. Since this rarely occurs, fix the problem in the simplest and most conservative way. Reported-by: Christopher Williams
2010-11-29Merge branch 'pan/auto-import-doc-fix/OTP-8848' into devPatrik Nyblom
* pan/auto-import-doc-fix/OTP-8848: Correct description of no_auto_import compiler directive
2010-11-26beam_utils: Fix liveness analysis for gc_bif instructionsBjörn Gustavsson
When gc_bif instructions occurred outside of a block, beam_utils:check_liveness/3 did not take into account that the instruction could do a garbage collection, and could falsely report that an x register would be killed. That could cause the beam_dead pass to make the code unsafe by removing the assignment to an x register that would subsequently be referenced by the garbage collector. Reported-by: Christopher Williams
2010-11-15Call chmod without the "-f" flagHolger Weiß
"-f" is a non-standard chmod option which at least SGI IRIX and HP UX do not support. As the only effect of the "-f" flag is to suppress warning messages, it can be safely omitted.
2010-10-29Merge branch 'ks/strengthen-specs' into devBjörn Gustavsson
* ks/strengthen-specs: lists: Strengthen and modernize specs syntax_tools: Fix an erroneous type and strengthen some specs ordsets: Export ordset/1 type and strengthen specs compiler: Strengthen some specs to shut off dialyzer warnings
2010-10-26compiler: Strengthen some specs to shut off dialyzer warningsKostis Sagonas
2010-10-12beam_block: Do optimizations in the safe orderBjörn Gustavsson
Moving of allocation instructions upwards in the instruction stream (in order to enable further optimizations) in beam_block, is implemented with the assumption that if a register {x,X} contains a valid term, then all other x register with lower numbers than X also contain valid terms. That assumption is true after code generation. The beam_utils:live_opt/1 optimization, however, may invalidate that assumption. For instance, if a receive statement exports a variable that is used, but the return value of the receive statement is not used, then {x,1} but not {x,0} contains a valid term at the end of the receive statement. If the receive statement is followed by {bif,self,{f,0},[],{x,0}}. {test_heap,NumberOfWords,2}. moving the allocation upwards will produce {test_heap,NumberOfWords,2}. {bif,self,{f,0},[],{x,0}}. which will cause the beam_validator pass to scream loudly that {x,0} is not live at the test_heap instruction. Fix the problem by doing the optimizations in reverse order. Reported-by: Jim Engquist
2010-10-08core_lint: Fix the err_desc() type specBjörn Gustavsson
Silence the Dialyzer warning introduced in commit 7b283aa9507b45f2cd403b061ad92ab059fb71b5.
2010-10-07Merge branch 'bjorn/compiler-bin-generators/OTP-8864' into devBjörn Gustavsson
* bjorn/compiler-bin-generators/OTP-8864: core_lint: Enforce that tail segments only occur at the end Don't generate multiple tail segments in binary matching Factor out some of the code for binary generators Add tests for tail segments in binary generators
2010-10-07core_lint: Enforce that tail segments only occur at the endBjörn Gustavsson
2010-09-23Fix compiler crash when constructing zero-size binary segmentsBjörn Gustavsson
Code such as foo(A) -> <<A:0>>. would cause a compiler crash.
2010-09-22Don't generate multiple tail segments in binary matchingBjörn Gustavsson
In binary matching, there must only be one "tail segment" (i.e. a size-less segment of type binary) and it must be last. Thus, the compiler will reject the following function definition: foo(<<A/bits,B/bits>>) -> ok. But code such as the following: [42 || <<_:8/integer, _/bits>> <= Bits] will internally (in the Core Erlang format) be translated to a binary matching pattern containing two tail segments. The compiler happens to generate correct code anyway (later passes will get rid of the redundant tail segment), but it is ugly and will confuse tools such as Dialyzer. Change the transformation of binary generators (in both list and binary comprehensions) not to generate add a tail segment if there already is one.
2010-09-22Factor out some of the code for binary generatorsBjörn Gustavsson
In the code for handling binary generators (in list and binary comprehensions), factor out the code for appending a match-all tail segment onto a pattern into a separate function. That will only make the code somewhat simpler, but will facilitate fixing a bug/misfeture in the next commit.
2010-09-22Add tests for tail segments in binary generatorsBjörn Gustavsson
2010-09-20Correct description of no_auto_import compiler directivePatrik Nyblom
2010-09-13Prepare releaseOTP_R14BErlang/OTP
2010-09-10Remove warnings for clashes with new autoimported BIFsPatrik Nyblom
2010-08-30Merge branch 'pan/ms_transform_warnings/OTP-6759' into devPatrik Nyblom
* pan/ms_transform_warnings/OTP-6759: Add testcases for ms_transform warning and fix scoping Add warnings for shadowed variables in ms_transform funs