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

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

From:
kjs
Date:
December 7, 2008 05:29
Subject:
[svn:parrot] r33603 - trunk/compilers/pirc/new
Message ID:
20081207132916.52A84CB9AF@x12.develooper.com
Author: kjs
Date: Sun Dec  7 05:29:15 2008
New Revision: 33603

Modified:
   trunk/compilers/pirc/new/pir.y
   trunk/compilers/pirc/new/pircompunit.h
   trunk/compilers/pirc/new/piremit.c
   trunk/compilers/pirc/new/pirparser.c

Log:
[pirc] change order of types, to match type values in pdd03. (I, S, P, N, having values 0, 1, 2, 3, respectively).

Modified: trunk/compilers/pirc/new/pir.y
==============================================================================
--- trunk/compilers/pirc/new/pir.y	(original)
+++ trunk/compilers/pirc/new/pir.y	Sun Dec  7 05:29:15 2008
@@ -200,10 +200,10 @@
 static void undeclared_symbol(yyscan_t yyscanner, lexer_state * const lexer,
                               char const * const symbol);
 
-/* names of the Parrot types. Note that pir_type_namwes is global,
+/* names of the Parrot types. Note that pir_type_names is (file-)global,
  * but it's read-only, so that's fine.
  */
-static char const * const pir_type_names[] = { "int", "num", "string", "pmc" };
+static char const * const pir_type_names[] = { "int", "string", "pmc", "num" };
 
 
 /* enable debugging of generated parser */
@@ -2163,6 +2163,13 @@
 %%
 
 
+
+/* the order of these letters match with the pir_type enumeration.
+ * These are used for generating the full opname (set I0, 10 -> set_i_ic).
+ */
+static char const type_codes[5] = {'i', 's', 'p', 'n', '?'};
+
+
 /*
 
 =head1 FUNCTIONS
@@ -3268,10 +3275,6 @@
 }
 
 
-/* the order of these letters match with the pir_type enumeration.
- * These are used for generating the full opname (set I0, 10 -> set_i_ic).
- */
-static char const type_codes[5] = {'i', 'n', 's', 'p', '?'};
 
 
 /*

Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h	(original)
+++ trunk/compilers/pirc/new/pircompunit.h	Sun Dec  7 05:29:15 2008
@@ -13,16 +13,15 @@
 #ifndef PARROT_PIR_PIRCOMPUNIT_H_GUARD
 #define PARROT_PIR_PIRCOMPUNIT_H_GUARD
 
-/* the 4 parrot types; use explicit values, they are used to index an array,
- * so this way we can be sure that works properly.
- * (don't assume enum's start counting at 0).
+/* the 4 parrot types; use explicit values that match the values in
+ * PDD03_calling_conventions.pod.
  */
 typedef enum pir_types {
     INT_TYPE     = 0,
-    NUM_TYPE     = 1,
-    STRING_TYPE  = 2,
-    PMC_TYPE     = 3,
-    UNKNOWN_TYPE = 4  /* for uninitialized types */
+    STRING_TYPE  = 1,
+    PMC_TYPE     = 2,
+    NUM_TYPE     = 3,
+    UNKNOWN_TYPE = 4  /* for uninitialized types, handy to detect missing initializations. */
 
 } pir_type;
 

Modified: trunk/compilers/pirc/new/piremit.c
==============================================================================
--- trunk/compilers/pirc/new/piremit.c	(original)
+++ trunk/compilers/pirc/new/piremit.c	Sun Dec  7 05:29:15 2008
@@ -31,7 +31,7 @@
 /* the order of these letters match with the pir_type enumeration.
  * These are used for human-readable PASM output.
  */
-static char const pir_register_types[5] = {'I', 'N', 'S', 'P', '?'};
+static char const pir_register_types[5] = {'I', 'S', 'P', 'N', '?'};
 
 static void emit_pir_statement(lexer_state * const lexer, subroutine * const sub);
 static void emit_pir_instruction(lexer_state * const lexer, instruction * const instr);

Modified: trunk/compilers/pirc/new/pirparser.c
==============================================================================
--- trunk/compilers/pirc/new/pirparser.c	(original)
+++ trunk/compilers/pirc/new/pirparser.c	Sun Dec  7 05:29:15 2008
@@ -515,10 +515,10 @@
 static void undeclared_symbol(yyscan_t yyscanner, lexer_state * const lexer,
                               char const * const symbol);
 
-/* names of the Parrot types. Note that pir_type_namwes is global,
+/* names of the Parrot types. Note that pir_type_names is (file-)global,
  * but it's read-only, so that's fine.
  */
-static char const * const pir_type_names[] = { "int", "num", "string", "pmc" };
+static char const * const pir_type_names[] = { "int", "string", "pmc", "num" };
 
 
 /* enable debugging of generated parser */
@@ -4852,6 +4852,13 @@
 
 
 
+
+/* the order of these letters match with the pir_type enumeration.
+ * These are used for generating the full opname (set I0, 10 -> set_i_ic).
+ */
+static char const type_codes[5] = {'i', 's', 'p', 'n', '?'};
+
+
 /*
 
 =head1 FUNCTIONS
@@ -5957,10 +5964,6 @@
 }
 
 
-/* the order of these letters match with the pir_type enumeration.
- * These are used for generating the full opname (set I0, 10 -> set_i_ic).
- */
-static char const type_codes[5] = {'i', 'n', 's', 'p', '?'};
 
 
 /*



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