[svn:parrot] r43065 - in branches/context_unify3/src: call ops
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Dec 15 10:44:50 UTC 2009
Author: chromatic
Date: Tue Dec 15 10:44:50 2009
New Revision: 43065
URL: https://trac.parrot.org/parrot/changeset/43065
Log:
[ops] Reformatted code; no functional changes.
Modified:
branches/context_unify3/src/call/args.c
branches/context_unify3/src/ops/core.ops
Modified: branches/context_unify3/src/call/args.c
==============================================================================
--- branches/context_unify3/src/call/args.c Tue Dec 15 10:35:46 2009 (r43064)
+++ branches/context_unify3/src/call/args.c Tue Dec 15 10:44:50 2009 (r43065)
@@ -2421,53 +2421,23 @@
return;
else {
/* Broke encapuslation. Direct poking into CallContext is much faster */
- /* In tailcall we don't push freshly created CallContext. Instead we
- * are copying parameters into current one and destroy new.
- * Ok-ok. Not actually copying, but swapping to avoid memory
- * management hassle */
- struct Pcc_cell *pos1, *pos2;
- PMC *pmc1, *pmc2;
- STRING *string1, *string2;
- INTVAL int1, int2;
- Hash *hash1, *hash2;
-
- GETATTR_CallContext_positionals(interp, parent, pos1);
- GETATTR_CallContext_positionals(interp, tailcall, pos2);
- SETATTR_CallContext_positionals(interp, parent, pos2);
- SETATTR_CallContext_positionals(interp, tailcall, pos1);
-
- GETATTR_CallContext_type_tuple(interp, parent, pmc1);
- GETATTR_CallContext_type_tuple(interp, tailcall, pmc2);
- SETATTR_CallContext_type_tuple(interp, parent, pmc2);
- SETATTR_CallContext_type_tuple(interp, tailcall, pmc1);
-
- GETATTR_CallContext_short_sig(interp, parent, string1);
- GETATTR_CallContext_short_sig(interp, tailcall, string2);
- SETATTR_CallContext_short_sig(interp, parent, string2);
- SETATTR_CallContext_short_sig(interp, tailcall, string1);
-
- GETATTR_CallContext_arg_flags(interp, parent, pmc1);
- GETATTR_CallContext_arg_flags(interp, tailcall, pmc2);
- SETATTR_CallContext_arg_flags(interp, parent, pmc2);
- SETATTR_CallContext_arg_flags(interp, tailcall, pmc1);
-
- /* XXX Do we need it? */
- /*
- GETATTR_CallContext_return_flags(interp, parent, pmc1);
- GETATTR_CallContext_return_flags(interp, tailcall, pmc2);
- SETATTR_CallContext_return_flags(interp, parent, pmc2);
- SETATTR_CallContext_return_flags(interp, tailcall, pmc1);
- */
-
- GETATTR_CallContext_hash(interp, parent, hash1);
- GETATTR_CallContext_hash(interp, tailcall, hash2);
- SETATTR_CallContext_hash(interp, parent, hash2);
- SETATTR_CallContext_hash(interp, tailcall, hash1);
-
- GETATTR_CallContext_num_positionals(interp, parent, int1);
- GETATTR_CallContext_num_positionals(interp, tailcall, int2);
- SETATTR_CallContext_num_positionals(interp, parent, int2);
- SETATTR_CallContext_num_positionals(interp, tailcall, int1);
+ void ** returns_values;
+ void ** tailcall_returns_values;
+ INTVAL returns_size;
+ PMC * return_flags;
+
+ GETATTR_CallContext_returns_size(interp, parent, returns_size);
+ GETATTR_CallContext_returns_values(interp, parent, returns_values);
+
+ /* Resize tailcall.returns_values to new size */
+ tailcall_returns_values = csr_reallocate_return_values(interp, tailcall, returns_size);
+
+ /* And copy values over it */
+ mem_copy_n_typed(tailcall_returns_values, returns_values, returns_size, void**);
+
+ /* Store raw signature */
+ GETATTR_CallContext_return_flags(interp, parent, return_flags);
+ SETATTR_CallContext_return_flags(interp, tailcall, return_flags);
}
}
Modified: branches/context_unify3/src/ops/core.ops
==============================================================================
--- branches/context_unify3/src/ops/core.ops Tue Dec 15 10:35:46 2009 (r43064)
+++ branches/context_unify3/src/ops/core.ops Tue Dec 15 10:44:50 2009 (r43065)
@@ -519,16 +519,14 @@
op set_args(inconst PMC) :flow {
- opcode_t * const raw_args = CUR_OPCODE;
- PMC * const signature = $1;
- PMC * call_sig;
- INTVAL argc;
+ opcode_t * const raw_args = CUR_OPCODE;
+ PMC * const signature = $1;
+ PMC *call_sig = Parrot_pcc_build_sig_object_from_op(interp,
+ PMCNULL, signature, raw_args);
+ INTVAL argc = VTABLE_elements(interp, signature);
- call_sig = Parrot_pcc_build_sig_object_from_op(interp,
- PMCNULL, signature, raw_args);
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_sig);
- argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -549,15 +547,11 @@
op get_params(inconst PMC) :flow {
opcode_t * const raw_params = CUR_OPCODE;
- PMC *caller_ctx, *ctx;
- PMC *ccont, *call_object;
- PMC * const signature = $1;
- INTVAL argc;
-
- ctx = CURRENT_CONTEXT(interp);
- ccont = Parrot_pcc_get_continuation(interp, ctx);
-
- caller_ctx = Parrot_pcc_get_caller_ctx(interp, ctx);
+ PMC * const signature = $1;
+ PMC *ctx = CURRENT_CONTEXT(interp);
+ PMC *ccont = Parrot_pcc_get_continuation(interp, ctx);
+ PMC *caller_ctx = Parrot_pcc_get_caller_ctx(interp, ctx);
+ INTVAL argc = VTABLE_elements(interp, signature);
Parrot_pcc_fill_params_from_op(interp, ctx, signature, raw_params);
@@ -565,9 +559,10 @@
if (PObj_get_FLAGS(ccont) & SUB_FLAG_TAILCALL) {
PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
Parrot_pcc_dec_recursion_depth(interp, ctx);
- Parrot_pcc_set_caller_ctx(interp, ctx, Parrot_pcc_get_caller_ctx(interp, caller_ctx));
+ Parrot_pcc_set_caller_ctx(interp, ctx,
+ Parrot_pcc_get_caller_ctx(interp, caller_ctx));
}
- argc = VTABLE_elements(interp, signature);
+
goto OFFSET(argc + 2);
}
More information about the parrot-commits
mailing list