aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2018-08-08 20:04:39 +0200
committerRickard Green <[email protected]>2018-08-09 15:08:06 +0200
commit83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe (patch)
treef30e904588f359bb38b23561d807f3fc52abdf9c /erts/emulator/beam
parentdb6059a9217767a6e42e93cec05089c0ec977d20 (diff)
downloadotp-83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe.tar.gz
otp-83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe.tar.bz2
otp-83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe.zip
Fix caching of NIF environment when executing dirty
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_nif.c12
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);
}