aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/index.c8
-rw-r--r--erts/emulator/beam/index.h10
-rw-r--r--erts/emulator/beam/module.c6
3 files changed, 15 insertions, 9 deletions
diff --git a/erts/emulator/beam/index.c b/erts/emulator/beam/index.c
index 7cd45440f4..25d5cce0f3 100644
--- a/erts/emulator/beam/index.c
+++ b/erts/emulator/beam/index.c
@@ -68,14 +68,14 @@ erts_index_init(ErtsAlcType_t type, IndexTable* t, char* name,
return t;
}
-int
-index_put(IndexTable* t, void* tmpl)
+IndexSlot*
+index_put_entry(IndexTable* t, void* tmpl)
{
int ix;
IndexSlot* p = (IndexSlot*) hash_put(&t->htable, tmpl);
if (p->index >= 0) {
- return p->index;
+ return p;
}
ix = t->entries;
@@ -92,7 +92,7 @@ index_put(IndexTable* t, void* tmpl)
t->entries++;
p->index = ix;
t->seg_table[ix>>INDEX_PAGE_SHIFT][ix&INDEX_PAGE_MASK] = p;
- return ix;
+ return p;
}
int index_get(IndexTable* t, void* tmpl)
diff --git a/erts/emulator/beam/index.h b/erts/emulator/beam/index.h
index 69d1cc0a22..3afe48d007 100644
--- a/erts/emulator/beam/index.h
+++ b/erts/emulator/beam/index.h
@@ -55,16 +55,24 @@ void index_info(int, void *, IndexTable*);
int index_table_sz(IndexTable *);
int index_get(IndexTable*, void*);
-int index_put(IndexTable*, void*);
+
+IndexSlot* index_put_entry(IndexTable*, void*);
void erts_index_merge(Hash*, IndexTable*);
/* Erase all entries with index 'ix' and higher
*/
void index_erase_latest_from(IndexTable*, Uint ix);
+ERTS_GLB_INLINE int index_put(IndexTable*, void*);
ERTS_GLB_INLINE IndexSlot* erts_index_lookup(IndexTable*, Uint);
#if ERTS_GLB_INLINE_INCL_FUNC_DEF
+
+ERTS_GLB_INLINE int index_put(IndexTable* t, void* tmpl)
+{
+ return index_put_entry(t, tmpl)->index;
+}
+
ERTS_GLB_INLINE IndexSlot*
erts_index_lookup(IndexTable* t, Uint ix)
{
diff --git a/erts/emulator/beam/module.c b/erts/emulator/beam/module.c
index ab4f387982..f326aecebf 100644
--- a/erts/emulator/beam/module.c
+++ b/erts/emulator/beam/module.c
@@ -122,7 +122,6 @@ Module*
erts_put_module(Eterm mod)
{
Module e;
- int index;
IndexTable* mod_tab;
ASSERT(is_atom(mod));
@@ -132,8 +131,7 @@ erts_put_module(Eterm mod)
mod_tab = &module_tables[erts_loader_code_ix()];
e.module = atom_val(mod);
- index = index_put(mod_tab, (void*) &e);
- return (Module*) erts_index_lookup(mod_tab, index);
+ return (Module*) index_put_entry(mod_tab, (void*) &e);
}
Module *module_code(int i, ErtsCodeIndex code_ix)
@@ -185,7 +183,7 @@ void module_start_load(void)
*/
for (i = dst->entries; i < src->entries; i++) {
src_mod = (Module*) erts_index_lookup(src, i);
- dst_mod = (Module*) erts_index_lookup(dst, index_put(dst, src_mod));
+ dst_mod = (Module*) index_put_entry(dst, src_mod);
ASSERT(dst_mod != src_mod);
dst_mod->curr = src_mod->curr;