[erlang-bugs] Bugs with hibernate/3 and HiPE

Paul Guyot pguyot@REDACTED
Tue Sep 28 16:21:47 CEST 2010


Le 28 sept. 2010 à 15:53, Mikael Pettersson a écrit :

> Your "fix" for #3 is wrong I think.  hibernate should empty the stack.
> If you don't empty the native stack then yes, at the next GC, we'd
> scan a dead stack, find dead pointers to stale data, and do bad things.
> Your call to fullsweep_nstack() changes this so that in the next GC
> we scan a dead stack, find dead pointers to tenured data, and don't
> crash.
> 
> The correct fix ought to be to simply empty the native stack.  There's
> no existing procedure for doing that, but something like
> 
> void hipe_empty_nstack(Process *p)
> {
>    p->hipe.nstgraylim = NULL;
> #if defined(HIPE_NSTACK_GROWS_DOWN)
>    p->hipe.nsp = p->hipe.nstend;
> #else
>    p->hipe.nsp = p->hipe.nstack;
> #endif
> }
> 
> should be close to what's needed.  hipe_native_bifs.c right after the
> definitions of hipe_inc_nstack() seems like a reasonable place to put it.

Mikael,

Thank you for your e-mail and carefully reviewing this fix. I initially tried to empty the native stack but this crashed, as I definitely lacked the grasp of the native garbage collector for this fix. This function seems to work, at least the hibernate_native_SUITE tests pass.
I committed your suggested change on top of the original commit here:

git fetch git://github.com/pguyot/otp.git fix-hibernate-with-hipe
http://github.com/pguyot/otp/commit/1d5234d5ef54f60e50b36d42083a8cd86429bcb4

Also, I guess you meant hipe_switch_mode.c instead of hipe_native_bifs.c.

Regards,

Paul
-- 
Semiocast                    http://semiocast.com/
+33.175000290 - 62 bis rue Gay-Lussac, 75005 Paris



More information about the erlang-bugs mailing list