aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
AgeCommit message (Collapse)Author
2016-11-25Merge branch 'richarl/fix-license-headers/PR-788'Björn Gustavsson
* richarl/fix-license-headers/PR-788: Make use of the Header feature in yecc Remove Emacs timestamp markers Remove obsolete CVS keyword markup Update obsolete author e-mails Replace broken example URL Add missing entries to COPYRIGHT file Correct copyright on stdlib files Add license headers to hipe files in kernel Correct copyright info on typer files Correct copyright and license on dialyzer files Correct copyright on remaining hipe files Correct copyright info on hipe cerl files Correct copyright info on cerl-related files Correct the copyright info in docgen_edoc_xml_cb Update Syntax Tools license headers Remove some obsolete files Update EDoc license headers to dual Apache2/LGPL Update EUnit license headers to dual Apache2/LGPL
2016-11-23Remove Emacs timestamp markersRichard Carlsson
2016-11-23Remove obsolete CVS keyword markupRichard Carlsson
2016-11-23Update obsolete author e-mailsRichard Carlsson
2016-11-23Correct copyright on remaining hipe filesRichard Carlsson
2016-11-23Correct copyright info on hipe cerl filesRichard Carlsson
2016-11-23Merge branch 'maint'Sverker Eriksson
2016-11-23Merge branch 'margnus1/hipe-call-elim-crash/PR-1253/OTP-13965' into maintSverker Eriksson
* margnus1/hipe-call-elim-crash/PR-1253: hipe_icode_call_elim: Fix cf elimination crash hipe: Improve error message on internal crashes
2016-11-23Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Substitute 'opacity' for 'opaqueness' dialyzer: Improve a warning message dialyzer: Improve a warning message dialyzer: Correct a warnings message
2016-11-22dialyzer: Substitute 'opacity' for 'opaqueness'Hans Bolinder
Suggested by Kostis.
2016-11-19hipe_icode_call_elim: Fix cf elimination crashMagnus Lång
hipe_icode_call_elim could in some cases replace an #icode_call{} with control flow with a move instruction. This would break the control flow graph invariants and cause a crash.
2016-11-19hipe: Improve error message on internal crashesMagnus Lång
Print the MFA/module being compiled, and pretty-print the backtrace with lib:format_stacktrace/4. Additionally, make the error_msg/2 macro in hipe.hrl respect the HIPE_LOGGING define, since messages produced by this macro just before runtime shutdown were sometimes lost (since code_server:error_msg/2 is asynchronous).
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-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-10Merge branch 'maint'Sverker Eriksson
# Conflicts: # lib/hipe/llvm/hipe_rtl_to_llvm.erl
2016-11-10Merge branch 'margnus1/hipe_llvm39_bugs/PR-1237/OTP-14027/OTP-14028' into maintSverker Eriksson
* margnus1/hipe_llvm39_bugs/PR-1237: hipe_rtl_to_llvm: Constants for bits per byte/word hipe_llvm: Work around LLVM 3.9 sdesc bug hipe_llvm: Fix incorrect atom alignment assumption
2016-11-08hipe_rtl_to_llvm: Constants for bits per byte/wordMagnus Lång
The constant ?WORD_WIDTH is renamed ?BITS_IN_WORD, and a new constant ?BITS_IN_BYTE is introduced. Additionally, a bug in a currently unused case clause of llvm_type_from_size/1 is fixed (the size of a word was hardcoded to 64 bits).
2016-11-07hipe_llvm: Work around LLVM 3.9 sdesc bugMagnus Lång
As of LLVM 3.9, the x86-call-frame-opt pass in LLVM's X86 backend causes the stack descriptors to contain incorrect (or even negative) frame sizes or root slot offsets. This might cause LLVM-compiled modules to be rejected during loading with a badarg exception in hipe_bifs:enter_sdecs/1 (which additionally prints a "hipe_bifs_enter_sdesc_1: bad sdesc!" message to stderr), or it might cause corruption or segmentation faults when walking stacks (f.ex. during GC) containing frames compiled with ErLLVM. As a workaround, we pass the -no-x86-call-frame-opt flag to llc when the version is at least 3.9
2016-11-07hipe_llvm: Fix incorrect atom alignment assumptionMagnus Lång
ErLLVM was declaring atoms in the following manner: @atom_ok = external constant i64 ; Used inside a function like this %var = ptrtoint i64* @atom_ok to i64 However, doing so makes LLVM think the `atom_ok` is 8-byte aligned, since it refers to a i64 value. This resulted in LLVM occasionally incorrectly optimising away type tests on atoms, causing incorrect behaviour or even segfaults. One such case is in bs_match_compiler:coverage_apply/2, in which an is_boxed test on a literal atom was optimised away, causing the code to try and load the "header" of an atom. This problem reproduces with LLVM versions 3.7 through 3.9. By declaring atoms as i8 (byte) constants instead, LLVM no longer makes these alignment assumptions, and the bug is fixed.
2016-11-07Merge branch 'maint'Sverker Eriksson
2016-11-03Add a test case that should now workKostis Sagonas
2016-11-03Fix the native code translation of bs_match_stringKostis Sagonas
This fixes a HiPE bug reported on erlang-questions on 2/11/2016. The BEAM to ICode tranaslation of the bs_match_string instruction, written long ago for binaries (i.e., with byte-sized strings), tried to do a `clever' translation of even bit-sized strings using a HiPE primop that took a `Size' argument expressed in *bytes*. ICode is not really the place to do such a thing, and moreover there is really no reason for the HiPE primop not to take a Size argument expressed in *bits* instead. This commit changes the `Size' argument to be in bits, postpones the translation of the bs_match_string primop Fixed in a pair-programming/debugging session with @margnus1. until RTL and does a proper translation using bit-sized quantities there.
2016-10-24Merge branch 'sverker/hipe-llvm-remote-call/OTP-13983'Sverker Eriksson
2016-10-21hipe,llvm: Change inc_stack_0 bif call to not_remoteSverker Eriksson
Seems to work either way, it just seem more correct as all other 'bif' calls are 'not_remote'.
2016-10-21hipe: Remove redundant assertionSverker Eriksson
2016-10-18hipe_llvm: Use different symbols for remote callsMagnus Lång
2016-10-18Change the return type of hipe_bifs:add_ref/2Kostis Sagonas
2016-10-17kernel,hipe: Fix dialyzer warningsSverker Eriksson
2016-10-14Merge branch 'master' into sverker/hipe-code-loadnpurgeSverker Eriksson
Conflicts: erts/emulator/beam/beam_bif_load.c erts/emulator/beam/beam_load.c and added macro DBG_TRACE_MFA_P in beam_load.h
2016-10-14hipe: TRY fix llvm external calls to own moduleSverker Eriksson
to not be transformed to local calls. code_SUITE:uprade still fails if run with compile option {hipe,to_llvm}
2016-10-14hipe,erts: Remove cached fun 'native_address'Sverker Eriksson
Did not work with purge and made worse by new purge strategy. Did yield terrible performance when fun thing is created *before* fun code is loaded. Like when receiving not yet loaded fun from other node. The cached 'native_address' in ErlFunThing will not be updated leading to mode switch and error_handler being called for every call to the fun from native code.
2016-10-14erts: Fix early hipe patch loadingSverker Eriksson
by introducing hipe_bifs:commit_patch_load/1 that creates the HipeModule.
2016-10-14erts: Move new hipe ref and sdesc lists to loader stateSverker Eriksson
2016-10-14Add a loader state for HiPE code loadingMagnus Lång
Just like the BEAM loader state (as returned by erlang:prepare_loading/2), the HiPE loader state is contained in a magic binary. Eventually, we will separate HiPE loading into a prepare and a finalise phase, like the BEAM loader, where the prepare phase will be implemented by hipe_unified_loader and the finalise phase be implemented in C by hipe_load.c and beam_load.c, making prepare side-effect free and finalise atomic. The finalise phase will be exposed through the erlang:finish_loading/1 API, just like the BEAM loader, as this will allow HiPE and BEAM modules to be mixed in the same atomic "commit". The usage of a loader state makes it easier to keep track of all resources allocated during loading, and will not only make it easy to prevent leaks when hipe_unified_loader crashes, but also paves the way for proper, leak-free, unloading of HiPE modules.
2016-10-13Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Fix opaque bug dialyzer: Fix opaque bugs