[erlang-questions] Why can't HiPE inline functions across modules?

Kostis Sagonas kostis@REDACTED
Wed Nov 19 01:07:07 CET 2008

Tony Arcieri wrote:
> I've read that HiPE can't inline functions across modules.  Is this 
> merely an implementation issue of HiPE, or is there some intractable 
> problem I'm missing?

None of the two.  The semantics of Erlang dictates that module qualified 
calls go via the module/function look up table to see if a module update 
has been performed.  That's how BEAM does it and it seemed natural to us 
that HiPE would also do the same thing.

> People typically bring up code change as the reason, however I don't see 
> why HiPE couldn't walk the graph of modules for which inlining has been 
> performed during a code change and deoptimize them all back to their 
> original state, then start all inlining for these modules over from 
> scratch again.

Well, provided you also come up with some other (preferably cheap) way 
of checking during execution that some /other/ module than the one under 
execution in has been updated, you can of course do what you suggest.

Please send us the patch for it.  Looking forward!


PS. Oh, please do not forget to also handle that your code generates the
     same exceptions (and stack traces) as BEAM because otherwise some
     users might not like seeing different results than BEAM when running
     native code.  But of course that's also not an intractable problem
     either ;-)

More information about the erlang-questions mailing list