aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2018-08-09 17:18:28 +0200
committerRickard Green <[email protected]>2018-08-09 17:18:28 +0200
commit30eedd359ce5f6aa3f9b3dbbfbee4afe34ca3ce6 (patch)
treeae7ea2cf2eb68902d8382837e27866b02ad54787 /erts/emulator/beam
parenta81f89796e439f672681ea21baaf9e87e0f1936b (diff)
parent83ce2a8e8da4aab4578f589e6af6e5c93bcdaebe (diff)
downloadotp-30eedd359ce5f6aa3f9b3dbbfbee4afe34ca3ce6.tar.gz
otp-30eedd359ce5f6aa3f9b3dbbfbee4afe34ca3ce6.tar.bz2
otp-30eedd359ce5f6aa3f9b3dbbfbee4afe34ca3ce6.zip
Merge branch 'rickard/full-cache-nif-env/OTP-15223/ERL-695' into maint
* 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.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 26498eda7b..ee6e6085b6 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);
}