Author: Armin Rigo <[email protected]>
Branch: hashtable
Changeset: r1502:194265597fad
Date: 2014-11-10 15:09 +0100
http://bitbucket.org/pypy/stmgc/changeset/194265597fad/
Log: Export stm_hashtable_lookup() too
diff --git a/c7/stm/hashtable.c b/c7/stm/hashtable.c
--- a/c7/stm/hashtable.c
+++ b/c7/stm/hashtable.c
@@ -25,8 +25,6 @@
*/
-typedef TLPREFIX struct stm_hashtable_entry_s stm_hashtable_entry_t;
-
uint32_t stm_hashtable_entry_userdata;
@@ -170,9 +168,9 @@
VOLATILE_HASHTABLE(hashtable)->table = biggertable;
}
-static stm_hashtable_entry_t *_stm_hashtable_lookup(object_t *hashtableobj,
- stm_hashtable_t *hashtable,
- uintptr_t index)
+stm_hashtable_entry_t *stm_hashtable_lookup(object_t *hashtableobj,
+ stm_hashtable_t *hashtable,
+ uintptr_t index)
{
stm_hashtable_table_t *table;
uintptr_t mask;
@@ -305,22 +303,20 @@
}
}
-object_t *stm_hashtable_read(object_t *hashtableobj, stm_hashtable_t
*hashtable,
- uintptr_t index)
+object_t *stm_hashtable_read(object_t *hobj, stm_hashtable_t *hashtable,
+ uintptr_t key)
{
- stm_hashtable_entry_t *e = _stm_hashtable_lookup(hashtableobj, hashtable,
- index);
+ stm_hashtable_entry_t *e = stm_hashtable_lookup(hobj, hashtable, key);
stm_read((object_t *)e);
return e->object;
}
-void stm_hashtable_write(object_t *hashtableobj, stm_hashtable_t *hashtable,
- uintptr_t index, object_t *nvalue,
+void stm_hashtable_write(object_t *hobj, stm_hashtable_t *hashtable,
+ uintptr_t key, object_t *nvalue,
stm_thread_local_t *tl)
{
STM_PUSH_ROOT(*tl, nvalue);
- stm_hashtable_entry_t *e = _stm_hashtable_lookup(hashtableobj, hashtable,
- index);
+ stm_hashtable_entry_t *e = stm_hashtable_lookup(hobj, hashtable, key);
stm_write((object_t *)e);
STM_POP_ROOT(*tl, nvalue);
e->object = nvalue;
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -534,8 +534,12 @@
If you want to embed the hashtable inside an 'object_t' you
probably need a light finalizer to do the freeing. */
typedef struct stm_hashtable_s stm_hashtable_t;
+typedef TLPREFIX struct stm_hashtable_entry_s stm_hashtable_entry_t;
+
stm_hashtable_t *stm_hashtable_create(void);
void stm_hashtable_free(stm_hashtable_t *);
+stm_hashtable_entry_t *stm_hashtable_lookup(object_t *, stm_hashtable_t *,
+ uintptr_t key);
object_t *stm_hashtable_read(object_t *, stm_hashtable_t *, uintptr_t key);
void stm_hashtable_write(object_t *, stm_hashtable_t *, uintptr_t key,
object_t *nvalue, stm_thread_local_t *);
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit