diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-08-29 18:27:45 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2017-03-24 10:53:14 +0100 |
commit | 14d709b0e07e899161a40bb43fc43fd6916f59ab (patch) | |
tree | 841aac1ed1a67417d4274215aeadbec3b1b2ead3 /erts/emulator/beam/beam_emu.c | |
parent | f7d248a6794655809e2fdc7d0d1932bbb3dc8cc0 (diff) | |
download | otp-14d709b0e07e899161a40bb43fc43fd6916f59ab.tar.gz otp-14d709b0e07e899161a40bb43fc43fd6916f59ab.tar.bz2 otp-14d709b0e07e899161a40bb43fc43fd6916f59ab.zip |
compiler: Add is_tagged_tuple instruction
Rewrite the instruction stream on tagged tuple tests.
Tagged tuples means a tuple of any arity with an atom as its first element.
Typically records, ok-tuples and error-tuples.
from:
...
{test,is_tuple,Fail,[Src]}.
{test,test_arity,Fail,[Src,Sz]}.
...
{get_tuple_element,Src,0,Dst}.
...
{test,is_eq_exact,Fail,[Dst,Atom]}.
...
to:
...
{test,is_tagged_tuple,Fail,[Src,Sz,Atom]}.
...
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r-- | erts/emulator/beam/beam_emu.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 8be0f58227..9a91fdce08 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -850,6 +850,15 @@ do { \ } while (0) #endif +#define IsTaggedTuple(Src,Arityval,Tag,Fail) \ + do { \ + if (!(is_tuple(Src) && \ + (tuple_val(Src))[0] == Arityval && \ + (tuple_val(Src))[1] == Tag)) { \ + Fail; \ + } \ + } while (0) + #define IsBoolean(X, Fail) if ((X) != am_true && (X) != am_false) { Fail; } #define IsBinary(Src, Fail) \ |