[svn:parrot] r40767 - in branches/context_pmc3: . include/parrot src src/interp src/runcore
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon Aug 24 22:12:23 UTC 2009
Author: bacek
Date: Mon Aug 24 22:12:23 2009
New Revision: 40767
URL: https://trac.parrot.org/parrot/changeset/40767
Log:
[cage] Fix some codetest failures.
Modified:
branches/context_pmc3/MANIFEST
branches/context_pmc3/include/parrot/context.h
branches/context_pmc3/include/parrot/interpreter.h
branches/context_pmc3/src/context.c
branches/context_pmc3/src/interp/inter_create.c
branches/context_pmc3/src/runcore/cores.c
Modified: branches/context_pmc3/MANIFEST
==============================================================================
--- branches/context_pmc3/MANIFEST Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/MANIFEST Mon Aug 24 22:12:23 2009 (r40767)
@@ -1245,6 +1245,7 @@
src/byteorder.c []
src/call/ops.c []
src/call/pcc.c []
+src/context.c []
src/datatypes.c []
src/debug.c []
src/dynext.c []
Modified: branches/context_pmc3/include/parrot/context.h
==============================================================================
--- branches/context_pmc3/include/parrot/context.h Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/include/parrot/context.h Mon Aug 24 22:12:23 2009 (r40767)
@@ -171,4 +171,11 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/context.c */
-#endif
+#endif /* PARROT_CONTEXT_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/context_pmc3/include/parrot/interpreter.h
==============================================================================
--- branches/context_pmc3/include/parrot/interpreter.h Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/include/parrot/interpreter.h Mon Aug 24 22:12:23 2009 (r40767)
@@ -196,7 +196,7 @@
/*
* Get Context from interpeter.
*/
-#define CONTEXT(interp) (interp->ctx)
+#define CONTEXT(interp) ((interp)->ctx)
/*
@@ -205,8 +205,8 @@
* Not considered as part of public API. Should be replaced with proper accessor
* functions to manipulate Context.
*/
-#define CONTEXT_FIELD(interp, ctx, name) ((Parrot_cx_get_context(interp, ctx))->name)
-#define CURRENT_CONTEXT_FIELD(interp, name) CONTEXT_FIELD(interp, interp->ctx, name)
+#define CONTEXT_FIELD(interp, ctx, name) ((Parrot_cx_get_context((interp), (ctx)))->name)
+#define CURRENT_CONTEXT_FIELD(interp, name) CONTEXT_FIELD((interp), (interp)->ctx, name)
#define CHUNKED_CTX_MEM 0 /* no longer works, but will be reinstated
Modified: branches/context_pmc3/src/context.c
==============================================================================
--- branches/context_pmc3/src/context.c Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/src/context.c Mon Aug 24 22:12:23 2009 (r40767)
@@ -30,7 +30,7 @@
/*
-
+
=item C<STRING* Parrot_cx_get_string_constant(PARROT_INTERP, PMC *ctx, INTVAL
idx)>
@@ -52,7 +52,7 @@
/*
-
+
=item C<PMC* Parrot_cx_get_pmc_constant(PARROT_INTERP, PMC *ctx, INTVAL idx)>
Get PMC constant from context.
@@ -116,7 +116,7 @@
/*
-=item C<UINTVAL Parrot_cx_inc_recursion_depth(PARROT_INTERP, PMC *ctx)>
+=item C<UINTVAL Parrot_cx_get_recursion_depth(PARROT_INTERP, PMC *ctx)>
Get recursion depth from context.
@@ -128,7 +128,7 @@
UINTVAL
Parrot_cx_get_recursion_depth(PARROT_INTERP, ARGIN(PMC *ctx))
{
- ASSERT_ARGS(Parrot_cx_inc_recursion_depth)
+ ASSERT_ARGS(Parrot_cx_get_recursion_depth)
Parrot_Context *c = Parrot_cx_get_context(interp, ctx);
return c->recursion_depth;
}
@@ -185,7 +185,7 @@
PMC*
Parrot_cx_get_caller_ctx(PARROT_INTERP, ARGIN(PMC *ctx))
{
- ASSERT_ARGS(Parrot_cx_dec_recursion_depth)
+ ASSERT_ARGS(Parrot_cx_get_caller_ctx)
Parrot_Context *c = Parrot_cx_get_context(interp, ctx);
return c->caller_ctx;
}
@@ -205,7 +205,7 @@
void
Parrot_cx_set_caller_ctx(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *caller_ctx))
{
- ASSERT_ARGS(Parrot_cx_dec_recursion_depth)
+ ASSERT_ARGS(Parrot_cx_set_caller_ctx)
Parrot_Context *c = Parrot_cx_get_context(interp, ctx);
c->caller_ctx = caller_ctx;
}
@@ -224,7 +224,7 @@
PMC*
Parrot_cx_get_namespace(PARROT_INTERP, ARGIN(PMC *ctx))
{
- ASSERT_ARGS(Parrot_cx_dec_recursion_depth)
+ ASSERT_ARGS(Parrot_cx_get_namespace)
Parrot_Context *c = Parrot_cx_get_context(interp, ctx);
return c->current_namespace;
}
@@ -244,7 +244,7 @@
void
Parrot_cx_set_namespace(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN(PMC *_namespace))
{
- ASSERT_ARGS(Parrot_cx_dec_recursion_depth)
+ ASSERT_ARGS(Parrot_cx_set_namespace)
Parrot_Context *c = Parrot_cx_get_context(interp, ctx);
c->current_namespace = _namespace;
}
Modified: branches/context_pmc3/src/interp/inter_create.c
==============================================================================
--- branches/context_pmc3/src/interp/inter_create.c Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/src/interp/inter_create.c Mon Aug 24 22:12:23 2009 (r40767)
@@ -152,7 +152,6 @@
Parrot_block_GC_mark(interp);
Parrot_block_GC_sweep(interp);
- //create_initial_context(interp);
interp->ctx = PMCNULL;
interp->resume_flag = RESUME_INITIAL;
@@ -210,6 +209,8 @@
PARROT_ERRORS_on(interp, PARROT_ERRORS_RESULT_COUNT_FLAG);
#endif
+ create_initial_context(interp);
+
/* main is called as a Sub too - this will get depth 0 then */
CURRENT_CONTEXT_FIELD(interp, recursion_depth) = (UINTVAL)-1;
Modified: branches/context_pmc3/src/runcore/cores.c
==============================================================================
--- branches/context_pmc3/src/runcore/cores.c Mon Aug 24 22:11:51 2009 (r40766)
+++ branches/context_pmc3/src/runcore/cores.c Mon Aug 24 22:12:23 2009 (r40767)
@@ -263,6 +263,16 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+#ifdef code_start
+# undef code_start
+#endif
+#ifdef code_end
+# undef code_end
+#endif
+
+#define code_start interp->code->base.data
+#define code_end (interp->code->base.data + interp->code->base.size)
+
/*
=item C<opcode_t * runops_fast_core(PARROT_INTERP, opcode_t *pc)>
@@ -285,6 +295,10 @@
CURRENT_CONTEXT_FIELD(interp, current_pc) = NULL;
while (pc) {
+ if (pc < code_start || pc >= code_end)
+ Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ "attempt to access code outside of current code segment");
+
DO_OP(pc, interp);
}
@@ -327,16 +341,6 @@
#endif
}
-#ifdef code_start
-# undef code_start
-#endif
-#ifdef code_end
-# undef code_end
-#endif
-
-#define code_start interp->code->base.data
-#define code_end (interp->code->base.data + interp->code->base.size)
-
/*
More information about the parrot-commits
mailing list