[erlang-questions] funs and code loading

Matthias Lang matthias@REDACTED
Thu Jan 17 00:59:37 CET 2008


Matthias Lang writes:

 > (I haven't checked whether or not (some) of the above is another facet of
 > http://erlang.org/pipermail/erlang-bugs/2007-June/000368.html )

I had a go at fixing the underlying problem with new funs overwriting
old funs.

The fix involves changing erts/emulator/beam/erl_fun.c. I have
attached a patch against R12B-0, but not sent it to erlang-patches
because there are two loose ends:

  1. I don't understand what HIPE's doing when it messes around 
     with the fun table, so I didn't want to fiddle with it.

     In short: I have left erl_fun.c:erts_get_fun_entry() broken, 
     but it's only used by hipe/hipe_bif0.c.  

     (Aside: Does hot code loading work with HIPE?)

  2. erts/emulator/beam/external.c has support for the old fun
     format. If someone finds a way to mix old and new funs,
     i.e. calls both erts_put_fun_entry and erts_put_fun_entry2
     with the same fun, then that might not do what it should.
     Maybe some pathological setup with old and new nodes updating
     each others' code might be able to do that. I am unsure.

     One solution is to drop support for the old fun format.

I have tested that the patch (a) does the right thing for the test
case in the URL above and (b) also does the right thing for the test
case I posted a few days ago. No testing beyond that.

Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fun_hash_patch
Type: application/octet-stream
Size: 1448 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080117/4ab6084b/attachment.obj>


More information about the erlang-questions mailing list