aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/erlang.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-12-17 13:20:31 +0100
committerSverker Eriksson <[email protected]>2013-12-17 13:20:31 +0100
commit165846b143c8275350972caaf4c1013cfe5db043 (patch)
tree8ec4ddea514aa1a0e94249328a77df91d5195ebf /erts/preloaded/src/erlang.erl
parent7d4e5e2458e0627882f49078b9757dd6ae21a6fe (diff)
parent4b3462665c591dffa05294ce5ea94c6259446a04 (diff)
downloadotp-165846b143c8275350972caaf4c1013cfe5db043.tar.gz
otp-165846b143c8275350972caaf4c1013cfe5db043.tar.bz2
otp-165846b143c8275350972caaf4c1013cfe5db043.zip
Merge tag 'OTP_R16B03_yielding_binary_to_term'
Yielding binary_to_term. OTP-11535 * tag 'OTP_R16B03_yielding_binary_to_term': Increase versions for OTP_R16B03_yielding_binary_to_term erts: Adjust term_to_binary reduction factors erts: Yield after trapping term_to_binary if gc has been ordered erts: Let term_to_binary disable gc while trapping erts: Improve stress of binary_to_term in binary_SUITE erts: Fix bug in binary_to_term for compressed on halfword erts: Fix crash when binary_to_term throws badarg erts: Trapping memcpy in binary_to_term erts: Cleanup code for trapping binary_to_term erts: Add erlang wrappers to binary_to_term trapping uncompress trapping size calculation trapping binary_to_term/2 trapping STRING_EXT trapping lists and tuples trapping binary_to_term passing binary_SUITE Conflicts: erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/vsn.mk lib/kernel/vsn.mk lib/stdlib/vsn.mk
Diffstat (limited to 'erts/preloaded/src/erlang.erl')
-rw-r--r--erts/preloaded/src/erlang.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index a21da2ecc9..0ed677c3d8 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -362,15 +362,25 @@ binary_to_list(_Binary, _Start, _Stop) ->
%% binary_to_term/1
-spec binary_to_term(Binary) -> term() when
Binary :: ext_binary().
-binary_to_term(_Binary) ->
- erlang:nif_error(undefined).
+binary_to_term(Binary) ->
+ %% This BIF may throw badarg while trapping
+ try
+ erts_internal:binary_to_term(Binary)
+ catch
+ error:Reason -> erlang:error(Reason,[Binary])
+ end.
%% binary_to_term/2
-spec binary_to_term(Binary, Opts) -> term() when
Binary :: ext_binary(),
Opts :: [safe].
-binary_to_term(_Binary, _Opts) ->
- erlang:nif_error(undefined).
+binary_to_term(Binary, Opts) ->
+ %% This BIF may throw badarg while trapping
+ try
+ erts_internal:binary_to_term(Binary,Opts)
+ catch
+ error:Reason -> erlang:error(Reason,[Binary,Opts])
+ end.
%% bit_size/1
%% Shadowed by erl_bif_types: erlang:bit_size/1