You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JIT: fix binary matching with large integers on 32 bits
Patterns such as:
```erlang
<<"🌑"/utf8, Moons255Str/binary>> = Moons256Str,
```
(as found in test_binary_to_atom)
do match a 32 bits integer in a binary. It is typically encoded by compiler with
a 31 bits match followed by a 1 bit match, maybe because of some BEAM
optimization (?).
```
{bs_start_match4,{atom,no_fail},1,{x,0},{x,1}}.
{bs_match,{f,27},
{x,1},
{commands,[{ensure_at_least,32,1},
{'=:=',nil,31,2018494024},
{'=:=',nil,1,1}]}}.
```
In our case, if the pattern value is larger than 28 bits, the
`?PRIM_BITSTRING_EXTRACT_INTEGER` primitive will return a boxed integer.
On 32 bits platforms, we need to unbox it for comparison.
If we confirm the compiler always matches up to 31 bits, we could actually
optimize this differently, or maybe squash the two.
Signed-off-by: Paul Guyot <[email protected]>
0 commit comments