From 71f2687e53ef52ae94ab3569a601456d1e906a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 26 May 2010 11:49:25 +0200 Subject: beam_loader: Support external funs in the literal pool A future release of the compiler might want to treat external funs as literals. Make sure that the loader can cope with an export entry being created from both an entry in the literal pool and from the export table (i.e. if an external fun refers to an exported function in the same module). --- erts/emulator/beam/beam_bif_load.c | 2 -- erts/emulator/beam/beam_load.c | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'erts') diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index 2561d7a630..8c1f85ea37 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -66,8 +66,6 @@ load_module_2(BIF_ALIST_2) erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN); erts_smp_block_system(0); - erts_export_consolidate(); - hp = HAlloc(BIF_P, 3); sz = binary_size(BIF_ARG_2); if ((i = erts_load_module(BIF_P, 0, diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 57f5ad0a62..d82b5dbcac 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -757,6 +757,14 @@ bin_load(Process *c_p, ErtsProcLocks c_p_locks, } } + /* + * Since the literal table *may* have contained external + * funs (containing references to export entries), now is + * the time to consolidate the export tables. + */ + + erts_export_consolidate(); + /* * Load the code chunk. */ -- cgit v1.2.3