Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
function.h File Reference

Compiled function. More...

#include <reduct/defs.h>
#include <reduct/inst.h>
#include <reduct/optimize.h>
#include <assert.h>
#include <stdlib.h>
Include dependency graph for function.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  reduct_const_slot_t
 Constant slot. More...
 
struct  reduct_function_t
 Compiled function structure. More...
 

Enumerations

enum  reduct_const_slot_type_t { REDUCT_CONST_SLOT_TYPE_NONE , REDUCT_CONST_SLOT_TYPE_STATIC , REDUCT_CONST_SLOT_TYPE_CAPTURE }
 Constant slot type. More...
 
enum  reduct_function_flags_t { REDUCT_FUNCTION_FLAG_NONE = 0 , REDUCT_FUNCTION_FLAG_VARIADIC = 1 << 0 , REDUCT_FUNCTION_FLAG_OPTIMIZED = 1 << 1 }
 Function flags. More...
 

Functions

REDUCT_API void reduct_function_init (reduct_function_t *func)
 Initialize a function structure.
 
REDUCT_API reduct_function_treduct_function_new (struct reduct *reduct)
 Create a new function.
 
REDUCT_API void reduct_function_grow (struct reduct *reduct, reduct_function_t *func)
 Grow the instruction buffer.
 
static void reduct_function_emit (struct reduct *reduct, reduct_function_t *func, reduct_inst_t inst, uint32_t position)
 Emit an instruction to the function.
 
REDUCT_API reduct_const_t reduct_function_add_constant (struct reduct *reduct, reduct_function_t *func, reduct_handle_t handle)
 Add a static constant to the function's template, returning its index.
 
REDUCT_API reduct_const_t reduct_function_add_capture (struct reduct *reduct, reduct_function_t *func)
 Add a capture placeholder slot to the function's template, returning its index.
 
REDUCT_API void reduct_function_retain (struct reduct *reduct, reduct_function_t *function)
 Retain a function, preventing it from being collected by the garbage collector.
 
REDUCT_API void reduct_function_release (struct reduct *reduct, reduct_function_t *function)
 Release a function, potentially allowing the garbage collector to collect it.
 

Detailed Description

Compiled function.

Definition in file function.h.