Mon Jul 2 15:31:31 CEST 2001 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 3 Jul 2001 16:39:12 +0000 (16:39 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 3 Jul 2001 16:39:12 +0000 (16:39 -0000)
* cil-opcodes.xml: use a more proper XML format (single root tag).
* make-opcodes-def.pl: use XML::Parser, remove debugging print that
broke compilation, corrected opcode byte len.

Tue,  3 Jul 2001 18:32:10 +0200 Paolo Molaro <lupus@ximian.com>

* main.c: return on failure.

Tue Jul  3 18:33:32 CEST 2001 Paolo Molaro <lupus@ximian.com>

* assembly.c: g_free(ii->cli_sections) (and avoid double free of
cli_section_tables).

lupus - who'd like better a toplevel ChangeLog

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

mono/cil/ChangeLog
mono/cil/cil-opcodes.xml
mono/cil/make-opcodes-def.pl
mono/dis/.cvsignore
mono/dis/ChangeLog
mono/dis/main.c
mono/metadata/ChangeLog
mono/metadata/assembly.c

index 5e87e546dec032eefc40167ebb4563ca1195ac0f..9c5f7cb389f145385ff7d026725d29b48c039ef5 100644 (file)
@@ -1,3 +1,9 @@
+Mon Jul  2 15:31:31 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+       * cil-opcodes.xml: use a more proper XML format (single root tag).
+       * make-opcodes-def.pl: use XML::Parser, remove debugging print that
+       broke compilation, corrected opcode byte len.
+
 2001-07-01  Miguel de Icaza  <miguel@ximian.com>
 
        * cil-opcodes.xml: New file that describes the CIL opcodes in
index 7aac56f96b11cde9aa28fddde46205430c71f30b..b6c6e362c69dd411706dc8e71d4bc42a08a9ebe3 100644 (file)
@@ -1,3 +1,4 @@
+<opdesc>\r
 <opcode name="nop" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x00" flow="next"/>\r
 <opcode name="break" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x01" flow="break"/>\r
 <opcode name="ldarg.0" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x02" flow="next"/>\r
 <opcode name="endmac" input="Pop0" output="Push0" args="InlineNone" o1="0x00" o2="0x00" flow="meta"/>\r
 \r
 \r
-\r
+</opdesc>\r
index 20b63f7d12505e3fcb97c99f34bc43ed417a6001..3114918bb6512267b93896dba71100d0be68413a 100644 (file)
 #
 # We should really be doing this with XSLT, but I know nothing about XSLT
 # ;-)
+# or maybe just an XML::Parser... - lupus
 
+use strict;
+use XML::Parser;
 
-open OPCODES, "cil-opcodes.xml" || die "Can not open cil-opcodes.xml";
-open OUTPUT, ">opcode.def" || die "Can not create opcode.def file";
+my %valid_flow;
+# the XML file also includes "throw"
+@valid_flow{qw(next call return branch meta cond-branch)} = ();
 
-while (<OPCODES>){
-    chop;
-    next if (!/<opcode .*\/>/);
+open OUTPUT, ">opcode.def" || die "Can not create opcode.def file: $!";
 
-    ($name, $input, $output, $args, $o1, $o2, $flow) = $_ =~ /name=\"([\w\.]+)\"\s+input=\"([\w+]+)\"\s+output=\"([\w+]+)\"\s+args=\"(\w+)\"\s+o1=\"0x(\w+)\"\s+o2=\"0x(\w+)\"\s+flow=\"([\w-]+)\"\/>/;
-    print "NAME: $1\n";
-    $name = $1;
-    $input = $2;
-    $output = $3;
-    $args = $4;
-    $o1 = $5;
-    $o2 = $6;
-    $flow = $7;
+my $parser = new XML::Parser (Handlers => {Start => \&handle_opcode});
+$parser->parsefile("cil-opcodes.xml");
+print_trailer();
+close(OUTPUT) || die "Can not close file: $!";
 
-    $uname = $name;
-    $uname =~ s/\./_/g;
-    $uname =~ tr [a-z] [A-Z];
-    if ($o1 =~ /0xff/){
+sub handle_opcode {
+    my ($parser, $elem, %attrs) = @_;
+    my ($name, $input, $output, $args, $o1, $o2, $flow, $uname, $count, $ff);
+       
+    return if ($elem ne 'opcode');
+
+    ($name, $input, $output, $args, $o1, $o2, $flow) = 
+               @attrs{qw(name input output args o1 o2 flow)};
+
+    $uname = uc $name;
+    $uname =~ tr/./_/;
+    if (hex($o1) == 0xff){
        $count = 1;
     } else {
        $count = 2;
     }
 
     $ff = "ERROR";
-    $ff = "NEXT" if ($flow =~ /^next$/);
-    $ff = "CALL" if ($flow =~ /^call$/);
-    $ff = "RETURN" if ($flow =~ /^return$/);
-    $ff = "BRANCH" if ($flow =~ /^branch$/);
-    $ff = "COND_BRANCH" if ($flow =~ /^cond-branch$/);
-    $ff = "META" if ($flow =~ /^meta$/);
+    if (exists $valid_flow{$flow}) {
+       $ff = uc $flow;
+       $ff =~ tr/-/_/;
+    }
 
-    print OUTPUT "OPDEF(CEE_$uname, \"$name\", $input, $output, $args, X, $count, 0x$o1, 0x$o2, $ff)\n";
+    print OUTPUT "OPDEF(CEE_$uname, \"$name\", $input, $output, $args, X, $count, $o1, $o2, $ff)\n";
     
 }
 
-print OUTPUT<<EOF
+sub print_trailer {
+print OUTPUT<<EOF;
 #ifndef OPALIAS
 #define _MONO_CIL_OPALIAS_DEFINED_
 #define OPALIAS(a,s,r)
@@ -72,3 +76,5 @@ OPALIAS(CEE_ENDFAULT,   "endfault",  CEE_ENDFINALLY)
 #undef _MONO_CIL_OPALIAS_DEFINED_
 #endif
 EOF
+}
+
index 8521f30085c3921dd47278c0952e861a871a5b51..45b45b2bee5e5d6eef37d87c42ac3e9a1c70a9de 100644 (file)
@@ -2,4 +2,4 @@ Makefile
 Makefile.in
 .libs
 .deps
-monodirs
+monodis
index 714ba8bd317e5a9a42e11c6967474d117c32f0a1..6ebaa6b868c005283d37d4ae005599b4d7ef9c9c 100644 (file)
@@ -1,3 +1,7 @@
+Tue,  3 Jul 2001 18:32:10 +0200 Paolo Molaro <lupus@ximian.com>
+
+       * main.c: return on failure.
+
 2001-07-02  Miguel de Icaza  <miguel@ximian.com>
 
        * dis-cil.c (get_encoded_user_string): Return a string from the
index f740ec11ebb1d6f00d9fb238de5cf476b1849fe2..6da2b25a3cd5fe0c3c3c72d76c7e2b3398356cbe 100644 (file)
@@ -527,7 +527,7 @@ disassemble_file (const char *file)
        ass = mono_assembly_open (file, &status);
        if (ass == NULL){
                fprintf (stderr, "Error while trying to process %s\n", file);
-               
+               return;
        }
 
        ii = ass->image_info;
index 2a339d6c8c139e5f5c86f56780586cc904128fef..4855e323c1c1e75a9b8c4a858751c0d187253eb7 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul  3 18:33:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+       * assembly.c: g_free(ii->cli_sections) (and avoid double free of
+       cli_section_tables).
+
 2001-07-01  Miguel de Icaza  <miguel@ximian.com>
 
        * metadata.c (mono_metadata_user_string): New function, provides
index ccaee480e9fc84cb8366cc77ecb5846ca4ea22cb..306172d2cfe53a8c1379d5ff86b9433ea2dcae0c 100644 (file)
@@ -395,7 +395,7 @@ mono_assembly_close (MonoAssembly *assembly)
                if (ii->cli_section_tables)
                        g_free (ii->cli_section_tables);
                if (ii->cli_sections)
-                       g_free (ii->cli_section_tables);
+                       g_free (ii->cli_sections);
                g_free (assembly->image_info);
        }