2010-05-25 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 25 May 2010 17:25:21 +0000 (17:25 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 25 May 2010 17:25:21 +0000 (17:25 -0000)
* genmdesc.c: Added support for nacl: key on the machine
description files to support the extra space required by Google
Native Client.

svn path=/trunk/mono/; revision=157881

mono/mini/ChangeLog
mono/mini/genmdesc.c
mono/mini/genmdesc.pl

index e69faecaebaeceb6d35b7ec037d73a08cb72bc68..2689dc918881187fe4aab4e503cc52291ea1b168 100755 (executable)
@@ -1,3 +1,9 @@
+2010-05-25  Miguel de Icaza  <miguel@novell.com>
+
+       * genmdesc.c: Added support for nacl: key on the machine
+       description files to support the extra space required by Google
+       Native Client.
+
 2010-05-23  Zoltan Varga  <vargaz@gmail.com>
 
        * mini.c (mono_jit_compile_method_inner): Propagate exceptions in one more place.
index 7d34d3561a89e5460ba5b29a23ace680680025f2..40bcdef3a1d17c4fd9b0f000eb107717e315d47b 100644 (file)
@@ -43,6 +43,7 @@ typedef struct {
        char spec [MONO_INST_MAX];
 } OpDesc;
 
+static int nacl;
 static GHashTable *table;
 static GHashTable *template_table;
 
@@ -65,7 +66,7 @@ load_file (const char *name) {
         * The format of the lines are:
         * # comment
         * opcode: [dest:format] [src1:format] [src2:format] [flags:format] [clob:format] 
-        *      [cost:num] [res:format] [delay:num] [len:num]
+        *      [cost:num] [res:format] [delay:num] [len:num] [nacl:num]
         * format is a single letter that depends on the field
         * NOTE: no space between the field name and the ':'
         *
@@ -132,7 +133,11 @@ load_file (const char *name) {
                                */
                        } else if (strncmp (p, "len:", 4) == 0) {
                                p += 4;
-                               desc->spec [MONO_INST_LEN] = strtoul (p, &p, 10);
+                               desc->spec [MONO_INST_LEN] += strtoul (p, &p, 10);
+                       } else if (strncmp (p, "nacl:", 5) == 0){
+                               p += 5;
+                               if (nacl)
+                                       desc->spec [MONO_INST_LEN] += strtoul (p, &p, 10);
                        } else if (strncmp (p, "template:", 9) == 0) {
                                char *tname;
                                int i;
@@ -284,14 +289,22 @@ main (int argc, char* argv [])
                dump ();
        } else if (argc < 4) {
                g_print ("Usage: genmdesc arguments\n");
-               g_print ("\tgenmdesc desc                        Output to stdout the description file.\n");
-               g_print ("\tgenmdesc output name desc [desc1...] Write to output the description in a table named 'name'.\n");
+               g_print ("\tgenmdesc desc     Output to stdout the description file.\n");
+               g_print ("\tgenmdesc [--nacl] output name desc [desc1...]\n"
+                       "                     Write to output the description in a table named 'name',\n"
+                       "                     use --nacl to generate Google NativeClient code\n");
                return 1;
        } else {
-               int i;
-               for (i = 3; i < argc; ++i)
+               int i = 3;
+               if (strcmp (argv [1], "--nacl")){
+                       nacl = 1;
+                       i++;
+               }
+               
+               for (; i < argc; ++i)
                        load_file (argv [i]);
-               build_table (argv [1], argv [2]);
+               
+               build_table (argv [1 + nacl], argv [2 + nacl]);
        }
        return 0;
 }
index 7216f36529c233ac3683a5c6fcbeb5450085eb57..1b5e754736db99329f5f47656a6969f72ad22bcd 100644 (file)
@@ -13,7 +13,8 @@ sub INST_SRC2  () {return 2;}
 sub INST_SRC3  () {return 3;}
 sub INST_LEN   () {return 4;}
 sub INST_CLOB  () {return 5;}
-sub INST_MAX   () {return 6;}
+sub INST_NACL  () {return 6;}
+sub INST_MAX   () {return 7;}
 
 # this must include all the #defines used in mini-ops.h
 my @defines = qw (__i386__ __x86_64__ __ppc__ __powerpc__ __ppc64__ __arm__