Author: Remi Meier
Branch: stmgc-c7
Changeset: r70480:13693bb0b800
Date: 2014-04-07 14:51 +0200
http://bitbucket.org/pypy/pypy/changeset/13693bb0b800/
Log: import stmgc
diff --git a/rpython/translator/stm/import_stmgc.py
b/rpython/translator/stm/import_stmgc.py
--- a/rpython/translator/stm/import_stmgc.py
+++ b/rpython/translator/stm/import_stmgc.py
@@ -26,6 +26,8 @@
for p in sorted(plist):
if not (p.basename.endswith('.c') or p.basename.endswith('.h')):
continue
+ if p.basename.startswith('.'):
+ continue
if p.basename.startswith('demo'):
continue
path = stmgc_dest.join(p.relto(stmgc_dir))
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 @@
-5dbd50990e2c
+cfd37feb0f23+
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
@@ -81,7 +81,6 @@
/* thread-safe: use the lock of pages.c to prevent any remapping
from occurring under our feet */
mutex_pages_lock();
- increment_total_allocated(size + LARGE_MALLOC_OVERHEAD);
/* Allocate the object with largemalloc.c from the lower addresses. */
char *addr = _stm_large_malloc(size);
diff --git a/rpython/translator/stm/src_stm/stm/largemalloc.c
b/rpython/translator/stm/src_stm/stm/largemalloc.c
--- a/rpython/translator/stm/src_stm/stm/largemalloc.c
+++ b/rpython/translator/stm/src_stm/stm/largemalloc.c
@@ -53,6 +53,7 @@
#define BOTH_CHUNKS_USED 0
#define CHUNK_HEADER_SIZE offsetof(struct malloc_chunk, d)
#define END_MARKER 0xDEADBEEF
+#define MIN_ALLOC_SIZE (sizeof(struct malloc_chunk) - CHUNK_HEADER_SIZE)
#define chunk_at_offset(p, ofs) ((mchunk_t *)(((char *)(p)) + (ofs)))
#define data2chunk(p) chunk_at_offset(p, -CHUNK_HEADER_SIZE)
@@ -89,7 +90,7 @@
The additional chunks of a given size are linked "vertically" in
the secondary 'u' doubly-linked list.
-
+
+-----+
| 296 |
+-----+
@@ -259,8 +260,8 @@
/* it can be very small, but we need to ensure a minimal size
(currently 32 bytes) */
- if (request_size < sizeof(struct malloc_chunk) - CHUNK_HEADER_SIZE)
- request_size = sizeof(struct malloc_chunk) - CHUNK_HEADER_SIZE;
+ if (request_size < MIN_ALLOC_SIZE)
+ request_size = MIN_ALLOC_SIZE;
size_t index = largebin_index(request_size);
sort_bin(index);
@@ -334,6 +335,7 @@
}
mscan->size = request_size;
mscan->prev_size = BOTH_CHUNKS_USED;
+ increment_total_allocated(request_size + LARGE_MALLOC_OVERHEAD);
return (char *)&mscan->d;
}
@@ -344,6 +346,9 @@
assert((chunk->size & (sizeof(char *) - 1)) == 0);
assert(chunk->prev_size != THIS_CHUNK_FREE);
+ /* 'size' is at least MIN_ALLOC_SIZE */
+ increment_total_allocated(-(chunk->size + LARGE_MALLOC_OVERHEAD));
+
#ifndef NDEBUG
assert(chunk->size >= sizeof(dlist_t));
assert(chunk->size <= (((char *)last_chunk) - (char *)data));
@@ -555,7 +560,6 @@
chunk = next_chunk(chunk); /* go to the first non-free chunk */
while (chunk != last_chunk) {
-
/* here, the chunk we're pointing to is not free */
assert(chunk->prev_size != THIS_CHUNK_FREE);
@@ -567,8 +571,6 @@
/* use the callback to know if 'chunk' contains an object that
survives or dies */
if (!_largemalloc_sweep_keep(chunk)) {
- size_t size = chunk->size;
- increment_total_allocated(-(size + LARGE_MALLOC_OVERHEAD));
_stm_large_free((char *)&chunk->d); /* dies */
}
chunk = mnext;
diff --git a/rpython/translator/stm/src_stm/stm/nursery.c
b/rpython/translator/stm/src_stm/stm/nursery.c
--- a/rpython/translator/stm/src_stm/stm/nursery.c
+++ b/rpython/translator/stm/src_stm/stm/nursery.c
@@ -244,7 +244,6 @@
}
char *realobj = REAL_ADDRESS(pseg->pub.segment_base, item->addr);
ssize_t size = stmcb_size_rounded_up((struct object_s *)realobj);
- increment_total_allocated(-(size + LARGE_MALLOC_OVERHEAD));
_stm_large_free(stm_object_pages + item->addr);
} TREE_LOOP_END;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit