aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-11-18Add test using LFE-generated Core Erlang modulesBjörn Gustavsson
Ensure that correct (not necessarily optimal) code is generated for Core Erlang code not originating from v3_core.
2016-11-18Remove beam_boolBjörn Gustavsson
The guard optimizations in v3_kernel has removed the need for beam_bool.
2016-11-18v3_kernel: Generate optimized code for guardsBjörn Gustavsson
The compiler produces poor code for complex guard expressions with andalso/orelse. Here is an example from the filename module: -define(IS_DRIVELETTER(Letter),(((Letter >= $A) andalso (Letter =< $Z)) orelse ((Letter >= $a) andalso (Letter =< $z)))). skip_prefix(Name, false) -> Name; skip_prefix([L, DrvSep|Name], DrvSep) when ?IS_DRIVELETTER(L) -> Name; skip_prefix(Name, _) -> Name. beam_bool fails to simplify the code for the guard, leaving several 'bif' instructions: {function, skip_prefix, 2, 49}. {label,48}. {line,[{location,"filename.erl",187}]}. {func_info,{atom,filename},{atom,skip_prefix},2}. {label,49}. {test,is_ne_exact,{f,52},[{x,1},{atom,false}]}. {test,is_nonempty_list,{f,52},[{x,0}]}. {get_list,{x,0},{x,2},{x,3}}. {test,is_nonempty_list,{f,52},[{x,3}]}. {get_list,{x,3},{x,4},{x,5}}. {bif,'=:=',{f,52},[{x,1},{x,4}],{x,6}}. {test,is_ge,{f,50},[{x,2},{integer,65}]}. {bif,'=<',{f,52},[{x,2},{integer,90}],{x,7}}. {test,is_eq_exact,{f,51},[{x,7},{atom,false}]}. {test,is_ge,{f,50},[{x,2},{integer,97}]}. {bif,'=<',{f,52},[{x,2},{integer,122}],{x,7}}. {jump,{f,51}}. {label,50}. {move,{atom,false},{x,7}}. {label,51}. {bif,'=:=',{f,52},[{x,7},{atom,true}],{x,7}}. {test,is_eq_exact,{f,52},[{x,6},{atom,true}]}. {test,is_eq_exact,{f,52},[{x,7},{atom,true}]}. {move,{x,5},{x,0}}. return. {label,52}. return. We can add optimizations of guard tests to v3_kernel to achive a better result: {function, skip_prefix, 2, 49}. {label,48}. {line,[{location,"filename.erl",187}]}. {func_info,{atom,filename},{atom,skip_prefix},2}. {label,49}. {test,is_ne_exact,{f,51},[{x,1},{atom,false}]}. {test,is_nonempty_list,{f,51},[{x,0}]}. {get_list,{x,0},{x,2},{x,3}}. {test,is_nonempty_list,{f,51},[{x,3}]}. {get_list,{x,3},{x,4},{x,5}}. {test,is_eq_exact,{f,51},[{x,1},{x,4}]}. {test,is_ge,{f,51},[{x,2},{integer,65}]}. {test,is_lt,{f,50},[{integer,90},{x,2}]}. {test,is_ge,{f,51},[{x,2},{integer,97}]}. {test,is_ge,{f,51},[{integer,122},{x,2}]}. {label,50}. {move,{x,5},{x,0}}. return. {label,51}. return. Looking at the STDLIB application, there were 112 lines of BIF calls in guards that beam_bool failed to convert to test instructions. This commit eliminates all those BIF calls. Here is how I counted the instructions: $ PATH=$ERL_TOP/bin:$PATH erlc -I ../include -I ../../kernel/include -S *.erl $ grep "bif,'[=<>]" *.S | grep -v f,0 dets.S: {bif,'=:=',{f,547},[{x,4},{atom,read_write}],{x,4}}. dets.S: {bif,'=:=',{f,547},[{x,5},{atom,saved}],{x,5}}. dets.S: {bif,'=:=',{f,589},[{x,5},{atom,read}],{x,5}}. . . . $ grep "bif,'[=<>]" *.S | grep -v f,0 | wc 112 224 6765 $
2016-11-18Merge branch 'maint'Björn Gustavsson
* maint: Run dialyzer as part of the travis script Correct tar_SUITE:unicode/1
2016-11-18Merge branch 'kostis/travis-dialyzer' into maintBjörn Gustavsson
* kostis/travis-dialyzer: Run dialyzer as part of the travis script
2016-11-18Merge branch 'bjorn/cuddle-with-tests' into maintBjörn Gustavsson
* bjorn/cuddle-with-tests: Correct tar_SUITE:unicode/1
2016-11-18Merge branch 'maint'Ingela Anderton Andin
2016-11-18Merge branch 'ingela/httpc/keep-alive-https/OTP-14041' into maintIngela Anderton Andin
* ingela/httpc/keep-alive-https/OTP-14041: inets: httpc - do not send absolute URIs over TLS tunnels
2016-11-18Suppress warnings from v3_kernel when inlining is turned onBjörn Gustavsson
v3_kernel may produce unwanted and confusing warnings for code that has been inlined with the new inliner (cerl_inline). Consider this code: -compile(inline). compute1(X) -> add(X, 0). compute2(X, Y) -> add(X, Y). add(1, 0) -> 1; add(1, Y) -> %% "this clause cannot match..." 1 + Y; add(X, Y) -> X + Y. v3_kernel warns because add/2 has been inlined into compute1/1 and only the first clause in add/2 will match. But the other clauses are needed when add/2 is inlined into compute2/2, so the user cannot do anything to eliminate the warning (short of manually inlining add/2, defeating the purpose of the 'inline' option). The warning would be reasonable if compute2/2 didn't exist, but it would be too complicated for the compiler to figure whether a warning make sense or not. Therefore, suppress all warnings generated by v3_kernel if cerl_inline has been run. ERL-301
2016-11-18Merge branch 'dgud/stdlib/rand-fixup-spec'Dan Gudmundsson
* dgud/stdlib/rand-fixup-spec: Fixup of specs in rand
2016-11-18Merge branch 'maint'Ingela Anderton Andin
2016-11-18Merge branch 'ingela/odbc/mac' into maintIngela Anderton Andin
* ingela/odbc/mac: odbc: Remove support for old MACs
2016-11-18odbc: Remove support for old MACsIngela Anderton Andin
Change configure to skip odbc for old MACs, the change in PR-1227 is not backwards compatible with old MACs, and we do not see a need to continue support for such old versions. However it is still possible to make it work on such machines using the --with-odbc configure option.
2016-11-17Run dialyzer as part of the travis scriptKostis Sagonas
Build a dialyzer PLT and use it to analyze all OTP applications that can currently be analyzed without warnings even when the option -Wunmatched_returns is turned on. Note that the dialyzer run does _not_ enable the option which allows for improper lists. Applications to run dialyzer on are mentioned alphabetically. As more applications are fixed to run cleanly even with unmatched returns, they can be added to this list. However, there will come a point when the warning pass of Dialyzer will run out of memory on Travis and the process will be killed. This should be fixed in dialyzer.
2016-11-17erts: Tweak PSTACK to avoid warningSverker Eriksson
warning: array subscript is below array bounds and ok, it's technically undef behavior to set pointer before first array element.
2016-11-17erts: Fix all -Wundef errorsSverker Eriksson
2016-11-17erts: Add ErtsStrToSint64Sverker Eriksson
for simplify string to 64-bit integer parsing.
2016-11-17erts: Refactor crash dumping with cbprintfSverker Eriksson
Instead of passing around a file descriptor use a function pointer to facilitate more advanced backend write logic such as size limitation or compression.
2016-11-17erts: Add cbprintf for Callback PrintingSverker Eriksson
2016-11-17Correct tar_SUITE:unicode/1Björn Gustavsson
Make sure that we always test the "+fnu" option on all systems. It seems that it was not tested in our daily builds, since they are run non-interactively. Make sure that we sort the list of names in do_unicode/1. Otherwise the test would only work in "+fnl" mode because the list would only contain one element.
2016-11-17Merge branch 'elbrujohalcon/expand-sup-doc/PR-1233/OTP-14037'Siri Hansen
* elbrujohalcon/expand-sup-doc/PR-1233/OTP-14037: Expand on the behavior of supervisors
2016-11-17Fixup of specs in randDan Gudmundsson
Fixed bad specs introduced in commit ff568b5e818. Also suppress improper_lists warnings.
2016-11-17Merge branch 'dgud/mnesia/type-specs'Dan Gudmundsson
* dgud/mnesia/type-specs: Add basic spec and types
2016-11-17Add basic spec and typesDan Gudmundsson
2016-11-17Merge branch 'richcarl/mnesia/mnesia-ext-dont-wrap-cont/PR-1240/OTP-14039'Dan Gudmundsson
* richcarl/mnesia/mnesia-ext-dont-wrap-cont/PR-1240/OTP-14039: Don't wrap continuations from mnesia_ext backends
2016-11-17Merge branch 'jj1bdx/stdlib/rand-jump/PR-1235/OTP-14038'Dan Gudmundsson
* jj1bdx/stdlib/rand-jump/PR-1235/OTP-14038: Add jump functions to rand module
2016-11-16hipe_x86: Fix encoding of test instr w/ neg immMagnus Lång
Also, use byte form for immediates up to 255, since there's no sign extension in byte form. HiPE seems to never generate negative test immediates currently, but we should at least not output incorrect encodings.
2016-11-16hipe_tagscheme: Simplify test_two_fixnums with immMagnus Lång
test_two_fixnums would previously only check its right-hand argument for immediates, but not it's left. Now, test_two_fixnums reduces to test_fixnum if either argument is an immediate.
2016-11-16hipe_icode: Always const-propagate if&call argsMagnus Lång
2016-11-16hipe_tagscheme: x86 lea+test for mask_and_compareMagnus Lång
By changing mask_and_compare from and,sub to sub,and, x86 can use a 3-address LEA immediate add, saving a mov. The RISC backends should see no change in sequence length. We make test_(heap_|sub)binary use mask_and_compare so they will benefit too.
2016-11-16hipe_tagscheme: Improve fixnum_addsub with immMagnus Lång
The addsub sequence was suboptimal when one of the arguments was immediate, because it became an immediate alu followed by an immediate alub, and the optimisers would not combine them due to the risk of altering the branch. However, in this case we know that such a rewrite is safe, and do it directly in hipe_tagscheme:fixnum_addsub/5 instead.
2016-11-16hipe: Make realloc_binary fast case true branchMagnus Lång
This makes the fast case a fallthrough and the slow case a branch, hopefully improving cache locality.
2016-11-16hipe_x86_postpass: Negate conditions in goto elimMagnus Lång
2016-11-16hipe_tagscheme: Improve fixnum add on x86Magnus Lång
With the introduction of immediate adds encoded as 'LEA' on x86, it is now possible to do a fixnum add in two instructions and one branch by commuting the addition and reusing the result register as a temporary, which makes the 'alub' a 2-address add, saving a move instruction.
2016-11-16erts: Remove unused erl_crash_dump()Sverker Eriksson
2016-11-15hipe_rtl_to_x86: Use LEA only for immediate addsMagnus Lång
It seems that most 3-address adds of temps can be move coalesced. Therefore, we limit the behaviour added by 1567585dda8 to only affect immediate adds. Also, add conversion of immediate mov+sub to lea.
2016-11-15hipe_x86: LeaToAdd peephole ruleMagnus Lång
Although LEA is useful for three-address form adds, sometimes it is used where a normal add would have sufficed (due to the addition being the last use of one of the operands; but RTL lowering does not know that as it does not have liveness information). As a workaround, we convert LEA back to ADD when the destination is the same as one of the operands.
2016-11-15hipe_sparc: move coalescingMagnus Lång
2016-11-15hipe_ppc: better rlwinm ppMagnus Lång
2016-11-15hipe_ppc: move coalescingMagnus Lång
2016-11-15hipe_rtl: drop alub dest when unusedMagnus Lång
2016-11-15hipe_rtl: unify branch and alubMagnus Lång
branch and alub overlap in their use cases, but the backends rely on knowing that the result is unused in their lowering of branch. By extending alub so that the destination is optional, it can fully replace branch. This simplifies rtl by reducing code duplication and the number of instructions. Also, in the x86 and arm backends, we can now use 'test' and {'tst','mvn','teq'} to lower some alubs without destinations. This is particularly good for x86, as sequences such as 'is_boxed' type tests now get shorter (both from not needing a mov to copy the variable, but also from the fact that 'testb' encodes shorter than 'andq').
2016-11-15hipe_x86: Fix&activate ElimCmp0 peephole ruleMagnus Lång
2016-11-15hipe_{x86,amd64}: Finish test instr implementationMagnus Lång
2016-11-15Expand on the behavior of supervisorsBrujo Benavides
Add additional details on the behavior of supervisors when reaching maximum restart intensity, as stated by @rvirding at [Medium](https://goo.gl/XhwpSL)
2016-11-14erts: Add gcc compile error -Werror=undefSverker Eriksson
to get errors for "#if UNDEFINED_MACRO"
2016-11-14Merge branch 'maint'Hans Nilsson
2016-11-14Merge branch 'hans/ssh/cuddle_tests_maint' into maintHans Nilsson
2016-11-14Merge branch 'tokitori/stdlib/optimize-sets/PR-1212/OTP-14035'Björn Gustavsson
* tokitori/stdlib/optimize-sets/PR-1212/OTP-14035: Speed up sets:add_element/2 and sets:del_element/2
2016-11-14Merge branch 'maint'Ingela Anderton Andin