aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/index.h
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2017-01-12 15:16:02 +0100
committerErlang/OTP <[email protected]>2017-01-12 15:16:02 +0100
commit905e6ea8c21e8bcba0933a147ef70f7044e6bead (patch)
tree341bb2f6a854b22d3c94f64a9a8c93ee9a4564cf /erts/emulator/beam/index.h
parent3473ecd83a7bbe7e0bebb865f25dddb93e3bf10f (diff)
parentaf5169d85fcd545e3c857a219db081a62f33404d (diff)
downloadotp-905e6ea8c21e8bcba0933a147ef70f7044e6bead.tar.gz
otp-905e6ea8c21e8bcba0933a147ef70f7044e6bead.tar.bz2
otp-905e6ea8c21e8bcba0933a147ef70f7044e6bead.zip
Merge branch 'sverker/make-export-fun-race/OTP-14144' into maint-19
* sverker/make-export-fun-race/OTP-14144: erts: Fix race bug between export fun creation and code loading
Diffstat (limited to 'erts/emulator/beam/index.h')
-rw-r--r--erts/emulator/beam/index.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/erts/emulator/beam/index.h b/erts/emulator/beam/index.h
index b2e3c0eab5..10f5d1eb39 100644
--- a/erts/emulator/beam/index.h
+++ b/erts/emulator/beam/index.h
@@ -65,6 +65,7 @@ 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);
+ERTS_GLB_INLINE int erts_index_num_entries(IndexTable* t);
#if ERTS_GLB_INLINE_INCL_FUNC_DEF
@@ -78,6 +79,19 @@ erts_index_lookup(IndexTable* t, Uint ix)
{
return t->seg_table[ix>>INDEX_PAGE_SHIFT][ix&INDEX_PAGE_MASK];
}
+
+ERTS_GLB_INLINE int erts_index_num_entries(IndexTable* t)
+{
+ int ret = t->entries;
+ /*
+ * Do a read barrier here to allow lock free iteration
+ * on tables where entries are never erased.
+ * index_put_entry() does matching write barrier.
+ */
+ ERTS_SMP_READ_MEMORY_BARRIER;
+ return ret;
+}
+
#endif
#endif