[svn:parrot] r47861 - branches/hash_faster/src
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Sat Jun 26 11:57:00 UTC 2010
Author: whiteknight
Date: Sat Jun 26 11:56:59 2010
New Revision: 47861
URL: https://trac.parrot.org/parrot/changeset/47861
Log:
[hash] remove non-starter function
Modified:
branches/hash_faster/src/hash.c
Modified: branches/hash_faster/src/hash.c
==============================================================================
--- branches/hash_faster/src/hash.c Sat Jun 26 11:31:23 2010 (r47860)
+++ branches/hash_faster/src/hash.c Sat Jun 26 11:56:59 2010 (r47861)
@@ -1045,85 +1045,6 @@
/*
-=item C<Hash * parrot_create_hash_preallocate(PARROT_INTERP,
- PARROT_DATA_TYPE val_type, Hash_key_type hkey_type, hash_comp_fn compare,
- hash_hash_key_fn keyhash)>
-
-Creates and initializes a hash, preallocating storage for a certain number
-of buckets. Function pointers determine its behaviors.
-The container passed in is the address of the hash PMC that is using it. The
-hash and the PMC point to each other.
-
-Memory from this function must be freed.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-PARROT_MALLOC
-Hash *
-parrot_create_hash_preallocate(PARROT_INTERP, PARROT_DATA_TYPE val_type,
- Hash_key_type hkey_type, NOTNULL(hash_comp_fn compare),
- NOTNULL(hash_hash_key_fn keyhash), INTVAL size)
-{
- ASSERT_ARGS(parrot_create_hash)
- HashBucket *bp;
- const INTVAL align_size = size % 4 == 0 ? size : ((size + 3) & ~0x03);
- const INTVAL init_size = (size < INITIAL_BUCKETS) ? INTIAL_BUCKETS : size;
- void *alloc = Parrot_gc_allocate_memory_chunk_with_interior_pointers(
- interp, sizeof (Hash) + HASH_ALLOC_SIZE(init_size));
- Hash * const hash = (Hash*)alloc;
- size_t i;
-
- PARROT_ASSERT(INITIAL_BUCKETS % 4 == 0);
-
- hash->compare = compare;
- hash->hash_val = keyhash;
- hash->entry_type = val_type;
- hash->key_type = hkey_type;
- hash->seed = interp->hash_seed;
- hash->mask = init_size - 1;
- hash->entries = 0;
- hash->container = PMCNULL;
- hash->free_list = NULL;
-
- /*
- Hash memory is laid out in a single contiguous block of memory:
-
- +-------------+---------+----------------+
- | struct hash | buckets | bucket_indices |
- +-------------+---------+----------------+
- ^
- | bp
-
-
- bp here gets set to the offset in the block directly after the hash
- structure. We use that to initialize hash->buckets, then we bump bp
- to point to the end of that, and call this the start of bucket_indices
- */
-
- bp = (HashBucket *)((char *)alloc + sizeof (Hash));
- hash->buckets = bp;
- bp += N_BUCKETS(init_size);
- hash->bucket_indices = (HashBucket **)bp;
-
- /* fill free_list from hi addresses so that we can use
- buckets[i] directly in an OrderedHash, *if* nothing
- was deleted */
-
- for (i = 0, --bp; i < N_BUCKETS(init_size); ++i, --bp) {
- bp->next = hash->free_list;
- hash->free_list = bp;
- }
-
- return hash;
-}
-
-
-/*
-
=item C<void parrot_hash_destroy(PARROT_INTERP, Hash *hash)>
Frees the memory allocated to the specified hash and its bucket store. Used by
More information about the parrot-commits
mailing list