aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-11-30 21:32:02 +0100
committerSverker Eriksson <[email protected]>2011-12-01 11:18:24 +0100
commitf04edcbd8bd692a953164f143fa7c2b496525394 (patch)
tree8b1f963beba99fa76e89639e872ed391124cfcfd
parentdb0289277e9e2bc2e06a8530d39af65a94fd8ba3 (diff)
downloadotp-f04edcbd8bd692a953164f143fa7c2b496525394.tar.gz
otp-f04edcbd8bd692a953164f143fa7c2b496525394.tar.bz2
otp-f04edcbd8bd692a953164f143fa7c2b496525394.zip
erts: Fix hipe bug in hibernate on PowerPC
Seems to apply to Sparc and ARM as well (even if not observed).
-rw-r--r--erts/emulator/hipe/hipe_mode_switch.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/erts/emulator/hipe/hipe_mode_switch.c b/erts/emulator/hipe/hipe_mode_switch.c
index 4d75883fc5..6a3ce5608f 100644
--- a/erts/emulator/hipe/hipe_mode_switch.c
+++ b/erts/emulator/hipe/hipe_mode_switch.c
@@ -337,14 +337,22 @@ Process *hipe_mode_switch(Process *p, unsigned cmd, Eterm reg[])
* stack: to this end hipe_${ARCH}_glue.S stores the BIF's
* arity in p->hipe.narity.
*
- * If the BIF emptied the stack (typically hibernate), p->hipe.nsp is
- * NULL and there is no need to get rid of stacked parameters.
+ * If the BIF emptied the stack (typically hibernate), p->hipe.nstack
+ * is NULL and there is no need to get rid of stacked parameters.
*/
unsigned int i, is_recursive = 0;
- if (p->hipe.nsp != NULL) {
+ if (p->hipe.nstack != NULL) {
+ ASSERT(p->hipe.nsp != NULL);
is_recursive = hipe_trap_from_native_is_recursive(p);
}
+ else {
+ /* Some architectures (risc) need this re-reset of nsp as the
+ * BIF wrapper do not detect stack change and causes an obsolete
+ * stack pointer to be saved in p->hipe.nsp before return to us.
+ */
+ p->hipe.nsp = NULL;
+ }
/* Schedule next process if current process was hibernated or is waiting
for messages */