aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-03-21 16:14:25 +0100
committerBjörn Gustavsson <[email protected]>2019-03-21 16:14:25 +0100
commit2cc798bbbf9924e1c87c6eaa6e1c8be8cca5596c (patch)
tree027aeb6c0a4be44a412385be59c777b3cee366ca /lib/compiler
parentb89b9d8e5f8a136150642b9f7e34268a6d99381f (diff)
parent4e0430638635083c199f81375a6c14f2ffb726fb (diff)
downloadotp-2cc798bbbf9924e1c87c6eaa6e1c8be8cca5596c.tar.gz
otp-2cc798bbbf9924e1c87c6eaa6e1c8be8cca5596c.tar.bz2
otp-2cc798bbbf9924e1c87c6eaa6e1c8be8cca5596c.zip
Merge branch 'bjorn/hipe-compilation/OTP-15596'
* bjorn/hipe-compilation/OTP-15596: HiPE: Don't fail the compilation for unimplemented instructions
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/Makefile3
-rw-r--r--lib/compiler/src/compile.erl12
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile
index c971e8844d..9f8d63baa1 100644
--- a/lib/compiler/src/Makefile
+++ b/lib/compiler/src/Makefile
@@ -129,9 +129,10 @@ APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
ifeq ($(NATIVE_LIBS_ENABLED),yes)
ERL_COMPILE_FLAGS += +native
+else
+ERL_COMPILE_FLAGS += -Werror
endif
ERL_COMPILE_FLAGS += +inline +warn_unused_import \
- -Werror \
-I../../stdlib/include -I$(EGEN) -W +warn_missing_spec
# ----------------------------------------------------
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 11dea9524b..28db8986ff 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -290,6 +290,10 @@ format_error(bad_crypto_key) ->
"invalid crypto key.";
format_error(no_crypto_key) ->
"no crypto key supplied.";
+format_error({unimplemented_instruction,Instruction}) ->
+ io_lib:fwrite("native-code compilation failed because of an "
+ "unimplemented instruction (~s).",
+ [Instruction]);
format_error({native, E}) ->
io_lib:fwrite("native-code compilation failed with reason: ~tP.",
[E, 25]);
@@ -1651,18 +1655,22 @@ native_compile_1(Code, St) ->
case IgnoreErrors of
true ->
Ws = [{St#compile.ifile,[{none,?MODULE,{native,R}}]}],
- {ok,St#compile{warnings=St#compile.warnings ++ Ws}};
+ {ok,Code,St#compile{warnings=St#compile.warnings ++ Ws}};
false ->
Es = [{St#compile.ifile,[{none,?MODULE,{native,R}}]}],
{error,St#compile{errors=St#compile.errors ++ Es}}
end
catch
+ exit:{unimplemented_instruction,_}=Unimplemented ->
+ Ws = [{St#compile.ifile,
+ [{none,?MODULE,Unimplemented}]}],
+ {ok,Code,St#compile{warnings=St#compile.warnings ++ Ws}};
Class:R:Stack ->
case IgnoreErrors of
true ->
Ws = [{St#compile.ifile,
[{none,?MODULE,{native_crash,R,Stack}}]}],
- {ok,St#compile{warnings=St#compile.warnings ++ Ws}};
+ {ok,Code,St#compile{warnings=St#compile.warnings ++ Ws}};
false ->
erlang:raise(Class, R, Stack)
end