aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
AgeCommit message (Collapse)Author
2018-03-14Merge branch 'maint'Henrik
Conflicts: OTP_VERSION
2018-03-09Update release notesErlang/OTP
2018-03-09Update version numbersErlang/OTP
2018-02-23Sort entries and correct typosMichał Muskała
2018-02-17Inline more type test BIFs in HiPEMichał Muskała
2018-02-06dialyzer: Assign a type to the primop build_stacktraceHans Bolinder
2018-02-01Merge pull request #1701 from bjorng/bjorn/get_hd_tlBjörn Gustavsson
Eliminate get_list/3 internally in the compiler
2018-01-29make HiPE work on x86_64 when PIE is enabledbhuztez
Currently HiPE amd64 assumes the runtime system code is loaded into the low 2G of the address space. However, this is not the case when PIE is enabled, it is loaded into a random location. So trampolines are required to call BIFs, and also we have first to load the address of sse2_fnegate_mask to a regisiter before xorpd in fchs.
2018-01-29Merge PR-1685 from sverker/sverker/hipe-verify-gcsafe OTP-14900Sverker Eriksson
Make hipe compile option verify_gcsafe the default
2018-01-26Eliminate get_list/3 internally in the compilerBjörn Gustavsson
Instructions that produce more than one result complicate optimizations. get_list/3 is one of two instructions that produce multiple results (get_map_elements/3 is the other). Introduce the get_hd/2 and get_tl/2 instructions that return the head and tail of a cons cell, respectively, and use it internally in all optimization passes. For efficiency, we still want to use get_list/3 if both head and tail are used, so we will translate matching pairs of get_hd and get_tl back to get_list instructions.
2018-01-22Don't build a stacktrace if it's only passed to erlang:raise/3Björn Gustavsson
Consider the following function: function({function,Name,Arity,CLabel,Is0}, Lc0) -> try %% Optimize the code for the function. catch Class:Error:Stack -> io:format("Function: ~w/~w\n", [Name,Arity]), erlang:raise(Class, Error, Stack) end. The stacktrace is retrieved, but it is only used in the call to erlang:raise/3. There is no need to build a stacktrace in this function. We can avoid the building if we introduce an instruction called raw_raise/3 that works exactly like the erlang:raise/3 BIF except that its third argument must be a raw stacktrace.
2018-01-22Merge branch 'maint'Björn Gustavsson
* maint: ErLLVM: Preserve precise BEAM tailcall semantics observer: Fix change accum Remove double calls observer: Don't crash for late messages observer: Optimize tv tab for many tables
2018-01-19ErLLVM: Preserve precise BEAM tailcall semanticsMagnus Lång
The BEAM compiler chooses not to perform tailcall optimisations for some calls in tail position, for example to some built-in functions. However, when the ErLLVM HiPE backend is used, LLVM may choose to perform tailcall optimisation on these calls, breaking the expected semantics. To preserve the precise semantics exhibited by BEAM, the 'notail' marker, present in LLVM since version 3.8, is added to call instructions that BEAM has not turned into tail calls, which inhibits LLVM from performing tail-call optimisation in turn.
2018-01-19Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Fix bsl/2 bug
2018-01-19Merge branch 'hasse/dialyzer/fix_bsl' into maintHans Bolinder
* hasse/dialyzer/fix_bsl: dialyzer: Fix bsl/2 bug
2018-01-16hipe: Make option 'verify_gcsafe' the defaultSverker Eriksson
2018-01-16hipe: Mark primop 'bs_put_utf8' as gcsafeSverker Eriksson
which is has been since 3d21f793538927ae88f78504a11dd898e8ca1a7a
2018-01-15Merge branch 'maint'Sverker Eriksson
2018-01-15Merge branch 'sverker/cuddle-big-bin-tests' into maintSverker Eriksson
2018-01-12dialyzer: Fix bsl/2 bugHans Bolinder
Also modified erl_bif_types:infinity_bsl() when called with zero as first argument. As of writing this, erlang:'bsl'/2 is modified on the master branch to never fail if called with a huge second argument.
2018-01-09Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Correct handling of erlang:abs/1
2018-01-08dialyzer: Correct handling of erlang:abs/1Hans Bolinder
See also https://bugs.erlang.org/browse/ERL-551.
2018-01-05hipe: Avoid out-of-memory crash for bs_SUITE:bs_constructSverker Eriksson
2018-01-03Merge branch 'maint'Sverker Eriksson
2018-01-03Fix bug in hipe primop bs_put_utf8Sverker Eriksson
by preventing it from doing GC, which generated code relies on.
2017-12-13Merge branch 'maint'Henrik Nord
2017-12-08Update release notesErlang/OTP
2017-12-08Update version numbersErlang/OTP
2017-11-30Add syntax in try/catch to retrieve the stacktrace directlyBjörn Gustavsson
This commit adds a new syntax for retrieving the stacktrace without calling erlang:get_stacktrace/0. That allow us to deprecate erlang:get_stacktrace/0 and ultimately remove it. The problem with erlang:get_stacktrace/0 is that it can keep huge terms in a process for an indefinite time after an exception. The stacktrace can be huge after a 'function_clause' exception or a failed call to a BIF or operator, because the arguments for the call will be included in the stacktrace. For example: 1> catch abs(lists:seq(1, 1000)). {'EXIT',{badarg,[{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}]}} 2> erlang:get_stacktrace(). [{erlang,abs, [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22, 23,24|...]], []}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {erl_eval,expr,5,[{file,"erl_eval.erl"},{line,431}]}, {shell,exprs,7,[{file,"shell.erl"},{line,687}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,642}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,627}]}] 3> We can extend the syntax for clauses in try/catch to optionally bind the stacktrace to a variable. Here is an example using the current syntax: try Expr catch C:E -> Stk = erlang:get_stacktrace(), . . . In the new syntax, it would look like: try Expr catch C:E:Stk -> . . . Only a variable (not a pattern) is allowed in the stacktrace position, to discourage matching of the stacktrace. (Matching would also be expensive, because the raw format of the stacktrace would have to be converted to the cooked form before matching.) Note that: try Expr catch E -> . . . is a shorthand for: try Expr catch throw:E -> . . . If the stacktrace is to be retrieved for a throw, the 'throw:' prefix must be explicitly included: try Expr catch throw:E:Stk -> . . .
2017-11-28Merge branch 'maint'Hans Bolinder
* maint: dialyzer: Extend the map implementation's handling of ?unit dialyzer: Use string:find() instead of string:str()
2017-11-22dialyzer: Extend the map implementation's handling of ?unitHans Bolinder
The Maps implementation handles ?unit in more cases. Exactly when t_is_none_or_unit() is to be called is not clear to me. The added cases are about a map type being ?unit, but the key or the value of an association can also be ?unit, but that is not always checked.
2017-11-20Merge PR-1632 from margnus1/hipe-receive-opt OTP-14785Sverker Eriksson
HiPE: Optimise receives matching unique references
2017-11-20Merge branch 'maint'Lukas Larsson
2017-11-20Merge branch 'lukas/docs/xmllint_fixes/OTP-14721' into maintLukas Larsson
* lukas/docs/xmllint_fixes/OTP-14721: ssl/ssh: Remove/ignore unused XML_FILES doc files Refactor xmllint check and make it fail on failure Add toplevel xmllint make target Conflicts: lib/crypto/doc/src/Makefile
2017-11-20Merge branch 'lukas/stdlib/maps_iterators/OTP-14012'Lukas Larsson
* lukas/stdlib/maps_iterators/OTP-14012: erts: Limit size of first iterator for hashmaps Update primary bootstrap Update preloaded modules erts: Remove erts_internal:maps_to_list/2 stdlib: Make io_lib and io_lib_pretty use maps iterator erts: Implement batching maps:iterator erts: Implement maps path iterator erts: Implement map iterator using a stack stdlib: Introduce maps iterator API Conflicts: bootstrap/lib/stdlib/ebin/io_lib.beam bootstrap/lib/stdlib/ebin/io_lib_pretty.beam erts/emulator/beam/bif.tab erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/zlib.beam
2017-11-20erts: Implement batching maps:iteratorLukas Larsson
This iterator implementation fetches multiple elements to iterate over in one call to erts_internal:maps_next instead of one at a time. This means that the memory usage will go up for the iterator as we are buffering elements, but the usage is still bounded. In this implementation the max memory usage is 1000 words. Using this approach makes the iterator as fast as using maps:to_list, so maps:iterator/2 has been removed.
2017-11-16HiPE: Unique ref receive optMagnus Lång
2017-11-15Merge PR-1621 from margnus1/hipe-literal-tagSverker Eriksson
HiPE: Support for literal tag, tests and bugfixes
2017-11-09Merge branch 'maint'Sverker Eriksson
2017-11-09Merge PR-1618 from sverker/sverker/hipe-doc-limitations OTP-14767Sverker Eriksson
Document HiPE limitations
2017-11-06Clearify call trace limitations.Sverker Eriksson
2017-11-05HiPE: Support literal tagsMagnus Lång
Literal tags are used by the VM as an alternative to reserving a large virtual memory space in order to be able to quickly identify which terms are literals. The use of literal tags harms performance, but is useful to support systems where allocating a large amount of virtual memory is not an option.
2017-11-05HiPE: Verify GC safety of derived valuesMagnus Lång
HiPE has had metadata for gc safety on it's temporaries for a while, but it has never been enforced or even checked, so naturally several gc-safety violations has slipped through. A new pass, hipe_rtl_verify_gcsafe verifies gcsafety on optimised RTL and is used when running the testsuite, and can be manually enabled with +{hipe,[verify_gcsafe]}.
2017-11-05HiPE: Make is_divisible a primopMagnus Lång
Since gcunsafe values are live over is_divisible calls (although only the happy path, which never GCd), it should be a primop so there cannot be any GCs.
2017-11-05hipe_rtl_lcm: Fix another bugMagnus Lång
During deletion, the killing of expressions was not considered.
2017-11-05hipe_rtl_lcm: Fix Lazy Code Motion bugMagnus Lång
The lazy code motion optimisation pass could violate its guarantees eliminating partial redundancy by moving an expression to before a call instruction.
2017-11-03Removed "unused list comprehensions"Sverker Eriksson
which don't seem to be true.
2017-11-03Merge branch 'maint'Sverker Eriksson
2017-11-03Merge PR-1607 from sverker/hipe_bin_utf32_bug OTP-14740Sverker Eriksson
Fix hipe bug in binary <<X/utf32>> construction
2017-11-03Fix bug in hipe for <<X/utf32>>Sverker Eriksson
by introducing new primop 'is_unicode' with no exception (ab)use and no GC. Replaces bs_validate_unicode which is kept for backward compat for now.