HiPE all the things

Hi folks.

So, I was fooling around with various combinations of ERL_COMPILER_OPTIONS="[native,{hipe, [verbose, o3]}]" and forcing dependency compiles with Mix, erlc_options: [:native, {:hipe, [:verbose, :o3]}] in mix.exs, and this small utility that calls :hipe.c on all modules that have native: false.

Somewhat predictably, I ended up in a situation where every single loaded module’s module_info (sticky ones included!) reported native: true. No amount of uninformed fooling with :c / :code / :compiler has seemed to get rid of all the native modules, and changes often don’t seem to stick after I quit iex -S mix

  1. What are the possible downsides of this?
  2. Since the BEAM files contain both native and bytecode formats, how do I force iex/mix/erlc/etc to ignore the native code / prefer bytecode?
  3. How can I undo this? Do I need to? Can I just delete *.beam from under Erlang’s and Elixir’s prefixes, and run mix compile in some project directory?
6 Likes