hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
CodegenObjectCache Class Reference

#include <codegenObjectCache.hpp>

Public Member Functions

CodegenObjectCachesetCompilerCtx (const std::shared_ptr< compilerContext > &compilerCtx)
 set the build config
 
void purge_and_update (const yoi::vec< yoi::wstr > &source_files)
 purge the cache, add the entries that previously not in the cache, remove the entries that are not in the source_files
 
yoi::indexT register_entry (const yoi::wstr &abs_path_on_disk)
 register a new entry to the cache
 
void update_last_modification (const yoi::wstr &abs_path_on_disk, yoi::indexT last_modification)
 update the last modification time of an entry
 
yoi::indexT get_entry_index (const yoi::wstr &abs_path_on_disk)
 get the entry from the cache
 
CodegenObjectCacheEntry get_entry (const yoi::wstr &abs_path_on_disk)
 get the entry from the cache
 
void remove_entry (const yoi::wstr &abs_path_on_disk)
 remove the entry from the cache
 

Public Attributes

std::shared_ptr< compilerContextcompilerCtx
 
std::map< yoi::wstr, CodegenObjectCacheEntrycache
 
std::set< yoi::indexTfree_list
 
yoi::indexT next_hash = 0
 
std::mutex cacheMutex
 

Private Member Functions

yoi::indexT register_entry_unlocked (const yoi::wstr &abs_path_on_disk)
 

Detailed Description

Definition at line 61 of file codegenObjectCache.hpp.

Member Function Documentation

◆ get_entry()

CodegenObjectCacheEntry get_entry ( const yoi::wstr abs_path_on_disk)

get the entry from the cache

Parameters
abs_path_on_diskthe absolute path of the source file on the disk
Returns
the entry

Definition at line 187 of file codegenObjectCache.cpp.

References CodegenObjectCache::cache, CodegenObjectCache::cacheMutex, and CodegenObjectCache::register_entry_unlocked().

Referenced by LLVMCodegen::generate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_entry_index()

yoi::indexT get_entry_index ( const yoi::wstr abs_path_on_disk)

get the entry from the cache

Parameters
abs_path_on_diskthe absolute path of the source file on the disk
Returns
the index of the entry

Definition at line 179 of file codegenObjectCache.cpp.

References CodegenObjectCache::cache, and CodegenObjectCache::cacheMutex.

◆ purge_and_update()

void purge_and_update ( const yoi::vec< yoi::wstr > &  source_files)

purge the cache, add the entries that previously not in the cache, remove the entries that are not in the source_files

Parameters
source_filesthe source files to check

Definition at line 124 of file codegenObjectCache.cpp.

References CodegenObjectCache::cache, CodegenObjectCache::cacheMutex, CodegenObjectCache::free_list, and CodegenObjectCache::register_entry_unlocked().

Referenced by LLVMCodegen::LLVMCodegen().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_entry()

yoi::indexT register_entry ( const yoi::wstr abs_path_on_disk)

register a new entry to the cache

Parameters
abs_path_on_diskthe absolute path of the source file on the disk
Returns
the index of the new entry
Note
the object filename will be generated based on the hash of the source file

Definition at line 174 of file codegenObjectCache.cpp.

References CodegenObjectCache::cacheMutex, and CodegenObjectCache::register_entry_unlocked().

Here is the call graph for this function:

◆ register_entry_unlocked()

◆ remove_entry()

void remove_entry ( const yoi::wstr abs_path_on_disk)

remove the entry from the cache

Parameters
abs_path_on_diskthe absolute path of the source file on the disk

Definition at line 195 of file codegenObjectCache.cpp.

References CodegenObjectCache::cache, CodegenObjectCache::cacheMutex, and CodegenObjectCache::free_list.

◆ setCompilerCtx()

CodegenObjectCache & setCompilerCtx ( const std::shared_ptr< compilerContext > &  compilerCtx)

set the build config

Parameters
build_configthe build config
Returns
the CodegenObjectCache

Definition at line 217 of file codegenObjectCache.cpp.

References CodegenObjectCache::compilerCtx.

Referenced by LLVMCodegen::LLVMCodegen().

Here is the caller graph for this function:

◆ update_last_modification()

void update_last_modification ( const yoi::wstr abs_path_on_disk,
yoi::indexT  last_modification 
)

update the last modification time of an entry

Parameters
abs_path_on_diskthe absolute path of the source file on the disk
last_modificationthe last modification time

Definition at line 201 of file codegenObjectCache.cpp.

References CodegenObjectCache::cache, and CodegenObjectCache::cacheMutex.

Referenced by LLVMCodegen::generate().

Here is the caller graph for this function:

Member Data Documentation

◆ cache

◆ cacheMutex

◆ compilerCtx

std::shared_ptr<compilerContext> compilerCtx

◆ free_list

◆ next_hash

yoi::indexT next_hash = 0

Definition at line 66 of file codegenObjectCache.hpp.

Referenced by CodegenObjectCache::register_entry_unlocked().


The documentation for this class was generated from the following files: