Author: Remi Meier Branch: Changeset: r962:b99ef80df576 Date: 2014-03-05 15:44 +0100 http://bitbucket.org/pypy/stmgc/changeset/b99ef80df576/
Log: a more randomness in allocation sizes diff --git a/c7/demo/demo_random.c b/c7/demo/demo_random.c --- a/c7/demo/demo_random.c +++ b/c7/demo/demo_random.c @@ -208,15 +208,15 @@ case 3: // allocate fresh 'p' push_roots(); size_t sizes[4] = {sizeof(struct node_s), - sizeof(struct node_s) + 48, + sizeof(struct node_s) + (get_rand(100000) & ~15), sizeof(struct node_s) + 4096, sizeof(struct node_s) + 4096*70}; size_t size = sizes[get_rand(4)]; p = stm_allocate(size); ((nodeptr_t)p)->sig = SIGNATURE; ((nodeptr_t)p)->my_size = size; - ((nodeptr_t)p)->my_id = -1; - ((nodeptr_t)p)->my_hash = -1; + ((nodeptr_t)p)->my_id = 0; + ((nodeptr_t)p)->my_hash = 0; pop_roots(); /* reload_roots not necessary, all are old after start_transaction */ break; @@ -239,7 +239,7 @@ case 8: // id checking if (p) { nodeptr_t n = (nodeptr_t)p; - if (n->my_id == -1) { + if (n->my_id == 0) { write_barrier(p); n->my_id = stm_id(p); } @@ -252,7 +252,7 @@ case 9: if (p) { nodeptr_t n = (nodeptr_t)p; - if (n->my_hash == -1) { + if (n->my_hash == 0) { write_barrier(p); n->my_hash = stm_identityhash(p); } @@ -367,8 +367,8 @@ struct node_s prebuilt_template = { .sig = SIGNATURE, .my_size = sizeof(struct node_s), - .my_id = -1, - .my_hash = -1, + .my_id = 0, + .my_hash = 0, .next = NULL }; @@ -379,7 +379,7 @@ prebuilt_roots[i] = stm_setup_prebuilt((objptr_t)new_templ); if (i % 2 == 0) { - int hash = i; + int hash = i + 5; stm_set_prebuilt_identityhash(prebuilt_roots[i], hash); ((nodeptr_t)prebuilt_roots[i])->my_hash = hash; _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit