Permalink
Browse files

Merged pcc_hackathon_6Mar10 into trunk. Because this changed op numbe…

…ring, you

likely need to make realclean.

git-svn-id: https://svn.parrot.org/parrot/trunk@45108 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 268d15a commit 363ca41fa8984c6c6859cdb6a7f3adfda8d5b256 @chromatic chromatic committed Mar 22, 2010
@@ -277,19 +277,15 @@ instruction_writes(ARGIN(const Instruction *ins), ARGIN(const SymReg *r))
const int f = ins->flags;
int j;
- /*
- * a get_results opcode is before the actual sub call
- * but for the register allocator, the effect matters, thus
- * postpone the effect after the invoke
- */
+ /* a get_results opcode occurs after the actual sub call */
if (ins->opnum == PARROT_OP_get_results_pc) {
int i;
/* but only if it isn't the get_results opcode of
* an ExceptionHandler, which doesn't have
* a call next
*/
- if (ins->next && (ins->next->type & ITPCCSUB))
+ if (ins->prev && (ins->prev->type & ITPCCSUB))
return 0;
for (i = ins->symreg_count - 1; i >= 0; --i) {
@@ -308,7 +304,7 @@ instruction_writes(ARGIN(const Instruction *ins), ARGIN(const SymReg *r))
* structure
*/
while (ins && ins->opnum != PARROT_OP_get_results_pc)
- ins = ins->prev;
+ ins = ins->next;
if (!ins)
return 0;
@@ -344,6 +340,7 @@ instruction_writes(ARGIN(const Instruction *ins), ARGIN(const SymReg *r))
return 0;
}
+
/*
=item C<int get_branch_regno(const Instruction *ins)>
View
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2009, Parrot Foundation.
+ * Copyright (C) 2003-2010, Parrot Foundation.
* $Id$
*/
@@ -416,7 +416,8 @@ expand_pcc_sub(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGIN(Instruction *ins))
SymReg *regs[2];
/* if this sub is a method, unshift 'self' as first param */
- if ((unit->type & IMC_HAS_SELF) || (sub->pcc_sub->pragma & (P_METHOD | P_VTABLE))) {
+ if ((unit->type & IMC_HAS_SELF)
+ || (sub->pcc_sub->pragma & (P_METHOD | P_VTABLE))) {
SymReg *self = get_sym(interp, "self");
if (!self) {
self = mk_symreg(interp, "self", 'P');
@@ -866,11 +867,6 @@ expand_pcc_sub_call(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *i
return;
}
- /* handle return results */
- n = sub->pcc_sub->nret;
- ins = pcc_get_args(interp, unit, ins, "get_results", n,
- sub->pcc_sub->ret, sub->pcc_sub->ret_flags);
-
/* insert the call */
if (meth_call) {
regs[0] = sub->pcc_sub->object;
@@ -899,6 +895,11 @@ expand_pcc_sub_call(PARROT_INTERP, ARGMOD(IMC_Unit *unit), ARGMOD(Instruction *i
}
ins->type |= ITPCCSUB;
+
+ /* handle return results */
+ n = sub->pcc_sub->nret;
+ ins = pcc_get_args(interp, unit, ins, "get_results", n,
+ sub->pcc_sub->ret, sub->pcc_sub->ret_flags);
}
/*
@@ -81,6 +81,8 @@ my $foo = $interp->find_global('foo');
$pmc = $foo->invoke( 'S->P', 'BAR' );
is( $pmc->get_string(), 'BAR FOO ',
'... and compiled sub should work just like any other Sub pmc' );
+=cut
+my $foo;
=cut
View
@@ -1,5 +1,5 @@
/* call.h
- * Copyright (C) 2001-2008, Parrot Foundation.
+ * Copyright (C) 2001-2010, Parrot Foundation.
* SVN Info
* $Id$
* Overview:
@@ -157,14 +157,25 @@ void runops(PARROT_INTERP, size_t offs)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-void Parrot_pcc_append_result(PARROT_INTERP,
- ARGIN(PMC *sig_object),
- ARGIN(STRING *type),
- ARGIN(void *result))
+PARROT_CANNOT_RETURN_NULL
+PMC* Parrot_pcc_build_call_from_c_args(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *signature),
+ ARGIN(const char *sig),
+ ...)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC* Parrot_pcc_build_call_from_varargs(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *signature),
+ ARGIN(const char *sig),
+ ARGMOD(va_list *args))
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
__attribute__nonnull__(3)
- __attribute__nonnull__(4);
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*args);
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
@@ -187,17 +198,6 @@ PMC* Parrot_pcc_build_sig_object_from_varargs(PARROT_INTERP,
__attribute__nonnull__(1)
__attribute__nonnull__(3);
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PMC* Parrot_pcc_build_sig_object_returns_from_op(PARROT_INTERP,
- ARGIN_NULLOK(PMC *signature),
- ARGIN(PMC *raw_sig),
- ARGIN(opcode_t *raw_args))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4);
-
PARROT_EXPORT
void Parrot_pcc_fill_params_from_c_args(PARROT_INTERP,
ARGMOD(PMC *call_object),
@@ -212,40 +212,24 @@ PARROT_EXPORT
void Parrot_pcc_fill_params_from_op(PARROT_INTERP,
ARGMOD_NULLOK(PMC *call_object),
ARGIN(PMC *raw_sig),
- ARGIN(opcode_t *raw_params))
+ ARGIN(opcode_t *raw_params),
+ Errors_classes direction)
__attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
FUNC_MODIFIES(*call_object);
PARROT_EXPORT
-void Parrot_pcc_fill_returns_from_c_args(PARROT_INTERP,
+void Parrot_pcc_fill_params_from_varargs(PARROT_INTERP,
ARGMOD_NULLOK(PMC *call_object),
ARGIN(const char *signature),
- ...)
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*call_object);
-
-PARROT_EXPORT
-void Parrot_pcc_fill_returns_from_continuation(PARROT_INTERP,
- ARGMOD_NULLOK(PMC *call_object),
- ARGIN(PMC *raw_sig),
- ARGIN(PMC *from_call_obj))
+ ARGMOD(va_list *args),
+ Errors_classes direction)
__attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
- FUNC_MODIFIES(*call_object);
-
-PARROT_EXPORT
-void Parrot_pcc_fill_returns_from_op(PARROT_INTERP,
- ARGMOD_NULLOK(PMC *call_object),
- ARGIN(PMC *raw_sig),
- ARGIN(opcode_t *raw_returns))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*call_object);
+ FUNC_MODIFIES(*call_object)
+ FUNC_MODIFIES(*args);
void Parrot_pcc_merge_signature_for_tailcall(PARROT_INTERP,
ARGMOD_NULLOK(PMC * parent),
@@ -266,11 +250,27 @@ void Parrot_pcc_parse_signature_string(PARROT_INTERP,
FUNC_MODIFIES(*arg_flags)
FUNC_MODIFIES(*return_flags);
-#define ASSERT_ARGS_Parrot_pcc_append_result __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+PARROT_CAN_RETURN_NULL
+void Parrot_pcc_split_signature_string(PARROT_INTERP,
+ ARGIN(const char *signature),
+ ARGMOD(char **arg_sig),
+ ARGMOD(char **return_sig))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*arg_sig)
+ FUNC_MODIFIES(*return_sig);
+
+#define ASSERT_ARGS_Parrot_pcc_build_call_from_c_args \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sig_object) \
- , PARROT_ASSERT_ARG(type) \
- , PARROT_ASSERT_ARG(result))
+ , PARROT_ASSERT_ARG(sig))
+#define ASSERT_ARGS_Parrot_pcc_build_call_from_varargs \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sig) \
+ , PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_Parrot_pcc_build_sig_object_from_op \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -280,11 +280,6 @@ void Parrot_pcc_parse_signature_string(PARROT_INTERP,
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(sig))
-#define ASSERT_ARGS_Parrot_pcc_build_sig_object_returns_from_op \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(raw_sig) \
- , PARROT_ASSERT_ARG(raw_args))
#define ASSERT_ARGS_Parrot_pcc_fill_params_from_c_args \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -295,20 +290,11 @@ void Parrot_pcc_parse_signature_string(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(raw_sig) \
, PARROT_ASSERT_ARG(raw_params))
-#define ASSERT_ARGS_Parrot_pcc_fill_returns_from_c_args \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(signature))
-#define ASSERT_ARGS_Parrot_pcc_fill_returns_from_continuation \
+#define ASSERT_ARGS_Parrot_pcc_fill_params_from_varargs \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(raw_sig) \
- , PARROT_ASSERT_ARG(from_call_obj))
-#define ASSERT_ARGS_Parrot_pcc_fill_returns_from_op \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(raw_sig) \
- , PARROT_ASSERT_ARG(raw_returns))
+ , PARROT_ASSERT_ARG(signature) \
+ , PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_Parrot_pcc_merge_signature_for_tailcall \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
@@ -318,6 +304,12 @@ void Parrot_pcc_parse_signature_string(PARROT_INTERP,
, PARROT_ASSERT_ARG(signature) \
, PARROT_ASSERT_ARG(arg_flags) \
, PARROT_ASSERT_ARG(return_flags))
+#define ASSERT_ARGS_Parrot_pcc_split_signature_string \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(signature) \
+ , PARROT_ASSERT_ARG(arg_sig) \
+ , PARROT_ASSERT_ARG(return_sig))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/call/args.c */
View
@@ -223,12 +223,6 @@ UINTVAL Parrot_pcc_get_recursion_depth_func(PARROT_INTERP, ARGIN(PMC *ctx))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-PMC* Parrot_pcc_get_results_signature_func(PARROT_INTERP, ARGIN(PMC *ctx))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_signature_func(PARROT_INTERP, ARGIN(PMC *ctx))
@@ -328,13 +322,6 @@ void Parrot_pcc_set_pred_offset_func(PARROT_INTERP,
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_EXPORT
-void Parrot_pcc_set_results_signature_func(PARROT_INTERP,
- ARGIN(PMC *ctx),
- ARGIN_NULLOK(PMC *sig))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_EXPORT
void Parrot_pcc_set_signature_func(PARROT_INTERP,
ARGIN(PMC *ctx),
@@ -452,10 +439,6 @@ UINTVAL Parrot_pcc_warnings_test_func(PARROT_INTERP,
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
-#define ASSERT_ARGS_Parrot_pcc_get_results_signature_func \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
@@ -507,10 +490,6 @@ UINTVAL Parrot_pcc_warnings_test_func(PARROT_INTERP,
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
-#define ASSERT_ARGS_Parrot_pcc_set_results_signature_func \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_set_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ctx))
@@ -551,9 +530,6 @@ UINTVAL Parrot_pcc_warnings_test_func(PARROT_INTERP,
# define Parrot_pcc_get_caller_ctx(i, c) (__C(c)->caller_ctx)
# define Parrot_pcc_set_caller_ctx(i, c, value) (__C(c)->caller_ctx = (value))
-# define Parrot_pcc_get_results_signature(i, c) (__C(c)->results_signature)
-# define Parrot_pcc_set_results_signature(i, c, value) (__C(c)->results_signature = (value))
-
# define Parrot_pcc_get_namespace(i, c) (__C(c)->current_namespace)
# define Parrot_pcc_set_namespace(i, c, value) (__C(c)->current_namespace = (value))
@@ -615,9 +591,6 @@ UINTVAL Parrot_pcc_warnings_test_func(PARROT_INTERP,
# define Parrot_pcc_get_caller_ctx(i, c) Parrot_pcc_get_caller_ctx_func((i), (c))
# define Parrot_pcc_set_caller_ctx(i, c, value) Parrot_pcc_set_caller_ctx_func((i), (c), (value))
-# define Parrot_pcc_get_results_signature(i, c) Parrot_pcc_get_results_signature_func((i), (c))
-# define Parrot_pcc_set_results_signature(i, c, value) Parrot_pcc_set_results_signature_func((i), (c), (value))
-
# define Parrot_pcc_get_namespace(i, c) Parrot_pcc_get_namespace_func((i), (c))
# define Parrot_pcc_set_namespace(i, c, value) Parrot_pcc_set_namespace_func((i), (c), (value))
@@ -140,7 +140,10 @@ sub generate_accessor {
/* Generated macro accessors for '$attrname' attribute of $pmcname PMC. */
#define GETATTR_${pmcname}_${attrname}(interp, pmc, dest) \\
do { \\
- if (PObj_is_object_TEST(pmc)) { \\
+ if (!PObj_is_object_TEST(pmc)) { \\
+ (dest) = ((Parrot_${pmcname}_attributes *)PMC_data(pmc))->$attrname; \\
+ } \\
+ else { \\
EOA
if ($isfuncptr == 1) {
@@ -189,8 +192,6 @@ EOA
$decl .= <<"EOA";
} \\
- else \\
- (dest) = ((Parrot_${pmcname}_attributes *)PMC_data(pmc))->$attrname; \\
} while (0)
#define SETATTR_${pmcname}_${attrname}(interp, pmc, value) \\
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2008, Parrot Foundation.
+# Copyright (C) 2004-2010, Parrot Foundation.
# $Id$
package Parrot::Pmc2c::PCCMETHOD;
@@ -258,7 +258,8 @@ END
/*BEGIN RETURN $returns */
END
$e->emit( <<"END", __FILE__, __LINE__ + 1 );
- Parrot_pcc_fill_returns_from_c_args(interp, _call_object, "$returns_signature",
+ interp->current_object = PMCNULL;
+ Parrot_pcc_build_call_from_c_args(interp, _call_object, "$returns_signature",
$returns_varargs);
return;
/*END RETURN $returns */
@@ -416,8 +417,6 @@ sub rewrite_pccmethod {
PMC * const _ccont = Parrot_pcc_get_continuation(interp, _ctx);
PMC * const _call_object = Parrot_pcc_get_signature(interp, _ctx);
- Parrot_pcc_set_signature(interp, _ctx, NULL);
-
{ /* BEGIN PARMS SCOPE */
END
$e->emit(<<"END");
Oops, something went wrong.

0 comments on commit 363ca41

Please sign in to comment.