infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
cache.c File Reference

Implements trampoline deduplication and caching. More...

#include "common/infix_internals.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for cache.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _cache_entry_t
 

Macros

#define CACHE_BUCKETS   1021
 

Typedefs

typedef struct _cache_entry_t _cache_entry_t
 

Functions

static uint64_t _cache_hash (const char *sig, void *target_fn, bool is_safe)
 
infix_forward_t_infix_cache_lookup (const char *signature, void *target_fn, bool is_safe)
 
void _infix_cache_insert (infix_forward_t *trampoline)
 
void _infix_cache_clear (void)
 
static bool _cache_remove_no_lock (infix_forward_t *trampoline)
 
bool _infix_cache_remove (infix_forward_t *trampoline)
 
void _infix_cache_release (infix_forward_t *trampoline)
 

Variables

static _cache_entry_tg_trampoline_cache [CACHE_BUCKETS]
 
static infix_mutex_t g_cache_mutex = INFIX_MUTEX_INITIALIZER
 

Detailed Description

Implements trampoline deduplication and caching.

Copyright (c) 2025 Sanko Robinson

This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.

SPDX-License-Identifier: (Artistic-2.0 OR MIT)

The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

SPDX-License-Identifier: CC-BY-4.0

Macro Definition Documentation

◆ CACHE_BUCKETS

#define CACHE_BUCKETS   1021

Typedef Documentation

◆ _cache_entry_t

Function Documentation

◆ _cache_hash()

static uint64_t _cache_hash ( const char *  sig,
void *  target_fn,
bool  is_safe 
)
static

◆ _cache_remove_no_lock()

static bool _cache_remove_no_lock ( infix_forward_t trampoline)
static

◆ _infix_cache_clear()

void _infix_cache_clear ( void  )

◆ _infix_cache_insert()

void _infix_cache_insert ( infix_forward_t trampoline)

◆ _infix_cache_lookup()

infix_forward_t * _infix_cache_lookup ( const char *  signature,
void *  target_fn,
bool  is_safe 
)

◆ _infix_cache_release()

void _infix_cache_release ( infix_forward_t trampoline)

◆ _infix_cache_remove()

bool _infix_cache_remove ( infix_forward_t trampoline)

Variable Documentation

◆ g_cache_mutex

infix_mutex_t g_cache_mutex = INFIX_MUTEX_INITIALIZER
static

◆ g_trampoline_cache

_cache_entry_t* g_trampoline_cache[CACHE_BUCKETS]
static