diff options
author | Erlang/OTP <[email protected]> | 2018-08-09 17:28:27 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2018-08-09 17:28:27 +0200 |
commit | 31c48e56a972d2f7fe589e3b1746715cbc851db6 (patch) | |
tree | a5f9beeb6864293db389ddf795032f026577127c /erts/emulator/beam | |
parent | b90e795c55c10079345bb76d61248b92a58d7bee (diff) | |
parent | 83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe (diff) | |
download | otp-31c48e56a972d2f7fe589e3b1746715cbc851db6.tar.gz otp-31c48e56a972d2f7fe589e3b1746715cbc851db6.tar.bz2 otp-31c48e56a972d2f7fe589e3b1746715cbc851db6.zip |
Merge branch 'rickard/full-cache-nif-env/OTP-15223/ERL-695' into maint-20
* rickard/full-cache-nif-env/OTP-15223/ERL-695:
Fix caching of NIF environment when executing dirty
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 4e479c26ef..f8e964e2cf 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -409,8 +409,18 @@ static void full_flush_env(ErlNifEnv* env) static void full_cache_env(ErlNifEnv* env) { #ifdef ERTS_DIRTY_SCHEDULERS - if (env->proc->static_flags & ERTS_STC_FLG_SHADOW_PROC) + if (env->proc->static_flags & ERTS_STC_FLG_SHADOW_PROC) { erts_cache_dirty_shadow_proc(env->proc); + /* + * If shadow proc had heap fragments when flushed + * those have now been moved to the real proc. + * Ensure heap pointers do not point into a heap + * fragment on real proc... + */ + ASSERT(!env->proc->mbuf); + env->hp_end = HEAP_LIMIT(env->proc); + env->hp = HEAP_TOP(env->proc); + } #endif cache_env(env); } |