aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2017-03-16hipe: Add range splitter range_splitMagnus Lång
hipe_range_split is a complex live range splitter, more sophisticated thatn hipe_restore_reuse, but still targeted specifically at temporaries forced onto stack by being live over call instructions. hipe_range_split partitions the control flow graph at call instructions, like hipe_regalloc_prepass. Splitting decisions are made on a per partition and per temporary basis. There are three different ways in which hipe_range_split may choose to split a temporary in a program partition: * Mode1: Spill the temp before calls, and restore it after them * Mode2: Spill the temp after definitions, restore it after calls * Mode3: Spill the temp after definitions, restore it before uses To pick which of these should be used for each temp×partiton pair, hipe_range_split uses a cost function. The cost is simply the sum of the cost of all expected stack accesses, and the cost for an individual stack access is based on the probability weight of the basic block that it resides in. This biases the range splitter so that it attempts moving stack accesses from a functions hot path to the cold path. hipe_bb_weights is used to compute the probability weights. mode3 is effectively the same as what hipe_restore_reuse does. Because of this, hipe_restore_reuse reuses the analysis pass of hipe_restore_reuse in order to compute the minimal needed set of spills and restores. The reason mode3 was introduced to hipe_range_split rather than simply composing it with hipe_restore_reuse (by running both) is that such a composition resulted in poor register allocation results due to insufficiently strong move coalescing in the register allocator. The cost function heuristic has a couple of tuning knobs: * {range_split_min_gain, Gain} (default: 1.1, range: [0.0, inf)) The minimum proportional improvement that the cost of all stack accesses to a temp must display in order for that temp to be split. * {range_split_mode1_fudge, Factor} (default: 1.1, range: [0.0, inf)) Costs for mode1 are multiplied by this factor in order to discourage it when it provides marginal benefits. The justification is that mode1 causes temps to be live for longest, thus leading to higher register pressure. * {range_split_weight_power, Factor} (default: 2, range: (0.0, inf)) Adjusts how much effect the basic block weights have on the cost of a stack access. A stack access in a block with weight 1.0 has cost 1.0, a stack access in a block with weight 0.01 has cost 1/Factor. Additionally, the option range_split_weights chooses whether the basic block weights are used at all. In the case that the input is very big, hipe_range_split automatically falls back to hipe_restore_reuse only in order to keep compile times under control. Note that this is not only because of hipe_range_split being slow, but also due to the resulting program being slow to register allocate, and is not as partitionable by hipe_regalloc_prepass. hipe_restore_reuse, on the other hand, does not affect the programs partitionability. The hipe_range_split pass is controlled by a new option ra_range_split. ra_range_split is added to o2, and ra_restore_reuse is disabled in o2.
2017-03-16hipe: Add module computing basic blocks weightsMagnus Lång
hipe_bb_weights computes basic block weights by using the branch probability predictions as the coefficients in a linear equation system. This linear equation system is then solved using Gauss-Jordan Elimination. The equation system representation is picked to be efficient with highly sparse data. During triangelisation, the remaining equations are dynamically reordered in order to prevent the equations from growing in the common case, preserving the benefit of the sparse equation representation. In the case that the input is very big, hipe_bb_weights automatically falls back to a rough approximation in order to keep compile times under control.
2017-03-16hipe: Add branch prediction accessor ra callbacksMagnus Lång
Adds a new register allocator callback Target:branch_preds(Instr, Context) which, for a control flow instruction Instr, returns a list of tuples {Target, Probability} for each label name Target that Instr may branch to. Probability is a float between 0.0 and 1.0 and corresponds to the predicted probability that control flow branches to the corresponding target. The probabilities may sum to at most 1.0 (rounding errors aside). Note that a sum less than 1.0 is valid.
2017-03-16hipe: Add range splitter restore_reuseMagnus Lång
hipe_restore_reuse is a simplistic range splitter that splits temps that are forced onto the stack by being live over call instructions. In particular, it attempts to avoid cases where there are several accesses to such stack allocated temps in straight-line code, uninterrupted by any calls. In order to achieve this it splits temps between just before the first access(es) and just after the last access(es) in such straight-line code groups. The hipe_restore_reuse pass is controlled by a new option ra_restore_reuse. ra_restore_reuse is added to o1.
2017-03-16hipe: Add basic range splitting ra callbacksMagnus Lång
In addition to the temporary name rewriting that hipe_regalloc_prepass does, range splitters also need to be able to insert move instructions, as well as inserting new basic blocks in the control flow graph. The following four callbacks are added for that purpose: * Target:mk_move(Src, Dst, Context) Returns a move instruction from the temporary (not just register number) Src to Dst. * Target:mk_goto(Label, Context) Returns a unconditional control flow instruction that branches to the label with name Label. * Target:redirect_jmp(Instr, ToOld, ToNew, Context) Modifies the control flow instruction Instr so that any control flow that would go to a label with name ToOld instead goes to the label with name ToNew. * Target:new_label(Context) Returns a fresh label name that does not belong to any existing block in the current function, and is to be used to create a new basic block in the control flow graph by calling Target:update_bb/4 with this new name.
2017-03-16hipe: Add basic_edge_cases test caseMagnus Lång
Two tests are added, primarily aimed at the range splitters. * test_float_spills, which exercises the rare case of high floating point register pressure, including spill slot move coalescing. * test_infinite_loops, which tests that various infinite loops are properly compiled and do contain reduction tests (otherwise they would permanently hog their scheduler and not notice being sent an exit signal).
2017-03-16hipe: Extract disjoint sets to its own moduleMagnus Lång
2017-03-16hipe_x86_subst: Fix bug with zero-arity #fp_unop{}Magnus Lång
2017-03-16Merge branch 'ingela/ssl/dtls-test'Ingela Anderton Andin
* ingela/ssl/dtls-test: dtls: Correct version check dtls: Test case fixes
2017-03-16Merge branch 'siri/edoc/testcuddle'Siri Hansen
* siri/edoc/testcuddle: Run preprocess when generating xmerl documentation in test
2017-03-16Merge remote-tracking branch ↵Hans Bolinder
'origin/jparise/parsetools/yecc-header-dot/OTP-14276/PR-1357' * origin/jparise/parsetools/yecc-header-dot/OTP-14276/PR-1357: Include ending dot in yecc's Header code example
2017-03-15Merge branch 'bjorn/stdlib/erl_tar'Björn Gustavsson
* bjorn/stdlib/erl_tar: erl_tar: Close files after reading from a tar file
2017-03-15Merge pull request #1373 from richcarl/edoc-no-timstampsBjörn Gustavsson
edoc: Don't generate timestamps in footer OTP-14277
2017-03-15Merge pull request #1371 from aggelgian/fix-otp-internalBjörn Gustavsson
Fix unhandled exceptions in otp_internal module
2017-03-15Merge pull request #1374 from bjorng/bjorn/compiler/fix-beam_typeBjörn Gustavsson
beam_type: Avoid an internal consistency check failure
2017-03-14Merge branch 'maint'Rickard Green
* maint: Updated OTP version Prepare release Conflicts: OTP_VERSION lib/typer/doc/src/notes.xml lib/typer/vsn.mk
2017-03-14Prepare releaseErlang/OTP
2017-03-14Merge branch 'hasse/hipe/remove_work_around'Hans Bolinder
* hasse/hipe/remove_work_around: hipe: Remove work around for Dialyzer bug
2017-03-14Merge branch 'hasse/fix_erl_anno_use'Hans Bolinder
* hasse/fix_erl_anno_use: parsetools: Fix handling of locations and annotations diameter: Fix handling of locations and annotations kernel: Fix handling of locations and annotations compiler: Fix handling of locations and annotations eunit: Fix handling of locations and annotations Update preloaded erts: Fix handling of locations and annotations dialyzer: Fix handling of annotations in a test debugger: Fix handling of locations and annotations stdlib: Extend functions in erl_parse to handle form_info() stdlib: Fix handling of locations and annotations erts: Correct the documentation of abstract end-of-file stdlib: Add debug tests to the erl_parse module stdlib: improve the erl_anno module's debug tests stdlib: Improve the erl_pp module's debug tests
2017-03-14Merge pull request #1342 from dgud/dgud/observer/max_and_dirty_sched/OTP-14137Dan Gudmundsson
2017-03-13Merge branch 'maint'Rickard Green
* maint: Fix xml warnings in old release notes
2017-03-13Fix xml warnings in old release notesRickard Green
2017-03-13beam_type: Avoid an internal consistency check failureBjörn Gustavsson
Code such as the following: -record(x, {a}). f(R, N0) -> N = N0 / 100, if element(1, R#x.a) =:= 0 -> N end. would fail to compile with the following message: m: function f/2+19: Internal consistency check failed - please report this bug. Instruction: {fmove,{fr,0},{x,1}} Error: {uninitialized_reg,{fr,0}}: This bug was introduced in 348b5e6bee2f. Basically, the beam_type pass placed the fmove instruction in the wrong place. Instructions that store to floating point registers and instructions that read from floating point registers are supposed to be in the same basic block. Fix the problem by flushing all floating points instruction before a call the pseudo-BIF is_record/3, thus making sure that the fmove instruction is placed in the correct block. Here is an annotated listing of the relevant part of the .S file (before the fix): {test_heap,{alloc,[{words,0},{floats,1}]},2}. {fconv,{x,1},{fr,0}}. {fmove,{float,100.0},{fr,1}}. fclearerror. {bif,fdiv,{f,0},[{fr,0},{fr,1}],{fr,0}}. {fcheckerror,{f,0}}. %% The instruction {fmove,{fr,0},{x,1}} should have %% been here. %% Block of instructions expanded from a call to %% the pseudo-BIF is_record/3. (Expanded in a later %% compiler pass.) {test,is_tuple,{f,3},[{x,0}]}. {test,test_arity,{f,3},[{x,0},2]}. {get_tuple_element,{x,0},0,{x,2}}. {test,is_eq_exact,{f,3},[{x,2},{atom,x}]}. {move,{atom,true},{x,2}}. {jump,{f,4}}. {label,3}. {move,{atom,false},{x,2}}. {label,4}. %% End of expansion. %% The fmove instruction that beam_validator complains %% about. {fmove,{fr,0},{x,1}}. Reported-by: Richard Carlsson
2017-03-13Fix small typosDimitar Haralanov
2017-03-13edoc: Don't generate timestamps in footerRichard Carlsson
2017-03-13Merge branch 'wiml/crypto/rsa-generate-key/ERL-165/PR-1299/OTP-14140'Hans Nilsson
2017-03-13hipe: Remove work around for Dialyzer bugHans Bolinder
The bug in Dialyzer is fixed in commit 5ac2943.
2017-03-12Fix return value of obsolete_1(rpc,safe_multi_server_call,A)Aggelos Giantsios
The following calls: - otp_internal:obsolete(rpc, safe_multi_server_call, 2). - otp_internal:obsolete(rpc, safe_multi_server_call, 3). threw an unhandled exception. The return value has been amended to match the relevant pattern of obsolete/3.
2017-03-10Update copyright yearRickard Green
2017-03-10observer: Add a max carrier size columnDan Gudmundsson
Users wanted to see the maximum value seen by observer during it's uptime. Note changes faster than the sample rate will still be missed.
2017-03-10observer: Draw dotted lines for dirty cpu threadsDan Gudmundsson
In OTP-20 dirty_schedulers are default on. Draw them dotted so we can difference between real schedulers and dirty schedulers.
2017-03-10parsetools: Fix handling of locations and annotationsHans Bolinder
2017-03-10Merge branch 'hasse/dialyzer/fix_plt_suite'Hans Bolinder
* hasse/dialyzer/fix_plt_suite: dialyzer: Correct a test case
2017-03-10dtls: Correct version checkIngela Anderton Andin
2017-03-10dtls: Test case fixesIngela Anderton Andin
2017-03-10erl_tar: Close files after reading from a tar fileBjörn Gustavsson
Also let the test suite verify that all files that are opened will be closed before the end of each test case. aa0c4b0df7cdc7 introduced the file descriptor leak.
2017-03-10Merge branch 'egil/tools/fix-makefile'Björn-Egil Dahlberg
* egil/tools/fix-makefile: tools: Remove percept from makefile
2017-03-09ssh: documents ssh:daemon_info/1Hans Nilsson
2017-03-09ssh: Host and Profile info returned in ssh:daemon_infoHans Nilsson
2017-03-09public_key: Bugfix public_key:generate_key({namedCurve,OID})Hans Nilsson
2017-03-09Merge branch 'maint'Hans Nilsson
2017-03-09ssh: Update .app fileHans Nilsson
2017-03-09public_key: updated crypto dependence in .app.srcHans Nilsson
2017-03-09public_key: RSA key gen documentationHans Nilsson
2017-03-09public_key: Make test suites use the new RSA key generation functionHans Nilsson
2017-03-09public_key: New -spec for public_key:generate_key/1Hans Nilsson
2017-03-09public_key: Add RSA to public_key:generate_key/1Hans Nilsson
2017-03-09crypto: Document exceptions thrown in crypto:generate_keyHans Nilsson
2017-03-09crypto: Uppdate crypto.app.src for dirty_scheduler dependency in ERTSHans Nilsson
2017-03-09crypto: removed error function from PR and added error handling in crypto.erlHans Nilsson