Author: leo
Date: Thu Oct 20 00:48:06 2005
New Revision: 9519
Modified:
trunk/classes/continuation.pmc
trunk/classes/coroutine.pmc
trunk/classes/retcontinuation.pmc
trunk/classes/sub.pmc
trunk/include/parrot/inter_call.h
trunk/include/parrot/interpreter.h
trunk/ops/core.ops
trunk/src/inter_call.c
trunk/src/inter_run.c
trunk/src/interpreter.c
Log:
Variable-sized reg frames 8 - pass context instead of regs
* all call related APIs for argument passing have now a parrot_context_t*
argument instead of struct parrot_regs_t*
This is an API change and might break C code.
---
* fix a braino in prederef code
Modified: trunk/classes/continuation.pmc
==============================================================================
--- trunk/classes/continuation.pmc (original)
+++ trunk/classes/continuation.pmc Thu Oct 20 00:48:06 2005
@@ -208,7 +208,7 @@ destination to continue execution.
void* invoke (void* next) {
struct Parrot_cont * cc = PMC_cont(SELF);
- struct parrot_regs_t *caller_regs;
+ parrot_context_t *caller_ctx;
parrot_context_t *ctx;
opcode_t *pc;
@@ -219,7 +219,7 @@ destination to continue execution.
PIO_eprintf(INTERP, "# Back in sub '%Ss'\n",
Parrot_full_sub_name(INTERP, sub));
}
- caller_regs = INTERP->ctx.bp;
+ caller_ctx = CONTEXT(INTERP->ctx);
/*
* set context
*/
@@ -245,7 +245,7 @@ destination to continue execution.
*/
Parrot_block_DOD(INTERP);
parrot_pass_args(INTERP, cc->seg,
- caller_regs,
+ caller_ctx,
PARROT_OP_get_results_pc);
Parrot_unblock_DOD(INTERP);
}
Modified: trunk/classes/coroutine.pmc
==============================================================================
--- trunk/classes/coroutine.pmc (original)
+++ trunk/classes/coroutine.pmc Thu Oct 20 00:48:06 2005
@@ -93,7 +93,7 @@ Swaps the "context".
void* invoke (void* next) {
struct Parrot_coro * co = PMC_coro(SELF);
- struct parrot_regs_t *caller_regs;
+ parrot_context_t *caller_ctx;
struct PackFile_ByteCode *wanted_seg;
opcode_t * dest = co->address;
parrot_context_t *ctx;
@@ -106,7 +106,7 @@ Swaps the "context".
if (ccont == NEED_CONTINUATION) {
ccont = new_ret_continuation_pmc(interpreter, next);
}
- caller_regs = INTERP->ctx.bp;
+ caller_ctx = CONTEXT(INTERP->ctx);
/*
* first time set current sub, cont, object
*/
@@ -136,7 +136,7 @@ Swaps the "context".
if (*dest == PARROT_OP_get_params_pc) {
INTERP->current_params = dest;
dest = parrot_pass_args(INTERP, wanted_seg,
- caller_regs,
+ caller_ctx,
PARROT_OP_get_params_pc);
}
}
@@ -165,7 +165,7 @@ Swaps the "context".
/* yield values */
if (INTERP->current_returns && ctx->current_results)
parrot_pass_args(INTERP, wanted_seg,
- co->ctx->bp,
+ co->ctx,
PARROT_OP_get_results_pc);
}
Modified: trunk/classes/retcontinuation.pmc
==============================================================================
--- trunk/classes/retcontinuation.pmc (original)
+++ trunk/classes/retcontinuation.pmc Thu Oct 20 00:48:06 2005
@@ -87,7 +87,7 @@ the frame pointer in the stack frame cac
void* invoke (void* next) {
Stack_Chunk_t *ctr_stack, *stack_now;
struct Parrot_cont * cc = PMC_cont(SELF);
- struct parrot_regs_t *caller_regs;
+ parrot_context_t *caller_ctx;
/*
* unwind control stack
*/
@@ -114,7 +114,7 @@ the frame pointer in the stack frame cac
Parrot_full_sub_name(INTERP, to_sub),
Parrot_full_sub_name(INTERP, from_sub));
}
- caller_regs = INTERP->ctx.bp;
+ caller_ctx = CONTEXT(INTERP->ctx);
CONTEXT(INTERP->ctx) = cc->to_ctx;
INTERP->ctx.bp = CONTEXT(INTERP->ctx)->bp;
INTERP->ctx.bp_ps = CONTEXT(INTERP->ctx)->bp_ps;
@@ -130,7 +130,7 @@ the frame pointer in the stack frame cac
*/
Parrot_block_DOD(INTERP);
parrot_pass_args(INTERP, cc->seg,
- caller_regs,
+ caller_ctx,
PARROT_OP_get_results_pc);
Parrot_unblock_DOD(INTERP);
}
Modified: trunk/classes/sub.pmc
==============================================================================
--- trunk/classes/sub.pmc (original)
+++ trunk/classes/sub.pmc Thu Oct 20 00:48:06 2005
@@ -236,7 +236,7 @@ Invokes the subroutine.
void* invoke (void* next) {
struct Parrot_sub * sub = PMC_sub(SELF);
- struct parrot_regs_t *caller_regs;
+ parrot_context_t *caller_ctx;
struct Parrot_Context *context;
PMC *ccont;
opcode_t *pc;
@@ -281,7 +281,7 @@ Invokes the subroutine.
*
*/
pc = sub->address;
- caller_regs = INTERP->ctx.bp;
+ caller_ctx = CONTEXT(INTERP->ctx);
ccont = INTERP->current_cont;
INTERP->current_cont = NULL;
if (ccont == NEED_CONTINUATION) {
@@ -336,7 +336,7 @@ create_ctx:
* get_params, so that we can skip this opcode, we
* start executing in the sub after this opcode
*/
- pc = parrot_pass_args(INTERP, sub->seg, caller_regs,
+ pc = parrot_pass_args(INTERP, sub->seg, caller_ctx,
PARROT_OP_get_params_pc);
}
Modified: trunk/include/parrot/inter_call.h
==============================================================================
--- trunk/include/parrot/inter_call.h (original)
+++ trunk/include/parrot/inter_call.h Thu Oct 20 00:48:06 2005
@@ -37,7 +37,7 @@ struct call_state_1 {
} op;
} u;
struct PackFile_Constant **constants;
- struct parrot_regs_t *regs;
+ parrot_context_t *ctx;
INTVAL i;
INTVAL n;
INTVAL sig;
@@ -54,11 +54,11 @@ struct call_state {
};
int Parrot_init_arg_sig(Interp *, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
const char *sig, void *ap, struct call_state_1 *st);
int Parrot_init_arg_op(Interp *, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
opcode_t *pc, struct call_state_1 *st);
int Parrot_init_arg_nci(Interp *, struct call_state *st, const char *sig);
@@ -72,15 +72,15 @@ int Parrot_store_arg(Interp *, struct ca
int parrot_check_tail_call(Interp*, struct PackFile_ByteCode *, opcode_t *);
opcode_t * parrot_pass_args(Interp *, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *caller_regs, int what);
+ parrot_context_t *ctx, int what);
opcode_t * parrot_pass_args_fromc(Interp *, const char *sig,
opcode_t *dest, parrot_context_t * ctxp, va_list ap);
FLOATVAL set_retval_f(Interp*, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp);
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx);
void* set_retval(Interp*, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp);
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx);
INTVAL set_retval_i(Interp*, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp);
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx);
#endif /* PARROT_INTER_CALL_H_GUARD */
Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h (original)
+++ trunk/include/parrot/interpreter.h Thu Oct 20 00:48:06 2005
@@ -439,7 +439,7 @@ STRING*interpinfo_s(Interp *interpreter,
void runops(Interp *, size_t offset);
void runops_int(Interp *, size_t offset);
-struct parrot_regs_t* Parrot_runops_fromc(Interp *, PMC *sub);
+parrot_context_t* Parrot_runops_fromc(Interp *, PMC *sub);
void* Parrot_runops_fromc_args(Interp *, PMC *sub, const char *sig, ...);
INTVAL Parrot_runops_fromc_args_reti(Interp *, PMC *, const char *, ...);
FLOATVAL Parrot_runops_fromc_args_retf(Interp *, PMC *, const char *, ...);
Modified: trunk/ops/core.ops
==============================================================================
--- trunk/ops/core.ops (original)
+++ trunk/ops/core.ops Thu Oct 20 00:48:06 2005
@@ -508,15 +508,15 @@ op get_params(inconst PMC) {
opcode_t *this = CUR_OPCODE;
PMC *signature = $1;
struct Parrot_sub * sub = PMC_sub(CONTEXT(interpreter->ctx)->current_sub);
- struct parrot_regs_t *caller_regs;
+ parrot_context_t *caller_ctx;
PMC *cont_pmc;
opcode_t *pc;
interpreter->current_params = this;
cont_pmc = CONTEXT(interpreter->ctx)->current_cont;
- caller_regs = PMC_cont(cont_pmc)->to_ctx->bp;
- pc = parrot_pass_args(interpreter, sub->seg, caller_regs,
+ caller_ctx = PMC_cont(cont_pmc)->to_ctx;
+ pc = parrot_pass_args(interpreter, sub->seg, caller_ctx,
PARROT_OP_get_params_pc);
goto ADDRESS(pc);
}
Modified: trunk/src/inter_call.c
==============================================================================
--- trunk/src/inter_call.c (original)
+++ trunk/src/inter_call.c Thu Oct 20 00:48:06 2005
@@ -47,9 +47,11 @@ int
Parrot_init_arg_nci(Interp *interpreter, struct call_state *st,
const char *sig)
{
- Parrot_init_arg_op(interpreter, interpreter->code, interpreter->ctx.bp,
+ Parrot_init_arg_op(interpreter, interpreter->code,
+ CONTEXT(interpreter->ctx),
interpreter->current_args, &st->src);
- Parrot_init_arg_sig(interpreter, interpreter->code, interpreter->ctx.bp,
+ Parrot_init_arg_sig(interpreter, interpreter->code,
+ CONTEXT(interpreter->ctx),
sig, NULL, &st->dest);
return 1;
}
@@ -76,9 +78,10 @@ Parrot_init_ret_nci(Interp *interpreter,
seg = interpreter->code;
}
/* TODO simplify all */
- Parrot_init_arg_sig(interpreter, interpreter->code, interpreter->ctx.bp,
+ Parrot_init_arg_sig(interpreter, interpreter->code,
+ CONTEXT(interpreter->ctx),
sig, NULL, &st->src);
- Parrot_init_arg_op(interpreter, seg, ctx->bp,
+ Parrot_init_arg_op(interpreter, seg, ctx,
ctx->current_results, &st->dest);
next_arg(interpreter, &st->src);
next_arg(interpreter, &st->dest);
@@ -88,14 +91,14 @@ Parrot_init_ret_nci(Interp *interpreter,
/*
=item C<int Parrot_init_arg_sig(Interp *, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
const char *sig, void *ap, struct call_state_1 *st)>
Initialize argument transfer with given code segment (holding the
const_table), registers, function signature, and arguments.
=item C<int Parrot_init_arg_op(Interp *, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
opcode_t *pc, struct call_state_1 *st)>
Initialize argument transfer with given code segment (holding the
@@ -113,7 +116,7 @@ These functions return 0, if no argument
int
Parrot_init_arg_op(Interp *interpreter, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
opcode_t *pc, struct call_state_1 *st)
{
PMC *sig_pmc;
@@ -121,7 +124,7 @@ Parrot_init_arg_op(Interp *interpreter,
st->i = -1;
st->n = 0;
st->mode = CALL_STATE_OP | CALL_STATE_NEXT_ARG;
- st->regs = regs;
+ st->ctx = ctx;
if (pc) {
st->constants = seg->const_table->constants;
++pc;
@@ -137,14 +140,14 @@ Parrot_init_arg_op(Interp *interpreter,
int
Parrot_init_arg_sig(Interp *interpreter, struct PackFile_ByteCode *seg,
- struct parrot_regs_t *regs,
+ parrot_context_t *ctx,
const char *sig, void *ap, struct call_state_1 *st)
{
st->i = -1;
st->n = 0;
st->mode = CALL_STATE_SIG | CALL_STATE_NEXT_ARG;
- st->regs = regs;
+ st->ctx = ctx;
if (*sig) {
st->u.sig.sig = sig - 1;
if (ap)
@@ -163,7 +166,7 @@ fetch_arg_int_op(Interp *interpreter, st
idx = *st->src.u.op.pc;
if (!(st->src.sig & PARROT_ARG_CONSTANT)) {
- idx = BP_REG_INT(st->src.regs, idx);
+ idx = BP_REG_INT(st->src.ctx->bp, idx);
}
UVal_int(st->val) = idx;
st->src.mode |= CALL_STATE_NEXT_ARG;
@@ -181,7 +184,7 @@ fetch_arg_str_op(Interp *interpreter, st
s_arg = st->src.constants[idx]->u.string;
}
else {
- s_arg = BP_REG_STR(st->src.regs, idx);
+ s_arg = BP_REG_STR(st->src.ctx->bp, idx);
}
UVal_str(st->val) = s_arg;
st->src.mode |= CALL_STATE_NEXT_ARG;
@@ -199,7 +202,7 @@ fetch_arg_num_op(Interp *interpreter, st
f_arg = st->src.constants[idx]->u.number;
}
else {
- f_arg = BP_REG_NUM(st->src.regs, idx);
+ f_arg = BP_REG_NUM(st->src.ctx->bp, idx);
}
UVal_num(st->val) = f_arg;
st->src.mode |= CALL_STATE_NEXT_ARG;
@@ -218,7 +221,7 @@ fetch_arg_pmc_op(Interp *interpreter, st
p_arg = st->src.constants[idx]->u.key;
}
else {
- p_arg = BP_REG_PMC(st->src.regs, idx);
+ p_arg = BP_REG_PMC(st->src.ctx->bp, idx);
}
if (st->src.sig & PARROT_ARG_FLATTEN) {
_array = CONST_STRING(interpreter, "array");
@@ -504,10 +507,9 @@ clone_key_arg(Interp *interpreter, struc
/* need old = src context
* clone sets key values according to refered
* register items
- *
- * XXX
*/
- interpreter->ctx.bp = st->src.regs;
+ interpreter->ctx.bp = st->src.ctx->bp;
+ interpreter->ctx.bp_ps = st->src.ctx->bp_ps;
p_arg = VTABLE_clone(interpreter, p_arg);
interpreter->ctx.bp = new_ctx.bp;
interpreter->ctx.bp_ps = new_ctx.bp_ps;
@@ -531,7 +533,7 @@ again:
if (st->opt_so_far > 1)
real_exception(interpreter, NULL, E_ValueError,
":opt_flag preceeded by more then one :optional");
- BP_REG_INT(st->dest.regs, *st->dest.u.op.pc) = st->opt_so_far;
+ BP_REG_INT(st->dest.ctx->bp, *st->dest.u.op.pc) = st->opt_so_far;
st->opt_so_far = 0;
if (!next_arg(interpreter, &st->dest))
return 0;
@@ -575,7 +577,7 @@ Parrot_store_arg(Interp *interpreter, st
st->dest.slurp = pmc_new(interpreter,
Parrot_get_ctx_HLL_type(interpreter,
enum_class_ResizablePMCArray));
- BP_REG_PMC(st->dest.regs, *st->dest.u.op.pc) = st->dest.slurp;
+ BP_REG_PMC(st->dest.ctx->bp, *st->dest.u.op.pc) = st->dest.slurp;
st->dest.mode |= CALL_STATE_FLATTEN;
return Parrot_store_arg(interpreter, st);
}
@@ -587,16 +589,16 @@ Parrot_store_arg(Interp *interpreter, st
assert(st->dest.mode & CALL_STATE_OP);
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_INTVAL:
- BP_REG_INT(st->dest.regs, *st->dest.u.op.pc) = UVal_int(st->val);
+ BP_REG_INT(st->dest.ctx->bp, *st->dest.u.op.pc) =
UVal_int(st->val);
break;
case PARROT_ARG_FLOATVAL:
- BP_REG_NUM(st->dest.regs, *st->dest.u.op.pc) = UVal_num(st->val);
+ BP_REG_NUM(st->dest.ctx->bp, *st->dest.u.op.pc) =
UVal_num(st->val);
break;
case PARROT_ARG_STRING:
- BP_REG_STR(st->dest.regs, *st->dest.u.op.pc) = UVal_str(st->val);
+ BP_REG_STR(st->dest.ctx->bp, *st->dest.u.op.pc) =
UVal_str(st->val);
break;
case PARROT_ARG_PMC:
- BP_REG_PMC(st->dest.regs, *st->dest.u.op.pc) = UVal_pmc(st->val);
+ BP_REG_PMC(st->dest.ctx->bp, *st->dest.u.op.pc) =
UVal_pmc(st->val);
break;
}
st->dest.mode |= CALL_STATE_NEXT_ARG;
@@ -605,14 +607,14 @@ Parrot_store_arg(Interp *interpreter, st
/*
-=item C<opcode_t * parrot_pass_args(Interp *, struct PackFile_ByteCode
*dst_seg struct parrot_regs_t *caller_regs, int what)>
+=item C<opcode_t * parrot_pass_args(Interp *, struct PackFile_ByteCode
*dst_seg parrot_context_t *src_ctx, int what)>
Main argument passing routine.
Prelims: code segments aren't yet switched, so that the current
constants are still that of the caller. The destination context is
-already created and set, C<caller_regs> point to the caller's
-registers. C<dst_seg> has the constants of the destination.
+already created and set, C<src_ctx> point to the caller's
+context. C<dst_seg> has the constants of the destination.
C<what> is either C<PARROT_OP_get_params_pc> or C<PARROT_OP_get_results_pc>.
With the former arguments are passed from the caller into a subroutine,
@@ -664,11 +666,11 @@ parrot_check_tail_call(Interp* interpret
if (*pc != PARROT_OP_get_params_pc)
return 1;
todo = Parrot_init_arg_op(interpreter, dst_seg,
- interpreter->ctx.bp, pc, &st.dest);
+ CONTEXT(interpreter->ctx), pc, &st.dest);
if (!todo)
return 1;
todo = Parrot_init_arg_op(interpreter, interpreter->code,
- interpreter->ctx.bp,
+ CONTEXT(interpreter->ctx),
interpreter->current_args, &st.src);
if (!todo)
return 1;
@@ -696,7 +698,7 @@ parrot_check_tail_call(Interp* interpret
opcode_t *
parrot_pass_args(Interp *interpreter, struct PackFile_ByteCode *dst_seg,
- struct parrot_regs_t *caller_regs, int what)
+ parrot_context_t *src_ctx, int what)
{
const char *action;
struct call_state st;
@@ -708,10 +710,10 @@ parrot_pass_args(Interp *interpreter, st
if (what == PARROT_OP_get_params_pc) {
dst_pc = interpreter->current_params;
todo = Parrot_init_arg_op(interpreter, dst_seg,
- interpreter->ctx.bp, dst_pc, &st.dest);
+ CONTEXT(interpreter->ctx), dst_pc, &st.dest);
src_pc = CONTEXT(interpreter->ctx)->current_args;
Parrot_init_arg_op(interpreter, interpreter->code,
- caller_regs, src_pc, &st.src);
+ src_ctx, src_pc, &st.src);
interpreter->current_params = NULL;
action = "params";
}
@@ -735,9 +737,9 @@ parrot_pass_args(Interp *interpreter, st
action = "params";
}
todo = Parrot_init_arg_op(interpreter, dst_seg,
- interpreter->ctx.bp, dst_pc, &st.dest);
+ CONTEXT(interpreter->ctx), dst_pc, &st.dest);
Parrot_init_arg_op(interpreter, interpreter->code,
- caller_regs, src_pc, &st.src);
+ src_ctx, src_pc, &st.src);
}
st.opt_so_far = 0; /* XXX */
while (todo) {
@@ -804,9 +806,9 @@ parrot_pass_args_fromc(Interp *interpret
}
Parrot_init_arg_op(interpreter, interpreter->code,
- interpreter->ctx.bp, dest, &st.dest);
+ CONTEXT(interpreter->ctx), dest, &st.dest);
todo = Parrot_init_arg_sig(interpreter, interpreter->code,
- old_ctxp->bp, sig, PARROT_VA_TO_VAPTR(ap), &st.src);
+ old_ctxp, sig, PARROT_VA_TO_VAPTR(ap), &st.src);
st.opt_so_far = 0; /* XXX */
while (todo) {
@@ -839,7 +841,7 @@ parrot_pass_args_fromc(Interp *interpret
*/
void*
set_retval(Parrot_Interp interpreter, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp)
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx)
{
opcode_t *src_pc;
int todo;
@@ -852,12 +854,11 @@ set_retval(Parrot_Interp interpreter, in
if (!sig_ret || sig_ret == 'v')
return NULL;
- Parrot_init_arg_op(interpreter, seg,
- bp, src_pc, &st.src);
+ Parrot_init_arg_op(interpreter, seg, ctx, src_pc, &st.src);
buf[0] = sig_ret;
buf[1] = 0;
todo = Parrot_init_arg_sig(interpreter, interpreter->code,
- interpreter->ctx.bp, sig, NULL, &st.dest);
+ CONTEXT(interpreter->ctx), sig, NULL, &st.dest);
if (todo) {
Parrot_fetch_arg(interpreter, &st);
@@ -874,7 +875,7 @@ set_retval(Parrot_Interp interpreter, in
*/
INTVAL
set_retval_i(Parrot_Interp interpreter, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp)
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx)
{
opcode_t *src_pc;
int todo;
@@ -887,10 +888,9 @@ set_retval_i(Parrot_Interp interpreter,
}
src_pc = interpreter->current_returns;
interpreter->current_returns = NULL;
- Parrot_init_arg_op(interpreter, seg,
- bp, src_pc, &st.src);
+ Parrot_init_arg_op(interpreter, seg, ctx, src_pc, &st.src);
todo = Parrot_init_arg_sig(interpreter, interpreter->code,
- interpreter->ctx.bp, sig, NULL, &st.dest);
+ CONTEXT(interpreter->ctx), sig, NULL, &st.dest);
if (todo) {
Parrot_fetch_arg(interpreter, &st);
Parrot_convert_arg(interpreter, &st);
@@ -904,7 +904,7 @@ set_retval_i(Parrot_Interp interpreter,
*/
FLOATVAL
set_retval_f(Parrot_Interp interpreter, int sig_ret,
- struct PackFile_ByteCode *seg, struct parrot_regs_t *bp)
+ struct PackFile_ByteCode *seg, parrot_context_t *ctx)
{
opcode_t *src_pc;
int todo;
@@ -917,10 +917,9 @@ set_retval_f(Parrot_Interp interpreter,
}
src_pc = interpreter->current_returns;
interpreter->current_returns = NULL;
- Parrot_init_arg_op(interpreter, seg,
- bp, src_pc, &st.src);
+ Parrot_init_arg_op(interpreter, seg, ctx, src_pc, &st.src);
todo = Parrot_init_arg_sig(interpreter, interpreter->code,
- interpreter->ctx.bp, sig, NULL, &st.dest);
+ CONTEXT(interpreter->ctx), sig, NULL, &st.dest);
if (todo) {
Parrot_fetch_arg(interpreter, &st);
Parrot_convert_arg(interpreter, &st);
Modified: trunk/src/inter_run.c
==============================================================================
--- trunk/src/inter_run.c (original)
+++ trunk/src/inter_run.c Thu Oct 20 00:48:06 2005
@@ -99,7 +99,7 @@ runops(Interp *interpreter, size_t offs)
/*
-=item C<struct parrot_regs_t *
+=item C<parrot_context_t *
Parrot_runops_fromc(Parrot_Interp interpreter, PMC *sub)>
Runs the Parrot ops, called from C code. The function arguments are
@@ -110,12 +110,12 @@ is an invocable C<Sub> PMC.
*/
-struct parrot_regs_t *
+parrot_context_t *
Parrot_runops_fromc(Parrot_Interp interpreter, PMC *sub)
{
PMC *ret_c;
opcode_t offset, *dest;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
/* we need one return continuation with a NULL offset */
interpreter->current_cont = ret_c =
@@ -130,19 +130,19 @@ Parrot_runops_fromc(Parrot_Interp interp
dest = VTABLE_invoke(interpreter, sub, (void*) 1);
if (!dest)
internal_exception(1, "Subroutine returned a NULL address");
- bp = interpreter->ctx.bp;
+ ctx = CONTEXT(interpreter->ctx);
offset = dest - interpreter->code->base.data;
runops(interpreter, offset);
- return bp;
+ return ctx;
}
-static struct parrot_regs_t *
+static parrot_context_t *
runops_args(Parrot_Interp interpreter, PMC *sub, PMC *obj,
STRING *meth, const char* sig, va_list ap)
{
opcode_t offset, *dest;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
parrot_context_t *old_ctx;
int i;
/*
@@ -176,10 +176,10 @@ runops_args(Parrot_Interp interpreter, P
old_ctx, ap);
}
- bp = interpreter->ctx.bp;
+ ctx = CONTEXT(interpreter->ctx);
offset = dest - interpreter->code->base.data;
runops(interpreter, offset);
- return bp;
+ return ctx;
}
@@ -250,7 +250,7 @@ void *
Parrot_run_meth_fromc(Parrot_Interp interpreter,
PMC *sub, PMC *obj, STRING *meth)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
opcode_t offset, *dest;
interpreter->current_cont = new_ret_continuation_pmc(interpreter, NULL);
@@ -258,10 +258,10 @@ Parrot_run_meth_fromc(Parrot_Interp inte
dest = VTABLE_invoke(interpreter, sub, (void*)1);
if (!dest)
internal_exception(1, "Subroutine returned a NULL address");
- bp = interpreter->ctx.bp;
+ ctx = CONTEXT(interpreter->ctx);
offset = dest - interpreter->code->base.data;
runops(interpreter, offset);
- return set_retval(interpreter, 0, PMC_sub(sub)->seg, bp);
+ return set_retval(interpreter, 0, PMC_sub(sub)->seg, ctx);
}
void *
@@ -269,12 +269,12 @@ Parrot_runops_fromc_args(Parrot_Interp i
const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
va_end(args);
- return set_retval(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
@@ -283,12 +283,12 @@ Parrot_runops_fromc_args_reti(Parrot_Int
const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
va_end(args);
- return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
FLOATVAL
@@ -296,12 +296,12 @@ Parrot_runops_fromc_args_retf(Parrot_Int
const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
va_end(args);
- return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
void*
@@ -309,12 +309,12 @@ Parrot_run_meth_fromc_args(Parrot_Interp
PMC *sub, PMC *obj, STRING *meth, const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
va_end(args);
- return set_retval(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
INTVAL
@@ -322,12 +322,12 @@ Parrot_run_meth_fromc_args_reti(Parrot_I
PMC *sub, PMC *obj, STRING *meth, const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
va_end(args);
- return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
FLOATVAL
@@ -335,72 +335,72 @@ Parrot_run_meth_fromc_args_retf(Parrot_I
PMC *sub, PMC *obj, STRING *meth, const char *sig, ...)
{
va_list args;
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
va_start(args, sig);
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
va_end(args);
- return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
void *
Parrot_runops_fromc_arglist(Parrot_Interp interpreter, PMC *sub,
const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
- return set_retval(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ return set_retval(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
INTVAL
Parrot_runops_fromc_arglist_reti(Parrot_Interp interpreter, PMC *sub,
const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
- return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
FLOATVAL
Parrot_runops_fromc_arglist_retf(Parrot_Interp interpreter, PMC *sub,
const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
- return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, PMCNULL, NULL, sig, args);
+ return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
void*
Parrot_run_meth_fromc_arglist(Parrot_Interp interpreter,
PMC *sub, PMC *obj, STRING *meth, const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
- return set_retval(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
+ return set_retval(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
INTVAL
Parrot_run_meth_fromc_arglist_reti(Parrot_Interp interpreter,
PMC *sub, PMC *obj, STRING *meth, const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
- return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
+ return set_retval_i(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
FLOATVAL
Parrot_run_meth_fromc_arglist_retf(Parrot_Interp interpreter,
PMC *sub, PMC *obj, STRING *meth, const char *sig, va_list args)
{
- struct parrot_regs_t *bp;
+ parrot_context_t *ctx;
- bp = runops_args(interpreter, sub, obj, meth, sig, args);
- return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, bp);
+ ctx = runops_args(interpreter, sub, obj, meth, sig, args);
+ return set_retval_f(interpreter, *sig, PMC_sub(sub)->seg, ctx);
}
/*
Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c (original)
+++ trunk/src/interpreter.c Thu Oct 20 00:48:06 2005
@@ -370,11 +370,11 @@ init_prederef(Interp *interpreter, int w
sig = interpreter->code->const_table->constants[pc[1]]->u.key;
n += VTABLE_elements(interpreter, sig);
}
- pc += n;
- i += n;
/* count ops that need a PIC */
if (parrot_PIC_op_is_cached(interpreter, *pc))
n_pics++;
+ pc += n;
+ i += n;
}
interpreter->code->prederef.code = temp;