context.h

Include dependency graph for context.h:

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

This graph shows which files directly or indirectly include context.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"]
    "22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c"]
    "29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" fillcolor="#BFBFBF"]
    "27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "25" [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"]
    "26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/opcodesswitch.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/opcodesswitch.h"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.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"]
    "22" -> "5" [dir=back tooltip="include"]
    "29" -> "30" [dir=back tooltip="include"]
    "29" -> "5" [dir=back tooltip="include"]
    "29" -> "6" [dir=back tooltip="include"]
    "29" -> "11" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "7" [dir=back tooltip="include"]
    "1" -> "8" [dir=back tooltip="include"]
    "1" -> "12" [dir=back tooltip="include"]
    "1" -> "17" [dir=back tooltip="include"]
    "1" -> "13" [dir=back tooltip="include"]
    "1" -> "18" [dir=back tooltip="include"]
    "1" -> "10" [dir=back tooltip="include"]
    "1" -> "4" [dir=back tooltip="include"]
    "1" -> "21" [dir=back tooltip="include"]
    "1" -> "5" [dir=back tooltip="include"]
    "1" -> "26" [dir=back tooltip="include"]
    "1" -> "27" [dir=back tooltip="include"]
    "1" -> "28" [dir=back tooltip="include"]
    "1" -> "15" [dir=back tooltip="include"]
    "1" -> "16" [dir=back tooltip="include"]
    "1" -> "29" [dir=back tooltip="include"]
    "1" -> "23" [dir=back tooltip="include"]
    "1" -> "20" [dir=back tooltip="include"]
    "28" -> "5" [dir=back tooltip="include"]
    "28" -> "27" [dir=back tooltip="include"]
    "23" -> "6" [dir=back tooltip="include"]
    "23" -> "24" [dir=back tooltip="include"]
    "21" -> "2" [dir=back tooltip="include"]
    "21" -> "4" [dir=back tooltip="include"]
    "21" -> "5" [dir=back tooltip="include"]
    "21" -> "6" [dir=back tooltip="include"]
    "21" -> "22" [dir=back tooltip="include"]
    "21" -> "23" [dir=back tooltip="include"]
    "21" -> "25" [dir=back tooltip="include"]
    "18" -> "19" [dir=back tooltip="include"]
    "18" -> "5" [dir=back tooltip="include"]
    "18" -> "14" [dir=back tooltip="include"]
    "18" -> "20" [dir=back tooltip="include"]
    "12" -> "7" [dir=back tooltip="include"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "10" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "12" -> "15" [dir=back tooltip="include"]
    "12" -> "16" [dir=back tooltip="include"]
    "25" -> "7" [dir=back tooltip="include"]
    "25" -> "13" [dir=back tooltip="include"]
    "25" -> "4" [dir=back tooltip="include"]
    "25" -> "5" [dir=back tooltip="include"]
    "25" -> "16" [dir=back tooltip="include"]
    "25" -> "11" [dir=back tooltip="include"]
    "26" -> "4" [dir=back tooltip="include"]
    "26" -> "5" [dir=back tooltip="include"]
    "26" -> "6" [dir=back tooltip="include"]
    "26" -> "14" [dir=back tooltip="include"]
    "6" -> "7" [dir=back tooltip="include"]
    "6" -> "4" [dir=back tooltip="include"]
    "8" -> "9" [dir=back tooltip="include"]
    "8" -> "10" [dir=back tooltip="include"]
    "8" -> "6" [dir=back tooltip="include"]
    "8" -> "11" [dir=back tooltip="include"]
}

Defines

MAX_REG

Typedefs

typedef enum NativeHandlerResult NativeHandlerResult
typedef NativeHandlerResult (*native_handler_f)(Context *ctx)

Enums

enum NativeHandlerResult

Values:

enumerator NativeTerminate
enumerator NativeContinue
enum ContextFlags

Values:

enumerator NoFlags
enumerator WaitingTimeout
enumerator WaitingTimeoutExpired
enumerator Running
enumerator Ready
enumerator Killed
enumerator Trap
enum HeapGrowthStrategy

Values:

enumerator BoundedFreeHeapGrowth
enumerator MinimumHeapGrowth
enumerator FibonacciHeapGrowth

Functions

