curry.backends.cxx.interface module

class curry.backends.cxx.interface.IBackend(backend=None)[source]

Bases: IBackend

after_evaluation(interp)[source]

Called when the values of an evaluation are exhausted. The C++ backend applies and logs the compiled objects that finished during the evaluation.

property backend_name

E.g., ‘py’ or ‘cxx’.

before_evaluation(interp)[source]

Called when an evaluation is about to start. The C++ backend applies the compiled objects that finished in the background.

property compile

Converts ICurry to an instance of IR.

property create_evaluation_rts

Creates a new runtime state representing an evaluation.

property extend_plan_skeleton
find_or_create_internal_module(moduleobj)[source]
property fundamental_symbols
gc_counters()[source]

The counters of the garbage collector of this backend, summed over its collections in this process, as a dict keyed by the names in stats.GC_COUNTERS (the seconds of the phases of a collection, the nodes marked by age, the configurations pushed, the queues and configurations destroyed, the writes into old nodes). A backend without a collector of its own answers an empty dict, which Interpreter.stats reports as zeros.

gc_seconds()[source]

The seconds the garbage collector of this backend has spent in its collections in this process. A backend without a collector of its own answers zero.

get_interpreter_state(interp)[source]

Gets the runtime-specific state attached to an interpreter.

getimpl(symbol)[source]

The implementation code of the step function of symbol (a CurryNodeInfo) as text; see curry.inspect.getimpl(). Raises ValueError when the backend has no code for the symbol.

init_interpreter_state(interp)[source]

Initializes an interpreter with the runtime-specific state.

property load_module

Load the contents of a Curry module.

lookup_builtin_module(modulename)[source]

Looks up the implementation for a built-in module.

property make_node
property materialize
module_loaded(interp, moduleobj, currypath)[source]

Called when the import of a module ends, after the imports of the module were imported and its symbols were loaded. currypath is the search path of the imports of the module: the path of a program given as a file, or the path of the interpreter for a module given by name (interpreter.import_.ImportEx). The C++ backend queues the background compile of a module it interprets (see backends.cxx.tiered).

module_unlinked(interp, moduleobj)[source]

Called when a module leaves the interpreter (Handle.unlink: a reset, or the hard reset of reload), after its name left interp.modules. The module object may stay alive in the hands of the user. The C++ backend hands the tables of the module to the kept store of the runtime, so a module of the same name made later runs its own code (issue #114; see Module::retire in cyrt/module.hpp).

num_collections()[source]

The number of collections the garbage collector of this backend has run in this process. A backend without a collector of its own answers zero.

property object_file_extension
scheduler_counters_enabled()[source]

True when the runtime of this backend counts the serial steps, the lifetimes of configurations, and the shared work of an evaluation (Interpreter.stats reports them). Only the C++ runtime built with make COUNTERS=1 does.

tiered_counts()[source]

The functions swapped to compiled code and the background compiles that failed in this process (Interpreter.stats reports them). A backend without tiered execution answers zeros.

property write_module

Write the contents of a Curry module to a stream.