Back to Atomvm

Module code_server

main-apidocs-erlang-estdlib-code-underscore-server.md

latest3.6 KB
Original Source

Module code_server

Code server.

Behaviours: gen_server.

Description

This module is responsible for performing JIT compilation of module

Function Index

| atom_resolver/2 | Get the atom from the atom module index. | | code_chunk/1 | Get the bytecode of a given module. | | import_resolver/2 | Get an imported function triplet from its index. | | is_loaded/1 | Determine if a given module is loaded. | | literal_resolver/2 | Get a module literal from its index. | | resume/2 | Resume a process that was trapped waiting for module to be loaded. | | set_native_code/3 | Associate a native code stream with a module. | | start_link/0 | Start code server. | | type_resolver/2 | Get a type from its index. |

Function Details

atom_resolver/2

atom_resolver(Module::module(), Index::non_neg_integer()) -> atom()

Module: module get the atom of
Index: atom index in the module

returns: The atom

Get the atom from the atom module index

code_chunk/1

code_chunk(Module::module()) -> binary()

Module: module to get the bytecode of

returns: Bytecode of the module, as a binary

Get the bytecode of a given module

import_resolver/2

import_resolver(Module::module(), Index::non_neg_integer()) -> {atom(), atom(), non_neg_integer()}

Module: module to get the imported function from
Index: imported function index in the module

returns: The imported function as {Module, Function, Arity}

Get an imported function triplet from its index

is_loaded/1

is_loaded(Module::atom()) -> boolean()

Module: module to test

returns: true if the module is loaded

Determine if a given module is loaded

literal_resolver/2

literal_resolver(Module::module(), Index::non_neg_integer()) -> any()

Module: module get a literal from
Index: literal index in the module

returns: The module literal

Get a module literal from its index

resume/2

resume(Pid::pid(), LoadResult::ok | undef) -> true

Pid: process id to resume
LoadResult: result of the load operation

returns: ok

Resume a process that was trapped waiting for module to be loaded

set_native_code/3

set_native_code(Module::module(), LabelsCount::pos_integer(), Stream::jit:stream()) -> ok

Module: module to set the native code of
LabelsCount: number of labels in the module
Stream: resource describing the stream containing native code

returns: ok

Associate a native code stream with a module

start_link() -> {ok, pid()}

Start code server

type_resolver/2

type_resolver(Module::module(), Index::non_neg_integer()) -> any()

Module: module get a type from
Index: type index in the module

returns: The type information

Get a type from its index