process_info(P,current_function) and HiPE (was Re: Bugs with hibernate/3 and HiPE)
Paul Guyot
pguyot@REDACTED
Tue Sep 28 11:40:05 CEST 2010
> Hello,
>
> There are several bugs related to hibernate/3 BIF and HiPE:
>
> 1. erlang:hibernate/3 simply fails with badarg when called from HiPE.
> 2. erlang:hibernate/3 simply fails with badarg when called dynamically, in a way that the compiler and the loader cannot replace with the i_hibernate beam instruction.
> 3. There is a segfault in the garbage collector when calling erlang:hibernate/3 (from beam unless bug #1 is fixed) if the process went through HiPE. This is because erts_garbage_collect_hibernate would not clean up the hipe process state.
>
> These bugs are highly related: 1 and 2 are actually the same bug (hibernate/3 BIF isn't implemented, and apparently wasn't since it was introduced), and 3 causes segfaults with any reasonable test once bug #1 is fixed.
>
> The following patch fixes these issues:
> http://github.com/pguyot/otp/commit/fcc005c8758d97d7f0c402bfffede0b22b8ab401
> git fetch git://github.com/pguyot/otp.git fix-hibernate-with-hipe
Hello,
I realize I sent the e-mail above to erlang-bugs@ instead of erlang-patches@REDACTED
Besides, even with this fix to hibernate, gen_server_SUITE:hibernate/1 test does not pass when OTP is configured with --enable-native-libs. This is not because the process does not hibernate or does not wake up. Instead, the test heavily relies on process_info(P, current_function) which is not updated by HiPE, while beam updates it (on context switch, I guess).
What is the policy for current_function?
When started and when awoken after an hibernation, a simple gen_server with a non-native callback module with non-native gen_server and non-native proc_lib modules reports {current_function,{gen_server,loop,6}}. The same non-native callback module with native proc_lib and native gen_server reports {current_function,undefined} when started and {current_function,{erlang,hibernate,3}} when awoken after an hibernation (because erts_hibernate function sets current to the hibernate_3 BIF). Should we update HiPE to report some current_function, at least when switching mode? Or should we clear the current_function when waking up from hibernation?
Regards,
Paul
--
Semiocast http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris
More information about the erlang-bugs
mailing list