[svn:parrot] r40668 - in branches/context_pmc2/src: . gc interp

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu Aug 20 00:18:02 UTC 2009


Author: whiteknight
Date: Thu Aug 20 00:18:01 2009
New Revision: 40668
URL: https://trac.parrot.org/parrot/changeset/40668

Log:
[context_pmc2] fix some order-of-initialization issues in creating the first context. running into a segfault now whwere it appears a context is being freed prematurely

Modified:
   branches/context_pmc2/src/gc/alloc_register.c
   branches/context_pmc2/src/global_setup.c
   branches/context_pmc2/src/interp/inter_create.c

Modified: branches/context_pmc2/src/gc/alloc_register.c
==============================================================================
--- branches/context_pmc2/src/gc/alloc_register.c	Wed Aug 19 23:36:58 2009	(r40667)
+++ branches/context_pmc2/src/gc/alloc_register.c	Thu Aug 20 00:18:01 2009	(r40668)
@@ -280,7 +280,6 @@
 {
     ASSERT_ARGS(init_context)
     Parrot_Context_attributes *ctx = PARROT_CONTEXT(pmcctx);
-    Parrot_Context_attributes *old = PARROT_CONTEXT(pmcold);
 
     ctx->current_results   = NULL;
     ctx->results_signature = NULL;
@@ -291,17 +290,20 @@
     ctx->handlers          = PMCNULL;
     ctx->caller_ctx        = NULL;
 
-    if (old) {
-        /* some items should better be COW copied */
-        ctx->constants         = old->constants;
-        ctx->warns             = old->warns;
-        ctx->errors            = old->errors;
-        ctx->trace_flags       = old->trace_flags;
-        ctx->pred_offset       = old->pred_offset;
-        ctx->current_HLL       = old->current_HLL;
-        ctx->current_namespace = old->current_namespace;
-        /* end COW */
-        ctx->recursion_depth   = old->recursion_depth;
+    if (pmcold) {
+        Parrot_Context_attributes *old = PARROT_CONTEXT(pmcold);
+        if(old) {
+            /* some items should better be COW copied */
+            ctx->constants         = old->constants;
+            ctx->warns             = old->warns;
+            ctx->errors            = old->errors;
+            ctx->trace_flags       = old->trace_flags;
+            ctx->pred_offset       = old->pred_offset;
+            ctx->current_HLL       = old->current_HLL;
+            ctx->current_namespace = old->current_namespace;
+            /* end COW */
+            ctx->recursion_depth   = old->recursion_depth;
+        }
     }
     else {
         ctx->constants         = NULL;

Modified: branches/context_pmc2/src/global_setup.c
==============================================================================
--- branches/context_pmc2/src/global_setup.c	Wed Aug 19 23:36:58 2009	(r40667)
+++ branches/context_pmc2/src/global_setup.c	Thu Aug 20 00:18:01 2009	(r40668)
@@ -206,6 +206,8 @@
     PMC *classname_hash, *iglobals;
     int  i;
 
+    create_initial_context(interp);
+
     /* create the namespace root stash */
     interp->root_namespace = pmc_new(interp, enum_class_NameSpace);
     Parrot_init_HLL(interp);

Modified: branches/context_pmc2/src/interp/inter_create.c
==============================================================================
--- branches/context_pmc2/src/interp/inter_create.c	Wed Aug 19 23:36:58 2009	(r40667)
+++ branches/context_pmc2/src/interp/inter_create.c	Thu Aug 20 00:18:01 2009	(r40668)
@@ -153,11 +153,12 @@
     Parrot_block_GC_mark(interp);
     Parrot_block_GC_sweep(interp);
 
-    create_initial_context(interp);
+    //create_initial_context(interp);
+    interp->ctx = PMCNULL;
     interp->resume_flag = RESUME_INITIAL;
 
     /* main is called as a Sub too - this will get depth 0 then */
-    CONTEXT(interp)->recursion_depth = (UINTVAL)-1;
+    //CONTEXT(interp)->recursion_depth = (UINTVAL)-1;
     interp->recursion_limit = RECURSION_LIMIT;
 
     /* PANIC will fail until this is done */


More information about the parrot-commits mailing list