aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-01-20 17:39:14 +0100
committerSverker Eriksson <[email protected]>2012-02-21 12:23:00 +0100
commit0ebc1871238508783733423825d22967f5096d19 (patch)
tree02910edd496c5f8988ddb55b6b083bc9f698cfb4
parentdd3036c1a152c66a33b4d298cbbf428c075153b7 (diff)
downloadotp-0ebc1871238508783733423825d22967f5096d19.tar.gz
otp-0ebc1871238508783733423825d22967f5096d19.tar.bz2
otp-0ebc1871238508783733423825d22967f5096d19.zip
erts: Call erts_export_consolidate automatically
Renamed merge_secondary_table and called by export_start_load
-rw-r--r--erts/emulator/beam/beam_bif_load.c3
-rw-r--r--erts/emulator/beam/beam_load.c1
-rw-r--r--erts/emulator/beam/export.c38
-rw-r--r--erts/emulator/beam/export.h1
4 files changed, 16 insertions, 27 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index f21598a8b7..7c09ef7083 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -171,8 +171,6 @@ BIF_RETTYPE code_make_stub_module_3(BIF_ALIST_3)
erts_lock_code_ix();
erts_start_loader_code_ix();
- erts_export_consolidate(erts_loader_code_ix());
-
res = erts_make_stub_module(BIF_P, BIF_ARG_1, BIF_ARG_2, BIF_ARG_3);
if (res == BIF_ARG_1) {
@@ -291,7 +289,6 @@ BIF_RETTYPE delete_module_1(BIF_ALIST_1)
erts_lock_code_ix();
erts_start_loader_code_ix();
code_ix = erts_loader_code_ix();
- erts_export_consolidate(code_ix);
{
Module *modp = erts_get_module(BIF_ARG_1, code_ix);
if (!modp) {
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index eaaef472b4..e2a3914bf7 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -774,7 +774,6 @@ erts_finish_loading(LoaderState* stp, Process* c_p,
* exported and imported functions. This can't fail.
*/
- erts_export_consolidate(erts_loader_code_ix());
CHKBLK(ERTS_ALC_T_CODE,stp->code);
final_touch(stp);
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index c74a40b0db..eb76ec8fd4 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -292,7 +292,7 @@ erts_export_put(Eterm mod, Eterm func, unsigned int arity)
* be called).
*
* Stub export entries will be placed in the secondary export table.
- * erts_export_consolidate() will move all stub export entries into the
+ * export_start_load() will move all stub export entries into the
* main export table (will be done the next time code is loaded).
*/
@@ -322,33 +322,25 @@ erts_export_get_or_make_stub(Eterm mod, Eterm func, unsigned int arity)
}
/*
- * To be called before loading code (with other threads blocked).
- * This function will move all export entries from the secondary
- * export table into the primary.
+ * Move all export entries from the secondary export table into the primary.
*/
-void
-erts_export_consolidate(ErtsCodeIndex code_ix)
+static void merge_secondary_table(IndexTable* dst)
{
-#ifdef DEBUG
- HashInfo hi;
-#endif
-
- /*SVERK: Not sure if this is the way to go.
- Maye we should always merge into loader ix,
- or can loader table act as secondary_export_table?*/
-
- ERTS_SMP_LC_ASSERT((erts_is_code_ix_locked()
- && code_ix == erts_loader_code_ix())
- || erts_initialized == 0
- || erts_smp_thr_progress_is_blocking());
+ ERTS_SMP_LC_ASSERT(erts_is_code_ix_locked());
+ /*SVERK && code_ix == erts_loader_code_ix()));
+ || erts_initialized == 0
+ || erts_smp_thr_progress_is_blocking());*/
export_write_lock();
- erts_index_merge(&secondary_export_table, &export_tables[code_ix]);
- erts_hash_merge(&secondary_export_table, &export_tables[code_ix].htable);
+ erts_index_merge(&secondary_export_table, dst);
+ erts_hash_merge(&secondary_export_table, &dst->htable);
export_write_unlock();
#ifdef DEBUG
- hash_get_info(&hi, &export_tables[code_ix].htable);
- ASSERT(export_tables[code_ix].entries == hi.objs);
+ {
+ HashInfo hi;
+ hash_get_info(&hi, &dst->htable);
+ ASSERT(dst->entries == hi.objs);
+ }
#endif
}
@@ -440,6 +432,8 @@ void export_start_load(void)
dst->htable.fun.alloc = (HALLOC_FUN) &export_alloc; /* restore */
+ merge_secondary_table(dst);
+
entries_at_start_load = dst->entries;
IF_DEBUG(debug_start_load_ix = dst_ix);
diff --git a/erts/emulator/beam/export.h b/erts/emulator/beam/export.h
index db27606c49..85628aac0b 100644
--- a/erts/emulator/beam/export.h
+++ b/erts/emulator/beam/export.h
@@ -67,7 +67,6 @@ Export* erts_export_put(Eterm mod, Eterm func, unsigned int arity);
Export* erts_export_get_or_make_stub(Eterm, Eterm, unsigned);
-void erts_export_consolidate(ErtsCodeIndex);
Export *export_list(int,ErtsCodeIndex);
int export_list_size(ErtsCodeIndex);