[pypy-commit] stmgc default: add some comments
Raemi
noreply at buildbot.pypy.org
Thu Apr 9 17:00:46 CEST 2015
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch:
Changeset: r1754:e55658d12179
Date: 2015-04-09 17:03 +0200
http://bitbucket.org/pypy/stmgc/changeset/e55658d12179/
Log: add some comments
diff --git a/c8/stm/hashtable.c b/c8/stm/hashtable.c
--- a/c8/stm/hashtable.c
+++ b/c8/stm/hashtable.c
@@ -109,6 +109,8 @@
{
/* can only be safely called during major GC, when all other threads
are suspended */
+ assert(_has_mutex());
+
long i;
for (i = 1; i < NB_SEGMENTS; i++) {
if (get_priv_segment(i)->transaction_state == TS_NONE)
@@ -174,6 +176,7 @@
if (entry == NULL)
continue;
if (segment_base != NULL) {
+ /* -> compaction during major GC */
if (((struct stm_hashtable_entry_s *)
REAL_ADDRESS(segment_base, entry))->object == NULL &&
!_stm_was_read_by_anybody((object_t *)entry)) {
@@ -283,6 +286,9 @@
/* we can only enter here once! If we allocate stuff, we may
run the GC, and so 'hashtableobj' might move afterwards. */
if (_is_in_nursery(hashtableobj)) {
+ /* this also means that the hashtable is from this
+ transaction and not visible to other segments yet, so
+ the new entry can be nursery-allocated. */
entry = (stm_hashtable_entry_t *)
stm_allocate(sizeof(stm_hashtable_entry_t));
entry->userdata = stm_hashtable_entry_userdata;
More information about the pypy-commit
mailing list