src/runtime/stack_table.c
// To lookup an entry, we find the bucket, then follow the `next` pointers until we find an entry with a matching return address.
// Returns NULL if there's no entry for the provided return address.
To lookup an entry, we find the bucket, then follow the `next` pointers until we find an entry with a matching return address.
Returns NULL if there's no entry for the provided return address.
To lookup an entry we find the bucket then follow the ` next ` pointers until we find an entry with a matching return address . Returns NULL if there ' s no entry for the provided return address .
static StackEntry* stack_table_lookup(uint64_t ret_address) {
    uint64_t hash = ret_address % NUM_BUCKETS;
    StackBucket bucket = stack_table.buckets[hash];
    uint32_t idx = bucket.first;
    for (uint32_t i = 0; i < bucket.num_functions; i++) {
        if (stack_table.entries[idx].ret_address == ret_address) {
            return &stack_table.entries[idx];
        } else {
            idx = stack_table.entries[idx].next;
        }
    }
    return NULL;
}
static StackEntry * stack_table_lookup ( uint64_t ret_address ) { uint64_t hash = ret_address % NUM_BUCKETS ; StackBucket bucket = stack_table . buckets [ hash ] ; uint32_t idx = bucket . first ; for ( uint32_t i = 0 ; i < bucket . num_functions ; i ++ ) { if ( stack_table . entries [ idx ] . ret_address == ret_address ) { return & stack_table . entries [ idx ] ; } else { idx = stack_table . entries [ idx ] . next ; } } return NULL ; }
To lookup an entry, we find the bucket, then follow the `next` pointers until we find an entry with a matching return address.
To lookup an entry we find the bucket then follow the ` next ` pointers until we find an entry with a matching return address .