QuickBEAM.VM.Compiler.RuntimeHelpers (QuickBEAM v0.10.9)

Copy Markdown View Source

Runtime support for JIT-compiled code.

Summary

Functions

Appends spread values into an array-like target.

Applies a superclass constructor for super(...).

Converts an iterable or array-like value to a JavaScript array object.

Resolves an awaited JavaScript value for compiled async code.

Collects remaining values from an iterator into a list.

Constructs a JavaScript value from compiled code.

Returns the atom table from a context-like value.

Returns the home object associated with the current function.

Returns the JavaScript this value from a context-like value.

Copies enumerable object-spread properties.

Defines a method, getter, or setter from compiled code.

Defines a computed-name method, getter, or setter from compiled code.

Raises a JavaScript ReferenceError when a local is still in the temporal dead zone.

Returns a dirty interpreter context suitable for entry into compiled code.

Reads a variable from a compiled context or throws when absent.

Creates key iteration state for a JavaScript for...in loop.

Advances JavaScript for...of iterator state.

Creates iterator state for a JavaScript for...of loop.

Reads a JavaScript property value.

Reads a global binding and returns :undefined when absent.

Reads the value from a reference cell or object-property reference.

Reads a variable binding or throws a JavaScript ReferenceError when absent.

Reads the value referenced by a compiled variable reference.

Loads a registered VM module by name.

Applies JavaScript instanceof semantics.

Invokes a JavaScript callable from compiled code.

Invokes a tail-position JavaScript method from compiled code.

Invokes a callable variable reference with two arguments.

Invokes a callable stored in a variable reference.

Checks and invokes a callable variable reference with no arguments.

Checks and invokes a callable variable reference with three arguments.

Closes an iterator by calling its return method when present.

Applies JavaScript logical NOT.

Creates a mutable reference cell for a local slot value.

Returns or creates a mutable reference cell for an existing variable reference.

Applies JavaScript postfix decrement and returns {new_value, old_value}.

Resolves an atom-table entry to its runtime value.

Writes a JavaScript array element.

Writes a JavaScript property value.

Writes an existing private class field or throws when absent.

Writes a captured variable and returns the value.

Assigns a JavaScript function display name.

Assigns a function display name from a computed property value.

Writes a value through a compiled variable reference and returns the value.

Creates special object forms used by compiled object/class bytecode.

Throws a JavaScript error value.

Returns whether a value is JavaScript undefined.

Returns whether a value is either undefined or null.

Updates the active this value in a context.

Functions

add_brand(ctx \\ nil, target, brand)

append_spread(ctx \\ nil, arr, idx, obj)

Appends spread values into an array-like target.

apply_super(fun, new_target, args)

apply_super(ctx, fun, new_target, args)

Applies a superclass constructor for super(...).

array_from(ctx \\ nil, list)

Converts an iterable or array-like value to a JavaScript array object.

await(ctx \\ nil, val)

Resolves an awaited JavaScript value for compiled async code.

bit_not(ctx \\ nil, a)

check_brand(ctx, obj, brand)

check_ctor_return(ctx, val)

close_capture_cell(ctx \\ nil, cell, val)

collect_iterator(iter, next_fn)

collect_iterator(ctx, iter, next_fn)

Collects remaining values from an iterator into a list.

construct_runtime(ctor, new_target, args)

construct_runtime(ctx, ctor, new_target, args)

Constructs a JavaScript value from compiled code.

construct_runtime(ctx, ctor, new_target, args, call_pc)

context_arg_buf(arg1)

context_atoms(arg1)

Returns the atom table from a context-like value.

context_current_func(arg1)

context_gas(arg1)

context_globals(arg1)

context_home_object(ctx, current_func)

Returns the home object associated with the current function.

context_new_target(arg1)

context_struct(ctx)

context_super(ctx)

context_this(arg1)

Returns the JavaScript this value from a context-like value.

copy_data_properties(ctx \\ nil, target, source, exclude \\ nil)

Copies enumerable object-spread properties.

dec(ctx \\ nil, value)

define_array_el(ctx \\ nil, obj, idx, val)

define_class(ctor, parent_ctor, atom_idx)

define_class(ctx, ctor, parent_ctor, atom_idx)

define_field(obj, key, val)

define_field(ctx, obj, key, val)

define_method(target, method, name, flags)

define_method(ctx, target, method, name, flags)

Defines a method, getter, or setter from compiled code.

define_method_computed(ctx \\ nil, target, method, field_name, flags)

Defines a computed-name method, getter, or setter from compiled code.

define_private_field(ctx, obj, key, val)

delete_property(ctx \\ nil, obj, key)

delete_var(ctx, atom_idx)

ensure_capture_cell(ctx \\ nil, cell, val)

ensure_context(ctx)

ensure_initialized_local!(ctx \\ nil, val)

Raises a JavaScript ReferenceError when a local is still in the temporal dead zone.

entry_ctx()

Returns a dirty interpreter context suitable for entry into compiled code.

eval_or_call(ctx, fun, args)

fetch_ctx_var(ctx, name)

Reads a variable from a compiled context or throws when absent.

for_in_next(ctx \\ nil, iter)

for_in_start(ctx \\ nil, obj)

Creates key iteration state for a JavaScript for...in loop.

for_of_next(next_fn, iter_obj)

for_of_next(ctx, next_fn, iter_obj)

Advances JavaScript for...of iterator state.

for_of_start(obj)

for_of_start(ctx, obj)

Creates iterator state for a JavaScript for...of loop.

get_array_el2(ctx \\ nil, obj, idx)

get_capture(ctx, key)

get_field(obj, key)

