aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-03-10 17:33:06 +0100
committerSverker Eriksson <[email protected]>2011-03-10 17:33:06 +0100
commitdf454656f37296a47834ba8b01ec54f3638addba (patch)
tree8af160767fa201081aa5f6d5f3209617078af180 /erts/emulator/beam/bif.c
parent82106ef01f26a1d1a862b7f57fc580cbe46428b2 (diff)
parent5cddff325916c16487c0be91019ab737b3cfae3d (diff)
downloadotp-df454656f37296a47834ba8b01ec54f3638addba.tar.gz
otp-df454656f37296a47834ba8b01ec54f3638addba.tar.bz2
otp-df454656f37296a47834ba8b01ec54f3638addba.zip
Merge branch 'pg/fix-hibernate-with-hipe' into dev
* pg/fix-hibernate-with-hipe: Update copyright years Fix NULL-free bug in hibernate on debug emulator Fix several bugs related to hibernate/3 and HiPE Conflicts: erts/emulator/test/hibernate_SUITE.erl OTP-9125
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index bb237e378a..f01580eb2b 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2011. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -1091,10 +1091,20 @@ BIF_RETTYPE unlink_1(BIF_ALIST_1)
BIF_RETTYPE hibernate_3(BIF_ALIST_3)
{
/*
- * hibernate/3 is implemented as an instruction; therefore
- * this function will never be called.
+ * hibernate/3 is usually translated to an instruction; therefore
+ * this function is only called from HiPE or when the call could not
+ * be translated.
*/
- BIF_ERROR(BIF_P, BADARG);
+ Eterm reg[3];
+
+ if (erts_hibernate(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3, reg)) {
+ /*
+ * If hibernate succeeded, TRAP. The process will be suspended
+ * if status is P_WAITING or continue (if any message was in the queue).
+ */
+ BIF_TRAP_CODE_PTR_(BIF_P, BIF_P->i);
+ }
+ return THE_NON_VALUE;
}
/**********************************************************************/