aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/rtl/hipe_rtl_binary_construct.erl
AgeCommit message (Collapse)Author
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-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-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.
2017-03-02hipe_rtl_binary_construct: Refactor copy-pasteMagnus Lång
2016-11-23Correct copyright on remaining hipe filesRichard Carlsson
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-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-05-31Various cleanups and simplificationsKostis Sagonas
2015-12-02hipe: Fix signed compares of unsigned sizesMagnus Lång
Also, some of the branches were testing sizes in bits against a constant ?MAX_BINSIZE, which was in bytes. The signed comparisons masked this mistake. These branches have been removed since all sizes in bits that fit in a machine word are valid binary sizes. Finally, a test that reproduces the issue was added to bs_construct, along with a test for one of the cases (bs_init<0>(...)) when the test against ?MAX_BINSIZE must be changed to unsigned rather than removed.
2015-11-27hipe: Fix constructing huge binariesMagnus Lång
Bugs were fixed in hipe_rtl_binary_match:{first_part/3,make_size/3,set_high/1} in commit 5aea81c49, but it turns out these had been copy-pasted verbatim into hipe_rtl_binary_construct, where they were causing further bugs. They have now moved to hipe_rtl_binary, from where they are included by the other two modules. Furthermore, first_part/3 (reamed get_word_integer/3, since it loads integers that fits into an unsigned word), and make_size/3 now accepts a fourth argument to distinguish too large arguments (which should cause a system_limit exception) from negative or non-integral arguments. The use of first_part/3 (get_word_integer/3) from 5aea81c49 in hipe_rtl_binary_construct now allows several binary construction instructions to accept bignum sizes, as they were supposed to. Additionally, calls to hipe_rtl_binary_construct:check_and_untag_fixnum/3 were replaced with get_word_integer/4 since all of them were also supposed to accept sufficiently small bignums, but didn't, and check_and_untag_fixnum/3 was essentially identical to first_part/3 anyway. HiPE is now capable of passing bs_construct_SUITE completely unmodified.
2015-11-27hipe: test unit size match in bs_put_binary_allMagnus Lång
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.
2015-11-27hipe: test unit size match in bs_appendMagnus Lång
This feature was previously missing and expressions such as <<<<1:1>>/binary>> would succeed construction when compiled with HiPE. A primop is_divisible is introduced to handle the case when the unit size is not a power of two.
2015-11-27Fix hipe_rtl_binary_construct:floorlog2/1Magnus Lång
Relying on double-precision floating-point arithmetic to compute the log2 of an integer up to 64 bits long leads to rounding errors.
2015-10-12Fix edge case of Size = 0 in bs_put_integerKostis Sagonas
copy_offset_int_big was assuming (Offset + Size - 1) (Tmp9 in the first BB) would not underflow. It was also unconditionally reading and writing the binary even when Size was zero, unlike copy_int_little, which is the only other case of bs_put_integer that does not have a short-circuit on Size = 0. This was causing segfaults when constructing binaries starting with a zero-length integer field, because a logical right shift was used to compute an offset in bytes (which became 0x1fffffffffffffff) to read in the binary. Tests, taken from the emulator bs_construct_SUITE, were also added. The complete credit for the report and the fix goes to Magnus Lång.
2015-06-18Change license text to APLv2Bruce Yinhe
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP