[pypy-commit] stmgc c7-refactor: Align nursery sections
arigo
noreply at buildbot.pypy.org
Mon Feb 10 19:50:16 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r722:f4d87872cb45
Date: 2014-02-10 19:46 +0100
http://bitbucket.org/pypy/stmgc/changeset/f4d87872cb45/
Log: Align nursery sections
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -19,6 +19,9 @@
then they might be allocted outside sections but still in the nursery. */
#define MEDIUM_OBJECT (9*1024)
+/* size in bytes of the alignment of any section requested */
+#define NURSERY_ALIGNMENT 64
+
/************************************************************/
static union {
@@ -44,9 +47,13 @@
}
+#define NURSERY_ALIGN(bytes) \
+ (((bytes) + NURSERY_ALIGNMENT - 1) & ~(NURSERY_ALIGNMENT - 1))
+
static stm_char *allocate_from_nursery(uint64_t bytes)
{
/* thread-safe; allocate a chunk of memory from the nursery */
+ bytes = NURSERY_ALIGN(bytes);
uint64_t p = __sync_fetch_and_add(&nursery_ctl.used, bytes);
if (p + bytes > NURSERY_SIZE) {
//major_collection();
More information about the pypy-commit
mailing list