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
st...@fisharerojo.org
Thanks for the patch, however, applying it generates the warning: (on
linux x86; gcc)
src/sub.c: In function `mark_context':
src/sub.c:55: warning: comparison of distinct pointer types lacks a cast
I'm not sure how to proceed from here, and I hoped you would. How
should the patch be altered so that the warning doesn't appear?
Paul
Below is an additional change for src/sub.c.
I had been looking at this function for additional changes, but
I'd rather get this patch taken care of first, since the rest remaining
changes are made easier by this patch going in first.
I also noticed a warning with src/debug.c. There are certainly, however,
some rather severe existing problems with the Parrot debugger that I don't
know I am qualified to handle. It's pretty obvious that the previous
expectation that VTABLE_invoke() would return something that could be
turned into a PackFile was incorrect since everywhere else it's expected to
return an opcode_t*. I'm certain that I do not have the right answers, but
getting the Parrot Debugger to work may be a great exercize for a future
microgrant winner (hint hint).
Steve Peters
st...@fisharerojo.org
Index: src/sub.c
===================================================================
--- src/sub.c (revision 17850)
+++ src/sub.c (working copy)
@@ -52,7 +52,7 @@
* and GC the continuation
*/
obj = (PObj*)interp->current_cont;
- if (obj && obj != NEED_CONTINUATION)
+ if (obj && obj != (PObj*)NEED_CONTINUATION)
pobject_lives(interp, obj);
obj = (PObj*)ctx->current_cont;
if (obj && !PObj_live_TEST(obj))
Index: src/debug.c
===================================================================
--- src/debug.c (revision 17850)
+++ src/debug.c (working copy)
@@ -1973,15 +1973,27 @@
struct PackFile *eval_pf;
struct PackFile_ByteCode *old_cs;
- eval_pf = PDB_compile(interp, command);
+/*
+ The replacement code is almost certainly wrong. The previous
+ code is almost certainly wrong as well. Obviously, the
+ Parrot debugger needs some love.
+*/
+#if 0
+ /* eval_pf = PDB_compile(interp, command);
+
if (eval_pf) {
old_cs = Parrot_switch_to_cs(interp, eval_pf->cur_cs, 1);
run = eval_pf->cur_cs->base.data;
DO_OP(run,interp);
Parrot_switch_to_cs(interp, old_cs, 1);
- /* TODO destroy packfile */
+ TODO destroy packfile
}
+#endif
+ run = PDB_compile(interp, command);
+ if(run) {
+ DO_OP(run,interp);
+ }
}
/*
@@ -2000,25 +2012,22 @@
*/
-struct PackFile *
+opcode_t *
PDB_compile(Interp *interp, const char *command)
{
STRING *buf;
const char *end = "\nend\n";
- PMC * compiler, *code;
+ PMC * compiler;
STRING *key = const_string(interp, "PASM");
PMC *compreg_hash = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals, IGLOBALS_COMPREG_HASH);
-
compiler = VTABLE_get_pmc_keyed_str(interp, compreg_hash, key);
if (!VTABLE_defined(interp, compiler)) {
fprintf(stderr, "Couldn't find PASM compiler");
return NULL;
}
buf = Parrot_sprintf_c(interp, "%s%s", command, end);
-
- code = VTABLE_invoke(interp, compiler, buf);
- return PMC_struct_val(code);
+ return VTABLE_invoke(interp, compiler, buf);
}
/*
Note: I had to update include/parrot/debug.h to make sure that src/
debug.c