Lines Matching +defs:src +defs:hash

8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
192 static dtrace_dynvar_t dtrace_dynhash_sink; /* end of dynamic hash chains */
292 * On DEBUG kernels, DTrace will track the errors that has seen in a hash
296 * error hash may be examined with the ::dtrace_errhash MDB dcmd.
313 #define DTRACE_HASHSTR(hash, probe) \
314 dtrace_hash_str(*((char **)((uintptr_t)(probe) + (hash)->dth_stroffs)))
316 #define DTRACE_HASHNEXT(hash, probe) \
317 (dtrace_probe_t **)((uintptr_t)(probe) + (hash)->dth_nextoffs)
319 #define DTRACE_HASHPREV(hash, probe) \
320 (dtrace_probe_t **)((uintptr_t)(probe) + (hash)->dth_prevoffs)
322 #define DTRACE_HASHEQ(hash, lhs, rhs) \
323 (strcmp(*((char **)((uintptr_t)(lhs) + (hash)->dth_stroffs)), \
324 *((char **)((uintptr_t)(rhs) + (hash)->dth_stroffs))) == 0)
668 * (1) Start above the hash table that is at the base of
879 dtrace_vcanload(void *src, dtrace_diftype_t *type, dtrace_mstate_t *mstate,
893 sz = dtrace_strlen(src,
898 return (dtrace_canload((uintptr_t)src, sz, mstate, vstate));
1034 * Copy src to dst using safe memory accesses. The src is assumed to be unsafe
1040 dtrace_bcopy(const void *src, void *dst, size_t len)
1044 const uint8_t *s2 = src;
1062 * Copy src to dst using safe memory accesses, up to either the specified
1063 * length, or the point that a nul byte is encountered. The src is assumed to
1069 dtrace_strcpy(const void *src, void *dst, size_t len)
1073 const uint8_t *s2 = src;
1082 * Copy src to dst, deriving the size and type from the specified (BYREF)
1083 * variable type. The src is assumed to be unsafe memory specified by the DIF
1088 dtrace_vcopy(void *src, void *dst, dtrace_diftype_t *type)
1093 dtrace_strcpy(src, dst, type->dtdt_size);
1095 dtrace_bcopy(src, dst, type->dtdt_size);
1578 * on a hash chain, either the dirty list or the
1603 * We are now guaranteed that no hash chain contains a pointer
1637 dtrace_dynhash_t *hash = dstate->dtds_hash;
1655 * better than pathological hash distribution. The efficacy of the
1706 * comes out to be one of our two sentinel hash values. If this
1716 * critical that hash collisions be kept to an absolute minimum;
1724 volatile uintptr_t *lockp = &hash[bucket].dtdh_lock;
1740 lock = hash[bucket].dtdh_lock;
1744 start = hash[bucket].dtdh_chain;
1757 * end of the hash chain; we can kick out of
1769 * the line, one of the members of this hash
1777 * possible by detecting the hash marker. In
1815 ASSERT(hash[bucket].dtdh_chain != dvar);
1820 if (dtrace_casptr(&hash[bucket].dtdh_chain,
1824 * hash table head pointer, presumably because
1826 * We need to reread the hash chain and try
1836 * Now set the hash value to indicate that it's free.
1838 ASSERT(hash[bucket].dtdh_chain != dvar);
1853 * Finally, unlock this hash bucket.
1855 ASSERT(hash[bucket].dtdh_lock == lock);
1857 hash[bucket].dtdh_lock++;
1868 * one of the elements that we traversed in the hash chain
1871 * the hash bucket to prevent themselves from racing with
1872 * one another), and retry the hash chain traversal.
1886 if (hash[bucket].dtdh_lock != lock)
1890 ASSERT(hash[bucket].dtdh_lock == lock);
1892 hash[bucket].dtdh_lock++;
2066 if (dtrace_casptr(&hash[bucket].dtdh_chain, start, dvar) == start)
2071 * this hash chain, or another CPU is deleting an element from this
2072 * hash chain. The simplest way to deal with both of these cases
2359 * perchance, a prime) hash size for better hash distribution.
2377 * Calculate the hash value based on the key. Note that we _don't_
2408 * over to compute hash values, compare data, etc.
2463 * link it into the hash table appropriately, and apply the aggregator
2595 dtrace_buffer_t *src, *dest;
2610 src = &spec->dtsp_buffer[cpu];
2632 ASSERT(src->dtb_offset == 0);
2647 if (src->dtb_offset != 0) {
2668 if ((offs = dtrace_buffer_reserve(dest, src->dtb_offset,
2682 saddr = (uintptr_t)src->dtb_tomax;
2683 slimit = saddr + src->dtb_offset;
2711 dlimit = daddr + src->dtb_offset;
2712 saddr = (uintptr_t)src->dtb_tomax;
2733 dest->dtb_offset = offs + src->dtb_offset;
2748 src->dtb_offset = 0;
2749 src->dtb_xamot_drops += src->dtb_drops;
2750 src->dtb_drops = 0;
2835 dtrace_buffer_t *src = &spec->dtsp_buffer[cpu];
2837 if (src->dtb_tomax == NULL)
2841 src->dtb_offset = 0;
2848 if (src->dtb_offset == 0)
4010 uintptr_t src = tupregs[0].dttk_value;
4020 if (!dtrace_canload(src, size, mstate, vstate)) {
4025 dtrace_bcopy((void *)src, (void *)dest, size);
5059 uintptr_t src = tupregs[0].dttk_value;
5060 int i, j, len = dtrace_strlen((char *)src, size);
5064 if (!dtrace_canload(src, len + 1, mstate, vstate)) {
5081 src = (uintptr_t)".";
5090 if (dtrace_load8(src + i) != '/')
5104 if (dtrace_load8(src + i) == '/')
5116 if (dtrace_load8(src + i) != '/')
5147 src = (uintptr_t)".";
5178 dest[j] = dtrace_load8(src + i);
5212 uintptr_t src = tupregs[0].dttk_value;
5216 if (!dtrace_strcanload(src, size, mstate, vstate)) {
5231 c = dtrace_load8(src + i++);
5241 c = dtrace_load8(src + i++);
5262 c = dtrace_load8(src + i++);
5285 c = dtrace_load8(src + i++);
7322 dtrace_hash_t *hash = kmem_zalloc(sizeof (dtrace_hash_t), KM_SLEEP);
7324 hash->dth_stroffs = stroffs;
7325 hash->dth_nextoffs = nextoffs;
7326 hash->dth_prevoffs = prevoffs;
7328 hash->dth_size = 1;
7329 hash->dth_mask = hash->dth_size - 1;
7331 hash->dth_tab = kmem_zalloc(hash->dth_size *
7334 return (hash);
7338 dtrace_hash_destroy(dtrace_hash_t *hash)
7343 for (i = 0; i < hash->dth_size; i++)
7344 ASSERT(hash->dth_tab[i] == NULL);
7347 kmem_free(hash->dth_tab,
7348 hash->dth_size * sizeof (dtrace_hashbucket_t *));
7349 kmem_free(hash, sizeof (dtrace_hash_t));
7353 dtrace_hash_resize(dtrace_hash_t *hash)
7355 int size = hash->dth_size, i, ndx;
7356 int new_size = hash->dth_size << 1;
7365 for (bucket = hash->dth_tab[i]; bucket != NULL; bucket = next) {
7369 ndx = DTRACE_HASHSTR(hash, probe) & new_mask;
7377 kmem_free(hash->dth_tab, hash->dth_size * sizeof (void *));
7378 hash->dth_tab = new_tab;
7379 hash->dth_size = new_size;
7380 hash->dth_mask = new_mask;
7384 dtrace_hash_add(dtrace_hash_t *hash, dtrace_probe_t *new)
7386 int hashval = DTRACE_HASHSTR(hash, new);
7387 int ndx = hashval & hash->dth_mask;
7388 dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
7392 if (DTRACE_HASHEQ(hash, bucket->dthb_chain, new))
7396 if ((hash->dth_nbuckets >> 1) > hash->dth_size) {
7397 dtrace_hash_resize(hash);
7398 dtrace_hash_add(hash, new);
7403 bucket->dthb_next = hash->dth_tab[ndx];
7404 hash->dth_tab[ndx] = bucket;
7405 hash->dth_nbuckets++;
7408 nextp = DTRACE_HASHNEXT(hash, new);
7409 ASSERT(*nextp == NULL && *(DTRACE_HASHPREV(hash, new)) == NULL);
7413 prevp = DTRACE_HASHPREV(hash, bucket->dthb_chain);
7423 dtrace_hash_lookup(dtrace_hash_t *hash, dtrace_probe_t *template)
7425 int hashval = DTRACE_HASHSTR(hash, template);
7426 int ndx = hashval & hash->dth_mask;
7427 dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
7430 if (DTRACE_HASHEQ(hash, bucket->dthb_chain, template))
7438 dtrace_hash_collisions(dtrace_hash_t *hash, dtrace_probe_t *template)
7440 int hashval = DTRACE_HASHSTR(hash, template);
7441 int ndx = hashval & hash->dth_mask;
7442 dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
7445 if (DTRACE_HASHEQ(hash, bucket->dthb_chain, template))
7453 dtrace_hash_remove(dtrace_hash_t *hash, dtrace_probe_t *probe)
7455 int ndx = DTRACE_HASHSTR(hash, probe) & hash->dth_mask;
7456 dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
7458 dtrace_probe_t **prevp = DTRACE_HASHPREV(hash, probe);
7459 dtrace_probe_t **nextp = DTRACE_HASHNEXT(hash, probe);
7465 if (DTRACE_HASHEQ(hash, bucket->dthb_chain, probe))
7477 dtrace_hashbucket_t *b = hash->dth_tab[ndx];
7483 hash->dth_tab[ndx] = bucket->dthb_next;
7490 ASSERT(hash->dth_nbuckets > 0);
7491 hash->dth_nbuckets--;
7498 *(DTRACE_HASHNEXT(hash, *prevp)) = *nextp;
7502 *(DTRACE_HASHPREV(hash, *nextp)) = *prevp;
7613 panic("dtrace: undersized error hash");
7844 dtrace_hash_t *hash = NULL;
7871 * empty string, we perform a lookup in the corresponding hash and
7872 * use the hash table with the fewest collisions to do our search.
7877 hash = dtrace_bymod;
7883 hash = dtrace_byfunc;
7889 hash = dtrace_byname;
7893 * If we did not select a hash table, iterate over every probe and
7896 if (hash == NULL) {
7917 * If we selected a hash table, iterate over each probe of the same key
7921 for (probe = dtrace_hash_lookup(hash, &template); probe != NULL;
7922 probe = *(DTRACE_HASHNEXT(hash, probe))) {
8235 * remove all of them from their hash chains and from the probe array.
8260 * The provider's probes have been removed from the hash chains and
13326 * Set all of our hash buckets to point to the single sink, and (if
13327 * it hasn't already been set), set the sink's hash value to be the
13329 * lookups to know that they have iterated over an entire, valid hash
15580 * We've removed all of the module's probes from the hash chains and