aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bif_load.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2013-10-30 17:29:18 +0100
committerRickard Green <[email protected]>2013-11-18 20:12:36 +0100
commitc6cb0293ba33e1671f8ed670d5add082e5ee674a (patch)
treea00e3500442c0a175fbc027b61b437b103b8b8fb /erts/emulator/beam/beam_bif_load.c
parent406fd5c773b5ae73dbfc6b305a502ffbe236a9bb (diff)
downloadotp-c6cb0293ba33e1671f8ed670d5add082e5ee674a.tar.gz
otp-c6cb0293ba33e1671f8ed670d5add082e5ee674a.tar.bz2
otp-c6cb0293ba33e1671f8ed670d5add082e5ee674a.zip
Functionality for disabling garbage collection
Being able to disable garbage collection over context switches vastly simplifies implementation of yielding native code that builds large or complex data structures on the heap. This since the heap can be left in an inconsistent state over the context switch.
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r--erts/emulator/beam/beam_bif_load.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 5239940a50..3f92c5b025 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -495,6 +495,8 @@ BIF_RETTYPE erts_internal_check_process_code_2(BIF_ALIST_2)
res = erts_check_process_code(BIF_P, BIF_ARG_1, allow_gc, &reds);
+ ASSERT(is_value(res));
+
BIF_RET2(res, reds);
badarg:
@@ -784,6 +786,16 @@ check_process_code(Process* rp, Module* modp, int allow_gc, int *redsp)
}
}
+ if (rp->flags & F_DISABLE_GC) {
+ /*
+ * Cannot proceed. Process has disabled gc in order to
+ * safely leave inconsistent data on the heap and/or
+ * off heap lists. Need to wait for gc to be enabled
+ * again.
+ */
+ return THE_NON_VALUE;
+ }
+
/*
* See if there are funs that refer to the old version of the module.
*/