[Mono-bugs] [Bug 51037][Wis] New - Mono can't deal with CIL generated by SML.NET.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 7 Apr 2004 11:07:36 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vargaz@freemail.hu.

http://bugzilla.ximian.com/show_bug.cgi?id=51037

--- shadow/51037	2004-04-07 11:07:36.000000000 -0400
+++ shadow/51037.tmp.27721	2004-04-07 11:07:36.000000000 -0400
@@ -0,0 +1,280 @@
+Bug#: 51037
+Product: Mono: Runtime
+Version: unspecified
+OS: unknown
+OS Details: Current Debian unstable on x86
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gs234-mono-bugzilla@srcf.ucam.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono can't deal with CIL generated by SML.NET.
+BugsThisDependsOn: 51039[FIXED], 51041[FIXED], 51126[FIXED]
+
+Description of Problem:
+
+I have done some work to get SML.NET, an implementation of the functional
+language Standard ML for .NET, working with Mono.  Unfortunately, Mono is
+unable to cope with the CIL that SML.NET generates, and crashes and burns
+in a number of interesting ways.
+
+The following transcript demonstrates the failure modes.  In order to
+investigate these failures you can either follow the instructions given in
+<http://lists.ximian.com/archives/public/mono-devel-list/2003-November/002901.html>
+and
+<http://lists.ximian.com/archives/public/mono-devel-list/2003-November/002950.html>
+or you can download a tarball with the .il files from
+<http://home.tiscali.no/~sstr/gs234/sml.net.output.tar.bz2>.
+
+Transcript:
+  gs234@belldandy:~/smlnet/demos$ l
+  life/  ml-lex/	ml-yacc/  primes/  raytrace/  README.txt  sort/  trees/  xq/
+  gs234@belldandy:~/smlnet/demos$ cd ml-lex/
+  gs234@belldandy:~/smlnet/demos/ml-lex$ l
+  build.bat*	lexgen.doc  lexgen.tex	  mllex.sml	 README
+  export-lex.sml	lexgen.sml  mlex_int.doc  ml-lex.smlnet
+  gs234@belldandy:~/smlnet/demos/ml-lex$ smlnet @ml-lex
+  SML.NET 1.1 build 671 of Monday, 03 November 2003
+  Error: could not locate assembly: System.XML.dllError: could not locate
+assembly: System.Web.RegularExpressions.dll
+  [Interpreting commands in file
+/home/gs234/smlnet/demos/ml-lex/ml-lex.smlnet...]
+
+[Long and tedious output snipped]
+
+  Compiling whole program...sh: line 1:
+/usr/local/sandbox/mono/bin/ilasm.exe: Ikke tilgang
+
+      Assembler failed, invoked with: ilasm.exe /QUIET  
+"/home/gs234/smlnet/demos/ml-lex/ml-lex.il"
+/out="/home/gs234/smlnet/demos/ml-lex/ml-lex.exe"
+  done.
+
+Looks like SML.NET does not like the fact that ilasm.exe does not have
+executable permissions.
+
+  gs234@belldandy:~/smlnet/demos/ml-lex$ chmod +x
+/usr/local/sandbox/mono/bin/ilasm.exe 
+  gs234@belldandy:~/smlnet/demos/ml-lex$ smlnet @ml-lex
+  SML.NET 1.1 build 671 of Monday, 03 November 2003
+  Error: could not locate assembly: System.XML.dllError: could not locate
+assembly: System.Web.RegularExpressions.dll
+  [Interpreting commands in file
+/home/gs234/smlnet/demos/ml-lex/ml-lex.smlnet...]
+  Analysing dependencies...done.
+  Linking modules...done.
+  Compiling whole program...Mono ILasm compiler
+  ilasm [options] source-files
+     --about            About the Mono ILasm compiler
+     --version          Print the version number of the Mono ILasm compiler
+     /out:file_name     Specifies output file.
+     /exe               Compile to executable.
+     /dll               Compile to library.
+  Options can be of the form -option or /option
+
+
+      Assembler failed, invoked with: ilasm.exe /QUIET  
+"/home/gs234/smlnet/demos/ml-lex/ml-lex.il"
+/out="/home/gs234/smlnet/demos/ml-lex/ml-lex.exe"
+  done.
+
+I ilasm.exe is confused because the absolute paths look like
+Win32-style options.  Never mind, this can be done manually:
+
+  gs234@belldandy:~/smlnet/demos/ml-lex$ ilasm ml-lex.il
+  Assembling 'ml-lex.il' , no listing file, to exe --> 'ml-lex.exe'
+  Compilation succeeded
+
+mono barfs on the results:
+
+  gs234@belldandy:~/smlnet/demos/ml-lex$ mono ml-lex.exe 
+
+  ** ERROR **: Invalid IL code at IL0328 in $.Globals:.cctor (): IL_0328:
+newobj    0x06000044
+  
+  
+  aborting...
+  Avbrutt (SIGABRT)
+
+But mint seems to work:
+
+  gs234@belldandy:~/smlnet/demos/ml-lex$ mint ml-lex.exe
+  Usage: ml-lex <filename>
+
+  gs234@belldandy:~/smlnet/demos/ml-lex$ cd ..
+  gs234@belldandy:~/smlnet/demos$ l
+  life/  ml-lex/	ml-yacc/  primes/  raytrace/  README.txt  sort/  trees/  xq/
+  gs234@belldandy:~/smlnet/demos$ cd ml-yacc/
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ l
+  build.bat*  COPYRIGHT  doc/  examples/	ml-yacc.smlnet	README	src/
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ smlnet @ml-yacc
+  SML.NET 1.1 build 671 of Monday, 03 November 2003
+  Error: could not locate assembly: System.XML.dllError: could not locate
+assembly: System.Web.RegularExpressions.dll
+  [Interpreting commands in file
+/home/gs234/smlnet/demos/ml-yacc/ml-yacc.smlnet...]
+  [Interpreting commands in file
+/home/gs234/smlnet/lib/parsing/sources.smlnet...]
+  [Interpreting commands in file
+/home/gs234/smlnet/demos/ml-yacc/src/sources.smlnet...]
+  Analysing dependencies...
+
+[Long and tedious output elided]
+
+  Compiling whole program...Mono ILasm compiler
+  ilasm [options] source-files
+     --about            About the Mono ILasm compiler
+     --version          Print the version number of the Mono ILasm compiler
+     /out:file_name     Specifies output file.
+     /exe               Compile to executable.
+     /dll               Compile to library.
+  Options can be of the form -option or /option
+
+
+      Assembler failed, invoked with: ilasm.exe /QUIET  
+"/home/gs234/smlnet/demos/ml-yacc/ml-yacc.il"
+/out="/home/gs234/smlnet/demos/ml-yacc/ml-yacc.exe"
+  done.
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ ilasm ml-yacc.il
+  Assembling 'ml-yacc.il' , no listing file, to exe --> 'ml-yacc.exe'
+  Compilation succeeded
+
+mono fails again:
+
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ mono ml-yacc.exe 
+
+  ** ERROR **: Invalid IL code at IL06e1 in $.Globals:.cctor (): IL_06e1:
+newobj    0x060002b3
+
+
+  aborting...
+  Avbrutt (SIGABRT)
+
+mint doesn't do much better:
+
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ mint ml-yacc.exe
+  Nothing can catch this exception: TypeInitializationException: An
+exception was thrown by the type initializer for $.Globals
+  #0: 0xbf80194c nop        in $.Globals::$ ()
+  #1: 0x00000 call       in .ExportParseGen::.cctor ()
+  #2: 0xbf7ef3e0 nop        in .ExportParseGen::main ()
+
+  Inner exception: IndexOutOfRangeException: Array index is out of range
+  #0: 0x00000            in System.String::get_Chars ([0] )
+  #1: 0x00025 callvirt   in $.Globals::bc ()
+  #2: 0x00000 call       in $.Globals::bf ()
+  #3: 0x0001b call       in $.Globals::be ()
+  #4: 0x014a5 call       in $.Globals::.cctor ()
+  #5: 0xbf80194c nop        in $.Globals::$ ()
+  #6: 0x00000 call       in .ExportParseGen::.cctor ()
+  #7: 0xbf7ef3e0 nop        in .ExportParseGen::main ()
+
+  gs234@belldandy:~/smlnet/demos/ml-yacc$ cd ..
+  gs234@belldandy:~/smlnet/demos$ l
+  life/  ml-lex/	ml-yacc/  primes/  raytrace/  README.txt  sort/  trees/  xq/
+  gs234@belldandy:~/smlnet/demos$ cd primes/
+  gs234@belldandy:~/smlnet/demos/primes$ l
+  build.bat*  Primes.sml	Queue.sml  README.txt  Threads.sml
+  gs234@belldandy:~/smlnet/demos/primes$ smlnet Primes
+  SML.NET 1.1 build 671 of Monday, 03 November 2003
+  Error: could not locate assembly: System.XML.dllError: could not locate
+assembly: System.Web.RegularExpressions.dll
+  Analysing dependencies...
+
+[More tedious output elided]
+
+  Compilation succeeded: output in Primes.exe
+
+Another mono failure mode:
+
+  gs234@belldandy:~/smlnet/demos/primes$ mono Primes.exe 
+
+  ** ERROR **: file mini-x86.c: line 1278 (get_register_spilling):
+assertion failed: (regmask)
+  aborting...
+  Avbrutt (SIGABRT)
+
+But mint does fine:
+
+  gs234@belldandy:~/smlnet/demos/primes$ mint Primes.exe 
+  2 All sent 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83
+89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181
+191 193 197 199 
+
+  gs234@belldandy:~/smlnet/demos/primes$ cd ..
+  gs234@belldandy:~/smlnet/demos$ l
+  life/  ml-lex/	ml-yacc/  primes/  raytrace/  README.txt  sort/  trees/  xq/
+  gs234@belldandy:~/smlnet/demos$ cd sort/
+  gs234@belldandy:~/smlnet/demos/sort$ l
+  build.bat*  README.txt	Sort.sml
+  gs234@belldandy:~/smlnet/demos/sort$ smlnet Sort
+  SML.NET 1.1 build 671 of Monday, 03 November 2003
+  Error: could not locate assembly: System.XML.dllError: could not locate
+assembly: System.Web.RegularExpressions.dll
+  Analysing dependencies...
+    Parsing /home/gs234/smlnet/demos/sort/Sort.sml...done.
+  ...done.
+  Type checking structure Sort...done.
+  Compiling structure Sort...done.
+  Linking modules...done.
+  Compiling whole program...Compilation succeeded
+  done.
+  Compilation succeeded: output in Sort.exe
+
+mono dies again:
+
+  gs234@belldandy:~/smlnet/demos/sort$ mono Sort.exe 
+
+  ** ERROR **: Invalid IL code at IL0526 in .Sort:main (): IL_0526: call  
+   0x0a000004
+
+
+  aborting...
+  Avbrutt (SIGABRT)
+
+mint does better:
+
+  gs234@belldandy:~/smlnet/demos/sort$ mint Sort.exe 
+  50 27 4 81 58 35 12 89 66 43 20 97 74 51 28 5 82 59 36 13 90 67 44 21 98
+75 52 29 6 83 60 37 14 91 68 45 22 99 76 53 30 7 84 61 38 15 92 69 46 23 4
+5 6 7 12 13 14 15 20 21 22 23 27 28 29 30 35 36 37 38 43 44 45 46 50 51 52
+53 58 59 60 61 66 67 68 69 74 75 76 81 82 83 84 89 90 91 92 97 98 99 
+  gs234@belldandy:~/smlnet/demos/sort$
+
+------- Additional Comments From vargaz@freemail.hu  2003-11-16 10:57 -------
+The Invalid IL code at Globals:.cctor issue is tracked at bug
+#51039.
+
+The register allocator bug is already fixed in CVS.
+
+------- Additional Comments From jackson@ximian.com  2003-11-18 06:18 -------
+When running your buidl script I get this error in my build.log. I
+used the RPM version of Standard ML of New Jersey.
+
+Standard ML of New Jersey, Version 110.0.7, September 28, 2000 [CM;
+autoload enabled]
+- val it = () : unit
+stdIn:18.30-18.102 Error: operator and operand don't agree [literal]
+  operator domain: OS.Process.status
+  operand:         word
+  in expression:
+    OS.Process.exit 1
+
+
+------- Additional Comments From gs234-mono-bugzilla@srcf.ucam.org  2003-11-18 07:11 -------
+Look at the file smlnet/bld/build.sml.  getsmlnet.sh runs the command
+"sed -i s/0w1/OS.Process.failure/ bld/build.sml".  What you're seeing
+is the same error message that I get when the above sed invocation
+does not do its job.  (I have no idea how portable that invocation is,
+but it works for me(tm).)
+
+------- Additional Comments From gs234-mono-bugzilla@srcf.ucam.org  2003-11-18 17:56 -------
+You may wish to get the latest version of getsmlnet.sh from
+<http://lists.ximian.com/archives/public/mono-devel-list/2003-November/002993.html>.
+ It uses perl rather than sed.