Age | Commit message (Collapse) | Author |
|
If a try/catch is used to ignore the potential exception caused by some
expression with a side effect such as:
try
side_effect()
catch _Class:_Reason ->
ok
end,
.
.
.
the generated code will be wasteful:
try YReg TryLabel
%% call side_effect() here
try_end Yreg
jump GoodLabel
TryLabel:
try_case YReg
%% try_case has set up registers as follows:
%% x(0) -> error | exit | throw
%% x(1) -> reason
%% x(2) -> raw stack trace data
GoodLabel:
%% This code does not use any x registers.
There will be two code paths that both end up at GoodLabel, and
the try_case instruction will set up registers that are never used.
We can do better by replacing try_case with try_end to obtain this
code:
try YReg TryLabel
%% call side_effect() here
try_end Yreg
jump GoodLabel
TryLabel:
try_end YReg
GoodLabel:
The jump optimizer (beam_jump) can further optimize this code
like this:
try YReg TryLabel
%% call side_effect() here
TryLabel:
try_end YReg
|
|
|
|
HiPE's range analysis would not update the arguments of a callee when
the result of the call was ignored.
Fixes ERL-278.
|
|
erl_bif_types contains a fixed and improved copy-paste (obvious from the
dead Max_range2_leq_zero if branches) of hipe_icode_range:range_rem/2.
For now, delete the dead code and propagate back fixes and improvements
to hipe_icode_range.
|
|
|
|
* Omit bounds check in more cases.
A test case that needs this change to omit bounds check is added.
* Improve code generation by reformulating bounds check to decrease
register pressure.
|
|
This is useful to generate shorter code for closures generated by
(fun F/A).
|
|
* 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
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
Also, remove unused field 'counter' from #state{}.
|
|
|
|
hipe_icode_bincomp:find_bs_get_integer/3 was quadratic for no good reason. By observing
that NewSuccs and Rest are always disjoint, we can see that the worklist
does not need to be a set. Furthermore, by replacing the ordset Visited
with a map, we reduce complexity to (a very low) O(n lg n).
On cuter_binlib, this change reduced the time for hipe_icode_bincomp
from 60s to .25s. Using a gb_set for Visited gives .5s, and a sets:set
1s.
We apply the same optimisation to hipe_icode_range.
|
|
|
|
|
|
|
|
|
|
Seems like halt/2 should be a member of this club.
|
|
* Implemented removal of maps:is_key/2 calls of which the result is
known in a new pass during the typed phase, called
hipe_icode_call_elim.
* Added the option icode_call_elim that enables the
hipe_icode_call_elim pass, and made it default for o2.
|
|
* henrik/update-copyrightyear:
update copyright-year
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It was assumed in hipe_icode_fp:filter_map/3 that either all
predecessors would have an up-to-date ("assigned") tagged copy, or none
of them.
This is temporarily false during the fixpoint loop in
basic_floats:test_icode_type_crash_2/0, which exercises the
all_args_equal(Bindings) =:= true branch, that would previously
erroneously end up in the 'false' branch, which is what caused the crash
in that case.
This is likewise only temporarily false during the fixpoint loop in
basic_floats:test_icode_type_crash/0, but that case instead exercises
the 'false' branch, justifying the inclusion of both tests.
|
|
|
|
A previous commit introduced a change that exposed dead code in this
module and caused dialyzer warnings. This dead code was taken out.
While at it, performed some code refactoring in the handling of the
bs_get_integer primop.
|
|
Conflicts:
erts/emulator/beam/beam_emu.c
|
|
|
|
This allows us to compile bs_match_int_SUITE with HiPE without a
system_limit crash.
|
|
Expressions like <<0:(fun(X)->X end(anka))>> would fail with 'badarith'
in HiPE, but 'badarg' in BEAM.
hipe_beam_to_icode was attempting to optimise the amount of code
generated by letting the arithmetic error propagate instead of
catching it. However, since it was emitting a block to throw 'badarg' in
that case anyway, we can just reuse it to achieve just as compact code
that behaves exactly like BEAM.
|
|
The unit size field was previously completely discarded when lowering
this instruction from BEAM to Icode.
This feature was previously missing and expressions such as <<0,
<<1:1>>/binary>> would succeed construction when compiled with HiPE.
|
|
The bulk of the changes concerns cleanups and code refactorings concerning
record constructions that assigned 'undefined' to record fields whose type
did not contain this value. See commit 8ce35b2.
While at it, some new type definitions were introduced and type names were
used instead of record type notation. Minor code cleaups were also done.
|
|
|
|
According to EEP-43 for maps, a 'badmap' exception should be
generated when an attempt is made to update non-map term such as:
<<>>#{a=>42}
That was not implemented in the OTP 17.
José Valim suggested that we should take the opportunity to
improve the errors coming from map operations:
http://erlang.org/pipermail/erlang-questions/2015-February/083588.html
This commit implement better errors from map operations similar
to his suggestion.
When a map update operation (Map#{...}) or a BIF that expects a map
is given a non-map term, the exception will be:
{badmap,Term}
This kind of exception is similar to the {badfun,Term} exception
from operations that expect a fun.
When a map operation requires a key that is not present in a map,
the following exception will be raised:
{badkey,Key}
José Valim suggested that the exception should be
{badkey,Key,Map}. We decided not to do that because the map
could potentially be huge and cause problems if the error
propagated through links to other processes.
For BIFs, it could be argued that the exceptions could be simply
'badmap' and 'badkey', because the bad map and bad key can be found in
the argument list for the BIF in the stack backtrace. However, for the
map update operation (Map#{...}), the bad map or bad key will not be
included in the stack backtrace, so that information must be included
in the exception reason itself. For consistency, the BIFs should raise
the same exceptions as update operation.
If more than one key is missing, it is undefined which of
keys that will be reported in the {badkey,Key} exception.
|
|
|
|
|
|
Namely, extend the HiPE tagging scheme info, properly handle the translation
of the (is_)map type test to Icode and RTL and support handling of the map()
type in the type system.
While at it, also performed some clean up of things that needed small fixes.
|
|
|
|
|
|
|