module.h

Include dependency graph for module.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="stdbool.h" tooltip="stdbool.h"]
    "15" [label="stdatomic.h" tooltip="stdatomic.h"]
    "4" [label="atom.h" tooltip="atom.h"]
    "16" [label="synclist.h" tooltip="synclist.h"]
    "3" [label="stdint.h" tooltip="stdint.h"]
    "5" [label="stdlib.h" tooltip="stdlib.h"]
    "28" [label="valueshashtable.h" tooltip="valueshashtable.h"]
    "27" [label="exportedfunction.h" tooltip="exportedfunction.h"]
    "7" [label="context.h" tooltip="context.h"]
    "21" [label="utils.h" tooltip="utils.h"]
    "10" [label="term_typedef.h" tooltip="term_typedef.h"]
    "22" [label="stddef.h" tooltip="stddef.h"]
    "11" [label="limits.h" tooltip="limits.h"]
    "23" [label="refc_binary.h" tooltip="refc_binary.h"]
    "19" [label="string.h" tooltip="string.h"]
    "26" [label="mailbox.h" tooltip="mailbox.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" fillcolor="#BFBFBF"]
    "18" [label="term.h" tooltip="term.h"]
    "9" [label="erl_nif.h" tooltip="erl_nif.h"]
    "24" [label="resources.h" tooltip="resources.h"]
    "14" [label="smp.h" tooltip="smp.h"]
    "6" [label="atomshashtable.h" tooltip="atomshashtable.h"]
    "8" [label="globalcontext.h" tooltip="globalcontext.h"]
    "20" [label="memory.h" tooltip="memory.h"]
    "17" [label="stdio.h" tooltip="stdio.h"]
    "25" [label="timer_list.h" tooltip="timer_list.h"]
    "13" [label="list.h" tooltip="list.h"]
    "12" [label="inttypes.h" tooltip="inttypes.h"]
    "4" -> "3" [dir=forward tooltip="include"]
    "4" -> "5" [dir=forward tooltip="include"]
    "16" -> "13" [dir=forward tooltip="include"]
    "16" -> "17" [dir=forward tooltip="include"]
    "16" -> "14" [dir=forward tooltip="include"]
    "27" -> "18" [dir=forward tooltip="include"]
    "7" -> "8" [dir=forward tooltip="include"]
    "7" -> "13" [dir=forward tooltip="include"]
    "7" -> "26" [dir=forward tooltip="include"]
    "7" -> "14" [dir=forward tooltip="include"]
    "7" -> "18" [dir=forward tooltip="include"]
    "7" -> "25" [dir=forward tooltip="include"]
    "21" -> "22" [dir=forward tooltip="include"]
    "10" -> "11" [dir=forward tooltip="include"]
    "10" -> "12" [dir=forward tooltip="include"]
    "10" -> "3" [dir=forward tooltip="include"]
    "23" -> "2" [dir=forward tooltip="include"]
    "23" -> "5" [dir=forward tooltip="include"]
    "23" -> "13" [dir=forward tooltip="include"]
    "23" -> "24" [dir=forward tooltip="include"]
    "23" -> "14" [dir=forward tooltip="include"]
    "26" -> "2" [dir=forward tooltip="include"]
    "26" -> "13" [dir=forward tooltip="include"]
    "26" -> "14" [dir=forward tooltip="include"]
    "26" -> "10" [dir=forward tooltip="include"]
    "26" -> "21" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "6" [dir=forward tooltip="include"]
    "1" -> "7" [dir=forward tooltip="include"]
    "1" -> "27" [dir=forward tooltip="include"]
    "1" -> "8" [dir=forward tooltip="include"]
    "1" -> "18" [dir=forward tooltip="include"]
    "1" -> "28" [dir=forward tooltip="include"]
    "18" -> "2" [dir=forward tooltip="include"]
    "18" -> "3" [dir=forward tooltip="include"]
    "18" -> "17" [dir=forward tooltip="include"]
    "18" -> "5" [dir=forward tooltip="include"]
    "18" -> "19" [dir=forward tooltip="include"]
    "18" -> "20" [dir=forward tooltip="include"]
    "18" -> "23" [dir=forward tooltip="include"]
    "18" -> "21" [dir=forward tooltip="include"]
    "18" -> "10" [dir=forward tooltip="include"]
    "9" -> "10" [dir=forward tooltip="include"]
    "24" -> "5" [dir=forward tooltip="include"]
    "24" -> "9" [dir=forward tooltip="include"]
    "24" -> "13" [dir=forward tooltip="include"]
    "24" -> "20" [dir=forward tooltip="include"]
    "14" -> "2" [dir=forward tooltip="include"]
    "14" -> "15" [dir=forward tooltip="include"]
    "6" -> "4" [dir=forward tooltip="include"]
    "8" -> "3" [dir=forward tooltip="include"]
    "8" -> "4" [dir=forward tooltip="include"]
    "8" -> "9" [dir=forward tooltip="include"]
    "8" -> "13" [dir=forward tooltip="include"]
    "8" -> "14" [dir=forward tooltip="include"]
    "8" -> "16" [dir=forward tooltip="include"]
    "8" -> "18" [dir=forward tooltip="include"]
    "8" -> "25" [dir=forward tooltip="include"]
    "20" -> "9" [dir=forward tooltip="include"]
    "20" -> "10" [dir=forward tooltip="include"]
    "20" -> "21" [dir=forward tooltip="include"]
    "20" -> "3" [dir=forward tooltip="include"]
    "20" -> "5" [dir=forward tooltip="include"]
    "25" -> "2" [dir=forward tooltip="include"]
    "25" -> "3" [dir=forward tooltip="include"]
    "25" -> "13" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include module.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" fillcolor="#BFBFBF"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/opcodesswitch.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/opcodesswitch.h"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "2" -> "3" [dir=back tooltip="include"]
    "2" -> "4" [dir=back tooltip="include"]
    "2" -> "5" [dir=back tooltip="include"]
    "2" -> "6" [dir=back tooltip="include"]
    "8" -> "5" [dir=back tooltip="include"]
    "9" -> "6" [dir=back tooltip="include"]
    "9" -> "10" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "4" [dir=back tooltip="include"]
    "1" -> "5" [dir=back tooltip="include"]
    "1" -> "6" [dir=back tooltip="include"]
    "1" -> "8" [dir=back tooltip="include"]
    "1" -> "9" [dir=back tooltip="include"]
    "1" -> "11" [dir=back tooltip="include"]
    "11" -> "7" [dir=back tooltip="include"]
    "11" -> "12" [dir=back tooltip="include"]
    "11" -> "4" [dir=back tooltip="include"]
    "11" -> "5" [dir=back tooltip="include"]
    "11" -> "13" [dir=back tooltip="include"]
    "11" -> "14" [dir=back tooltip="include"]
    "11" -> "15" [dir=back tooltip="include"]
    "6" -> "7" [dir=back tooltip="include"]
    "6" -> "4" [dir=back tooltip="include"]
}

Defines

SMP_MODULE_LOCK(mod)
SMP_MODULE_UNLOCK(mod)

Enums

enum ModuleLoadResult

Values:

enumerator MODULE_LOAD_OK
enumerator MODULE_ERROR_FAILED_ALLOCATION

Functions

size_t module_get_exported_functions_count(Module *this_module)
uint32_t module_search_exported_function(Module *this_module, AtomString func_name, int func_arity, GlobalContext *glb)
static inline size_t module_get_exported_functions_list_size(Module *this_module)
term module_get_exported_functions(Module *this_module, Heap *heap, GlobalContext *global)
void module_destroy(Module *module)
Module *module_new_from_iff_binary(GlobalContext *global, const void *iff_binary, unsigned long size)
term module_load_literal(Module *mod, int index, Context *ctx)
static inline AtomString module_get_atom_string_by_id(const Module *mod, int local_atom_id, GlobalContext *glb)
static inline term module_get_atom_term_by_id(const Module *mod, int local_atom_id)
const struct ExportedFunction *module_resolve_function0(Module *mod, int import_table_index, struct UnresolvedFunctionCall *unresolved, GlobalContext *glb)
static inline term module_get_name(const Module *mod)
static inline const struct ExportedFunction *module_resolve_function(Module *mod, int import_table_index, GlobalContext *glb)
static inline term module_address(unsigned int module_index, unsigned int instruction_index)
static inline uint32_t module_get_fun_freeze(const Module *this_module, int fun_index)
static inline void module_get_fun(const Module *this_module, int fun_index, uint32_t *label, uint32_t *arity, uint32_t *n_freeze)
static inline const uint8_t *module_get_str(Module *mod, size_t offset, size_t *remaining)
bool module_get_function_from_label(Module *this_module, int label, AtomString *function_name, int *arity, GlobalContext *glb)
void module_insert_line_ref_offset(Module *mod, int line_ref, int offset)
int module_find_line(Module *mod, unsigned int offset)
static inline bool module_has_line_chunk(Module *mod)
__attribute__

Public Members

char magic[4]
uint32_t size
uint32_t info_size
uint32_t version
uint32_t opcode_max
uint32_t labels
uint32_t functions_count
uint8_t code[1]
struct LiteralEntry

Public Members

uint32_t size
void const *data
struct ModuleFilename

Public Members

uint8_t *data
size_t len
struct LineRefOffset

Collaboration diagram for LineRefOffset:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="LineRefOffset" tooltip="LineRefOffset" fillcolor="#BFBFBF"]
    "2" [label="ListHead" tooltip="ListHead"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "2" -> "2" [dir=forward tooltip="usage"]
}

Public Members

struct ListHead head
unsigned int offset
uint16_t line_ref
struct Module

Collaboration diagram for Module:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="Module" tooltip="Module" fillcolor="#BFBFBF"]
    "5" [label="ListHead" tooltip="ListHead"]
    "3" [label="ModuleFilename" tooltip="ModuleFilename"]
    "4" [label="LiteralEntry" tooltip="LiteralEntry"]
    "2" [label="ExportedFunction" tooltip="ExportedFunction"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "1" -> "3" [dir=forward tooltip="usage"]
    "1" -> "4" [dir=forward tooltip="usage"]
    "1" -> "5" [dir=forward tooltip="usage"]
    "5" -> "5" [dir=forward tooltip="usage"]
}

Public Members

CodeChunk *code
void *export_table
void *local_table
void *atom_table
void *fun_table
void *str_table
size_t str_table_len
uint16_t *line_refs
struct ModuleFilename *filenames
struct ListHead line_ref_offsets
const struct ExportedFunction **imported_funcs
const uint8_t **labels
void *literals_data
struct LiteralEntry *literals_table
int *local_atoms_to_global_table
void *module_platform_data
int module_index
int end_instruction_ii
unsigned int free_literals_data
Mutex *mutex