Permalink
Browse files

make erlang:exit/2, erlang:nif_error/1 no-return

In order to compile correctly, the compiler
needs to know that certain operations do
not return.  In order to compile recent
erlang.beam, we needed to update this.
  • Loading branch information...
1 parent 32ca0f9 commit 7de19530dd4d9cda69765f7411a1e887e0aa8679 @krestenkrab krestenkrab committed Mar 22, 2013
@@ -34,4 +34,5 @@
public static final EAtom BIF_ATOM = EAtom.intern("bif");
public static final EAtom GCBIF_ATOM = EAtom.intern("gc_bif");
public static final EAtom ARITHFBIF_ATOM = EAtom.intern("arithfbif");
+ public static final EAtom NIF_ERROR_ATOM = EAtom.intern("nif_error");
}
@@ -3010,6 +3010,8 @@ private boolean isExitFunc(ExtFun fun) {
return true;
if (fun.fun == CodeAtoms.ERROR_ATOM && (fun.arity==1 || fun.arity==2))
return true;
+ if (fun.fun == CodeAtoms.NIF_ERROR_ATOM && (fun.arity==1))
+ return true;
if (fun.fun == CodeAtoms.THROW_ATOM && fun.arity==1)
return true;
}
@@ -2114,8 +2114,13 @@ boolean is_exceptional_call(Insn insn) {
if (ext_fun.mod == ERLANG_ATOM &&
(ext_fun.fun == ERROR_ATOM
|| ext_fun.fun == THROW_ATOM
- || ext_fun.fun == EXIT_ATOM) &&
+ || ext_fun.fun == EXIT_ATOM
+ || ext_fun.fun == NIF_ERROR_ATOM) &&
ext_fun.arity == 1) return true;
+
+ if (ext_fun.mod == ERLANG_ATOM &&
+ ext_fun.fun == ERROR_ATOM &&
+ ext_fun.arity == 2) return true;
}
return false;
}
@@ -83,6 +83,7 @@
private static EAtom am_reductions = EAtom.intern("reductions");
private static EAtom am_garbage_collection = EAtom.intern("garbage_collection");
private static EAtom am_runtime = EAtom.intern("runtime");
+ private static EAtom am_nif_error = EAtom.intern("nif_error");
private static final EAtom am_run_queue = EAtom.intern("run_queue");
@BIF
@@ -2037,4 +2038,9 @@ public static EAtom check_old_code(EObject obj) {
boolean result = EModuleManager.module_loaded(module);
return ERT.box(result);
}
+
+ @BIF
+ public static EObject nif_error(EObject err) {
+ throw new ErlangExit(err);
+ }
}

0 comments on commit 7de1953

Please sign in to comment.