aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2017-03-24 10:54:53 +0100
committerBjörn-Egil Dahlberg <[email protected]>2017-03-24 10:54:53 +0100
commit513a14e3f8225aa35ced7c0a1753d287bae1b707 (patch)
tree8404345447bc0a9bb7e033e3a1e4aa167b8a86e6 /erts
parent84be7e0ec7c0c64f1beb418cdd09879822aca4b0 (diff)
parent63289176d5555903b72776dd96b38b3a13a257ab (diff)
downloadotp-513a14e3f8225aa35ced7c0a1753d287bae1b707.tar.gz
otp-513a14e3f8225aa35ced7c0a1753d287bae1b707.tar.bz2
otp-513a14e3f8225aa35ced7c0a1753d287bae1b707.zip
Merge branch 'egil/compiler/is_tagged_tuple/OTP-12148'
* egil/compiler/is_tagged_tuple/OTP-12148: Update primary bootstrap compiler: Cover beam_record in tests hipe: Transform is_tagged_tuple instruction compiler: Add is_tagged_tuple instruction
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_emu.c9
-rw-r--r--erts/emulator/beam/ops.tab14
2 files changed, 23 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) \
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index ec36b23059..9b5bd7a749 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -620,6 +620,20 @@ test_heap Need u==1 | put_list Y=y x==0 x==0 => test_heap_1_put_list Need Y
%macro: test_heap_1_put_list TestHeapPutList -pack
test_heap_1_put_list I y
+#
+# is_tagged_tuple Fail=f Src=rxy Arity Atom=a
+#
+
+is_tagged_tuple Fail Literal=q Arity Atom => \
+ move Literal x | is_tagged_tuple Fail x Arity Atom
+is_tagged_tuple Fail=f c Arity Atom => jump Fail
+
+%macro:is_tagged_tuple IsTaggedTuple -fail_action
+
+is_tagged_tuple f r A a
+is_tagged_tuple f x A a
+is_tagged_tuple f y A a
+
# Test tuple & arity (head)
is_tuple Fail Literal=q => move Literal x | is_tuple Fail x