diff options
author | Björn Gustavsson <[email protected]> | 2019-03-07 07:25:32 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2019-03-19 16:01:59 +0100 |
commit | 96730efed3b16bf20149d8716d17486217e51e6e (patch) | |
tree | ad57f89b3ecf4e8905188a9b91ee3dc226a618b1 /erts | |
parent | 58d0fdd849da6e4f6a13d26ea32291c21e125055 (diff) | |
download | otp-96730efed3b16bf20149d8716d17486217e51e6e.tar.gz otp-96730efed3b16bf20149d8716d17486217e51e6e.tar.bz2 otp-96730efed3b16bf20149d8716d17486217e51e6e.zip |
Combine is_tuple with is_tagged_tuple
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/instrs.tab | 10 | ||||
-rw-r--r-- | erts/emulator/beam/ops.tab | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/erts/emulator/beam/instrs.tab b/erts/emulator/beam/instrs.tab index 1eb83b61f2..aeb47c3b0f 100644 --- a/erts/emulator/beam/instrs.tab +++ b/erts/emulator/beam/instrs.tab @@ -817,6 +817,16 @@ is_tagged_tuple(Fail, Src, Arityval, Tag) { } } +is_tagged_tuple_ff(NotTupleFail, WrongRecordFail, Src, Arityval, Tag) { + Eterm term = $Src; + if (is_not_tuple(term)) { + $FAIL($NotTupleFail); + } else if (ERTS_UNLIKELY((tuple_val(term))[0] != $Arityval || + (tuple_val(term))[1] != $Tag)) { + $FAIL($WrongRecordFail); + } +} + is_tuple(Fail, Src) { if (is_not_tuple($Src)) { $FAIL($Fail); diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab index da5364183c..70a6049c75 100644 --- a/erts/emulator/beam/ops.tab +++ b/erts/emulator/beam/ops.tab @@ -629,6 +629,11 @@ test_arity f? xy A test_arity_get_tuple_element f? x A P x +is_tuple NotTupleFail Tuple=x | is_tagged_tuple WrongRecordFail Tuple Arity Atom => \ + is_tagged_tuple_ff NotTupleFail WrongRecordFail Tuple Arity Atom + +is_tagged_tuple_ff f? f? rx A a + get_tuple_element Reg=x P1 D1=x | get_tuple_element Reg=x P2 D2=x | \ get_tuple_element Reg=x P3 D3=x | \ succ(P1, P2) | succ(P2, P3) | \ |