develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34265 - trunk/compilers/pct/src/POST

From:
pmichaud
Date:
December 22, 2008 19:32
Subject:
[svn:parrot] r34265 - trunk/compilers/pct/src/POST
Message ID:
20081223033242.66ECBCBA12@x12.develooper.com
Author: pmichaud
Date: Mon Dec 22 19:32:38 2008
New Revision: 34265

Modified:
   trunk/compilers/pct/src/POST/Compiler.pir
   trunk/compilers/pct/src/POST/Node.pir

Log:
[pct]:  .HLL support part 1 -- 'hll' attribute in POST nodes.


Modified: trunk/compilers/pct/src/POST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/POST/Compiler.pir	(original)
+++ trunk/compilers/pct/src/POST/Compiler.pir	Mon Dec 22 19:32:38 2008
@@ -26,6 +26,8 @@
     $P0 = new 'ResizablePMCArray'
     set_global '@!subcode', $P0
 
+    $P0 = new 'String'
+    set_global '$?HLL', $P0
     $P0 = box '[]'
     set_global '$?NAMESPACE', $P0
     .return ()
@@ -237,6 +239,14 @@
     concat pirflags, ')'
   pirflags_done:
 
+    .local pmc outerhll, hll
+    outerhll = get_global '$?HLL'
+    hll = node.'hll'()
+    if hll goto have_hll
+    hll = outerhll
+  have_hll:
+    set_global '$?HLL', hll
+
     .local pmc outerns, ns, nskey
     outerns = get_global '$?NAMESPACE'
     nskey = outerns
@@ -259,6 +269,10 @@
     goto subpir_done
 
   subpir_post:
+    unless hll goto subpir_ns
+    $P0 = code.'escape'(hll)
+    code.'emit'("\n.HLL %0", $P0)
+  subpir_ns:
     code.'emit'("\n.namespace %0", nskey)
     $S0 = code.'escape'(name)
     code.'emit'(".sub %0 %1", $S0, pirflags)
@@ -286,6 +300,7 @@
     $P0 .= code
 
     set_global '$?NAMESPACE', outerns
+    set_global '$?HLL', outerhll
 
     code = new 'CodeString'
     .return (code)

Modified: trunk/compilers/pct/src/POST/Node.pir
==============================================================================
--- trunk/compilers/pct/src/POST/Node.pir	(original)
+++ trunk/compilers/pct/src/POST/Node.pir	Mon Dec 22 19:32:38 2008
@@ -187,6 +187,13 @@
 .end
 
 
+.sub 'hll' :method
+    .param pmc value           :optional
+    .param int has_value       :opt_flag
+    .tailcall self.'attr'('hll', value, has_value)
+.end
+
+
 .sub 'outer' :method
     .param pmc value           :optional
     .param int has_value       :opt_flag



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About