# New Ticket Created by Steve Peters
# Please include the string: [perl #42156]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42156 >
In this next round of cleanups, I switched over the invoke() methods
to return opcode_t* as Andy Dougherty suggested. Also, I added
a change to the NEED_CONTINUATION based on Kevin Tewks suggestions.
Finally, I also included a couple of additional changes to back out some
of my changes yesterday that are now irrelevant due to the first two
changes.
Steve Peters
[EMAIL PROTECTED]
Index: src/ops/object.ops
===================================================================
--- src/ops/object.ops (revision 17813)
+++ src/ops/object.ops (working copy)
@@ -60,8 +60,8 @@
"Method '%Ss' not found", meth);
}
interp->current_object = object;
- interp->current_cont = (PMC *)NEED_CONTINUATION;
- dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
+ interp->current_cont = NEED_CONTINUATION;
+ dest = VTABLE_invoke(interp, method_pmc, next);
goto ADDRESS(dest);
}
@@ -76,8 +76,8 @@
next = expr NEXT();
interp->current_object = object;
- interp->current_cont = (PMC *)NEED_CONTINUATION;
- dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
+ interp->current_cont = NEED_CONTINUATION;
+ dest = VTABLE_invoke(interp, method_pmc, next);
goto ADDRESS(dest);
}
Index: src/pmc/complex.pmc
===================================================================
--- src/pmc/complex.pmc (revision 17813)
+++ src/pmc/complex.pmc (working copy)
@@ -279,7 +279,7 @@
/*
-=item C<void* invoke(void* next)>
+=item C<opcode_t* invoke(void* next)>
Pythonic object constructor. SELF is a Complex Class object. Return a new
C<complex> object according to 2.1. Built-in Functions.
@@ -287,7 +287,7 @@
=cut
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
int argcP = REG_INT(3);
PMC *res = pmc_new(INTERP, enum_class_Complex);
if (argcP == 1) {
Index: src/pmc/retcontinuation.pmc
===================================================================
--- src/pmc/retcontinuation.pmc (revision 17813)
+++ src/pmc/retcontinuation.pmc (working copy)
@@ -74,7 +74,7 @@
}
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Transfers control to the calling context, and frees the current context.
@@ -82,7 +82,7 @@
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
struct Parrot_cont * cc = PMC_cont(SELF);
parrot_context_t *from_ctx = cc->from_ctx;
struct PackFile_ByteCode * const seg = cc->seg;
Index: src/pmc/parrotinterpreter.pmc
===================================================================
--- src/pmc/parrotinterpreter.pmc (revision 17813)
+++ src/pmc/parrotinterpreter.pmc (working copy)
@@ -284,7 +284,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Runs the interpreter's byte code.
@@ -292,7 +292,7 @@
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
Interp * new_interp =
(Interp *)PMC_data(SELF);
/*
Index: src/pmc/bound_nci.pmc
===================================================================
--- src/pmc/bound_nci.pmc (revision 17813)
+++ src/pmc/bound_nci.pmc (working copy)
@@ -33,7 +33,7 @@
Return the bound object.
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Calls the associated C method, returning C<*next>.
@@ -55,7 +55,7 @@
return PMC_pmc_val(SELF);
}
- void* invoke(void * next) {
+ opcode_t* invoke(void * next) {
if (PObj_get_FLAGS(SELF) & PObj_private0_FLAG) {
/* bound multi sub
* XXX maybe create separate PMC class
Index: src/pmc/multisub.pmc
===================================================================
--- src/pmc/multisub.pmc (revision 17813)
+++ src/pmc/multisub.pmc (working copy)
@@ -57,7 +57,7 @@
"attempt to set non Sub PMC");
}
- void* invoke(void *next) {
+ opcode_t* invoke(void *next) {
PMC *list = Parrot_mmd_sort_candidate_list(interp, SELF);
PMC *func = PMCNULL;
if (!PMC_IS_NULL(list))
Index: src/pmc/coroutine.pmc
===================================================================
--- src/pmc/coroutine.pmc (revision 17813)
+++ src/pmc/coroutine.pmc (working copy)
@@ -120,7 +120,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Swaps the "context".
@@ -128,7 +128,7 @@
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
struct Parrot_coro * co = PMC_coro(SELF);
parrot_context_t *caller_ctx;
struct PackFile_ByteCode *wanted_seg;
Index: src/pmc/delegate.pmc
===================================================================
--- src/pmc/delegate.pmc (revision 17813)
+++ src/pmc/delegate.pmc (working copy)
@@ -199,7 +199,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Invokes a subroutine.
@@ -207,7 +207,7 @@
*/
- void* invoke(void *next) {
+ opcode_t* invoke(void *next) {
STRING *meth = CONST_STRING(interp, "__invoke");
STRING *meth_v = CONST_STRING(interp, "invoke");
PMC *sub = Parrot_find_vtable_meth(interp, pmc, meth_v);
Index: src/pmc/continuation.pmc
===================================================================
--- src/pmc/continuation.pmc (revision 17813)
+++ src/pmc/continuation.pmc (working copy)
@@ -217,7 +217,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Restores the "context" of the interpreter and returns the branch
destination to continue execution.
@@ -226,7 +226,7 @@
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
struct Parrot_cont * cc = PMC_cont(SELF);
Stack_Chunk_t *stack_target = cc->dynamic_state;
Stack_Chunk_t *corresponding_target;
Index: src/pmc/compiler.pmc
===================================================================
--- src/pmc/compiler.pmc (revision 17813)
+++ src/pmc/compiler.pmc (working copy)
@@ -25,7 +25,7 @@
/*
-=item C<void *invoke(void *code_ptr)>
+=item C<opcode_t *invoke(void *code_ptr)>
Compiles the source code starting at C<code_ptr> and returns a new
C<Eval> PMC with a new PackFile attached.
@@ -34,7 +34,7 @@
*/
- void* invoke(void * code_ptr) {
+ opcode_t* invoke(void * code_ptr) {
return SUPER(code_ptr);
}
}
Index: src/pmc/closure.pmc
===================================================================
--- src/pmc/closure.pmc (revision 17813)
+++ src/pmc/closure.pmc (working copy)
@@ -84,7 +84,7 @@
sub->start_offs = addr - sub->seg->base.data;
}
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
struct Parrot_sub * sub = PMC_sub(SELF);
PMC *cont, *outer_sub;
Index: src/pmc/timer.pmc
===================================================================
--- src/pmc/timer.pmc (revision 17813)
+++ src/pmc/timer.pmc (working copy)
@@ -311,7 +311,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Adds the timer to the event queue.
@@ -319,7 +319,7 @@
*/
- void* invoke(void *next) {
+ opcode_t* invoke(void *next) {
add_timer(INTERP, SELF);
return next;
}
Index: src/pmc/exception_handler.pmc
===================================================================
--- src/pmc/exception_handler.pmc (revision 17813)
+++ src/pmc/exception_handler.pmc (working copy)
@@ -82,7 +82,7 @@
return result;
}
- void* invoke(void* ex) {
+ opcode_t* invoke(void* ex) {
struct Parrot_cont * cc = PMC_cont(SELF);
PMC *exception = ex;
parrot_context_t *ex_ctx;
Index: src/pmc/nci.pmc
===================================================================
--- src/pmc/nci.pmc (revision 17813)
+++ src/pmc/nci.pmc (working copy)
@@ -140,7 +140,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Calls the associated C function, returning C<*next>. If
the invocant is a class, the PMC arguments are
@@ -150,7 +150,7 @@
*/
- void* invoke(void * next) {
+ opcode_t* invoke(void * next) {
typedef INTVAL(*nci_sub_t)(Interp * , PMC * );
nci_sub_t func = PObj_flag_TEST(private2, SELF)
? (nci_sub_t) PMC_struct_val(SELF)
Index: src/pmc/eval.pmc
===================================================================
--- src/pmc/eval.pmc (revision 17813)
+++ src/pmc/eval.pmc (working copy)
@@ -124,7 +124,7 @@
}
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Invokes the first subroutine in the eval code.
@@ -132,7 +132,7 @@
*/
- void* invoke(void *next) {
+ opcode_t* invoke(void *next) {
PMC *sub = SELF.get_pmc_keyed_int(0);
return VTABLE_invoke(INTERP, sub, next);
}
Index: src/pmc/iterator.pmc
===================================================================
--- src/pmc/iterator.pmc (revision 17813)
+++ src/pmc/iterator.pmc (working copy)
@@ -407,7 +407,7 @@
/*
-=item C<void* invoke(void* next)>
+=item C<opcode_t* invoke(void* next)>
Return the next element of the aggregate. The return type may depend on
the aggregate. If there are no more items in the aggregate, I1 .. I4 are
@@ -418,7 +418,7 @@
=cut
*/
- void* invoke(void *next) {
+ opcode_t* invoke(void *next) {
PMC *agg, *key, *res;
INTVAL ires;
Index: src/pmc/sub.pmc
===================================================================
--- src/pmc/sub.pmc (revision 17813)
+++ src/pmc/sub.pmc (working copy)
@@ -202,7 +202,7 @@
/*
-=item C<void *invoke(void *next)>
+=item C<opcode_t *invoke(void *next)>
Invokes the subroutine.
@@ -210,7 +210,7 @@
*/
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
struct Parrot_sub * sub = PMC_sub(SELF);
parrot_context_t *caller_ctx;
struct Parrot_Context *context;
Index: src/dynpmc/subproxy.pmc
===================================================================
--- src/dynpmc/subproxy.pmc (revision 17813)
+++ src/dynpmc/subproxy.pmc (working copy)
@@ -22,7 +22,7 @@
PMC_data(SELF) = key;
}
- void* invoke(void* next) {
+ opcode_t* invoke(void* next) {
if (PObj_get_FLAGS(SELF) & PObj_private0_FLAG) {
PMC* key = PMC_data(SELF);
STRING* file;
Index: vtable.tbl
===================================================================
--- vtable.tbl (revision 17813)
+++ vtable.tbl (working copy)
@@ -333,7 +333,7 @@
PMC* nextkey_keyed_str(STRING* key, INTVAL what)
PMC* get_iter()
-void* invoke(void* next)
+opcode_t* invoke(void* next)
INTVAL can(STRING* method)
Index: lib/Parrot/Vtable.pm
===================================================================
--- lib/Parrot/Vtable.pm (revision 17813)
+++ lib/Parrot/Vtable.pm (working copy)
@@ -386,6 +386,7 @@
'void' => 'void',
'UINTVAL' => 'Parrot_Int',
'size_t' => 'size_t',
+ 'opcode_t*' => 'Parrot_Opcode*',
);
die "Unknown type $type\n" unless exists $typemap{$type};
Index: include/parrot/sub.h
===================================================================
--- include/parrot/sub.h (revision 17813)
+++ include/parrot/sub.h (working copy)
@@ -109,7 +109,7 @@
* a flag to signal a Sub that a new RetContinuation should be created
*/
-#define NEED_CONTINUATION ((void*)1)
+#define NEED_CONTINUATION ((PMC *)1)
/*
* Sub and Closure share a Parrot_sub structure.