diff options
author | Björn Gustavsson <[email protected]> | 2011-03-18 06:22:23 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-08-16 08:58:46 +0200 |
commit | d33e59b163744d209eca211050f323c6acd823d3 (patch) | |
tree | 7598a105c7adb0c5244670a6b7b8289fd77fe6de /lib/debugger | |
parent | aac2fac655dca8164b9ab4b1d4d1d45ffc7f9530 (diff) | |
download | otp-d33e59b163744d209eca211050f323c6acd823d3.tar.gz otp-d33e59b163744d209eca211050f323c6acd823d3.tar.bz2 otp-d33e59b163744d209eca211050f323c6acd823d3.zip |
Handle all guard BIFs as safe in function bodies
Make sure that all guards BIFs are handled as safe BIFs in function
bodies. BIFs in guards are already handled as safe. (self/0 is not
safe, but it is already specially handled.)
Diffstat (limited to 'lib/debugger')
-rw-r--r-- | lib/debugger/src/dbg_iload.erl | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/debugger/src/dbg_iload.erl b/lib/debugger/src/dbg_iload.erl index 70d43c20b2..d197cbe247 100644 --- a/lib/debugger/src/dbg_iload.erl +++ b/lib/debugger/src/dbg_iload.erl @@ -415,7 +415,7 @@ expr({call,Line,{remote,_,{atom,_,Mod},{atom,_,Func}},As0}) -> false -> {call_remote,Line,Mod,Func,As}; true -> - case bif_type(Mod, Func) of + case bif_type(Mod, Func, length(As0)) of safe -> {safe_bif,Line,Mod,Func,As}; spawn -> {spawn_bif,Line,Mod,Func,As}; unsafe ->{bif,Line,Mod,Func,As} @@ -583,24 +583,22 @@ new_vars(N, L, Vs) when N > 0 -> new_vars(N-1, L, [V|Vs]); new_vars(0, _, Vs) -> Vs. -bif_type(erlang, Name) -> bif_type(Name); -bif_type(_, _) -> unsafe. +bif_type(erlang, Name, Arity) -> + case erl_internal:guard_bif(Name, Arity) of + true -> + %% Guard BIFs are safe (except for self/0, but it is + %% handled with a special instruction anyway). + safe; + false -> + bif_type(Name) + end; +bif_type(_, _, _) -> unsafe. bif_type(register) -> safe; bif_type(unregister) -> safe; bif_type(whereis) -> safe; bif_type(registered) -> safe; -bif_type(abs) -> safe; -bif_type(float) -> safe; -bif_type(trunc) -> safe; -bif_type(round) -> safe; bif_type(math) -> safe; -bif_type(node) -> safe; -bif_type(length) -> safe; -bif_type(hd) -> safe; -bif_type(tl) -> safe; -bif_type(size) -> safe; -bif_type(element) -> safe; bif_type(setelement) -> safe; bif_type(atom_to_list) -> safe; bif_type(list_to_atom) -> safe; |