aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-08-10 19:02:27 +0200
committerErlang/OTP <[email protected]>2018-08-10 19:02:27 +0200
commitc1746bbc5ba842b3cf7e37932185e2788db874a4 (patch)
tree29f32eb271e2451739bb6a28d64feb32819310f8
parent2c1ca1cc79063cc76befb00ad1ccd16efbd470c2 (diff)
parent83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe (diff)
downloadotp-c1746bbc5ba842b3cf7e37932185e2788db874a4.tar.gz
otp-c1746bbc5ba842b3cf7e37932185e2788db874a4.tar.bz2
otp-c1746bbc5ba842b3cf7e37932185e2788db874a4.zip
Merge branch 'rickard/full-cache-nif-env/OTP-15223/ERL-695' into maint-21
* rickard/full-cache-nif-env/OTP-15223/ERL-695: Fix caching of NIF environment when executing dirty # Conflicts: # erts/emulator/beam/erl_nif.c
-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 0fbf0eb03a..ef010ff476 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -453,8 +453,18 @@ static void full_flush_env(ErlNifEnv* env)
static void full_cache_env(ErlNifEnv* env)
{
- 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);
+ }
cache_env(env);
}