[pypy-commit] pypy stmgc-c7: update to stmgc/24b92a4c84be
arigo
noreply at buildbot.pypy.org
Wed Jan 28 12:09:20 CET 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r75553:0789ec7eae51
Date: 2015-01-28 11:58 +0100
http://bitbucket.org/pypy/pypy/changeset/0789ec7eae51/
Log: update to stmgc/24b92a4c84be
diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-957947bc7ad9
+24b92a4c84be
diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c b/rpython/translator/stm/src_stm/stm/gcpage.c
--- a/rpython/translator/stm/src_stm/stm/gcpage.c
+++ b/rpython/translator/stm/src_stm/stm/gcpage.c
@@ -437,6 +437,12 @@
get_priv_segment(i)->modified_old_objects,
object_t * /*item*/,
({
+ /* (arigo) I think that here we need to mark_trace() both
+ the shared version and the private version in all cases.
+ Even if the visited flag is already set, we don't know
+ which version was already traced... Chances are that
+ it was the stm_object_pages version, but we are not sure.
+ */
mark_visited_test_and_set(item);
mark_trace(item, stm_object_pages); /* shared version */
mark_trace(item, base); /* private version */
diff --git a/rpython/translator/stm/src_stm/stm/hashtable.c b/rpython/translator/stm/src_stm/stm/hashtable.c
--- a/rpython/translator/stm/src_stm/stm/hashtable.c
+++ b/rpython/translator/stm/src_stm/stm/hashtable.c
@@ -140,10 +140,10 @@
static void _stm_rehash_hashtable(stm_hashtable_t *hashtable,
uintptr_t biggercount,
- bool remove_unread)
+ int remove_unread_from_seg)
{
- dprintf(("rehash %p to %ld, remove_unread=%d\n",
- hashtable, biggercount, (int)remove_unread));
+ dprintf(("rehash %p to %ld, remove_unread_from_seg=%d\n",
+ hashtable, biggercount, remove_unread_from_seg));
size_t size = (offsetof(stm_hashtable_table_t, items)
+ biggercount * sizeof(stm_hashtable_entry_t *));
@@ -160,14 +160,18 @@
uintptr_t j, mask = table->mask;
uintptr_t rc = biggertable->resize_counter;
+ char *segment_base = get_segment_base(remove_unread_from_seg);
for (j = 0; j <= mask; j++) {
stm_hashtable_entry_t *entry = table->items[j];
if (entry == NULL)
continue;
- if (remove_unread) {
- if (entry->object == NULL &&
- !_stm_was_read_by_anybody((object_t *)entry))
+ if (remove_unread_from_seg != 0) {
+ if (((struct stm_hashtable_entry_s *)
+ REAL_ADDRESS(segment_base, entry))->object == NULL &&
+ !_stm_was_read_by_anybody((object_t *)entry)) {
+ dprintf((" removing dead %p\n", entry));
continue;
+ }
}
_insert_clean(biggertable, entry);
rc -= 6;
@@ -256,6 +260,7 @@
entry->userdata = stm_hashtable_entry_userdata;
entry->index = index;
entry->object = NULL;
+ hashtable->additions = STM_SEGMENT->segment_num;
}
else {
/* for a non-nursery 'hashtableobj', we pretend that the
@@ -293,11 +298,11 @@
e->index = index;
e->object = NULL;
}
+ hashtable->additions += 0x100;
release_privatization_lock();
}
write_fence(); /* make sure 'entry' is fully initialized here */
table->items[i] = entry;
- hashtable->additions += 1;
write_fence(); /* make sure 'table->items' is written here */
VOLATILE_TABLE(table)->resize_counter = rc - 6; /* unlock */
return entry;
@@ -310,7 +315,7 @@
biggercount *= 4;
else
biggercount *= 2;
- _stm_rehash_hashtable(hashtable, biggercount, /*remove_unread=*/false);
+ _stm_rehash_hashtable(hashtable, biggercount, /*remove_unread=*/0);
goto restart;
}
}
@@ -339,8 +344,10 @@
stm_hashtable_table_t *table = hashtable->table;
assert(!IS_EVEN(table->resize_counter));
- if (hashtable->additions * 4 > table->mask) {
- hashtable->additions = 0;
+ if ((hashtable->additions >> 8) * 4 > table->mask) {
+ int segment_num = (hashtable->additions & 0xFF);
+ if (!segment_num) segment_num = 1;
+ hashtable->additions = segment_num;
uintptr_t initial_rc = (table->mask + 1) * 4 + 1;
uintptr_t num_entries_times_6 = initial_rc - table->resize_counter;
uintptr_t count = INITIAL_HASHTABLE_SIZE;
@@ -350,7 +357,8 @@
can never grow larger than the current table size. */
assert(count <= table->mask + 1);
- _stm_rehash_hashtable(hashtable, count, /*remove_unread=*/true);
+ dprintf(("compact with %ld items:\n", num_entries_times_6 / 6));
+ _stm_rehash_hashtable(hashtable, count, /*remove_unread=*/segment_num);
}
table = hashtable->table;
diff --git a/rpython/translator/stm/src_stm/stm/prof.c b/rpython/translator/stm/src_stm/stm/prof.c
--- a/rpython/translator/stm/src_stm/stm/prof.c
+++ b/rpython/translator/stm/src_stm/stm/prof.c
@@ -91,7 +91,7 @@
}
}
-int stm_set_timing_log(const char *profiling_file_name,
+int stm_set_timing_log(const char *profiling_file_name, int fork_mode,
int expand_marker(stm_loc_marker_t *, char *, int))
{
close_timing_log();
@@ -117,6 +117,7 @@
if (!open_timing_log(profiling_file_name))
return -1;
- profiling_basefn = strdup(profiling_file_name);
+ if (fork_mode != 0)
+ profiling_basefn = strdup(profiling_file_name);
return 0;
}
diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h
--- a/rpython/translator/stm/src_stm/stmgc.h
+++ b/rpython/translator/stm/src_stm/stmgc.h
@@ -159,7 +159,7 @@
The best is to use typedefs like above.
The object_s part contains some fields reserved for the STM library.
- Right now this is only one byte.
+ Right now this is only four bytes.
*/
struct object_s {
@@ -470,13 +470,15 @@
stm_loc_marker_t *markers);
/* Calling this sets up a stmcb_timing_event callback that will produce
- a binary file calling 'profiling_file_name'. After a fork(), it is
- written to 'profiling_file_name.fork<PID>'. Call it with NULL to
+ a binary file called 'profiling_file_name'. Call it with
+ 'fork_mode == 0' for only the main process, and with
+ 'fork_mode == 1' to also write files called
+ 'profiling_file_name.fork<PID>' after a fork(). Call it with NULL to
stop profiling. Returns -1 in case of error (see errno then).
The optional 'expand_marker' function pointer is called to expand
the marker's odd_number and object into data, starting at the given
position and with the given maximum length. */
-int stm_set_timing_log(const char *profiling_file_name,
+int stm_set_timing_log(const char *profiling_file_name, int fork_mode,
int expand_marker(stm_loc_marker_t *, char *, int));
More information about the pypy-commit
mailing list