parrotcode: Transform Ops to C Code | |
Contents | Perl Modules |
Parrot::OpTrans - Transform Ops to C Code
Parrot::OpTrans
is the abstract superclass for the Parrot op to C transforms.
Each transform contains various bits of information needed to generate the C code,
and creates a different type of run loop.
The methods defined here supply various default values and behaviour common to all transforms.
The subclass hierarchy is as follows:
OpTrans
|_________________________
| | |
C CGoto Compiled
| |
CPrederef |
| | |
| |_________|
| |
CSwitch CGP
new()
prefix()
Parrot_
' prefix.Parrot::Op
's func_name()
to individuate op function names.suffix()
defines()
#define
macros required.opsarraytype()
opcode_t
, but the prederef runops core uses an array of void*
to do its clever tricks.core_type()
Parrot_Run_core_t
enum
in include/parrot/interpreter.h for a list of the core types.core_prefix()
run_core_func_decl($base)
$base
is the name of the main ops file minus the .ops extension.ops_addr_decl($base_suffix)
$base_suffix
is the name of the main ops file minus the .ops extension with suffix()
and an underscore appended.run_core_func_decl($base)
$base
is the same as for run_core_func_decl()
.run_core_func_start()
run_core_func_decl()
is implemented, to return the C code prior to the run core function.run_core_after_addr_table($base_suffix)
$base_suffix
is the same as for ops_addr_decl()
.run_core_finish($base)
$base
is the same as for run_core_func_decl()
.init_func_init1($base)
$base
is the same as for run_core_func_decl()
.init_set_dispatch($base_suffix)
$base_suffix
is the same as for ops_addr_decl()
.Macro Substitutions
The following methods are called by Parrot::OpFile
to perform ops file macro substitutions.
access_arg($type, $value, $op)
$op
is an instance of Parrot::Op
.gen_goto($where)
goto_X
methods below call this method with the return value of an expr_X
method (implemented in subclass).restart_address($address)
restart ADDRESS($address)
.restart_offset($offset)
restart OFFSET($offset)
.goto_address($address)
goto ADDRESS($address)
macro in an ops file into the relevant C code.goto_offset($offset)
goto OFFSET($offset)
macro in an ops file into the relevant C code.goto_pop()
goto POP($address)
macro in an ops file into the relevant C code.expr_offset($offset)
OFFSET($offset)
. Called by goto_offset()
.expr_address($address)
ADDRESS($address)
. Called by goto_address()
.
|