diff options
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/escript.erl | 18 | ||||
-rw-r--r-- | lib/stdlib/test/supervisor_SUITE.erl | 6 |
2 files changed, 18 insertions, 6 deletions
diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl index 7cb02afb11..0d2d23180a 100644 --- a/lib/stdlib/src/escript.erl +++ b/lib/stdlib/src/escript.erl @@ -31,7 +31,7 @@ %%----------------------------------------------------------------------- --type mode() :: 'compile' | 'debug' | 'interpret' | 'run'. +-type mode() :: 'native' | 'compile' | 'debug' | 'interpret' | 'run'. -type source() :: 'archive' | 'beam' | 'text'. -record(state, {file :: file:filename(), @@ -304,7 +304,11 @@ parse_and_run(File, Args, Options) -> false -> case lists:member("i", Options) of true -> interpret; - false -> Mode + false -> + case lists:member("n", Options) of + true -> native; + false -> Mode + end end end end, @@ -321,6 +325,14 @@ parse_and_run(File, Args, Options) -> _Other -> fatal("There were compilation errors.") end; + native -> + case compile:forms(FormsOrBin, [report,native]) of + {ok, Module, BeamBin} -> + {module, Module} = code:load_binary(Module, File, BeamBin), + run(Module, Args); + _Other -> + fatal("There were compilation errors.") + end; debug -> case compile:forms(FormsOrBin, [report, debug_info]) of {ok,Module,BeamBin} -> @@ -664,7 +676,7 @@ epp_parse_file2(Epp, S, Forms, Parsed) -> {attribute,Ln,mode,NewMode} -> S2 = S#state{mode = NewMode}, if - NewMode =:= compile; NewMode =:= interpret; NewMode =:= debug -> + NewMode =:= compile; NewMode =:= interpret; NewMode =:= debug; NewMode =:= native -> epp_parse_file(Epp, S2, [Form | Forms]); true -> Args = lists:flatten(io_lib:format("illegal mode attribute: ~p", [NewMode])), diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl index 8aed93ce12..6e927da2ab 100644 --- a/lib/stdlib/test/supervisor_SUITE.erl +++ b/lib/stdlib/test/supervisor_SUITE.erl @@ -1310,7 +1310,7 @@ count_children_memory(Config) when is_list(Config) -> %% count_children consumes memory using an accumulator function, %% but the space can be reclaimed incrementally, - %% which_children may generate garbage that will reclaimed later. + %% which_children may generate garbage that will be reclaimed later. case (Size5 =< Size4) of true -> ok; false -> @@ -1338,8 +1338,8 @@ count_children_allocator_test(MemoryState) -> lists:all(fun(State) -> State == {e, true} end, AllocStates). %------------------------------------------------------------------------- do_not_save_start_parameters_for_temporary_children(doc) -> - ["Temporary children shall not be restarted so they should not" - "save start parameters, as it potentially can" + ["Temporary children shall not be restarted so they should not " + "save start parameters, as it potentially can " "take up a huge amount of memory for no purpose."]; do_not_save_start_parameters_for_temporary_children(suite) -> []; |