refc_binary.h
Include dependency graph for refc_binary.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"]
"1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
"8" [label="assert.h" tooltip="assert.h"]
"13" [label="utils.h" tooltip="utils.h"]
"4" [label="list.h" tooltip="list.h"]
"11" [label="stdint.h" tooltip="stdint.h"]
"3" [label="stdlib.h" tooltip="stdlib.h"]
"12" [label="memory.h" tooltip="memory.h"]
"5" [label="resources.h" tooltip="resources.h"]
"14" [label="stddef.h" tooltip="stddef.h"]
"6" [label="erl_nif.h" tooltip="erl_nif.h"]
"9" [label="limits.h" tooltip="limits.h"]
"7" [label="term_typedef.h" tooltip="term_typedef.h"]
"15" [label="stdio.h" tooltip="stdio.h"]
"10" [label="inttypes.h" tooltip="inttypes.h"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
"1" -> "4" [dir=forward tooltip="include"]
"1" -> "5" [dir=forward tooltip="include"]
"13" -> "14" [dir=forward tooltip="include"]
"13" -> "15" [dir=forward tooltip="include"]
"13" -> "3" [dir=forward tooltip="include"]
"12" -> "11" [dir=forward tooltip="include"]
"12" -> "3" [dir=forward tooltip="include"]
"12" -> "6" [dir=forward tooltip="include"]
"12" -> "7" [dir=forward tooltip="include"]
"12" -> "13" [dir=forward tooltip="include"]
"5" -> "3" [dir=forward tooltip="include"]
"5" -> "6" [dir=forward tooltip="include"]
"5" -> "4" [dir=forward tooltip="include"]
"5" -> "12" [dir=forward tooltip="include"]
"6" -> "7" [dir=forward tooltip="include"]
"7" -> "8" [dir=forward tooltip="include"]
"7" -> "9" [dir=forward tooltip="include"]
"7" -> "10" [dir=forward tooltip="include"]
"7" -> "11" [dir=forward tooltip="include"]
}](../../../_images/graphviz-cf504eb91ad28bb6c18f5c6545d0a1351080f06c.png)
This graph shows which files directly or indirectly include refc_binary.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"13" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.c"]
"6" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
"23" [label="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/interop.h"]
"21" [label="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
"14" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
"1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/refc_binary.h" fillcolor="#BFBFBF"]
"34" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
"51" [label="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
"43" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
"44" [label="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/dictionary.h"]
"15" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.c"]
"9" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.c"]
"16" [label="/__w/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/context.h"]
"17" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bif.h"]
"27" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
"35" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
"3" [label="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/memory.c"]
"33" [label="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/sys.h"]
"18" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.c"]
"29" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.h"]
"26" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
"36" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
"7" [label="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/resources.c"]
"25" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c"]
"28" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.c"]
"24" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.h"]
"8" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.h"]
"45" [label="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"]
"20" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.c"]
"19" [label="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/debug.h"]
"12" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
"47" [label="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/externalterm.h"]
"50" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
"49" [label="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
"2" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
"48" [label="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
"30" [label="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
"11" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.c"]
"10" [label="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/bitstring.h"]
"52" [label="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"]
"41" [label="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
"4" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
"37" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
"32" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
"31" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
"5" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
"38" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
"22" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
"46" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
"42" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
"39" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.c"]
"40" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.h"]
"23" -> "24" [dir=back tooltip="include"]
"23" -> "13" [dir=back tooltip="include"]
"23" -> "14" [dir=back tooltip="include"]
"23" -> "27" [dir=back tooltip="include"]
"23" -> "26" [dir=back tooltip="include"]
"23" -> "4" [dir=back tooltip="include"]
"23" -> "5" [dir=back tooltip="include"]
"23" -> "22" [dir=back tooltip="include"]
"23" -> "28" [dir=back tooltip="include"]
"21" -> "15" [dir=back tooltip="include"]
"21" -> "2" [dir=back tooltip="include"]
"21" -> "3" [dir=back tooltip="include"]
"21" -> "4" [dir=back tooltip="include"]
"21" -> "5" [dir=back tooltip="include"]
"21" -> "22" [dir=back tooltip="include"]
"21" -> "6" [dir=back tooltip="include"]
"21" -> "7" [dir=back tooltip="include"]
"1" -> "2" [dir=back tooltip="include"]
"1" -> "3" [dir=back tooltip="include"]
"1" -> "4" [dir=back tooltip="include"]
"1" -> "5" [dir=back tooltip="include"]
"1" -> "6" [dir=back tooltip="include"]
"1" -> "7" [dir=back tooltip="include"]
"1" -> "8" [dir=back tooltip="include"]
"34" -> "18" [dir=back tooltip="include"]
"34" -> "14" [dir=back tooltip="include"]
"34" -> "27" [dir=back tooltip="include"]
"34" -> "35" [dir=back tooltip="include"]
"34" -> "26" [dir=back tooltip="include"]
"34" -> "36" [dir=back tooltip="include"]
"34" -> "4" [dir=back tooltip="include"]
"34" -> "37" [dir=back tooltip="include"]
"34" -> "5" [dir=back tooltip="include"]
"34" -> "38" [dir=back tooltip="include"]
"34" -> "22" [dir=back tooltip="include"]
"51" -> "9" [dir=back tooltip="include"]
"51" -> "15" [dir=back tooltip="include"]
"51" -> "43" [dir=back tooltip="include"]
"51" -> "2" [dir=back tooltip="include"]
"51" -> "13" [dir=back tooltip="include"]
"51" -> "14" [dir=back tooltip="include"]
"51" -> "27" [dir=back tooltip="include"]
"51" -> "26" [dir=back tooltip="include"]
"51" -> "4" [dir=back tooltip="include"]
"51" -> "5" [dir=back tooltip="include"]
"51" -> "39" [dir=back tooltip="include"]
"51" -> "40" [dir=back tooltip="include"]
"51" -> "22" [dir=back tooltip="include"]
"51" -> "7" [dir=back tooltip="include"]
"51" -> "32" [dir=back tooltip="include"]
"44" -> "9" [dir=back tooltip="include"]
"44" -> "15" [dir=back tooltip="include"]
"44" -> "43" [dir=back tooltip="include"]
"44" -> "3" [dir=back tooltip="include"]
"44" -> "14" [dir=back tooltip="include"]
"44" -> "4" [dir=back tooltip="include"]
"44" -> "6" [dir=back tooltip="include"]
"16" -> "17" [dir=back tooltip="include"]
"16" -> "15" [dir=back tooltip="include"]
"16" -> "19" [dir=back tooltip="include"]
"16" -> "21" [dir=back tooltip="include"]
"16" -> "12" [dir=back tooltip="include"]
"16" -> "2" [dir=back tooltip="include"]
"16" -> "23" [dir=back tooltip="include"]
"16" -> "3" [dir=back tooltip="include"]
"16" -> "18" [dir=back tooltip="include"]
"16" -> "29" [dir=back tooltip="include"]
"16" -> "14" [dir=back tooltip="include"]
"16" -> "34" [dir=back tooltip="include"]
"16" -> "27" [dir=back tooltip="include"]
"16" -> "26" [dir=back tooltip="include"]
"16" -> "4" [dir=back tooltip="include"]
"16" -> "5" [dir=back tooltip="include"]
"16" -> "39" [dir=back tooltip="include"]
"16" -> "40" [dir=back tooltip="include"]
"16" -> "6" [dir=back tooltip="include"]
"16" -> "7" [dir=back tooltip="include"]
"16" -> "41" [dir=back tooltip="include"]
"16" -> "31" [dir=back tooltip="include"]
"16" -> "28" [dir=back tooltip="include"]
"17" -> "9" [dir=back tooltip="include"]
"17" -> "18" [dir=back tooltip="include"]
"17" -> "14" [dir=back tooltip="include"]
"35" -> "27" [dir=back tooltip="include"]
"33" -> "15" [dir=back tooltip="include"]
"33" -> "2" [dir=back tooltip="include"]
"33" -> "18" [dir=back tooltip="include"]
"33" -> "14" [dir=back tooltip="include"]
"33" -> "4" [dir=back tooltip="include"]
"33" -> "7" [dir=back tooltip="include"]
"29" -> "17" [dir=back tooltip="include"]
"29" -> "18" [dir=back tooltip="include"]
"29" -> "14" [dir=back tooltip="include"]
"29" -> "30" [dir=back tooltip="include"]
"29" -> "31" [dir=back tooltip="include"]
"29" -> "33" [dir=back tooltip="include"]
"29" -> "28" [dir=back tooltip="include"]
"36" -> "26" [dir=back tooltip="include"]
"24" -> "25" [dir=back tooltip="include"]
"24" -> "26" [dir=back tooltip="include"]
"24" -> "4" [dir=back tooltip="include"]
"24" -> "5" [dir=back tooltip="include"]
"8" -> "9" [dir=back tooltip="include"]
"8" -> "10" [dir=back tooltip="include"]
"8" -> "15" [dir=back tooltip="include"]
"8" -> "16" [dir=back tooltip="include"]
"8" -> "43" [dir=back tooltip="include"]
"8" -> "44" [dir=back tooltip="include"]
"8" -> "45" [dir=back tooltip="include"]
"8" -> "47" [dir=back tooltip="include"]
"8" -> "48" [dir=back tooltip="include"]
"8" -> "25" [dir=back tooltip="include"]
"8" -> "13" [dir=back tooltip="include"]
"8" -> "23" [dir=back tooltip="include"]
"8" -> "3" [dir=back tooltip="include"]
"8" -> "18" [dir=back tooltip="include"]
"8" -> "29" [dir=back tooltip="include"]
"8" -> "14" [dir=back tooltip="include"]
"8" -> "27" [dir=back tooltip="include"]
"8" -> "26" [dir=back tooltip="include"]
"8" -> "4" [dir=back tooltip="include"]
"8" -> "5" [dir=back tooltip="include"]
"8" -> "52" [dir=back tooltip="include"]
"8" -> "40" [dir=back tooltip="include"]
"8" -> "46" [dir=back tooltip="include"]
"8" -> "31" [dir=back tooltip="include"]
"8" -> "28" [dir=back tooltip="include"]
"45" -> "17" [dir=back tooltip="include"]
"45" -> "29" [dir=back tooltip="include"]
"45" -> "34" [dir=back tooltip="include"]
"45" -> "30" [dir=back tooltip="include"]
"45" -> "46" [dir=back tooltip="include"]
"19" -> "20" [dir=back tooltip="include"]
"19" -> "3" [dir=back tooltip="include"]
"47" -> "12" [dir=back tooltip="include"]
"47" -> "18" [dir=back tooltip="include"]
"47" -> "14" [dir=back tooltip="include"]
"49" -> "50" [dir=back tooltip="include"]
"49" -> "2" [dir=back tooltip="include"]
"49" -> "14" [dir=back tooltip="include"]
"48" -> "49" [dir=back tooltip="include"]
"48" -> "15" [dir=back tooltip="include"]
"48" -> "16" [dir=back tooltip="include"]
"48" -> "51" [dir=back tooltip="include"]
"48" -> "2" [dir=back tooltip="include"]
"48" -> "3" [dir=back tooltip="include"]
"48" -> "18" [dir=back tooltip="include"]
"48" -> "29" [dir=back tooltip="include"]
"48" -> "14" [dir=back tooltip="include"]
"48" -> "27" [dir=back tooltip="include"]
"48" -> "26" [dir=back tooltip="include"]
"48" -> "36" [dir=back tooltip="include"]
"48" -> "4" [dir=back tooltip="include"]
"48" -> "37" [dir=back tooltip="include"]
"48" -> "5" [dir=back tooltip="include"]
"48" -> "38" [dir=back tooltip="include"]
"48" -> "39" [dir=back tooltip="include"]
"48" -> "40" [dir=back tooltip="include"]
"48" -> "22" [dir=back tooltip="include"]
"48" -> "46" [dir=back tooltip="include"]
"48" -> "41" [dir=back tooltip="include"]
"48" -> "32" [dir=back tooltip="include"]
"48" -> "33" [dir=back tooltip="include"]
"30" -> "14" [dir=back tooltip="include"]
"10" -> "11" [dir=back tooltip="include"]
"10" -> "12" [dir=back tooltip="include"]
"10" -> "13" [dir=back tooltip="include"]
"10" -> "14" [dir=back tooltip="include"]
"52" -> "9" [dir=back tooltip="include"]
"41" -> "2" [dir=back tooltip="include"]
"41" -> "42" [dir=back tooltip="include"]
"41" -> "14" [dir=back tooltip="include"]
"41" -> "4" [dir=back tooltip="include"]
"37" -> "4" [dir=back tooltip="include"]
"37" -> "5" [dir=back tooltip="include"]
"31" -> "32" [dir=back tooltip="include"]
"38" -> "5" [dir=back tooltip="include"]
"46" -> "2" [dir=back tooltip="include"]
"46" -> "14" [dir=back tooltip="include"]
"46" -> "4" [dir=back tooltip="include"]
"46" -> "22" [dir=back tooltip="include"]
"40" -> "25" [dir=back tooltip="include"]
"40" -> "14" [dir=back tooltip="include"]
"40" -> "26" [dir=back tooltip="include"]
"40" -> "4" [dir=back tooltip="include"]
"40" -> "5" [dir=back tooltip="include"]
"40" -> "39" [dir=back tooltip="include"]
}](../../../_images/graphviz-9edb1715c4c62b6881993dcd09fb8f3760b80190.png)
Functions
-
struct RefcBinary *refc_binary_create_resource(size_t size, struct ResourceType *resource_type)
Create a reference-counted resource object outside of the process heap.
This function will create a reference-counted resource object outside of the context heap. A blob will be allocated in the VM memory (e.g., via malloc). The allocated data will include an internal data structure that includes the data size and reference count.
- Parameters:
size – the size of the data to create
resource_type – the resource type,
NULL
for regular refc binaries.
- Returns:
a pointer to the out-of-context data.
-
static inline struct RefcBinary *refc_binary_create_refc(size_t size)
Create a reference-counted binary outside of the process heap.
This function will create a reference-counted binary outside of the context heap. A blob will be allocated in the VM memory (e.g., via malloc). The allocated data will include an internal data structure that includes the data size and reference count.
- Parameters:
size – the size of the data to create
- Returns:
a pointer to the out-of-context data.
-
const char *refc_binary_get_data(const struct RefcBinary *ptr)
get the data of the off-context binary
Return the data of the off-context binary
- Parameters:
ptr – Refc binary returned from memory_create_refc_binary
-
struct RefcBinary *refc_binary_from_data(void *ptr)
get the refc binary from its pointer
This must only be passed the result of
refc_binary_get_data
.- Parameters:
ptr – pointer obtained from
refc_binary_get_data
-
void refc_binary_increment_refcount(struct RefcBinary *ptr)
Increment the reference count on the refc binary.
- Parameters:
ptr – the refc binary
-
bool refc_binary_decrement_refcount(struct RefcBinary *ptr, GlobalContext *global)
Decrement the reference count on the refc binary.
This function will call
refc_binary_destroy
if the reference count reaches 0.- Parameters:
ptr – the refc binary
global – the global context
- Returns:
true if the refc binary was free’d; false, otherwise
-
void refc_binary_destroy(struct RefcBinary *refc, struct GlobalContext *global)
Destroy a refc binary after its reference count reached 0.
This function will call the destructor if the refc binary is a resource and will free the refc binary.
- Parameters:
refc – the binary to destroy
global – the global context
-
struct RefcBinary
- #include <refc_binary.h>
Collaboration diagram for RefcBinary: