Author: leo
Date: Wed Jul 13 23:09:38 2005
New Revision: 8626
Modified:
branches/leo-ctx5/classes/continuation.pmc
branches/leo-ctx5/classes/coroutine.pmc
branches/leo-ctx5/classes/retcontinuation.pmc
branches/leo-ctx5/src/inter_create.c
branches/leo-ctx5/src/inter_run.c
Log:
less bogus ref_count handling for context
Modified: branches/leo-ctx5/classes/continuation.pmc
==============================================================================
--- branches/leo-ctx5/classes/continuation.pmc (original)
+++ branches/leo-ctx5/classes/continuation.pmc Wed Jul 13 23:09:38 2005
@@ -62,7 +62,6 @@ Initializes the continuation.
void init () {
PMC_cont(SELF) = new_continuation(INTERP);
PMC_pmc_val(SELF) = NULL;
- CONTEXT(PMC_cont(SELF)->ctx)->ref_count++;
PObj_custom_mark_destroy_SETALL(SELF);
/*
* Whenever we create a continuation, all return continuations
@@ -129,11 +128,10 @@ Creates and returns a clone of the conti
/*
* the context is now referenced by both continuations
*/
- CONTEXT(cc->ctx)->ref_count++;
+ CONTEXT(cc_self->ctx)->ref_count++;
PMC_pmc_val(ret) = PMC_pmc_val(SELF);
cc->ctx_copy = mem_sys_allocate(sizeof(struct Parrot_Context));
- memcpy(cc->ctx_copy,
- cc_self->ctx_copy ? cc_self->ctx_copy : CONTEXT(cc_self->ctx),
+ memcpy(cc->ctx_copy, CONTEXT(cc_self->ctx),
sizeof(struct Parrot_Context));
return ret;
}
Modified: branches/leo-ctx5/classes/coroutine.pmc
==============================================================================
--- branches/leo-ctx5/classes/coroutine.pmc (original)
+++ branches/leo-ctx5/classes/coroutine.pmc Wed Jul 13 23:09:38 2005
@@ -104,7 +104,6 @@ Swaps the "context".
/*
* first time set current sub, cont, object
*/
- CONTEXT(INTERP->ctx)->ref_count++;
Parrot_alloc_context(INTERP);
co->ctx = INTERP->ctx;
wanted_seg = co->seg;
Modified: branches/leo-ctx5/classes/retcontinuation.pmc
==============================================================================
--- branches/leo-ctx5/classes/retcontinuation.pmc (original)
+++ branches/leo-ctx5/classes/retcontinuation.pmc Wed Jul 13 23:09:38 2005
@@ -40,7 +40,6 @@ Initializes the continuation.
void init () {
PMC_cont(SELF) = new_ret_continuation(INTERP);
PMC_pmc_val(SELF) = NULL;
- CONTEXT(PMC_cont(SELF)->ctx)->ref_count++;
PObj_custom_mark_destroy_SETALL(SELF);
}
Modified: branches/leo-ctx5/src/inter_create.c
==============================================================================
--- branches/leo-ctx5/src/inter_create.c (original)
+++ branches/leo-ctx5/src/inter_create.c Wed Jul 13 23:09:38 2005
@@ -252,7 +252,7 @@ init_context(Interp *interpreter, parrot
memcpy(CONTEXT(interpreter->ctx),
CONTEXT(old), sizeof(struct Parrot_Context));
CONTEXT(interpreter->ctx)->prev = old.rctx;
- CONTEXT(interpreter->ctx)->ref_count = 0;
+ CONTEXT(interpreter->ctx)->ref_count = 1;
CONTEXT(interpreter->ctx)->current_results = NULL;
CONTEXT(interpreter->ctx)->current_args = NULL;
@@ -415,11 +415,10 @@ Parrot_free_context(Interp *interpreter,
struct Parrot_Context *free_list;
/*
- * The context structure has a reference count, initially 0
+ * The context structure has a reference count, initially 1
* it' incrementented when a (ret)continuation is created or
* a continuation is cloned (and when a coroutine refers to
- * another sub)
- * Therefore the ref_count := 0 in leaf subs
+ * another sub XXX)
*/
if (--CONTEXT(*ctxp)->ref_count <= 0) {
free_list = (struct Parrot_Context *) interpreter->ctx_mem.free;
Modified: branches/leo-ctx5/src/inter_run.c
==============================================================================
--- branches/leo-ctx5/src/inter_run.c (original)
+++ branches/leo-ctx5/src/inter_run.c Wed Jul 13 23:09:38 2005
@@ -307,6 +307,16 @@ the latter handles return values and yie
*/
/* XXX */
#define CONST_STRING(i,s) const_string(i,s)
+
+#ifdef PREMATURE_OPT
+
+#undef VTABLE_elements
+#define VTABLE_elements(i, ar) PMC_int_val(ar)
+#undef VTABLE_get_integer_keyed_int
+#define VTABLE_get_integer_keyed_int(i, ar, idx) ((INTVAL*)PMC_data(ar))[idx]
+
+#endif
+
opcode_t *
parrot_pass_args(Interp *interpreter, struct PackFile_ByteCode *dst_seg,
struct parrot_regs_t *caller_regs, int what)