Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Kill NEED_CONTINUATION ugly hack.

Continuation is always created on caller side now.
  • Loading branch information...
commit 2caf6ce7a4ab1dcb9ad0f3c3135561fe5ecb596a 1 parent 0cb86fe
@bacek bacek authored
View
6 include/parrot/sub.h
@@ -103,12 +103,6 @@ typedef enum {
#define Sub_comp_INIT_CLEAR(o) Sub_comp_flag_CLEAR(PF_INIT, o)
/*
- * a flag to signal a Sub that a new Continuation should be created
- */
-
-#define NEED_CONTINUATION ((PMC *)1)
-
-/*
* maximum sub recursion depth
*/
View
5 src/gc/mark_sweep.c
@@ -214,14 +214,11 @@ static void
mark_interp(PARROT_INTERP)
{
ASSERT_ARGS(mark_interp)
- PObj *obj;
/* mark the list of iglobals */
Parrot_gc_mark_PMC_alive(interp, interp->iglobals);
/* mark the current continuation */
- obj = (PObj *)interp->current_cont;
- if (obj && obj != (PObj *)NEED_CONTINUATION)
- Parrot_gc_mark_PMC_alive(interp, (PMC *)obj);
+ Parrot_gc_mark_PMC_alive(interp, interp->current_cont);
/* mark the current context. */
Parrot_gc_mark_PMC_alive(interp, interp->cur_task);
View
5 src/pmc/coroutine.pmc
@@ -176,10 +176,7 @@ Swaps the "context".
PMC *ctx = Parrot_pcc_get_signature(INTERP, caller_ctx);
PMC *ccont = INTERP->current_cont;
- if (ccont == NEED_CONTINUATION) {
- ccont = Parrot_pmc_new(INTERP, enum_class_Continuation);
- VTABLE_set_pointer(INTERP, ccont, next_op);
- }
+ PARROT_ASSERT(!PMC_IS_NULL(ccont));
if (PObj_get_FLAGS(ccont) & SUB_FLAG_TAILCALL)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
View
2  src/pmc/imccompiler.pmc
@@ -150,7 +150,7 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
/* Handle the case where we we've been tailcalled into. See NCI.invoke
for more details */
- if (cont && cont != NEED_CONTINUATION
+ if (!PMC_IS_NULL(cont)
&& (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
next = VTABLE_invoke(INTERP, cont, next);
View
2  src/pmc/nativepccmethod.pmc
@@ -125,7 +125,7 @@ Call the function pointer.
{
PMC *cont = INTERP->current_cont;
- if (cont && cont != NEED_CONTINUATION
+ if (!PMC_IS_NULL(cont)
&& (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
next = VTABLE_invoke(INTERP, cont, next);
View
2  src/pmc/nci.pmc
@@ -278,7 +278,7 @@ class, the PMC arguments are shifted down.
* return continuation here, which gets rid of this frame
* and returns the real return address
*/
- if (cont && cont != NEED_CONTINUATION
+ if (!PMC_IS_NULL(cont)
&& (PObj_get_FLAGS(cont) & SUB_FLAG_TAILCALL)) {
cont = Parrot_pcc_get_continuation(interp, CURRENT_CONTEXT(interp));
next = VTABLE_invoke(INTERP, cont, next);
View
2  src/pmc/parrotinterpreter.pmc
@@ -173,8 +173,6 @@ create_interp(ARGIN(PMC *self), ARGIN_NULLOK(Parrot_Interp parent))
VTABLE_set_pmc_keyed_int(new_interp, new_interp->iglobals,
(INTVAL) IGLOBALS_INTERPRETER, self);
-
- new_interp->current_cont = NEED_CONTINUATION;
}
pmclass ParrotInterpreter no_ro manual_attrs provides invokable {
View
6 src/pmc/sub.pmc
@@ -414,12 +414,6 @@ Invokes the subroutine.
pc = sub->seg->base.data + sub->start_offs;
INTERP->current_cont = NULL;
- PARROT_ASSERT(ccont != NEED_CONTINUATION);
- if (ccont == NEED_CONTINUATION) {
- ccont = Parrot_pmc_new(INTERP, enum_class_Continuation);
- VTABLE_set_pointer(INTERP, ccont, next);
- }
-
PARROT_ASSERT(!PMC_IS_NULL(ccont));
if (PMC_IS_NULL(context))
Please sign in to comment.
Something went wrong with that request. Please try again.