[pypy-commit] pypy stmgc-c8-dictstrategy: Fix test_hashtable_prebuilt
arigo
noreply at buildbot.pypy.org
Wed Nov 25 11:39:10 EST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c8-dictstrategy
Changeset: r80958:f619f9fa3317
Date: 2015-11-25 17:39 +0100
http://bitbucket.org/pypy/pypy/changeset/f619f9fa3317/
Log: Fix test_hashtable_prebuilt
diff --git a/rpython/translator/stm/hashtable.py b/rpython/translator/stm/hashtable.py
--- a/rpython/translator/stm/hashtable.py
+++ b/rpython/translator/stm/hashtable.py
@@ -36,19 +36,19 @@
print >> f
print >> f, 'struct _hashtable_descr_s {'
print >> f, '\tUnsigned key;'
- print >> f, '\trpygcchar_t *value;'
- print >> f, '};'
+ print >> f, '\tint globalnum;'
+ print >> f, '} __attribute__((packed));'
print >> f, 'static struct _hashtable_descr_s hashtable_descs[] = {'
for node in nodes:
assert node.globalgcnum >= 0
items = node.get_hashtable_content()
items.sort(key=lambda entry: entry.index)
- print >> f, '\t{ %d, (rpygcchar_t *)%d },' % (node.globalgcnum,
- len(items))
+ print >> f, '\t{ %d, %d },' % (len(items), node.globalgcnum)
for entry in items:
- expr = database.get(entry.object, static=True)
- print >> f, '\t{ %d, %s },' % (entry.index, expr)
- print >> f
+ itemcontainer = entry.object._obj.container
+ itemnode = database.getcontainernode(itemcontainer)
+ assert itemnode.globalgcnum >= 0
+ print >> f, '\t\t{ %dL, %d },' % (entry.index, itemnode.globalgcnum)
print >> f, '};'
diff --git a/rpython/translator/stm/src_stm/extracode.h b/rpython/translator/stm/src_stm/extracode.h
--- a/rpython/translator/stm/src_stm/extracode.h
+++ b/rpython/translator/stm/src_stm/extracode.h
@@ -42,22 +42,26 @@
#if STM_PREBUILT_HASHTABLES > 0
struct _hashtable_descr_s *hdesc = hashtable_descs;
int i;
- long count;
+ Unsigned count;
pypy_HASHTABLE_OBJ0_t *htobj;
stm_hashtable_t *ht;
stm_hashtable_entry_userdata = STM_HASHTABLE_ENTRY_TYPEID;
for (i = 0; i < STM_PREBUILT_HASHTABLES; i++) {
- /* Every hashtable is one header hdesc entry followed by N hdescs.
- The header abuses 'key' as an index inside rpy_prebuilt and
- 'value' as the number of entries that follow. */
- htobj = (pypy_HASHTABLE_OBJ0_t *)rpy_prebuilt[hdesc->key];
- htobj->ha_ll_raw_hashtable = ht = stm_hashtable_create();
- count = (long)hdesc->value;
+ /* Every hashtable is one header hdesc entry followed by N
+ hdescs. The header abuses 'key' as the number of entries
+ that follow, and its 'globalnum' is the rpy_prebuilt index
+ of the hashtable itself. */
+ ht = stm_hashtable_create();
+ htobj = (pypy_HASHTABLE_OBJ0_t *)rpy_prebuilt[hdesc->globalnum];
+ stm_write((object_t *)htobj);
+ htobj->ha_ll_raw_hashtable = ht;
+ count = hdesc->key;
hdesc++;
while (count > 0) {
stm_hashtable_write((object_t *)htobj, ht, hdesc->key,
- (object_t *)hdesc->value, &stm_thread_local);
+ rpy_prebuilt[hdesc->globalnum],
+ &stm_thread_local);
hdesc++;
count--;
}
More information about the pypy-commit
mailing list