Context *context_new(GlobalContext *glb)
void context_destroy(Context *c)
static inline void context_ensure_fpregs(Context *c)
int context_execute_loop(Context *ctx, Module *mod, const char *function_name, int arity)
static inline int context_is_port_driver(const Context *ctx)
static inline void context_clean_registers(Context *ctx, int live)
static inline term *context_stack_base(const Context *ctx)
static inline size_t context_stack_size(const Context *ctx)
static inline size_t context_avail_free_memory(const Context *ctx)
static inline bool context_is_term_equal_to_atom_string(Context *ctx, term atom_a, AtomString atom_string_b)
size_t context_message_queue_len(Context *ctx)
size_t context_size(Context *ctx)
void context_update_flags(Context *ctx, int mask, int value)
static inline int context_get_flags(Context *ctx, int mask)
void context_process_kill_signal(Context *ctx, struct TermSignal *signal)
void context_process_process_info_request_signal(Context *ctx, struct BuiltInAtomRequestSignal *signal)
bool context_process_signal_trap_answer(Context *ctx, struct TermSignal *signal)
void context_process_flush_monitor_signal(Context *ctx, uint64_t ref_ticks, bool info)
bool context_get_process_info(Context *ctx, term *out, term atom_key)
int context_link(Context *ctx, term monitor_pid)
uint64_t context_monitor(Context *ctx, term monitor_pid)
struct ResourceMonitor *context_resource_monitor(Context *ctx, void *resource)
void context_unlink(Context *ctx, term monitor_pid)
struct Context

Collaboration diagram for Context:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "18" [label="SpinLock" tooltip="SpinLock"]
    "6" [label="Module" tooltip="Module"]
    "5" [label="ListHead" tooltip="ListHead"]
    "11" [label="HeapFragment" tooltip="HeapFragment"]
    "12" [label="GlobalContext" tooltip="GlobalContext"]
    "8" [label="ModuleFilename" tooltip="ModuleFilename"]
    "17" [label="TimerList" tooltip="TimerList"]
    "9" [label="LiteralEntry" tooltip="LiteralEntry"]
    "3" [label="MailboxMessage" tooltip="MailboxMessage"]
    "10" [label="Heap" tooltip="Heap"]
    "1" [label="Context" tooltip="Context" fillcolor="#BFBFBF"]
    "16" [label="AtomsHashTable" tooltip="AtomsHashTable"]
    "13" [label="ValuesHashTable" tooltip="ValuesHashTable"]
    "2" [label="Mailbox" tooltip="Mailbox"]
    "7" [label="ExportedFunction" tooltip="ExportedFunction"]
    "4" [label="TimerListItem" tooltip="TimerListItem"]
    "15" [label="SyncList" tooltip="SyncList"]
    "14" [label="HNode" tooltip="HNode"]
    "6" -> "7" [dir=forward tooltip="usage"]
    "6" -> "8" [dir=forward tooltip="usage"]
    "6" -> "9" [dir=forward tooltip="usage"]
    "6" -> "5" [dir=forward tooltip="usage"]
    "5" -> "5" [dir=forward tooltip="usage"]
    "11" -> "11" [dir=forward tooltip="usage"]
    "12" -> "13" [dir=forward tooltip="usage"]
    "12" -> "15" [dir=forward tooltip="usage"]
    "12" -> "6" [dir=forward tooltip="usage"]
    "12" -> "16" [dir=forward tooltip="usage"]
    "12" -> "17" [dir=forward tooltip="usage"]
    "12" -> "18" [dir=forward tooltip="usage"]
    "12" -> "5" [dir=forward tooltip="usage"]
    "17" -> "5" [dir=forward tooltip="usage"]
    "3" -> "3" [dir=forward tooltip="usage"]
    "10" -> "11" [dir=forward tooltip="usage"]
    "1" -> "1" [dir=forward tooltip="usage"]
    "1" -> "2" [dir=forward tooltip="usage"]
    "1" -> "4" [dir=forward tooltip="usage"]
    "1" -> "6" [dir=forward tooltip="usage"]
    "1" -> "10" [dir=forward tooltip="usage"]
    "1" -> "12" [dir=forward tooltip="usage"]
    "1" -> "5" [dir=forward tooltip="usage"]
    "16" -> "14" [dir=forward tooltip="usage"]
    "13" -> "14" [dir=forward tooltip="usage"]
    "2" -> "3" [dir=forward tooltip="usage"]
    "4" -> "5" [dir=forward tooltip="usage"]
    "15" -> "5" [dir=forward tooltip="usage"]
    "14" -> "14" [dir=forward tooltip="usage"]
}

Public Members

GlobalContext *global
Heap heap
term *e
term x[MAX_REG]
struct ListHead processes_list_head
struct ListHead processes_table_head
int32_t process_id
struct TimerListItem timer_list_head
struct ListHead monitors_head
avm_float_t *fr
size_t min_heap_size
size_t max_heap_size
enum HeapGrowthStrategy heap_growth_strategy
unsigned long cp
Module *saved_module
const void *saved_ip
void *restore_trap_handler
Mailbox mailbox
struct ListHead dictionary
native_handler_f native_handler
uint64_t reductions
unsigned int leader
unsigned int has_min_heap_size
unsigned int has_max_heap_size
bool trap_exit
enum ContextFlags ATOMIC flags
void *platform_data
term group_leader
term bs
size_t bs_offset
term exit_reason
struct Monitor

Collaboration diagram for Monitor:

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

Public Members

struct ListHead monitor_list_head
uint64_t ref_ticks
term monitor_obj
struct ResourceMonitor

Collaboration diagram for ResourceMonitor:

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

Public Members

struct Monitor base
struct ListHead resource_list_head