NAME ^

src/embed.c - The Parrot embedding interface

DESCRIPTION ^

This file implements the Parrot embedding interface.

Functions ^

Parrot_Interp Parrot_new

Returns a new Parrot interpreter.

The first created interpreter (parent is NULL) is the last one to get destroyed.

void Parrot_init_stacktop

Initializes the new interpreter when it hasn't been initialized before.

Additionally sets the stack top, so that Parrot objects created in inner stack frames will be visible during DODs stack walking code. stack_top should be the address of an automatic variable in the caller's stack frame. All unanchored Parrot objects (PMCs) must live in inner stack frames so that they are not destroyed during DOD runs.

Use this function when you call into Parrot before entering a run loop.

void Parrot_set_flag

Sets a flag in the interpreter specified by flag, any of PARROT_BOUNDS_FLAG, or PARROT_PROFILE_FLAG to enable profiling, and bounds checking respectively or PARROT_THR_TYPE_1, PARROT_THR_TYPE_2, or PARROT_THR_TYPE_3 to disable thread communication and variable sharing, disable variable sharing but enable thread communication, or to enable variable sharing.

void Parrot_set_debug

Set a debug flag: PARROT_DEBUG_FLAG.

void Parrot_set_trace

Set a trace flag: PARROT_TRACE_FLAG

void Parrot_clear_flag

Clears a flag in the interpreter.

void Parrot_clear_debug

Clears a flag in the interpreter.

void Parrot_clear_trace

Clears a flag in the interpreter.

Parrot_Int Parrot_test_flag

Test the interpreter flags specified in flag.

UINTVAL Parrot_test_debug

Test the interpreter flags specified in flag.

UINTVAL Parrot_test_trace

Test the interpreter flags specified in flag.

void Parrot_set_run_core

Sets the specified run core.

void Parrot_setwarnings

Activates the given warnings.

PackFile *Parrot_readbc

Read in a bytecode, unpack it into a PackFile structure, and do fixups.

void Parrot_loadbc

Loads the PackFile returned by Parrot_readbc().

static PMC *setup_argv

Creates and returns ARGS array PMC.

static int prof_sort_f

Sort function for profile data. Sorts by time.

static const char *op_name

Returns the name of the opcode.

static FLOATVAL calibrate

With this calibration, reported times of parrot -p almost match those measured with time parrot -b.

static void print_profile

Prints out a profile listing.

static void print_debug

Prints GC info.

static PMC *set_current_sub

RT#48260: Not yet documented!!!

void Parrot_runcode

Sets up ARGV and runs the ops.

opcode_t *Parrot_debug

Runs the interpreter's bytecode in debugging mode.

void Parrot_disassemble

Disassembles and prints out the interpreter's bytecode.

This is used by the Parrot disassembler.

void Parrot_run_native

Run the C function func through the program [enternative, end]. This ensures that the function is run with the same setup as in other run loops.

This function is used in some of the source tests in t/src which use the interpreter outside a runloop.

SEE ALSO ^

include/parrot/embed.h and docs/embed.pod.

HISTORY ^

Initial version by Brent Dax on 2002.1.28.


parrot