[pypy-commit] stmgc c8-new-page-handling: change stm_validate() signature
Raemi
noreply at buildbot.pypy.org
Fri Sep 19 13:09:30 CEST 2014
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: c8-new-page-handling
Changeset: r1395:18875506f028
Date: 2014-09-19 13:01 +0200
http://bitbucket.org/pypy/stmgc/changeset/18875506f028/
Log: change stm_validate() signature
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -102,9 +102,7 @@
/* in case page is already newer, validate everything now to have a common
revision for all pages */
- stm_validate(NULL);
-
- release_all_privatization_locks();
+ _stm_validate(NULL, true);
}
static void _signal_handler(int sig, siginfo_t *siginfo, void *context)
@@ -189,7 +187,8 @@
release_modified_objs_lock(from_seg);
}
-void stm_validate(void *free_if_abort)
+
+static void _stm_validate(void *free_if_abort, bool locks_acquired)
{
/* go from last known entry in commit log to the
most current one and apply all changes done
@@ -199,7 +198,12 @@
assert((uintptr_t)STM_PSEGMENT->last_commit_log_entry->next == -1);
return;
}
- assert(all_privatization_locks_acquired());
+
+ if (locks_acquired) {
+ assert(all_privatization_locks_acquired());
+ } else {
+ acquire_all_privatization_locks();
+ }
volatile struct stm_commit_log_entry_s *cl, *prev_cl;
cl = prev_cl = (volatile struct stm_commit_log_entry_s *)
@@ -253,6 +257,7 @@
STM_PSEGMENT->last_commit_log_entry = (struct stm_commit_log_entry_s *)cl;
}
+ release_all_privatization_locks();
if (needs_abort) {
free(free_if_abort);
stm_abort_transaction();
@@ -303,7 +308,7 @@
/* regular transaction: */
do {
- stm_validate(new);
+ _stm_validate(new, false);
/* try attaching to commit log: */
to = &(STM_PSEGMENT->last_commit_log_entry->next);
@@ -317,7 +322,7 @@
new = (struct stm_commit_log_entry_s*)-1;
do {
- stm_validate(NULL);
+ stm_validate();
/* try attaching to commit log: */
to = &(STM_PSEGMENT->last_commit_log_entry->next);
@@ -325,6 +330,11 @@
}
/* ############# STM ############# */
+void stm_validate()
+{
+ _stm_validate(NULL, false);
+}
+
void _stm_write_slowpath(object_t *obj)
{
@@ -460,7 +470,7 @@
check_nursery_at_transaction_start();
- stm_validate(NULL);
+ stm_validate();
}
long stm_start_transaction(stm_thread_local_t *tl)
diff --git a/c8/stm/core.h b/c8/stm/core.h
--- a/c8/stm/core.h
+++ b/c8/stm/core.h
@@ -138,6 +138,7 @@
static void abort_data_structures_from_segment_num(int segment_num);
static void _signal_handler(int sig, siginfo_t *siginfo, void *context);
+static void _stm_validate(void *free_if_abort, bool locks_acquired);
static inline void _duck(void) {
/* put a call to _duck() between two instructions that set 0 into
diff --git a/c8/stmgc.h b/c8/stmgc.h
--- a/c8/stmgc.h
+++ b/c8/stmgc.h
@@ -71,7 +71,7 @@
char *_stm_real_address(object_t *o);
#ifdef STM_TESTS
#include <stdbool.h>
-void stm_validate(void *free_if_abort);
+void stm_validate(void);
bool _stm_was_read(object_t *obj);
bool _stm_was_written(object_t *obj);
diff --git a/c8/test/support.py b/c8/test/support.py
--- a/c8/test/support.py
+++ b/c8/test/support.py
@@ -41,7 +41,7 @@
void stm_teardown(void);
void stm_register_thread_local(stm_thread_local_t *tl);
void stm_unregister_thread_local(stm_thread_local_t *tl);
-void stm_validate(void *free_if_abort);
+void stm_validate();
bool _check_stm_validate();
object_t *stm_setup_prebuilt(object_t *);
@@ -183,7 +183,7 @@
}
bool _check_stm_validate(void) {
- CHECKED(stm_validate(NULL));
+ CHECKED(stm_validate());
}
#undef CHECKED
More information about the pypy-commit
mailing list