Next: Interface
Up: Design
Previous: Memory Model
In our design, plugins can be specified either as pre-compiled machine
code, or in E-code - a language akin to `C [19] and developed
as part of the ECho high-performance event-delivery
middleware [10]. E-code is a fairly complete subset of the C
language that compiles to native machine code at runtime using a
dynamic code generator that processes one function at a time. A more
detailed list of E-code capabilities follows:
- Datatypes: E-code supports the following basic types: char, int, float, double, and boolean. It
also supports structures, pointers (including pointers to structures),
and pointer arithmetic.
- Variables: Global variables are allocated on the heap,
which is a per-runtime pool of ring-1 memory persistent across plugin
invocations. Local variables are allocated on the plugin stack.
- Function calls: Plugins are allowed to perform function
calls only to other functions or callbacks registered within their
runtime. Appropriate trap or trampoline code for the invocation is
generated automatically and transparently.
- Function prototypes: Plugin functions must conform to a
prototype convention - their first argument must be a `runtime_t ' to provide linkage back to their runtime.
Furthermore, their result type is restricted to long, however,
that is not a severe restriction since most basic datatypes are easily
cast to a long value, with the notable exception of the class of
floating point numbers, which must be passed back by reference.
- Language: E-code supports the C operators, for
loops, if, and return statements.
Currently, E-code does not support while loops, switch statements, unions, and function pointers, though they do not
pose conceptual difficulties and can be implemented if needed in the
future.
Next: Interface
Up: Design
Previous: Memory Model
Ivan Ganev
2004-02-13