Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
6543-Lower-size-limit-for-integers-to-4-Mbit.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 6543-Lower-size-limit-for-integers-to-4-Mbit.patch of Package erlang
From b5540a3a82412a06b9243805847b7e4995dd5843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Mon, 19 Jun 2023 13:16:20 +0200 Subject: [PATCH 3/6] Lower size limit for integers to 4 Mbit This new 4 Mbit limit should still be sufficiently large for practical applications. --- erts/emulator/beam/erl_bif_info.c | 5 +++++ erts/emulator/beam/erl_term.h | 7 ++++++- erts/emulator/test/big_SUITE.erl | 4 +--- erts/emulator/test/exception_SUITE.erl | 4 +--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c index d5e598515c..564c3b0f28 100644 --- a/erts/emulator/beam/erl_bif_info.c +++ b/erts/emulator/beam/erl_bif_info.c @@ -3245,6 +3245,11 @@ BIF_RETTYPE system_info_1(BIF_ALIST_1) #endif } else if (ERTS_IS_ATOM_STR("system_logger", BIF_ARG_1)) { BIF_RET(erts_get_system_logger()); + } else if (ERTS_IS_ATOM_STR("max_integer", BIF_ARG_1)) { + Eterm *hp = HAlloc(BIF_P, BIG_ARITY_MAX+1); + hp[0] = make_pos_bignum_header(BIG_ARITY_MAX); + sys_memset(hp + 1, 0xff, BIG_ARITY_MAX*sizeof(Eterm)); + BIF_RET(make_big(hp)); } BIF_ERROR(BIF_P, BADARG); diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h index 490fe1f1d1..bcb9daa4d1 100644 --- a/erts/emulator/beam/erl_term.h +++ b/erts/emulator/beam/erl_term.h @@ -411,7 +411,12 @@ _ET_DECLARE_CHECKED(Eterm,bignum_header_neg,Eterm) #define _unchecked_bignum_header_arity(x) _unchecked_header_arity((x)) _ET_DECLARE_CHECKED(Uint,bignum_header_arity,Eterm) #define bignum_header_arity(x) _ET_APPLY(bignum_header_arity,(x)) -#define BIG_ARITY_MAX ((1 << 19)-1) + +#if defined(ARCH_64) +# define BIG_ARITY_MAX ((1 << 16)-1) +#else +# define BIG_ARITY_MAX ((1 << 17)-1) +#endif #define make_big(x) make_boxed((x)) #define is_big(x) (is_boxed((x)) && _is_bignum_header(*boxed_val((x)))) #define is_not_big(x) (!is_big((x))) diff --git a/erts/emulator/test/big_SUITE.erl b/erts/emulator/test/big_SUITE.erl index a48a14357a..794902280a 100644 --- a/erts/emulator/test/big_SUITE.erl +++ b/erts/emulator/test/big_SUITE.erl @@ -376,9 +376,7 @@ system_limit(Config) when is_list(Config) -> ok. maxbig() -> - %% We assume that the maximum arity is (1 bsl 19) - 1. - Ws = erlang:system_info(wordsize), - (((1 bsl ((16777184 * (Ws div 4))-1)) - 1) bsl 1) + 1. + erlang:system_info(max_integer). toobig(Config) when is_list(Config) -> {'EXIT',{{badmatch,_},_}} = (catch toobig()), diff --git a/erts/emulator/test/exception_SUITE.erl b/erts/emulator/test/exception_SUITE.erl index 80fc35d2be..e78c2e337b 100644 --- a/erts/emulator/test/exception_SUITE.erl +++ b/erts/emulator/test/exception_SUITE.erl @@ -310,9 +310,7 @@ top_of_stacktrace(Conf) when is_list(Conf) -> ok. maxbig() -> - %% We assume that the maximum arity is (1 bsl 19) - 1. - Ws = erlang:system_info(wordsize), - (((1 bsl ((16777184 * (Ws div 4))-1)) - 1) bsl 1) + 1. + erlang:system_info(max_integer). maxbig_gc() -> Maxbig = maxbig(), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor