module.c

Include dependency graph for module.c:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "3" [label="stdbool.h" tooltip="stdbool.h"]
    "30" [label="bif.h" tooltip="bif.h"]
    "16" [label="stdatomic.h" tooltip="stdatomic.h"]
    "32" [label="iff.h" tooltip="iff.h"]
    "38" [label="bitstring.h" tooltip="bitstring.h"]
    "5" [label="atom.h" tooltip="atom.h"]
    "44" [label="trace.h" tooltip="trace.h"]
    "37" [label="assert.h" tooltip="assert.h"]
    "17" [label="synclist.h" tooltip="synclist.h"]
    "40" [label="defaultatoms.h" tooltip="defaultatoms.h"]
    "4" [label="stdint.h" tooltip="stdint.h"]
    "6" [label="stdlib.h" tooltip="stdlib.h"]
    "29" [label="valueshashtable.h" tooltip="valueshashtable.h"]
    "42" [label="scheduler.h" tooltip="scheduler.h"]
    "28" [label="exportedfunction.h" tooltip="exportedfunction.h"]
    "8" [label="context.h" tooltip="context.h"]
    "22" [label="utils.h" tooltip="utils.h"]
    "11" [label="term_typedef.h" tooltip="term_typedef.h"]
    "23" [label="stddef.h" tooltip="stddef.h"]
    "12" [label="limits.h" tooltip="limits.h"]
    "43" [label="stacktrace.h" tooltip="stacktrace.h"]
    "24" [label="refc_binary.h" tooltip="refc_binary.h"]
    "20" [label="string.h" tooltip="string.h"]
    "27" [label="mailbox.h" tooltip="mailbox.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" fillcolor="#BFBFBF"]
    "2" [label="module.h" tooltip="module.h"]
    "19" [label="term.h" tooltip="term.h"]
    "10" [label="erl_nif.h" tooltip="erl_nif.h"]
    "41" [label="opcodes.h" tooltip="opcodes.h"]
    "35" [label="time.h" tooltip="time.h"]
    "25" [label="resources.h" tooltip="resources.h"]
    "15" [label="smp.h" tooltip="smp.h"]
    "34" [label="sys.h" tooltip="sys.h"]
    "7" [label="atomshashtable.h" tooltip="atomshashtable.h"]
    "33" [label="nifs.h" tooltip="nifs.h"]
    "36" [label="opcodesswitch.h" tooltip="opcodesswitch.h"]
    "39" [label="debug.h" tooltip="debug.h"]
    "9" [label="globalcontext.h" tooltip="globalcontext.h"]
    "21" [label="memory.h" tooltip="memory.h"]
    "18" [label="stdio.h" tooltip="stdio.h"]
    "26" [label="timer_list.h" tooltip="timer_list.h"]
    "14" [label="list.h" tooltip="list.h"]
    "13" [label="inttypes.h" tooltip="inttypes.h"]
    "31" [label="externalterm.h" tooltip="externalterm.h"]
    "30" -> "3" [dir=forward tooltip="include"]
    "30" -> "5" [dir=forward tooltip="include"]
    "30" -> "8" [dir=forward tooltip="include"]
    "30" -> "28" [dir=forward tooltip="include"]
    "30" -> "2" [dir=forward tooltip="include"]
    "32" -> "4" [dir=forward tooltip="include"]
    "38" -> "19" [dir=forward tooltip="include"]
    "38" -> "3" [dir=forward tooltip="include"]
    "38" -> "4" [dir=forward tooltip="include"]
    "5" -> "4" [dir=forward tooltip="include"]
    "5" -> "6" [dir=forward tooltip="include"]
    "17" -> "14" [dir=forward tooltip="include"]
    "17" -> "18" [dir=forward tooltip="include"]
    "17" -> "15" [dir=forward tooltip="include"]
    "40" -> "9" [dir=forward tooltip="include"]
    "42" -> "8" [dir=forward tooltip="include"]
    "42" -> "9" [dir=forward tooltip="include"]
    "28" -> "19" [dir=forward tooltip="include"]
    "8" -> "9" [dir=forward tooltip="include"]
    "8" -> "14" [dir=forward tooltip="include"]
    "8" -> "27" [dir=forward tooltip="include"]
    "8" -> "15" [dir=forward tooltip="include"]
    "8" -> "19" [dir=forward tooltip="include"]
    "8" -> "26" [dir=forward tooltip="include"]
    "22" -> "23" [dir=forward tooltip="include"]
    "11" -> "12" [dir=forward tooltip="include"]
    "11" -> "13" [dir=forward tooltip="include"]
    "11" -> "4" [dir=forward tooltip="include"]
    "43" -> "8" [dir=forward tooltip="include"]
    "43" -> "2" [dir=forward tooltip="include"]
    "43" -> "19" [dir=forward tooltip="include"]
    "24" -> "3" [dir=forward tooltip="include"]
    "24" -> "6" [dir=forward tooltip="include"]
    "24" -> "14" [dir=forward tooltip="include"]
    "24" -> "25" [dir=forward tooltip="include"]
    "24" -> "15" [dir=forward tooltip="include"]
    "27" -> "3" [dir=forward tooltip="include"]
    "27" -> "14" [dir=forward tooltip="include"]
    "27" -> "15" [dir=forward tooltip="include"]
    "27" -> "11" [dir=forward tooltip="include"]
    "27" -> "22" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "5" [dir=forward tooltip="include"]
    "1" -> "30" [dir=forward tooltip="include"]
    "1" -> "8" [dir=forward tooltip="include"]
    "1" -> "31" [dir=forward tooltip="include"]
    "1" -> "9" [dir=forward tooltip="include"]
    "1" -> "32" [dir=forward tooltip="include"]
    "1" -> "14" [dir=forward tooltip="include"]
    "1" -> "33" [dir=forward tooltip="include"]
    "1" -> "19" [dir=forward tooltip="include"]
    "1" -> "22" [dir=forward tooltip="include"]
    "1" -> "34" [dir=forward tooltip="include"]
    "1" -> "15" [dir=forward tooltip="include"]
    "1" -> "18" [dir=forward tooltip="include"]
    "1" -> "6" [dir=forward tooltip="include"]
    "1" -> "36" [dir=forward tooltip="include"]
    "2" -> "3" [dir=forward tooltip="include"]
    "2" -> "4" [dir=forward tooltip="include"]
    "2" -> "5" [dir=forward tooltip="include"]
    "2" -> "7" [dir=forward tooltip="include"]
    "2" -> "8" [dir=forward tooltip="include"]
    "2" -> "28" [dir=forward tooltip="include"]
    "2" -> "9" [dir=forward tooltip="include"]
    "2" -> "19" [dir=forward tooltip="include"]
    "2" -> "29" [dir=forward tooltip="include"]
    "19" -> "3" [dir=forward tooltip="include"]
    "19" -> "4" [dir=forward tooltip="include"]
    "19" -> "18" [dir=forward tooltip="include"]
    "19" -> "6" [dir=forward tooltip="include"]
    "19" -> "20" [dir=forward tooltip="include"]
    "19" -> "21" [dir=forward tooltip="include"]
    "19" -> "24" [dir=forward tooltip="include"]
    "19" -> "22" [dir=forward tooltip="include"]
    "19" -> "11" [dir=forward tooltip="include"]
    "10" -> "11" [dir=forward tooltip="include"]
    "25" -> "6" [dir=forward tooltip="include"]
    "25" -> "10" [dir=forward tooltip="include"]
    "25" -> "14" [dir=forward tooltip="include"]
    "15" -> "3" [dir=forward tooltip="include"]
    "15" -> "16" [dir=forward tooltip="include"]
    "34" -> "9" [dir=forward tooltip="include"]
    "34" -> "2" [dir=forward tooltip="include"]
    "34" -> "4" [dir=forward tooltip="include"]
    "34" -> "35" [dir=forward tooltip="include"]
    "7" -> "5" [dir=forward tooltip="include"]
    "33" -> "5" [dir=forward tooltip="include"]
    "33" -> "8" [dir=forward tooltip="include"]
    "33" -> "28" [dir=forward tooltip="include"]
    "36" -> "2" [dir=forward tooltip="include"]
    "36" -> "37" [dir=forward tooltip="include"]
    "36" -> "20" [dir=forward tooltip="include"]
    "36" -> "30" [dir=forward tooltip="include"]
    "36" -> "38" [dir=forward tooltip="include"]
    "36" -> "39" [dir=forward tooltip="include"]
    "36" -> "40" [dir=forward tooltip="include"]
    "36" -> "28" [dir=forward tooltip="include"]
    "36" -> "33" [dir=forward tooltip="include"]
    "36" -> "41" [dir=forward tooltip="include"]
    "36" -> "42" [dir=forward tooltip="include"]
    "36" -> "22" [dir=forward tooltip="include"]
    "36" -> "27" [dir=forward tooltip="include"]
    "36" -> "43" [dir=forward tooltip="include"]
    "36" -> "44" [dir=forward tooltip="include"]
    "39" -> "8" [dir=forward tooltip="include"]
    "9" -> "4" [dir=forward tooltip="include"]
    "9" -> "5" [dir=forward tooltip="include"]
    "9" -> "10" [dir=forward tooltip="include"]
    "9" -> "14" [dir=forward tooltip="include"]
    "9" -> "15" [dir=forward tooltip="include"]
    "9" -> "17" [dir=forward tooltip="include"]
    "9" -> "19" [dir=forward tooltip="include"]
    "9" -> "26" [dir=forward tooltip="include"]
    "21" -> "10" [dir=forward tooltip="include"]
    "21" -> "11" [dir=forward tooltip="include"]
    "21" -> "22" [dir=forward tooltip="include"]
    "21" -> "4" [dir=forward tooltip="include"]
    "21" -> "6" [dir=forward tooltip="include"]
    "26" -> "3" [dir=forward tooltip="include"]
    "26" -> "4" [dir=forward tooltip="include"]
    "26" -> "14" [dir=forward tooltip="include"]
    "31" -> "19" [dir=forward tooltip="include"]
}

