aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_guard.c
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-01-19 07:02:42 +0000
committerErlang/OTP <[email protected]>2010-01-19 07:02:42 +0000
commit257fce5ee076fa0aabce47279d1d1112fad6abbb (patch)
treec0f92e813239c4f8c91058ed290c70a62d488631 /erts/emulator/beam/erl_bif_guard.c
parent141b8f28bc2180c0fb17479562cc59dce51218d4 (diff)
parent31e231d813d8a15a937ebd5fbb71299ce1faf9c1 (diff)
downloadotp-257fce5ee076fa0aabce47279d1d1112fad6abbb.tar.gz
otp-257fce5ee076fa0aabce47279d1d1112fad6abbb.tar.bz2
otp-257fce5ee076fa0aabce47279d1d1112fad6abbb.zip
Merge branch 'bg/compiler-beam_validator' into ccase/r13b04_dev
* bg/compiler-beam_validator: beam_validator: fix incorrect assumptions about GC guard BIFs OTP-8378 In rare circumstances when using garbaging collecting guard BIFs, the validation pass (beam_validator) would signal that the code was unsafe, when it in fact was correct. (Thanks to Kiran Khaladkar.)
Diffstat (limited to 'erts/emulator/beam/erl_bif_guard.c')
-rw-r--r--erts/emulator/beam/erl_bif_guard.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_bif_guard.c b/erts/emulator/beam/erl_bif_guard.c
index 8b47db10dd..440b0b4f14 100644
--- a/erts/emulator/beam/erl_bif_guard.c
+++ b/erts/emulator/beam/erl_bif_guard.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2006-2010. 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
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -318,6 +318,10 @@ double_to_integer(Process* p, double x)
* The following code is used when a guard that may build on the
* heap is called directly. They must not use HAlloc(), but must
* do a garbage collection if there is insufficient heap space.
+ *
+ * Important note: All error checking MUST be done before doing
+ * a garbage collection. The compiler assumes that all registers
+ * are still valid if a guard BIF generates an exception.
*/
#define ERTS_NEED_GC(p, need) ((HEAP_LIMIT((p)) - HEAP_TOP((p))) <= (need))