[Mono-list] Jit compiler

Paolo Molaro lupus@ximian.com
Thu, 20 Dec 2001 15:45:31 +0100


On 12/20/01 adc wrote:
>  I have downloaded the latest anonCVS and I am trying to run the disassembler on some of the tests in the tests directory. Once I have compiled these with the Microsoft C# compiler I execute, for example
> ./monodis ../tests/ackermann.exe
> 
> but I recieve an error about an assertion in loader.c at line 73.
> This assertion asserts that the assembly has been opened without error
> (which it obviously hasn't) the error appears to be happening in the

The asserts says what it did expect (opening the assembly correctly)
and not what it got.

> mono_image_open function in image.c. This seems to happen with every
> executable I throw at it, even extremely simple programs.

You probably have only corlib.dll installed and the corlib from cvs
erroneously uses regular expressions that are from a different assembly.
The included patch should fix it for you (if you run it on Linux,
haven't tested win32 in a while).

> I ask as for my disertation I am going to investigate the worthiness of
> writing an assembler from CIL executables to native code executables,
> what optimisations etc can be gained by the fact that we no longer have
> compilation speed as a major restriction (obviously we don't want a
> compiler that takes forever but it would then be of less concern).

The idea has been floating around for some time and, yes, we think it's
worthwhile, we just need someone to tackle it:-)

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better

Index: System/Byte.cs
===================================================================
RCS file: /cvs/public/mcs/class/corlib/System/Byte.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- System/Byte.cs	2001/12/07 12:05:28	1.8
+++ System/Byte.cs	2001/12/20 10:36:18	1.9
@@ -8,7 +8,6 @@
 //
 
 using System.Globalization;
-using System.Text.RegularExpressions;
 
 namespace System {
 	
@@ -75,38 +74,7 @@
 			}
 
 			// TODO: Handle other styles and FormatProvider properties
-			if (NumberStyles.Integer == style){
-				// the pattern allowed is: [ws][+]digits[ws]
-				// [ws] = optional whitespace (any amount)
-				// [+] = one optional plus sign
-				// digits = one or more characters '0' through '9'
-				Regex bytePattern = new Regex("^\\s*\\+?\\d+\\s*$");
-				if (bytePattern.IsMatch(s)){
-					int retVal = 0;
-					int endIndex;
-					// extract the digits from the string
-					Regex byteDigitPattern = new Regex("\\d+");
-					Match m = byteDigitPattern.Match(s);
-					// find out the index number where the digits end
-					endIndex = m.Index+m.Length-1;
-					// work back-to-front through the digits and
-					// multiply each digit by the next power of 10 (start at 0)
-					for(int j = endIndex; j>=m.Index; j--){
-						retVal += (s[j]-'0')*(int)Math.Pow(10,endIndex-j);
-						if (retVal > Byte.MaxValue || retVal < Byte.MinValue){    
-							throw new OverflowException();
-						}
-					}
-					return (byte)retVal;
-				}
-				else {
-				    throw new FormatException();
-				}
-				
-			}
-			else {
-				throw new NotImplementedException();
-			}
+			throw new NotImplementedException();
 		}
 
 		public override string ToString ()