In tests:
authorRodrigo Kumpera <kumpera@gmail.com>
Mon, 31 Dec 2007 14:46:06 +0000 (14:46 -0000)
committerRodrigo Kumpera <kumpera@gmail.com>
Mon, 31 Dec 2007 14:46:06 +0000 (14:46 -0000)
2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>

* test-emitbyte.il: new test for .emitbyte directive

In codegen:
2007-12-31  Rodrigo Kumpera  <rkumpera@novell.com>

* EmiteByteInst.cs: added. Implements support
for the .emitbyte directive.

In .:
2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>

* ilasm.exe.sources: added EmiteByteInst.cs.

In parser:
2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>

* ILParser.jay: Implement .emitbyte directive

svn path=/trunk/mcs/; revision=92063

mcs/ilasm/ChangeLog
mcs/ilasm/codegen/ChangeLog
mcs/ilasm/codegen/EmitByteInstr.cs [new file with mode: 0644]
mcs/ilasm/ilasm.exe.sources
mcs/ilasm/parser/ChangeLog
mcs/ilasm/parser/ILParser.jay
mcs/ilasm/tests/ChangeLog
mcs/ilasm/tests/test-emitbyte.il [new file with mode: 0644]

index cc71dc8c2465782424763c0fb087eb75caccd056..cc530e5b8f17cb51f98e1e38b5fce8bd2f04da36 100644 (file)
@@ -1,3 +1,7 @@
+2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>
+
+       * ilasm.exe.sources: added EmiteByteInst.cs.
+
 2006-06-07  Ankit Jain  <jankit@novell.com>
 
        * Report.cs (Report.FilePath): New, static property.
index c4f8f141a8734086b42f6736b34fc6a75ffcafcb..e10aac690337340b7e2ffcac816c3b855fa47a4d 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-31  Rodrigo Kumpera  <rkumpera@novell.com>
+
+       * EmiteByteInst.cs: added. Implements support
+       for the .emitbyte directive.
+
 2007-12-31  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * SwitchInstr.cs (Emit): Switch from using strings
diff --git a/mcs/ilasm/codegen/EmitByteInstr.cs b/mcs/ilasm/codegen/EmitByteInstr.cs
new file mode 100644 (file)
index 0000000..e6778fe
--- /dev/null
@@ -0,0 +1,34 @@
+//
+// Mono.ILASM.EmitByteIntr.cs
+//
+// Author(s):
+//  Rodrigo Kumpera (rkumpera@novell.com)
+//
+// (C) 2007 Novell, Inc (http://www.novell.com)
+//
+
+
+using System;
+using System.Collections;
+
+namespace Mono.ILASM {
+
+        public class EmitByteIntr : IInstr {
+
+                private int value;
+
+                public EmitByteIntr (int value, Location loc)
+                       : base (loc)
+                {
+                        this.value = value;
+                }
+
+                public override void Emit (CodeGen code_gen, MethodDef meth,
+                                          PEAPI.CILInstructions cil)
+                {
+                        cil.emitbyte ((byte)value);
+                }
+        }
+
+}
+
index 4659f94aa168229b7729244c82c6a1ec542e0575..bb93d16318390cf5017d5bd75a26c82e528b9714 100644 (file)
@@ -70,6 +70,7 @@ codegen/FileRef.cs
 codegen/MethodPointerTypeRef.cs
 codegen/GenericArguments.cs
 codegen/GenericParameters.cs
+codegen/EmitByteInstr.cs
 parser/ScannerAdapter.cs
 scanner/ILReader.cs
 scanner/ILTokenizingException.cs
index dbec8c35cf79a8a19cd422311e8fd87de4740c7c..ed7a968c887d63ab022f98b0d0c19f4bc2906cdd 100644 (file)
@@ -1,3 +1,7 @@
+2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>
+
+       * ILParser.jay: Implement .emitbyte directive 
+
 2007-12-31  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * ILParser.jay: Create LabelInfo instances for switch labels,
index 9164b67ba1977d366aff4cd35d37e944acdf454e..5e417341ecf97ed7147f3db8d247aeb4e1de538d 100644 (file)
@@ -2075,6 +2075,11 @@ method_decls             : /* EMPTY */
                        ;\r
 \r
 method_decl            : D_EMITBYTE int32\r
+                                               {\r
+                                                       codegen.CurrentMethodDef.AddInstr (new\r
+                                        EmitByteIntr ((int) $2, tokenizer.Location));\r
+                          \r
+                                               }\r
                        | D_MAXSTACK int32\r
                           {\r
                                 codegen.CurrentMethodDef.SetMaxStack ((int) $2);\r
index eed310a4b95f0e6d066410ff6836c324395ed80c..c2d553901f803ad0e81b7cd018970bb2a450cc8e 100644 (file)
@@ -1,3 +1,7 @@
+2007-12-31  Rodrigo Kumpera <rkumpera@novell.com>      
+
+       * test-emitbyte.il: new test for .emitbyte directive
+
 2007-10-09  Rodrigo Kumpera <rkumpera@novell.com>      
 
        * test-method-pointer-in-signature.il: New. Test for overloads
diff --git a/mcs/ilasm/tests/test-emitbyte.il b/mcs/ilasm/tests/test-emitbyte.il
new file mode 100644 (file)
index 0000000..80b6a3d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+This test try to use .emitbyte to generate the return value,
+the program should return 1 on sucess
+*/
+.assembly extern mscorlib
+{
+  .ver 2:0:0:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+}
+.assembly 'test-emitbyte'
+{
+  .hash algorithm 0x00008004
+  .ver  0:0:0:0
+}
+.module ld_type.exe
+
+.class public auto ansi beforefieldinit Driver
+        extends [mscorlib]System.Object
+{
+
+        .method public static int32 Main ()
+        {
+                .entrypoint
+                .maxstack 2
+                .locals init (int32 bla)
+               nop
+               .emitbyte 0x17 //equivalent to the ldc.i4.1 mnemonic
+               ret
+
+        }
+}
+
+