aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-11-13 18:07:33 +0100
committerSverker Eriksson <[email protected]>2013-11-21 15:04:27 +0100
commit522a29666088d5d96956d2752ffb1596d778cffd (patch)
treea9e6f80cfe1588a4290634b634389102babc07d8
parent6817539f36b0f5b4fcc3164d812e9535ee4be9ff (diff)
downloadotp-522a29666088d5d96956d2752ffb1596d778cffd.tar.gz
otp-522a29666088d5d96956d2752ffb1596d778cffd.tar.bz2
otp-522a29666088d5d96956d2752ffb1596d778cffd.zip
erts: Let term_to_binary disable gc while trapping
as an attempt to improve performance
-rw-r--r--erts/emulator/beam/external.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 28c6caf5fe..d5f3b19b82 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1055,8 +1055,10 @@ static BIF_RETTYPE term_to_binary_trap_1(BIF_ALIST_1)
Binary *bin = ((ProcBin *) binary_val(bt))->val;
Eterm res = erts_term_to_binary_int(BIF_P, Term, 0, 0,bin);
if (is_tuple(res)) {
+ ASSERT(BIF_P->flags & F_DISABLE_GC);
BIF_TRAP1(&term_to_binary_trap_export,BIF_P,res);
} else {
+ erts_set_gc_state(BIF_P, 1);
BIF_RET(res);
}
}
@@ -1065,8 +1067,10 @@ BIF_RETTYPE term_to_binary_1(BIF_ALIST_1)
{
Eterm res = erts_term_to_binary_int(BIF_P, BIF_ARG_1, 0, TERM_TO_BINARY_DFLAGS, NULL);
if (is_tuple(res)) {
+ erts_set_gc_state(BIF_P, 0);
BIF_TRAP1(&term_to_binary_trap_export,BIF_P,res);
} else {
+ ASSERT(!(BIF_P->flags & F_DISABLE_GC));
BIF_RET(res);
}
}
@@ -1118,8 +1122,10 @@ BIF_RETTYPE term_to_binary_2(BIF_ALIST_2)
res = erts_term_to_binary_int(p, Term, level, flags, bin);
if (is_tuple(res)) {
+ erts_set_gc_state(p, 0);
BIF_TRAP1(&term_to_binary_trap_export,BIF_P,res);
} else {
+ ASSERT(!(BIF_P->flags & F_DISABLE_GC));
BIF_RET(res);
}
}