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

[svn:parrot] r34574 - trunk/compilers/pirc/new

From:
kjs
Date:
December 29, 2008 06:27
Subject:
[svn:parrot] r34574 - trunk/compilers/pirc/new
Message ID:
20081229142751.BA795CB9FA@x12.develooper.com
Author: kjs
Date: Mon Dec 29 06:27:50 2008
New Revision: 34574

Modified:
   trunk/compilers/pirc/new/bcgen.c
   trunk/compilers/pirc/new/pircompunit.c
   trunk/compilers/pirc/new/pircompunit.h
   trunk/compilers/pirc/new/piremit.c

Log:
[pirc] remove lex_name field from target; no longer used. + some documentation updates.

Modified: trunk/compilers/pirc/new/bcgen.c
==============================================================================
--- trunk/compilers/pirc/new/bcgen.c	(original)
+++ trunk/compilers/pirc/new/bcgen.c	Mon Dec 29 06:27:50 2008
@@ -509,6 +509,11 @@
         STRING *lexname = string_from_cstring(bc->interp, lexiter->name, strlen(lexiter->name));
 
         /* declare the .lex as such */
+/*
+        fprintf(stderr, "Create lexinfo: color of .lex '%s' is: %d\n", lexiter->name,
+                lexiter->info->color);
+
+*/
         Parrot_PCCINVOKE(bc->interp, lex_info, method, "SI->", lexname, lexiter->info->color);
 
         lexiter = lexiter->next;

Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c	(original)
+++ trunk/compilers/pirc/new/pircompunit.c	Mon Dec 29 06:27:50 2008
@@ -1689,8 +1689,9 @@
 =item C<void
 set_lex_flag(lexer_state * const lexer, target * const t, char const * const name)>
 
-Set the lexical name C<name> on target C<t>, and store it
-as a lexical in the sub_info struct.
+Store target C<t> as a lexical in the sub_info struct. The lexical node
+stores a pointer to the target's syminfo structure, so it can access
+the allocated register.
 
 =cut
 
@@ -1704,8 +1705,6 @@
     /* link this lex node in the list of lexicals */
     lex->next = CURRENT_SUB(lexer)->info.lexicals;
     CURRENT_SUB(lexer)->info.lexicals = lex;
-
-    t->lex_name = name;
 }
 
 /*

Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h	(original)
+++ trunk/compilers/pirc/new/pircompunit.h	Mon Dec 29 06:27:50 2008
@@ -199,7 +199,6 @@
     struct syminfo *info;           /* pointer to symbol/pir_reg's information */
     target_flag     flags;          /* flags like :slurpy etc. */
     char const     *alias;          /* if this is a named parameter, this is the alias */
-    char const     *lex_name;       /* if this is a lexical, this field contains the name */
     struct key     *key;            /* the key of this target, i.e. $P0[$P1], $P1 is key. */
 
     struct target  *next;

Modified: trunk/compilers/pirc/new/piremit.c
==============================================================================
--- trunk/compilers/pirc/new/piremit.c	(original)
+++ trunk/compilers/pirc/new/piremit.c	Mon Dec 29 06:27:50 2008
@@ -21,6 +21,11 @@
  -p     for PASM output
  -b     for bytecode output
 
+The functions in this file walk the data structure that is built during
+the parse phase. During the traversal, bytecode for instructions and
+their operands are emitted through the C<bcgen> module.
+
+
 =head1 FUNCTIONS
 
 =over 4
@@ -308,9 +313,9 @@
 
                 fprintf(out, ".pcc_sub ");
 
-                if (TEST_FLAG(subiter->flags, SUB_FLAG_MAIN))
+                if (TEST_FLAG(subiter->flags, PIRC_SUB_FLAG_MAIN))
                     fprintf(out, ":main ");
-                if (TEST_FLAG(subiter->flags, SUB_FLAG_METHOD))
+                if (TEST_FLAG(subiter->flags, PIRC_SUB_FLAG_METHOD))
                     fprintf(out, ":method ");
                     /* XXX and so on; check which ones are available in PASM mode. */
 
@@ -631,7 +636,8 @@
     }
     while (iter != sub->statements->next);
 
-    if (TEST_FLAG(sub->flags, SUB_FLAG_IMMEDIATE)) {
+    /* XXX why does this not work? */
+    if (TEST_FLAG(sub->flags, PIRC_SUB_FLAG_IMMEDIATE)) {
         PackFile_fixup_subs(lexer->interp, PBC_IMMEDIATE, NULL);
     }
 }
@@ -642,7 +648,8 @@
 emit_pbc(lexer_state * const lexer)>
 
 Generate Parrot Byte Code from the abstract syntax tree.
-This is the top-level function.
+This is the top-level function. After all instructions
+have been emitted, the PBC is written to a file.
 
 =cut
 



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