Reads a JavaScript property value.

get_global(globals, name)

get_global_undef(globals, name)

Reads a global binding and returns :undefined when absent.

get_length(obj)

get_private_field(ctx, obj, key)

get_ref_value(ctx \\ nil, key, ref)

Reads the value from a reference cell or object-property reference.

get_super(func)

get_super(ctx, func)

get_var(name)

get_var(ctx, name)

Reads a variable binding or throws a JavaScript ReferenceError when absent.

get_var_ref(idx)

get_var_ref(ctx, idx)

Reads the value referenced by a compiled variable reference.

get_var_ref_check(idx)

get_var_ref_check(ctx, idx)

get_var_undef(name)

get_var_undef(ctx, name)

import_module(specifier)

import_module(ctx, specifier)

Loads a registered VM module by name.

in_operator(ctx \\ nil, key, obj)

inc(ctx \\ nil, value)

init_ctor(ctx)

instanceof(obj, ctor)

Applies JavaScript instanceof semantics.

invoke_method_runtime(fun, this_obj, args)

invoke_method_runtime(ctx, fun, this_obj, args)

invoke_runtime(fun, args)

invoke_runtime(ctx, fun, args)

Invokes a JavaScript callable from compiled code.

invoke_tail_method(ctx, fun, this_obj, args)

Invokes a tail-position JavaScript method from compiled code.

invoke_var_ref0(idx)

invoke_var_ref0(ctx, idx)

invoke_var_ref1(idx, arg0)

invoke_var_ref1(ctx, idx, arg0)

invoke_var_ref2(idx, arg0, arg1)

invoke_var_ref2(ctx, idx, arg0, arg1)

Invokes a callable variable reference with two arguments.

invoke_var_ref3(idx, arg0, arg1, arg2)

invoke_var_ref3(ctx, idx, arg0, arg1, arg2)

invoke_var_ref(idx, args)

invoke_var_ref(ctx, idx, args)

Invokes a callable stored in a variable reference.

invoke_var_ref_check0(idx)

invoke_var_ref_check0(ctx, idx)

Checks and invokes a callable variable reference with no arguments.

invoke_var_ref_check1(idx, arg0)

invoke_var_ref_check1(ctx, idx, arg0)

invoke_var_ref_check2(idx, arg0, arg1)

invoke_var_ref_check2(ctx, idx, arg0, arg1)

invoke_var_ref_check3(idx, arg0, arg1, arg2)

invoke_var_ref_check3(ctx, idx, arg0, arg1, arg2)

Checks and invokes a callable variable reference with three arguments.

invoke_var_ref_check(idx, args)

invoke_var_ref_check(ctx, idx, args)

iterator_close(iter_obj)

iterator_close(ctx, iter_obj)

Closes an iterator by calling its return method when present.

iterator_next_result(ctx \\ nil, next_fn, iter_obj, val)

lnot(ctx \\ nil, a)

Applies JavaScript logical NOT.

make_arg_ref(ctx \\ nil, idx)

make_loc_ref(ctx \\ nil, idx)

Creates a mutable reference cell for a local slot value.

make_var_ref(ctx, atom_idx)

make_var_ref_ref(ctx, idx)

Returns or creates a mutable reference cell for an existing variable reference.

materialize_constant(ctx, value)

new_object(ctx \\ nil)

null?(ctx \\ nil, val)

post_dec(ctx \\ nil, value)

Applies JavaScript postfix decrement and returns {new_value, old_value}.

post_inc(ctx \\ nil, value)

private_symbol(name)

private_symbol(ctx, name)

push_atom_value(atom_idx)

push_atom_value(ctx, atom_idx)

Resolves an atom-table entry to its runtime value.

push_this()

push_this(ctx)

put_array_el(ctx \\ nil, obj, idx, val)

Writes a JavaScript array element.

put_capture(ctx, key, val)

put_field(obj, key, val)

put_field(ctx, obj, key, val)

Writes a JavaScript property value.

put_private_field(ctx, obj, key, val)

Writes an existing private class field or throws when absent.

put_ref_value(ctx \\ nil, val, key, ref)

put_var_ref(idx, val)

put_var_ref(ctx, idx, val)

read_capture_cell(ctx \\ nil, cell, slot_val)

rest(ctx, start_idx)

set_capture(ctx, key, val)

Writes a captured variable and returns the value.

set_function_name(ctx \\ nil, fun, name)

Assigns a JavaScript function display name.

set_function_name_atom(fun, atom_idx)

set_function_name_atom(ctx, fun, atom_idx)

set_function_name_computed(ctx \\ nil, fun, name_val)

Assigns a function display name from a computed property value.

set_home_object(ctx \\ nil, method, target)

set_name_computed(ctx \\ nil, fun, name_val)

set_proto(ctx \\ nil, obj, proto)

set_var_ref(idx, val)

set_var_ref(ctx, idx, val)

Writes a value through a compiled variable reference and returns the value.

special_object(type)

special_object(ctx, type)

Creates special object forms used by compiled object/class bytecode.

strict_neq(ctx \\ nil, a, b)

sync_capture_cell(ctx \\ nil, cell, val)

throw_error(ctx, atom_idx, reason)

Throws a JavaScript error value.

throw_error_message(name, reason)

to_object(value)

typeof_is_function(ctx \\ nil, val)

typeof_is_undefined(ctx \\ nil, val)

undefined?(ctx \\ nil, val)

Returns whether a value is JavaScript undefined.

undefined_or_null?(val)

Returns whether a value is either undefined or null.

update_this(this_val)

update_this(ctx, this_val)

Updates the active this value in a context.

with_has_property(ctx, obj, key)