diff options
author | Rickard Green <[email protected]> | 2016-03-17 21:54:40 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-03-17 21:54:40 +0100 |
commit | 3c2d5d0dccd34cba89880cd4c1ded616d19696c2 (patch) | |
tree | db2d911a2bfcf13f93073501a6b846b2d33de8fd /erts | |
parent | 28f3bae60a4edb9432c29469f6a3c031e0859104 (diff) | |
download | otp-3c2d5d0dccd34cba89880cd4c1ded616d19696c2.tar.gz otp-3c2d5d0dccd34cba89880cd4c1ded616d19696c2.tar.bz2 otp-3c2d5d0dccd34cba89880cd4c1ded616d19696c2.zip |
Allow delayed gc while scheduled out
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index a706ebf595..7fcf977e08 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -9324,8 +9324,6 @@ Process *schedule(Process *p, int calls) } else { sched_out_proc: - ASSERT(!(p->flags & F_DELAY_GC)); - #ifdef ERTS_SMP ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(p); esdp = p->scheduler_data; @@ -9886,15 +9884,24 @@ Process *schedule(Process *p, int calls) #endif if (state & ERTS_PSFLG_RUNNING_SYS) { - reds -= execute_sys_tasks(p, &state, reds); - if (reds <= 0 + /* + * GC is normally never delayed when a process + * is scheduled out, but might be when executing + * hand written beam assembly in + * prim_eval:'receive'. If GC is delayed we are + * not allowed to execute system tasks. + */ + if (!(p->flags & F_DELAY_GC)) { + reds -= execute_sys_tasks(p, &state, reds); + if (reds <= 0 #ifdef ERTS_DIRTY_SCHEDULERS - || ERTS_SCHEDULER_IS_DIRTY(esdp) - || (state & ERTS_PSFLGS_DIRTY_WORK) + || ERTS_SCHEDULER_IS_DIRTY(esdp) + || (state & ERTS_PSFLGS_DIRTY_WORK) #endif - ) { - p->fcalls = reds; - goto sched_out_proc; + ) { + p->fcalls = reds; + goto sched_out_proc; + } } ASSERT(state & ERTS_PSFLG_RUNNING_SYS); @@ -9924,7 +9931,7 @@ Process *schedule(Process *p, int calls) } if (ERTS_IS_GC_DESIRED(p)) { - if (!(state & ERTS_PSFLG_EXITING) && !(p->flags & F_DISABLE_GC)) { + if (!(state & ERTS_PSFLG_EXITING) && !(p->flags & (F_DELAY_GC|F_DISABLE_GC))) { reds -= erts_garbage_collect_nobump(p, 0, p->arg_reg, p->arity); if (reds <= 0) { p->fcalls = reds; |