[svn:mod_parrot] r551 - in mod_parrot/trunk: languages/perl6/lib/Apache languages/perl6/lib/ModParrot lib

[email protected] Mon, 29 Dec 2008 12:54:29 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Mon Dec 29 12:54:26 2008
New Revision: 551

Removed:
   mod_parrot/trunk/languages/perl6/lib/Apache/ConstHelper.pir
   mod_parrot/trunk/languages/perl6/lib/ModParrot/ConstHelper.pir
Modified:
   mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm
   mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm
   mod_parrot/trunk/lib/mod_parrot.pir

Log:
merge PIR helper code into the Const modules
only execute certain modules if we're running from apache.  this works around
the precompilation issue in Parrot RT #61742.



Modified: mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm
==============================================================================
--- mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm	(original)
+++ mod_parrot/trunk/languages/perl6/lib/Apache/Const.pm	Mon Dec 29 12:54:26 2008
@@ -2,4 +2,26 @@
 
 module Apache::Const;
 
-use Apache::ConstHelper;
+q:PIR <
+    .include "iterator.pasm"
+
+    # don't proceed unless we're actually running
+    $P0 = get_root_global '!MODPARROT_RUNTIME'
+    if null $P0 goto done
+
+    $P0 = get_root_global ['ModParrot'; 'Apache'; 'Constants'], 'table'
+    $P1 = new 'Iterator', $P0
+    $P1 = .ITERATE_FROM_START
+  iter_start:
+    unless $P1 goto iter_end
+    $S0 = shift $P1
+    $I0 = $P0[$S0]
+    $P3 = new 'Integer'
+    $P3 = $I0
+    $S1 = '$'
+    $S1 .= $S0
+    set_hll_global ['Apache'; 'Const'], $S1, $P3
+    goto iter_start
+  iter_end:
+  done:
+>;

Modified: mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm
==============================================================================
--- mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm	(original)
+++ mod_parrot/trunk/languages/perl6/lib/ModParrot/Const.pm	Mon Dec 29 12:54:26 2008
@@ -2,4 +2,26 @@
 
 module ModParrot::Const;
 
-use ModParrot::ConstHelper;
+q:PIR <
+    .include "iterator.pasm"
+
+    # don't proceed unless we're actually running
+    $P0 = get_root_global '!MODPARROT_RUNTIME'
+    if null $P0 goto done
+
+    $P0 = get_root_global ['ModParrot'; 'Constants'], 'table'
+    $P1 = new 'Iterator', $P0
+    $P1 = .ITERATE_FROM_START
+  iter_start:
+    unless $P1 goto iter_end
+    $S0 = shift $P1
+    $I0 = $P0[$S0]
+    $P3 = new 'Integer'
+    $P3 = $I0
+    $S1 = '$'
+    $S1 .= $S0
+    set_hll_global ['ModParrot'; 'Const'], $S1, $P3
+    goto iter_start
+  iter_end:
+  done:
+>;

Modified: mod_parrot/trunk/lib/mod_parrot.pir
==============================================================================
--- mod_parrot/trunk/lib/mod_parrot.pir	(original)
+++ mod_parrot/trunk/lib/mod_parrot.pir	Mon Dec 29 12:54:26 2008
@@ -110,6 +110,11 @@
     load_bytecode 'ModParrot/Apache/RequestRec.pbc'
     load_bytecode 'ModParrot/APR/Pool.pbc'
     load_bytecode 'ModParrot/APR/Table.pbc'
+
+    # global to indicate that we're actually running
+    $P0 = new 'Integer'
+    $P0 = 1
+    set_root_global '!MODPARROT_RUNTIME', $P0
 .end
 
 .sub modparrot_set_include_path