[erlang-questions] NIF + HiPE - can it works together?

Sverker Eriksson sverker@REDACTED
Wed Jun 8 15:55:35 CEST 2011


I don't know if it has been stated, but HiPE and NIFs do not play nice 
together *within the same module*.
Using HiPE and NIFs on different modules within the same VM will 
hopefully work fine.


There seem to be a number of problems here.

1. erlang:load_nif fails as reported by Radosław Bułat. This seems to be 
a "simple" bug that can be fixed, but even if so...

2. The NIF overriding mechanism is not implemented for hipe and would 
probably yield unpredictable results.

3. Hipe compiler fails on on_load as reported.

I will look into the first two.  Not sure if #3 was expected not to 
work? (Mikael? Kostis?)


/Sverker, Erlang/OTP

Paul Davis wrote:
> I'm fairly certain that I saw somewhere that HiPE is incompatible with
> NIF's but I'm unable to actually Google a reference so I could be
> making that up based on that on_init error that I've seen before.
>
> If so, I'd probably just shove the code you want HiPE compiled into a
> lib module and have the nif stubs call out to that as necessary.
>
> HTH,
> Paul Davis
>
> 2011/6/6 Radosław Bułat <radek.bulat@REDACTED>:
>   
>> 2011/6/7 Radosław Bułat <radek.bulat@REDACTED>:
>>     
>>> 2011/6/6 Mikael Pettersson <mikpe@REDACTED>:
>>>       
>>>> Please post a standalone and minimal test case.
>>>>
>>>>         
>>> Yeah, sure.
>>>
>>>       
>> One more thing. When module is compiled with HiPE and try to use
>> on_load attribute it ends with error:
>>
>> <HiPE (v 3.8)> EXITED with reason {'trans_fun/2',on_load}
>> @hipe_beam_to_icode:1148
>>
>> =ERROR REPORT==== 7-Jun-2011::01:18:36 ===
>> Error in process <0.50.0> with exit value:
>> {{badmatch,{'EXIT',{{hipe_beam_to_icode,1148,{'trans_fun/2',on_load}},[{hipe_beam_to_icode,trans_fun,2},{hipe_beam_to_icode,trans_fun,2},{hipe_beam_to_icode,trans_mfa_code,5},{hipe_beam_to_icode,trans_beam_function_chunk...
>>
>> src/nif_with_hipe.erl:none: internal error in native_compile;
>> crash reason: {{badmatch,
>>                   {'EXIT',
>>                       {{hipe_beam_to_icode,1148,{'trans_fun/2',on_load}},
>>                        [{hipe_beam_to_icode,trans_fun,2},
>>                         {hipe_beam_to_icode,trans_fun,2},
>>                         {hipe_beam_to_icode,trans_mfa_code,5},
>>                         {hipe_beam_to_icode,trans_beam_function_chunk,2},
>>                         {hipe_beam_to_icode,'-module/2-lc$^1/1-1-',2},
>>                         {hipe,get_beam_icode,4},
>>                         {hipe,'-run_compiler_1/3-fun-0-',4}]}}},
>>               [{hipe,get_beam_icode,4},{hipe,'-run_compiler_1/3-fun-0-',4}]}
>>
>> --
>> Pozdrawiam
>>
>> Radosław Bułat
>> http://radarek.jogger.pl - mój blog
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>     
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>   





More information about the erlang-questions mailing list