diff options
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 86fb0f36fb..02014243e0 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -1715,8 +1715,8 @@ haw_thr_prgr_current_check_progress(ErtsAuxWorkData *awdp) if (current != ERTS_THR_PRGR_INVALID && !erts_thr_progress_equal(current, erts_thr_progress_current())) { /* - * We have used a previouly read current value that isn't the - * latest; need to poke ourselfs in order to guarantee no loss + * We have used a previously read current value that isn't the + * latest; need to poke ourselves in order to guarantee no loss * of wakeups. */ erts_sched_poke(awdp->ssi); @@ -2657,7 +2657,7 @@ handle_aux_work(ErtsAuxWorkData *awdp, erts_aint32_t orig_aux_work, int waiting) /* * Handlers are *only* allowed to modify flags in return value - * and ssi flags that are explicity handled by the handler. + * and ssi flags that are explicitly handled by the handler. * Handlers are, e.g., not allowed to read the ssi flag field and * then unconditionally return that value. * @@ -2667,7 +2667,7 @@ handle_aux_work(ErtsAuxWorkData *awdp, erts_aint32_t orig_aux_work, int waiting) /* * Keep ERTS_SSI_AUX_WORK flags in expected frequency order relative - * eachother. Most frequent first. + * each other. Most frequent first. */ HANDLE_AUX_WORK(ERTS_SSI_AUX_WORK_DELAYED_AW_WAKEUP, handle_delayed_aux_work_wakeup); @@ -3698,7 +3698,7 @@ wake_scheduler(ErtsRunQueue *rq) * The unlocked run queue is not strictly necessary * from a thread safety or deadlock prevention * perspective. It will, however, cost us performance - * if it is locked during wakup of another scheduler, + * if it is locked during wakeup of another scheduler, * so all code *should* handle this without having * the lock on the run queue. */ @@ -6020,7 +6020,7 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online, int no_poll_th rq->ix = ix; - /* make sure that the "extra" id correponds to the schedulers + /* make sure that the "extra" id corresponds to the schedulers * id if the esdp->no <-> ix+1 mapping change. */ @@ -6853,7 +6853,7 @@ change_proc_schedule_state(Process *p, | ERTS_PSFLG_RUNNING_SYS | ERTS_PSFLG_DIRTY_RUNNING | ERTS_PSFLG_DIRTY_RUNNING_SYS))) { - /* We activated a prevously inactive process */ + /* We activated a previously inactive process */ profile_runnable_proc(p, am_active); } @@ -6965,7 +6965,7 @@ active_sys_enqueue(Process *p, ErtsProcSysTask *sys_task, | ERTS_PSFLG_DIRTY_RUNNING | ERTS_PSFLG_DIRTY_RUNNING_SYS)) && (!(a & ERTS_PSFLG_ACTIVE) || (a & ERTS_PSFLG_SUSPENDED))) { - /* We activated a prevously inactive process */ + /* We activated a previously inactive process */ profile_runnable_proc(p, am_active); } } @@ -7501,7 +7501,7 @@ msb_scheduler_type_switch(ErtsSchedType sched_type, /* * Make sure to alternate between dirty types - * inbetween normal execution if highest + * between normal execution if highest * priorities are equal. */ @@ -9448,7 +9448,7 @@ Process *erts_schedule(ErtsSchedulerData *esdp, Process *p, int calls) int actual_reds; int reds; Uint32 flags; - erts_aint32_t state = 0; /* Supress warning... */ + erts_aint32_t state = 0; /* Suppress warning... */ int is_normal_sched; ERTS_MSACC_DECLARE_CACHE(); @@ -10607,7 +10607,7 @@ execute_sys_tasks(Process *c_p, erts_aint32_t *statep, int in_reds) st_res = am_false; if (st->arg[0] == am_false) { - erts_proc_lock(c_p, ERTS_PROC_LOCK_MSGQ); + erts_proc_sig_queue_lock(c_p); erts_proc_sig_fetch(c_p); erts_proc_unlock(c_p, ERTS_PROC_LOCK_MSGQ); } @@ -11104,7 +11104,7 @@ request_system_task(Process *c_p, Eterm requester, Eterm target, return ret; /* signal sent... */ } /* - * schedule system task directly since we wont violate + * schedule system task directly since we won't violate * signal order... */ } @@ -12172,6 +12172,7 @@ erl_create_process(Process* parent, /* Parent of process (default group leader). */ p->off_heap.first = NULL; p->off_heap.overhead = 0; + p->wrt_bins = NULL; if (is_not_immed(group_leader)) heap_need += NC_HEAP_SIZE(group_leader); @@ -12187,7 +12188,7 @@ erl_create_process(Process* parent, /* Parent of process (default group leader). p->high_water = p->heap; p->gen_gcs = 0; p->hend = p->heap + sz; - p->stop = p->hend - 1; /* Reserve place for continuation pointer */ + p->stop = p->hend - CP_SIZE; /* Reserve place for continuation pointer. */ p->htop = p->heap; p->heap_sz = sz; p->abandoned_heap = NULL; @@ -12204,8 +12205,19 @@ erl_create_process(Process* parent, /* Parent of process (default group leader). p->current = &p->u.initial; - p->i = beam_apply; - p->stop[0] = make_cp(beam_normal_exit); + p->i = beam_run_process; + + switch (erts_frame_layout) { + case ERTS_FRAME_LAYOUT_RA: + p->stop[0] = make_cp(beam_normal_exit); + break; + case ERTS_FRAME_LAYOUT_FP_RA: + p->stop[0] = make_cp(NULL); + p->stop[1] = make_cp(beam_normal_exit); + + FRAME_POINTER(p) = &p->stop[0]; + break; + } p->arg_reg = p->def_arg_reg; p->max_arg_reg = sizeof(p->def_arg_reg)/sizeof(p->def_arg_reg[0]); @@ -12255,11 +12267,13 @@ erl_create_process(Process* parent, /* Parent of process (default group leader). p->sig_qs.len = 0; p->sig_qs.nmsigs.next = NULL; p->sig_qs.nmsigs.last = NULL; + p->sig_inq_contention_counter = 0; p->sig_inq.first = NULL; p->sig_inq.last = &p->sig_inq.first; p->sig_inq.len = 0; p->sig_inq.nmsigs.next = NULL; p->sig_inq.nmsigs.last = NULL; + erts_atomic_init_nob(&p->sig_inq_buffers, (erts_aint_t)NULL); #ifdef ERTS_PROC_SIG_HARD_DEBUG p->sig_inq.may_contain_heap_terms = 0; #endif @@ -12736,6 +12750,7 @@ void erts_init_empty_process(Process *p) p->next = NULL; p->off_heap.first = NULL; p->off_heap.overhead = 0; + p->wrt_bins = NULL; p->common.u.alive.reg = NULL; p->heap_sz = 0; p->high_water = NULL; @@ -12759,11 +12774,13 @@ void erts_init_empty_process(Process *p) p->sig_qs.len = 0; p->sig_qs.nmsigs.next = NULL; p->sig_qs.nmsigs.last = NULL; + p->sig_inq_contention_counter = 0; p->sig_inq.first = NULL; p->sig_inq.last = &p->sig_inq.first; p->sig_inq.len = 0; p->sig_inq.nmsigs.next = NULL; p->sig_inq.nmsigs.last = NULL; + erts_atomic_init_nob(&p->sig_inq_buffers, (erts_aint_t)NULL); #ifdef ERTS_PROC_SIG_HARD_DEBUG p->sig_inq.may_contain_heap_terms = 0; #endif @@ -12856,6 +12873,7 @@ erts_debug_verify_clean_empty_process(Process* p) ASSERT(p->off_heap.first == NULL); ASSERT(p->off_heap.overhead == 0); + ASSERT(p->wrt_bins == NULL); ASSERT(p->mbuf == NULL); } @@ -12867,9 +12885,11 @@ erts_cleanup_empty_process(Process* p) { /* We only check fields that are known to be used... */ - erts_cleanup_offheap(&p->off_heap); + erts_cleanup_offheap_list(p->off_heap.first); p->off_heap.first = NULL; p->off_heap.overhead = 0; + erts_cleanup_offheap_list(p->wrt_bins); + p->wrt_bins = NULL; if (p->mbuf != NULL) { free_message_buffer(p->mbuf); @@ -12923,6 +12943,7 @@ delete_process(Process* p) /* Clean binaries and funs */ erts_cleanup_offheap(&p->off_heap); + erts_cleanup_offheap_list(p->wrt_bins); /* * The mso list should not be used anymore, but if it is, make sure that @@ -13804,7 +13825,7 @@ restart: * * - A non-immediate exit reason may refer to literals. * - A process executing dirty while terminated, might access - * any term on the heap, and therfore literals, until it has + * any term on the heap, and therefore literals, until it has * stopped executing dirty. */ if (!trap_state->block_rla_ref @@ -13936,6 +13957,7 @@ restart: erts_proc_lock(p, ERTS_PROC_LOCK_MSGQ); + erts_proc_sig_queue_flush_and_deinstall_buffers(p); erts_proc_sig_fetch(p); erts_proc_unlock(p, ERTS_PROC_LOCK_MSGQ); |