Author: leo
Date: Wed Aug 3 08:58:48 2005
New Revision: 8776
Modified:
branches/leo-ctx5/include/parrot/inter_call.h
branches/leo-ctx5/src/inter_call.c
Log:
Adjust va_list handling to scheme used in misc/spf_vtable
* pass a PARROT_VA_TO_VAPTR() and store that in call state
* this should fix amd64 build
Modified: branches/leo-ctx5/include/parrot/inter_call.h
==============================================================================
--- branches/leo-ctx5/include/parrot/inter_call.h (original)
+++ branches/leo-ctx5/include/parrot/inter_call.h Wed Aug 3 08:58:48 2005
@@ -28,7 +28,7 @@ struct call_state_1 {
int mode; /* from_sig, from_set_ops, flatten ...*/
union {
struct {
- va_list ap;
+ void *ap; /* a ptr to va_list */
const char *sig;
} sig;
struct {
@@ -55,7 +55,7 @@ struct call_state {
int Parrot_init_arg_sig(Interp *, struct PackFile_ByteCode *seg,
struct parrot_regs_t *regs,
- const char *sig, va_list ap, struct call_state_1 *st);
+ 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,
@@ -74,7 +74,7 @@ int parrot_check_tail_call(Interp*, stru
opcode_t * parrot_pass_args(Interp *, struct PackFile_ByteCode *seg,
struct parrot_regs_t *caller_regs, int what);
opcode_t * parrot_pass_args_fromc(Interp *, const char *sig, INTVAL src_n,
- opcode_t *dest, parrot_context_t * ctxp, va_list ap);
+ opcode_t *dest, parrot_context_t * ctxp, void *ap);
FLOATVAL set_retval_f(Interp*, int sig_ret,
struct PackFile_ByteCode *seg, struct parrot_regs_t *bp);
void* set_retval(Interp*, int sig_ret,
Modified: branches/leo-ctx5/src/inter_call.c
==============================================================================
--- branches/leo-ctx5/src/inter_call.c (original)
+++ branches/leo-ctx5/src/inter_call.c Wed Aug 3 08:58:48 2005
@@ -30,7 +30,7 @@ subroutines.
=item C<int Parrot_init_arg_sig(Interp *, struct PackFile_ByteCode *seg,
struct parrot_regs_t *regs,
- const char *sig, va_list ap, struct call_state_1 *st)>
+ 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.
@@ -105,7 +105,7 @@ Parrot_init_arg_op(Interp *interpreter,
int
Parrot_init_arg_sig(Interp *interpreter, struct PackFile_ByteCode *seg,
struct parrot_regs_t *regs,
- const char *sig, va_list ap, struct call_state_1 *st)
+ const char *sig, void *ap, struct call_state_1 *st)
{
st->i = -1;
@@ -114,7 +114,10 @@ Parrot_init_arg_sig(Interp *interpreter,
st->regs = regs;
if (*sig) {
st->u.sig.sig = sig - 1;
- st->u.sig.ap = ap;
+ if (ap)
+ st->u.sig.ap = ap;
+ else
+ st->u.sig.ap = NULL;
st->n = strlen(sig);
}
return st->n > 0;
@@ -213,7 +216,8 @@ flatten:
static int
fetch_arg_int_sig(Interp *interpreter, struct call_state *st)
{
- UVal_int(st->val) = va_arg(st->src.u.sig.ap, INTVAL);
+ va_list *ap = (va_list*)(st->src.u.sig.ap);
+ UVal_int(st->val) = va_arg(*ap, INTVAL);
st->src.mode |= CALL_STATE_NEXT_ARG;
return 1;
}
@@ -221,7 +225,8 @@ fetch_arg_int_sig(Interp *interpreter, s
static int
fetch_arg_num_sig(Interp *interpreter, struct call_state *st)
{
- UVal_num(st->val) = va_arg(st->src.u.sig.ap, FLOATVAL);
+ va_list *ap = (va_list*)(st->src.u.sig.ap);
+ UVal_num(st->val) = va_arg(*ap, FLOATVAL);
st->src.mode |= CALL_STATE_NEXT_ARG;
return 1;
}
@@ -229,7 +234,8 @@ fetch_arg_num_sig(Interp *interpreter, s
static int
fetch_arg_str_sig(Interp *interpreter, struct call_state *st)
{
- UVal_str(st->val) = va_arg(st->src.u.sig.ap, STRING*);
+ va_list *ap = (va_list*)(st->src.u.sig.ap);
+ UVal_str(st->val) = va_arg(*ap, STRING*);
st->src.mode |= CALL_STATE_NEXT_ARG;
return 1;
}
@@ -237,7 +243,8 @@ fetch_arg_str_sig(Interp *interpreter, s
static int
fetch_arg_pmc_sig(Interp *interpreter, struct call_state *st)
{
- UVal_pmc(st->val) = va_arg(st->src.u.sig.ap, PMC*);
+ va_list *ap = (va_list*)(st->src.u.sig.ap);
+ UVal_pmc(st->val) = va_arg(*ap, PMC*);
st->src.mode |= CALL_STATE_NEXT_ARG;
return 1;
}
@@ -747,7 +754,7 @@ parrot_pass_args_fromc(Interp *interpret
Parrot_init_arg_op(interpreter, interpreter->code,
interpreter->ctx.bp, dest, &st.dest);
todo = Parrot_init_arg_sig(interpreter, interpreter->code,
- old_ctxp->bp, sig, ap, &st.src);
+ old_ctxp->bp, sig, PARROT_VA_TO_VAPTR(ap), &st.src);
st.opt_so_far = 0; /* XXX */
while (todo) {