Plasma uses a byte code interpreter. One basic interpreter and runtime system is currently under development but this could change in the future, including the addition of native code generation.
The runtime is mostly C++ with small bits of C, some care needs to be taken with header files. C++ may call C (and include its headers) but C may not call C++ or include its headers (without wrappers).
These files break the rule about having matching implementation/header files for each module. Since for these headers, multiple alternative files could provide different implementations.
- pz_interp.h - The header file for the core of the interpreter
- pz_closure.h - Header file with closure related declrations. The implementation is in the interpreter files themselves.
- pz_generic.cpp - The architecture independent (and only) implementation of the interpreter
- pz_generic_*.{cpp,h} - Other parts of the generic interpreter. Only files in this group may include other headers in this group, there must be no coupling with the rest of the system other than trhough pz_interp.h
- pz_generic_run.cpp/pz_generic_run.h - The main loop of the interpreter.
- pz_generic_builtin.cpp/pz_generic_builtin.h - The implementation of the builtins.
Other files that may be interesting are:
- pz_main.cpp - The entry point for pzrun
- pz_option.cpp - Option processing for pzrun
- pz_instructions.h and pz_instructions.c Instruction data for the bytecode format
- pz.h/pz.cpp, pz_code.h/pz_code.cpp and pz_data.h/pz_data.cpp - Structures used by pzrun
- pz_gc.h and other pz_gc* files - The garbage collector is
across several files here.
- pz_gc_util.h contains an API that allows the GC to find roots in C++ code and determine when GC is safe.
- pz_gc_layout.h declares the heap structure.
- pz_format.h - Constants for the PZ bytecode format
- pz_read.h/pz_read.cpp - Code for reading the PZ bytecode format
-
PZ_DEV - Enable developer build which makes the PZ_RUNTIME_DEV_OPTS below available.
-
DEBUG - Enable runtime assertions.
Runtime options are specified using environment variables. They're each interpreted as comma-seperated, case-sensative tokens.
-
PZ_RUNTIME_OPTS for general runtime options.
-
load_verbose - verbose loading messages
-
fast_exit=[ yes | no ] - exit without freeing resources.
-
-
PZ_RUNTIME_DEV_OPTS for developer runtime options.
These require PZ_DEV to be defined during compile time.
-
interp_trace - tracing of PZ bytecode interpreter
-
gc_zealous - Make the GC zealously perform a GC before every allocation. To test this mode run: ( cd tests; ./run-tests.sh gc )
-