[pypy-commit] stmgc c8-adaptive-trx-length-per-thread: Use double instead of float
tobweber
pypy.commits at gmail.com
Fri May 12 10:10:52 EDT 2017
Author: Tobias Weber <tobias_weber89 at gmx.de>
Branch: c8-adaptive-trx-length-per-thread
Changeset: r2059:daf9d599a698
Date: 2017-05-12 14:14 +0200
http://bitbucket.org/pypy/stmgc/changeset/daf9d599a698/
Log: Use double instead of float
diff --git a/c8/stm/nursery.c b/c8/stm/nursery.c
--- a/c8/stm/nursery.c
+++ b/c8/stm/nursery.c
@@ -5,6 +5,7 @@
#include "finalizer.h"
#include <math.h>
+#include <inttypes.h>
/************************************************************/
@@ -23,12 +24,12 @@
uintptr_t stm_fill_mark_nursery_bytes = DEFAULT_FILL_MARK_NURSERY_BYTES;
// uintptr_t stm_fill_mark_nursery_bytes = LARGE_FILL_MARK_NURSERY_BYTES;
-#define STM_MIN_RELATIVE_TRANSACTION_LENGTH (0.00000001f)
+#define STM_MIN_RELATIVE_TRANSACTION_LENGTH (0.00000001)
-static float get_new_transaction_length(stm_thread_local_t *tl, bool aborts) {
+static double get_new_transaction_length(stm_thread_local_t *tl, bool aborts) {
const int multiplier = 100;
- float previous = tl->relative_transaction_length;
- float new = previous;
+ double previous = tl->relative_transaction_length;
+ double new = previous;
if (aborts) {
tl->transaction_length_backoff = 3;
if (previous > STM_MIN_RELATIVE_TRANSACTION_LENGTH) {
@@ -49,16 +50,16 @@
}
static void stm_transaction_length_handle_validation(stm_thread_local_t *tl, bool aborts) {
- if (!tl->initialized) {
+ if (!tl->initialized) { // TODO move to setup.c
tl->relative_transaction_length = STM_MIN_RELATIVE_TRANSACTION_LENGTH;
tl->initialized = true;
}
- float new = get_new_transaction_length(tl, aborts);
+ double new = get_new_transaction_length(tl, aborts);
tl->relative_transaction_length = new;
}
static uintptr_t stm_get_transaction_length(stm_thread_local_t *tl) {
- float relative_additional_length = tl->relative_transaction_length;
+ double relative_additional_length = tl->relative_transaction_length;
if (timing_enabled()) {
struct timespec relative_length = {
.tv_sec = (int)relative_additional_length,
@@ -70,8 +71,10 @@
STM_SINGLE_THREAD_MODE_ADAPTIVE,
&stm_duration_payload);
}
- return DEFAULT_FILL_MARK_NURSERY_BYTES +
+ uintptr_t result = DEFAULT_FILL_MARK_NURSERY_BYTES +
(uintptr_t)(LARGE_FILL_MARK_NURSERY_BYTES * relative_additional_length);
+ printf("%020" PRIxPTR "\n", result);
+ return result;
}
diff --git a/c8/stmgc.h b/c8/stmgc.h
--- a/c8/stmgc.h
+++ b/c8/stmgc.h
@@ -90,7 +90,7 @@
intptr_t self_or_0_if_atomic;
void *creating_pthread[2];
/* adaptive single thread mode */
- float relative_transaction_length;
+ double relative_transaction_length;
int transaction_length_backoff;
bool initialized;
} stm_thread_local_t;
More information about the pypy-commit
mailing list