aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_term.h
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-10-25 17:35:41 +0200
committerBjörn-Egil Dahlberg <[email protected]>2012-11-27 17:40:37 +0100
commite05a6c89abedfdff8ea16c645bd2b659c829cbfe (patch)
treedebba1aeee7e9a9299892616ea93b31aed978d43 /erts/emulator/beam/erl_term.h
parentbb915519aa16f6410b19c6f868805b47717f11fa (diff)
downloadotp-e05a6c89abedfdff8ea16c645bd2b659c829cbfe.tar.gz
otp-e05a6c89abedfdff8ea16c645bd2b659c829cbfe.tar.bz2
otp-e05a6c89abedfdff8ea16c645bd2b659c829cbfe.zip
erts: Define max tuple size to 24 bits
Erlang specification 4.7.3 defines max tuple size to 65535 elements It is now defined to 16777215 elements (24 bits)
Diffstat (limited to 'erts/emulator/beam/erl_term.h')
-rw-r--r--erts/emulator/beam/erl_term.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index c270d13365..df064fb73d 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -300,8 +300,17 @@ _ET_DECLARE_CHECKED(Uint,header_arity,Eterm)
#define header_arity(x) _ET_APPLY(header_arity,(x))
/* arityval access methods */
+/* Erlang Spec. 4.7.3 defines max arity to 65535
+ * we will however enforce max arity of 16777215 (24 bits)
+ * (checked in bifs and asserted in debug)
+ */
+#define MAX_ARITYVAL ((((Uint)1) << 24) - 1)
+#define ERTS_MAX_TUPLE_SIZE MAX_ARITYVAL
+
#define make_arityval(sz) _make_header((sz),_TAG_HEADER_ARITYVAL)
#define is_arity_value(x) (((x) & _TAG_HEADER_MASK) == _TAG_HEADER_ARITYVAL)
+#define is_sane_arity_value(x) ((((x) & _TAG_HEADER_MASK) == _TAG_HEADER_ARITYVAL) && \
+ (((x) >> _HEADER_ARITY_OFFS) <= MAX_ARITYVAL))
#define is_not_arity_value(x) (!is_arity_value((x)))
#define _unchecked_arityval(x) _unchecked_header_arity((x))
_ET_DECLARE_CHECKED(Uint,arityval,Eterm)