[erlang-bugs] R15B02 HiPE can't compile modules with on_load attribute
Tue Nov 27 15:08:59 CET 2012
Kostis Sagonas wrote:
> On 11/25/2012 08:16 PM, José Valim wrote:
>> HiPE can't compile a module with on_load attribute. This sample module
>> %% Exporting the function doesn't affect the outcome
>> %% -exports([do_nothing/0]).
>> do_nothing() -> ok.
>> When compiled via command line or via compile:forms.
>> A snippet of the error message is:
>> =ERROR REPORT==== 25-Nov-2012::18:48:29 ===
>> Error in process <0.88.0> with exit value:
> I can easily provide a patch that makes the HiPE compiler not crash
> when it finds an "on_load" BEAM instruction, but the real fix involves
> changing the HiPE loader to trigger execution of functions specified
> as part of the on_load attribute declaration.
> Perhaps somebody at OTP who is more familiar with the magic that the
> BEAM loader does when it finds BEAM code with on_load instructions can
> do this -- or at least help here.
Supporting "on_load" for Hipe is not trivial to do and it is not a
prioritized job for us right now.
If on_load is used to call erlang:load_nif/2, that's yet another thing
that would need to be fixed. Right now you can not mix Hipe and NIFs in
the same module.
More information about the erlang-bugs