Skip to content

Commit

Permalink
Allow binary bifs in match_spec and trace pattern guards
Browse files Browse the repository at this point in the history
This commit adds byte_size/2, binary_part/2 and binary_part/3 to
a valid guard lists, extending functionality of ets select and tracing.
  • Loading branch information
stolen committed Jul 5, 2021
1 parent dd3c4c2 commit f061d93
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions erts/emulator/beam/erl_db_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,24 @@ static DMCGuardBif guard_tab[] =
1,
DBIF_ALL
},
{
am_byte_size,
&byte_size_1,
1,
DBIF_ALL
},
{
am_binary_part,
&binary_part_2,
2,
DBIF_ALL
},
{
am_binary_part,
&binary_part_3,
3,
DBIF_ALL
},
{
am_tl,
&tl_1,
Expand Down
3 changes: 3 additions & 0 deletions lib/stdlib/src/ms_transform.erl
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,11 @@ real_guard_function(node,1) -> true;
real_guard_function(round,1) -> true;
real_guard_function(size,1) -> true;
real_guard_function(bit_size,1) -> true;
real_guard_function(byte_size,1) -> true;
real_guard_function(map_size,1) -> true;
real_guard_function(map_get,2) -> true;
real_guard_function(binary_part,2) -> true;
real_guard_function(binary_part,3) -> true;
real_guard_function(tl,1) -> true;
real_guard_function(trunc,1) -> true;
real_guard_function(self,0) -> true;
Expand Down

0 comments on commit f061d93

Please sign in to comment.