diff options
author | Kostis Sagonas <[email protected]> | 2015-10-02 14:50:29 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2015-10-02 15:08:00 +0200 |
commit | 5aea81c495f06d58d72b5d3dba86ed9326b1eb14 (patch) | |
tree | a453e8535236a7344287cdcd89b30a02008bb2e0 /lib/hipe/cerl/cerl_pmatch.erl | |
parent | c881813b0643138e9b1c1b1a573645460f14404e (diff) | |
download | otp-5aea81c495f06d58d72b5d3dba86ed9326b1eb14.tar.gz otp-5aea81c495f06d58d72b5d3dba86ed9326b1eb14.tar.bz2 otp-5aea81c495f06d58d72b5d3dba86ed9326b1eb14.zip |
Fix matching with huge binaries
In certain cases of matching with very big binaries, the HiPE compiler
generated code that would fail the match, even in cases that the matching
was successful. The problem was more quite noticeable on 32-bit platforms
where certain integer quantities would be represented as bignums.
Brief summary of changes:
* gen_rtl({bs_skip_bits, ...}, ...) could not handle too large constants.
Previously the constants were truncated to word size.
* hipe_rtl_binary_match:make_size/3 erroneously assumed that the output
of first_part/3 would not overflow when multiplied by 8, which is no
longer true. To maintain full performance, the overflow test is only
performed when BitsVar was a bignum. Thus, the fast path is identical
to before.
* hipe_rtl_binary_match:set_high/2 was assuming that only bits below
bit 27 were ever set in arguments to bs_skip_bits, which is not only
false when the arguments are bignums, but also on 64-bit platforms.
The commit includes a test taken from the bs_match_bin_SUITE.
Most of the credit for finding these HiPE compiler errors and for
creating appropriate fixes for them should go to Magnus Lång.
Diffstat (limited to 'lib/hipe/cerl/cerl_pmatch.erl')
0 files changed, 0 insertions, 0 deletions