aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-04-29sys_core_fold: Suppress warnings betterBjörn Gustavsson
86fbd6d76d strengthened type optimization in lets. As a result of the stronger optimizations, special care had to be taken to suppress false warnings. It turns out that false warnings can still slip through. Slapping on a 'compiler_generated' annotation at the top-level of a complex term such as #c_tuple{} may not suppress all warnings. We will need to go deeper into the term to eliminate all warnings.
2015-04-29beam_utils: Teach check_liveness/3 to understand get_map_elementsBjörn Gustavsson
Understanding get_map_elements improves the stack trimming done by beam_trim.
2015-04-29Teach beam_trim to handle map instructionsBjörn Gustavsson
2015-04-29beam_utils: Be less conservative about liveness for exit instructionsBjörn Gustavsson
beam_utils used to be overly conservative about liveness for exit instructions such as: call_ext erlang:exit/1 beam_utils would consider all y registers to be used, to avoid overwriting a catch or try tag. That does not seem to be a real risk. However, we miss opportunities for stack trimming if we consider y registers used by an exit instruction.
2015-04-29beam_validator: Stop validating the 'aligned' flag for binariesBjörn Gustavsson
The run-time system stopped paying attention the 'aligned' flag in bit syntax construction and matching when bitstrings were introduced in language. The beam_asm compiler pass will crash if the 'aligned' flag is given in bit syntax instructions. beam_validator still validates the 'aligned' flag. Before 912fea0b712a (which removed the possibility to validate existing BEAM files), the 'aligned' flag could actually be encountered when validating a BEAM file. Since the validation of 'aligned' no longer serves any useful purpose, remove the validation code.
2015-04-29beam_validator: Clean up updating of types for y registerBjörn Gustavsson
set_type_y/3 is far too complicated. Note that we don't need to check the #st.numy field, because we will detect the error anyway because the information for the y register will be missing in the #st.y gb_tree. There is also a clause that would never match because of a spelling error (the first "n" was missing in "uninitialized"). That clause is not needed because the default clause will do fine. Furthermore, we can break out the special case for handling catch_end and similar instructions into a new function.
2015-04-23beam_validator: Remove support for removed BIF fault/1,2Björn Gustavsson
The fault/1,2 BIF was removed a long time ago.
2015-04-23beam_validator: Correct merging of statesBjörn Gustavsson
When merging two states, the following fields should be merged between the states: #st.x, #st.y, #st.numy, #st.ct. Everything else should be set to the default values in a new state.
2015-04-23beam_validator: Correct merging of y registersBjörn Gustavsson
When merging y registers, only the y registers that are found in both states should be retained.
2015-04-22sys_pre_expand: Remove unused fields in #expand{} recordBjörn Gustavsson
The compile, bitdefault, and bittypes records are not really used in the #expand{} record.
2015-04-22Update primary bootstrapBjörn Gustavsson
2015-04-22Merge branch 'bjorn/compiler/eprof'Björn Gustavsson
* bjorn/compiler/eprof: v3_life: Optimize updating of the variable data base beam_jump: Replace use of lists:dropwhile/2 with a custom function beam_asm: Eliminate unnecessary use of iolist_to_binary/1 beam_bsm: Optimize btb_index() beam_type: Eliminate redundant calls to checkerror_1/2 erl_expand_records: Simplify handling of call_ext instructions beam_utils: Optimize index_labels_1/2 beam_block: Optimize matching of binary literals Move rewriting of bs_match from beam_clean to beam_z v3_codegen: Reduce cost for fixing up bs_match_string instructions v3_codegen: Optimize "turning" of y registers v3_kernel: Optimize subst_vsub/3 orddict: Eliminate unnecessary consing in store/3 and others compile: Add the {eprof,Pass} option for easy eprof running compile: Eliminate unnecessary wrappers for compiler passes Add z_SUITE to validate loaded code test suite: Always place .core files in data directories test suites: Unload modules compiled from .core or .S compilation_SUITE: Unload tested modules using the code server
2015-04-22v3_life: Optimize updating of the variable data baseBjörn Gustavsson
Updating of the variable data base takes most of the time.
2015-04-22beam_jump: Replace use of lists:dropwhile/2 with a custom functionBjörn Gustavsson
The use of lists:dropwhile/2 is noticeable in the eprof results.
2015-04-22beam_asm: Eliminate unnecessary use of iolist_to_binary/1Björn Gustavsson
2015-04-22beam_bsm: Optimize btb_index()Björn Gustavsson
lists:dropwhile/2 and the fun in btb_index_1/2 shows up in the top 10 list of eprof. Replace dropwhile with a special-purpose function for a tiny increase in speed.
2015-04-22beam_type: Eliminate redundant calls to checkerror_1/2Björn Gustavsson
Profiling shows that the excution time for checkerror_1/2 could be be near the top even for modules without any floating point operations. It turns out that the complexity of simplify_float_1/4 is quadratic. checkerror/1 is called with the growing accumulator for each iteration. checkerror/1 will traverse the entire accumulated list *unless* some floating point operations are used. We can avoid this situation if we only call checkerror/1 when there are live floating point registers. We can also avoid calling flush/3 if there are no live floating point registers.
2015-04-22erl_expand_records: Simplify handling of call_ext instructionsBjörn Gustavsson
The erl_expand_records module have inherited code from sys_pre_expand. We can simplify the code for handling the call_ext instruction to make the code clearer and a smidge faster.
2015-04-22beam_utils: Optimize index_labels_1/2Björn Gustavsson
The execution time for beam_utils:index_labels_1/2 is among the longest in the beam_bool, beam_bsm, beam_receive, and beam_trim compiler passes. Therefore it is worthwhile to do the minor optimization of replacing a call to lists:dropwhile/2 with a special-purpose drop_labels function.
2015-04-22beam_block: Optimize matching of binary literalsBjörn Gustavsson
When matching a binary literal as in: <<"abc">> = Bin the compiler will produce a sequence of three instructions (some details in the instructions removed for simplicity): bs_start_match2 Fail BinReg CtxtReg bs_match_string Fail CtxtReg "abc" bs_test_tail2 Fail CtxtReg 0 The sequence can be replaced with: is_eq_exact Fail BinReg "abc"
2015-04-22Move rewriting of bs_match from beam_clean to beam_zBjörn Gustavsson
The actual bs_match_string instruction has four operands: bs_match_string {f,Lbl} Ctxt NumBits {string,ListOfBytes} However, v3_codegen emits a more compact representation where the bits to match are packaged in a bitstring: bs_match_string {f,Lbl} Ctxt Bitstring Currently, beam_clean:clean_labels/1 will rewrite the compact representation to the final representation. That is unfortunate since clean_labels/1 is called by beam_dead, which means that the less compact representation will be introduced long before it is actually needed by beam_asm. It will also complicate any optimizations that we might want to do. Move the rewriting of bs_match_string from beam_clean:clean_labels/1 to the beam_z pass, which is the last pass executed before beam_validator and beam_asm.
2015-04-22v3_codegen: Reduce cost for fixing up bs_match_string instructionsBjörn Gustavsson
Commit b76588fb5a introduced an optimization of the compile time of huge functions with many bs_match_string instructions. The optimization is done in two passes. The first pass coalesces adjacent bs_match_string instructions. To avoid copying bitstrings multiple times, the bitstrings in the instructions are combined in to a (deep) list. The second pass goes through all instructions in the function and combines the list of bitstrings to a single bitstring in all bs_match_string instructions. The second pass (fix_bs_match_string) is run on all instructions in each function, even if there are no bs_match_instructions in the function. While fix_bs_match_string is not a bottleneck (it is a linear pass), its execution time is noticeable when profiling some modules. Move the execution of the second pass to the select_binary() function so that it will only be executed for instructions that do binary matching. Also take the opportunity to optimize away uses of bs_restore2 that occour directly after a bs_save2. That optimimization is currently done in beam_block, but it can be done essentially for free in the same pass that fixes up bs_match_string instructions.
2015-04-22v3_codegen: Optimize "turning" of y registersBjörn Gustavsson
Profiling shows that the execution time for "turning" y registers is noticeable for some modules (e.g. S1AP-PDU-Contents from the asn1 test suite). We can reduce the impact on running time by special-casing important instructions. In particular, there is no need to look for y registers in the list argument for a select_val instruction.
2015-04-22v3_kernel: Optimize subst_vsub/3Björn Gustavsson
Profiling shows that subst_vsub/3 dominates the running time. It is therefore worthwhile optimizing it.
2015-04-22orddict: Eliminate unnecessary consing in store/3 and othersBjörn Gustavsson
As a minor optimization, eliminate unnecessary cons operations in store/3, append/3, append_list/3, update/4, and update_counter/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-22Add z_SUITE to validate loaded codeBjörn Gustavsson
If we want to have test cases that run eprof, we must make sure that there are no modules loaded that don't have a working module_info/1 function, since eprof calls module_info(functions) to retrieve the list of functions in the module. Some test cases load modules compiled from Core Erlang that don't have any module_info/1 functions, so we will need make sure that all such modules have been unloaded. Add z_SUITE:loaded/1 to run after all other test cases to verify that all modules that the code server consider loaded are indeed loaded and all have working module_info/0,1 functions.
2015-04-22test suite: Always place .core files in data directoriesBjörn Gustavsson
For tidiness, always place .core files in data directories.
2015-04-22test suites: Unload modules compiled from .core or .SBjörn Gustavsson
The .core or .S files that are compiled in the test cases may lack module_info/0,1 functions, which will cause problems if we (for example) try to run eprof later. To avoid that problem, unload each module directly after testing it.
2015-04-22Merge branch 'hb/hipe/opaque_bugfix/OTP-12666'Hans Bolinder
* hb/hipe/opaque_bugfix/OTP-12666: hipe: Fix a bug in the handling of opaque types
2015-04-22Merge branch 'ia/pr/678/OTP-1267'Ingela Anderton Andin
* ia/pr/678/OTP-1267: Revert "Add workaround for problems with s_client defaults" ssl: Add unit test case ssl: Ignore signature_algorithm (TLS 1.2 extension) sent to TLS 1.0/1 server
2015-04-22Revert "Add workaround for problems with s_client defaults"Ingela Anderton Andin
This reverts commit a3cf4eb4cdd2ce178d81b62faa9f47485fd82331. This workaround is no longer needed as the, TLS-1.2 extension, signature_algorithm is now correctly ignored by previous TLS versions.
2015-04-21Merge branch 'sverk/etp-map'Sverker Eriksson
* sverk/etp-map: erts: Add map support to gdb etp command erts: Add etp_the_non_value
2015-04-21hipe: Fix a bug in the handling of opaque typesHans Bolinder
An opaque type ?opaque(_) was put in a list where #opaque{} was expected.
2015-04-21Merge branch 'mikpe/configure-linux-spelling'Zandra Hird
* mikpe/configure-linux-spelling: erts/configure.in: handle more 'linux' spellings
2015-04-21Merge branch 'vinoski/minor-erlang-el-fixes'Zandra Hird
* vinoski/minor-erlang-el-fixes: Minor fixes to emacs erlang-mode
2015-04-21Merge branch 'zandra/fix-ssl-obsolete-arity'Zandra Hird
* zandra/fix-ssl-obsolete-arity: add arity to obsolete_1(ssl, negotiated_next_protocol, 1)
2015-04-21Merge branch 'egil/fix-halfword-cmp'Björn-Egil Dahlberg
* egil/fix-halfword-cmp: erts: Fix halfword compare
2015-04-21ssl: Add unit test caseIngela Anderton Andin
2015-04-20compilation_SUITE: Unload tested modules using the code serverBjörn Gustavsson
Don't unload modules using BIFs; use the code server to ensure that code:all_loaded/0 only lists code that is actually loaded.
2015-04-20Merge branch 'wmalik/slave-specs'Björn Gustavsson
* wmalik/slave-specs: Remove unused comments Fix Host and Name type in slave.erl
2015-04-20zip: Suppress a dialyzer warning for an unmatched returnBjörn Gustavsson
A warning for an unmatched return was introduced in aaa7c917. The caller of openzip_close/1 ignores the return value, which could be an error tuple. In this situation, handling a fatal error, it is OK to ignore the return value; thus, we only need to make it explicit that we are ignoring the return value.
2015-04-20ssl: Ignore signature_algorithm (TLS 1.2 extension) sent to TLS 1.0/1 serverAndreas Schultz
pre TLS 1.2 server should ignore the signature_algorithms extension. The server code would attempt to select the signature/hash algorithm even when using TLS 1.0 or 1.1. Instead it should simply use the default algorithm on those versions.
2015-04-20erts/configure.in: handle more 'linux' spellingsMikael Pettersson
The configuration code which canonicalizes the operating system name into OPSYS requires Linux to be spelled 'linux' or 'Linux'. This is a problem in some build environments, e.g. RPM, which supply --build and --host using the longer 'linux-gnu' spelling. The effect is that OPSYS becomes 'noopsys' and some checks in erts/configure.in do not work as expected, e.g. the auto-enabling of HiPE may not happen. Fixed by matching on 'linux*' not just 'linux'. On ARM there are even longer variants such as 'linux-gnueabi' and 'linux-gnueabihf': these are also correctly mapped to 'linux' now.
2015-04-20Minor fixes to emacs erlang-modeSteve Vinoski
Fix "Unbalanced parentheses" error when indenting particular map constructs. Add new test cases for this fix. To prevent infinite looping when the programmer mistakenly enters incorrect syntax, detect cases where erlang-partial-parse fails to advance when called within a loop, and raise an "Illegal syntax" error.
2015-04-20erts: Fix halfword compareBjörn-Egil Dahlberg
2015-04-20Merge branch 'ia/public_key/bitstring/OTP-12110'Ingela Anderton Andin
* ia/public_key/bitstring/OTP-12110: ssl: Adjust to public_key application removing legacy compact_bit_string switch public_key: Update vsn for OTP 18 public_key: Reject bad signatures as early as possible public_key: Remove legacy switch compact_bit_string
2015-04-20ssl: Adjust to public_key application removing legacy compact_bit_string switchIngela Anderton Andin
2015-04-20public_key: Update vsn for OTP 18Ingela Anderton Andin