perl.cvs.mod_parrot
[Top] [All Lists]

[svn:mod_parrot] r383 - in mod_parrot/trunk: include src

Subject: [svn:mod_parrot] r383 - in mod_parrot/trunk: include src
From: jhorwitz@xxxxxxxxxxxx
Date: Thu, 24 Jul 2008 15:51:01 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Thu Jul 24 15:51:00 2008
New Revision: 383

Modified:
   mod_parrot/trunk/include/mod_parrot.h
   mod_parrot/trunk/src/context.c
   mod_parrot/trunk/src/mod_parrot.c
   mod_parrot/trunk/src/modparrot_config.c

Log:
fix crashes when using ParrotLoadImmediate and virtual hosts with +Parent


Modified: mod_parrot/trunk/include/mod_parrot.h
==============================================================================
--- mod_parrot/trunk/include/mod_parrot.h       (original)
+++ mod_parrot/trunk/include/mod_parrot.h       Thu Jul 24 15:51:00 2008
@@ -79,7 +79,7 @@
 void release_ctx(modparrot_context *);
 modparrot_context *get_interp_ctx(Parrot_Interp);
 void set_interp_ctx(Parrot_Interp, modparrot_context *);
-modparrot_context *modparrot_startup(apr_pool_t *, server_rec *);
+modparrot_context *modparrot_startup(apr_pool_t *, server_rec *, 
Parrot_Interp);
 void modparrot_load_file(Parrot_Interp, server_rec *, char *, char *);
 module *modparrot_add_module(Parrot_Interp, apr_pool_t *, const char *,
     Parrot_PMC);

Modified: mod_parrot/trunk/src/context.c
==============================================================================
--- mod_parrot/trunk/src/context.c      (original)
+++ mod_parrot/trunk/src/context.c      Thu Jul 24 15:51:00 2008
@@ -62,7 +62,7 @@
 
     /* pop each context off the list and destroy its interpreter */
     while ((ctxpp = apr_array_pop(ctx_pool))) {
-        if ((*ctxpp)->interp && !(*ctxpp)->parent_interp) {
+        if ((*ctxpp)->interp) {
             modparrot_destroy_interpreter((*ctxpp)->interp);
             (*ctxpp)->interp = NULL;
         }

Modified: mod_parrot/trunk/src/mod_parrot.c
==============================================================================
--- mod_parrot/trunk/src/mod_parrot.c   (original)
+++ mod_parrot/trunk/src/mod_parrot.c   Thu Jul 24 15:51:00 2008
@@ -158,15 +158,16 @@
 }
 
 /* public interface for starting an interpreter */
-modparrot_context *modparrot_startup(apr_pool_t *p, server_rec *s)
+modparrot_context *modparrot_startup(apr_pool_t *p, server_rec *s,
+    Parrot_Interp parent_interp)
 {
     modparrot_context *ctxp;
     modparrot_srv_config *cfg;
 
     cfg = ap_get_module_config(s->module_config, &parrot_module);
 
-    if (!mp_is_started) {
-        if (!(cfg->ctx_pool = mp_ctx_pool_init(p, NULL, 1))) {
+    if (!mp_is_started || (!cfg->ctx_pool && s->is_virtual)) {
+        if (!(cfg->ctx_pool = mp_ctx_pool_init(p, parent_interp, 1))) {
             MPLOG_ERROR(s, "context pool creation failed");
             return NULL;
         }
@@ -949,7 +950,7 @@
     cfg = ap_get_module_config(s->module_config, &parrot_module);
 
     if (cfg->option_flags & MP_OPT_ENABLE) {
-        if (!(ctxp = modparrot_startup(pconf, s))) {
+        if (!(ctxp = modparrot_startup(pconf, s, NULL))) {
             return HTTP_INTERNAL_SERVER_ERROR;
         }
         parent_interp = ctxp->interp;
@@ -970,23 +971,20 @@
         vscfg = ap_get_module_config(vs->module_config, &parrot_module);
         if (!(vscfg->option_flags & MP_OPT_ENABLE)) continue;
         if (vscfg->option_flags & MP_OPT_PARENT) {
-            /* XXX this crashes if we don't specify parent context. we can't
-             * create multiple interpreters in the same process, which is a
-             * either a problem with parrot or a problem with my understanding
-             * of the interpreter creation process.
-             */
-            if (!(vscfg->ctx_pool =
-                mp_ctx_pool_init(pconf, parent_interp, 1))) {
-                MPLOG_ERROR(s, "context pool creation failed");
+            if (!(vsctxp = modparrot_startup(pconf, vs, parent_interp))) {
                 return HTTP_INTERNAL_SERVER_ERROR;
             }
-            if (!(vsctxp = init_ctx(vs))) {
-                MPLOG_ERROR(vs, "context initialization failed");
-                return HTTP_INTERNAL_SERVER_ERROR;
+
+            /* load ParrotLoad files */
+            modparrot_load_files(vsctxp->interp, vs, vscfg->preload);
+
+            /* if we weren't tracing the initialization phase, enable tracing 
*/
+            if (!(vscfg->option_flags & MP_OPT_TRACE_INIT)) {
+                Parrot_set_trace(vsctxp->interp, vscfg->trace_flags);
             }
         }
         else {
-            if (cfg->option_flags & MP_OPT_ENABLE) {
+            if (vscfg->option_flags & MP_OPT_ENABLE) {
                 vscfg->ctx_pool = cfg->ctx_pool;
             }
             else {

Modified: mod_parrot/trunk/src/modparrot_config.c
==============================================================================
--- mod_parrot/trunk/src/modparrot_config.c     (original)
+++ mod_parrot/trunk/src/modparrot_config.c     Thu Jul 24 15:51:00 2008
@@ -300,7 +300,7 @@
 
     /* XXX how do we get the context if we've already started? */
     if (!mp_is_started) {
-        ctxp = modparrot_startup(cmd->pool, cmd->server);
+        ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     }
 
     parse_handler(cmd->pool, handler, l);
@@ -600,7 +600,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     set_mp_config_vectors(ctxp, cmd);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 1, arg);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
@@ -616,7 +616,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 2, arg1, arg2);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
     return NULL;
@@ -631,7 +631,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 2, arg1, arg2);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
     return NULL;
@@ -647,7 +647,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 3, arg1, arg2, arg3);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
     return NULL;
@@ -663,7 +663,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 3, arg1, arg2, arg3);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
     return NULL;
@@ -679,7 +679,7 @@
     modparrot_module_cmd_data *data = cmd->cmd->cmd_data;
     int ret;
 
-    ctxp = modparrot_startup(cmd->pool, cmd->server);
+    ctxp = modparrot_startup(cmd->pool, cmd->server, NULL);
     args = make_cmd_args_array(ctxp->interp, cmd->pool, 3, arg1, arg2, arg3);
     ret = Parrot_call_sub_ret_int(ctxp->interp, data->func, "IP", args);
     return NULL;

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r383 - in mod_parrot/trunk: include src, jhorwitz <=