Quantcast

HIPE and on_load

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

HIPE and on_load

Caragea Silviu
Hello,

When I compile using HIPE: ERL_COMPILER_OPTIONS="[native,{hipe, [o3]}]"

All dependencies using NIF's are failing to compile:

<HiPE (v 3.15.3)> EXITED with reason {'trans_fun/2',on_load} @hipe_beam_to_icode:1148

Is this an expected behavior or anything I can do to bypass this ?

Silviu

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HIPE and on_load

Alex S.
This is an expected behaviour, I think, as there’s no trampoline in native-compiled functions to load NIFs into.

> 6 марта 2017 г., в 17:45, Caragea Silviu <[hidden email]> написал(а):
>
> Hello,
>
> When I compile using HIPE: ERL_COMPILER_OPTIONS="[native,{hipe, [o3]}]"
>
> All dependencies using NIF's are failing to compile:
>
> <HiPE (v 3.15.3)> EXITED with reason {'trans_fun/2',on_load} @hipe_beam_to_icode:1148
>
> Is this an expected behavior or anything I can do to bypass this ?
>
> Silviu
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HIPE and on_load

Kostis Sagonas-2
In reply to this post by Caragea Silviu
On 03/06/17 16:45, Caragea Silviu wrote:

> Hello,
>
> When I compile using HIPE: ERL_COMPILER_OPTIONS="[native,{hipe, [o3]}]"
>
> All dependencies using NIF's are failing to compile:
>
> <HiPE (v 3.15.3)> EXITED with reason {'trans_fun/2',on_load}
> @hipe_beam_to_icode:1148
>
> Is this an expected behavior or anything I can do to bypass this ?

Yes, this is expected behaviour.

The on_load attribute instructs the BEAM loader to do its magic when
loading this module (typically containing NIFs).  Files containing NIFs
typically only contain very minimal Erlang code so they do not benefit
much from native code compilation anyway.  So simply do not compile them
to native code.

Perhaps adding an attribute

-compile(no_native).

on the source of the file will solve the problem?

Kostis
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HIPE and on_load

Caragea Silviu
Thanks,

I'll try to see if there is a way in mix file to specifiy what projects should be built without HIPE. It's not so simple to take every single dep and modify :)

Silviu

On Mon, Mar 6, 2017 at 4:51 PM, Kostis Sagonas <[hidden email]> wrote:
On 03/06/17 16:45, Caragea Silviu wrote:
Hello,

When I compile using HIPE: ERL_COMPILER_OPTIONS="[native,{hipe, [o3]}]"

All dependencies using NIF's are failing to compile:

<HiPE (v 3.15.3)> EXITED with reason {'trans_fun/2',on_load}
@hipe_beam_to_icode:1148

Is this an expected behavior or anything I can do to bypass this ?

Yes, this is expected behaviour.

The on_load attribute instructs the BEAM loader to do its magic when loading this module (typically containing NIFs).  Files containing NIFs typically only contain very minimal Erlang code so they do not benefit much from native code compilation anyway.  So simply do not compile them to native code.

Perhaps adding an attribute

-compile(no_native).

on the source of the file will solve the problem?

Kostis


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...