diff options
author | Rickard Green <[email protected]> | 2016-11-23 14:24:11 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-11-23 14:24:11 +0100 |
commit | 8d56324cbf72726e955946b9f774f8f1f1004467 (patch) | |
tree | 5e764a0b2232f7d0d34e60cfd63958532ec63b84 /erts/emulator/beam/erl_nif.c | |
parent | 7c3bdf14220b500308a14f71aa91139dece2d731 (diff) | |
parent | 8fade0888ff75fafb2abb512cfb97bcb5472fec1 (diff) | |
download | otp-8d56324cbf72726e955946b9f774f8f1f1004467.tar.gz otp-8d56324cbf72726e955946b9f774f8f1f1004467.tar.bz2 otp-8d56324cbf72726e955946b9f774f8f1f1004467.zip |
Merge branch 'maint'
* maint:
Update etp-commands for dirty schedulers
Fix scheduling of system tasks on processes executing dirty
Fix call time tracing with dirty schedulers
Fix send of exit signal to process executing dirty
Fix dirty scheduler process priority
Fix alloc-util hard-debug
Silence debug warning when no beam jump table is used with dirty schedulers
Fix check_process_code() when NifExport is in use
Fix GC when NifExport is in use
Fix saving of original arguments when rescheduling via NifExport
Conflicts:
erts/emulator/beam/beam_bif_load.c
erts/emulator/beam/erl_nif.c
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 19adff610b..01169852b2 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -2312,6 +2312,17 @@ erts_setup_nif_gc(Process* proc, Eterm** objv, int* nobj) return gc; } +int +erts_check_nif_export_in_area(Process *p, char *start, Uint size) +{ + NifExport *nep = ERTS_PROC_GET_NIF_TRAP_EXPORT(p); + if (!nep || !nep->saved_current) + return 0; + if (ErtsInArea(nep->saved_current, start, size)) + return 1; + return 0; +} + /* * Allocate a NifExport and set it in proc specific data */ @@ -2363,6 +2374,7 @@ init_nif_sched_data(ErlNifEnv* env, NativeFunPtr direct_fp, NativeFunPtr indirec Eterm* reg; NifExport* ep; int i, scheduler; + int orig_argc; execution_state(env, &proc, &scheduler); @@ -2373,11 +2385,14 @@ init_nif_sched_data(ErlNifEnv* env, NativeFunPtr direct_fp, NativeFunPtr indirec reg = erts_proc_sched_data(proc)->x_reg_array; + ASSERT(!need_save || proc->current); + orig_argc = need_save ? (int) proc->current->arity : 0; + ep = (NifExport*) ERTS_PROC_GET_NIF_TRAP_EXPORT(proc); if (!ep) - ep = allocate_nif_sched_data(proc, argc); - else if (need_save && ep->rootset_extra < argc) { - NifExport* new_ep = allocate_nif_sched_data(proc, argc); + ep = allocate_nif_sched_data(proc, orig_argc); + else if (need_save && ep->rootset_extra < orig_argc) { + NifExport* new_ep = allocate_nif_sched_data(proc, orig_argc); destroy_nif_export(ep); ep = new_ep; } @@ -2390,16 +2405,14 @@ init_nif_sched_data(ErlNifEnv* env, NativeFunPtr direct_fp, NativeFunPtr indirec } if (scheduler > 0) ERTS_VBUMP_ALL_REDS(proc); - for (i = 0; i < argc; i++) { - if (need_save) - ep->rootset[i+1] = reg[i]; - reg[i] = (Eterm) argv[i]; - } if (need_save) { - ASSERT(proc->current); ep->saved_current = proc->current; - ep->saved_argc = argc; + ep->saved_argc = orig_argc; + for (i = 0; i < orig_argc; i++) + ep->rootset[i+1] = reg[i]; } + for (i = 0; i < argc; i++) + reg[i] = (Eterm) argv[i]; proc->i = (BeamInstr*) ep->exp.addressv[0]; ep->exp.info.mfa.module = proc->current->module; ep->exp.info.mfa.function = proc->current->function; |