Defines

LITT_UNCOMPRESSED_SIZE_OFFSET
LITT_HEADER_SIZE
TAG_COMPACT_INT
TAG_COMPACT_ATOM
TAG_EXTENDED_INT
TAG_EXTENDED_ATOM
CHECK_FREE_SPACE(space, error)
IMPL_CODE_LOADER

Functions

static struct LiteralEntry *module_build_literals_table(const void *literalsBuf)
static void module_add_label(Module *mod, int index, void *ptr)
static enum ModuleLoadResult module_build_imported_functions_table(Module *this_module, uint8_t *table_data, GlobalContext *glb)
static void parse_line_table(uint16_t **line_refs, struct ModuleFilename **filenames, uint8_t *data, size_t len)
static enum ModuleLoadResult module_populate_atoms_table(Module *this_module, uint8_t *table_data, GlobalContext *glb)
bool module_get_function_from_label(Module *this_module, int label, AtomString *function_name, int *arity, GlobalContext *glb)
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)
term module_get_exported_functions(Module *this_module, Heap *heap, GlobalContext *glb)
Module *module_new_from_iff_binary(GlobalContext *global, const void *iff_binary, unsigned long size)
COLD_FUNC void module_destroy (Module *module)
term module_load_literal(Module *mod, int index, Context *ctx)
const struct ExportedFunction *module_resolve_function0(Module *mod, int import_table_index, struct UnresolvedFunctionCall *unresolved, GlobalContext *glb)
static uint16_t *parse_line_refs(uint8_t **data, size_t num_refs, size_t len)
struct ModuleFilename *parse_filename_table(uint8_t **data, size_t num_filenames, size_t len)
void module_insert_line_ref_offset(Module *mod, int line_ref, int offset)
int module_find_line(Module *mod, unsigned int offset)