Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/ilasm
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2007-12-31 17:46:06 +0300
committerRodrigo Kumpera <kumpera@gmail.com>2007-12-31 17:46:06 +0300
commit9633488d6ee87acb7f22d5519a05270632893963 (patch)
treecdd267e091068472b39e8805828a7275e6426811 /mcs/ilasm
parent12829754cf73e561c3a7412273931b5d19394299 (diff)
In tests:
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
Diffstat (limited to 'mcs/ilasm')
-rw-r--r--mcs/ilasm/ChangeLog4
-rw-r--r--mcs/ilasm/codegen/ChangeLog5
-rw-r--r--mcs/ilasm/codegen/EmitByteInstr.cs34
-rw-r--r--mcs/ilasm/ilasm.exe.sources1
-rw-r--r--mcs/ilasm/parser/ChangeLog4
-rw-r--r--mcs/ilasm/parser/ILParser.jay5
-rw-r--r--mcs/ilasm/tests/ChangeLog4
-rw-r--r--mcs/ilasm/tests/test-emitbyte.il33
8 files changed, 90 insertions, 0 deletions
diff --git a/mcs/ilasm/ChangeLog b/mcs/ilasm/ChangeLog
index cc71dc8c246..cc530e5b8f1 100644
--- a/mcs/ilasm/ChangeLog
+++ b/mcs/ilasm/ChangeLog
@@ -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.
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog
index c4f8f141a87..e10aac69033 100644
--- a/mcs/ilasm/codegen/ChangeLog
+++ b/mcs/ilasm/codegen/ChangeLog
@@ -1,5 +1,10 @@
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
to LabelInfo.
diff --git a/mcs/ilasm/codegen/EmitByteInstr.cs b/mcs/ilasm/codegen/EmitByteInstr.cs
new file mode 100644
index 00000000000..e6778fe3500
--- /dev/null
+++ b/mcs/ilasm/codegen/EmitByteInstr.cs
@@ -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);
+ }
+ }
+
+}
+
diff --git a/mcs/ilasm/ilasm.exe.sources b/mcs/ilasm/ilasm.exe.sources
index 4659f94aa16..bb93d163183 100644
--- a/mcs/ilasm/ilasm.exe.sources
+++ b/mcs/ilasm/ilasm.exe.sources
@@ -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
diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog
index dbec8c35cf7..ed7a968c887 100644
--- a/mcs/ilasm/parser/ChangeLog
+++ b/mcs/ilasm/parser/ChangeLog
@@ -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,
diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay
index 9164b67ba19..5e417341ecf 100644
--- a/mcs/ilasm/parser/ILParser.jay
+++ b/mcs/ilasm/parser/ILParser.jay
@@ -2075,6 +2075,11 @@ method_decls : /* EMPTY */
;
method_decl : D_EMITBYTE int32
+ {
+ codegen.CurrentMethodDef.AddInstr (new
+ EmitByteIntr ((int) $2, tokenizer.Location));
+
+ }
| D_MAXSTACK int32
{
codegen.CurrentMethodDef.SetMaxStack ((int) $2);
diff --git a/mcs/ilasm/tests/ChangeLog b/mcs/ilasm/tests/ChangeLog
index eed310a4b95..c2d553901f8 100644
--- a/mcs/ilasm/tests/ChangeLog
+++ b/mcs/ilasm/tests/ChangeLog
@@ -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
index 00000000000..80b6a3d42b0
--- /dev/null
+++ b/mcs/ilasm/tests/test-emitbyte.il
@@ -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
+
+ }
+}
+
+