Merge pull request #4444 from lateralusX/jlorenss/windows-unwind-info
authorJohan Lorensson <lateralusx.github@gmail.com>
Fri, 10 Mar 2017 10:16:23 +0000 (11:16 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Mar 2017 10:16:23 +0000 (11:16 +0100)
Improve unwind support on Windows x64.

239 files changed:
README.md
configure.ac
data/config.in
docs/sources/mono-api-image.html
eglib/configure.ac
external/bockbuild
external/cecil
external/corefx
external/corert
mcs/class/Mono.Cecil/Consts.cs [new file with mode: 0644]
mcs/class/Mono.Cecil/Mono.Cecil.dll.sources
mcs/class/Mono.Options/Documentation/en/Mono.Options/Command.xml [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/Mono.Options/CommandSet.xml [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/Mono.Options/HelpCommand.xml [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml
mcs/class/Mono.Options/Documentation/en/examples/commands.cs [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/examples/commands.in [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/examples/commands.txt [new file with mode: 0644]
mcs/class/Mono.Options/Documentation/en/index.xml
mcs/class/Mono.Options/Makefile
mcs/class/Mono.Options/Mono.Options/Options.cs
mcs/class/Mono.Options/Mono.Options_test.dll.sources
mcs/class/Mono.Options/Test/Mono.Options-Test-net_4_x.csproj [new file with mode: 0644]
mcs/class/Mono.Options/Test/Mono.Options/CommandSetTest.cs [new file with mode: 0644]
mcs/class/Mono.Options/Test/Mono.Options/CommandTest.cs [new file with mode: 0644]
mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs
mcs/class/System.Core/System.Core-net_4_x.csproj
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.Drawing/System.Drawing/Color.cs
mcs/class/System.Drawing/System.Drawing/Image.cs
mcs/class/System.Drawing/System.Drawing/KnownColors.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/GraphicsPathIteratorTest.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/GraphicsPathTest.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/LinearGradientBrushTest.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/PathGradientBrushTest.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestColorBlend.cs
mcs/class/System.Drawing/Test/System.Drawing.Drawing2D/TestMatrix.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/MetafileTest.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestColorMatrix.cs
mcs/class/System.Drawing/Test/System.Drawing.Imaging/TestImageAttributes.cs
mcs/class/System.Drawing/Test/System.Drawing.Text/PrivateFontCollectionCas.cs
mcs/class/System.Drawing/Test/System.Drawing.Text/PrivateFontCollectionTest.cs
mcs/class/System.Drawing/Test/System.Drawing/ColorConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/ColorTranslator.cs
mcs/class/System.Drawing/Test/System.Drawing/FontFamilyTest.cs
mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs
mcs/class/System.Drawing/Test/System.Drawing/PenTest.cs
mcs/class/System.Drawing/Test/System.Drawing/RegionDataTest.cs
mcs/class/System.Drawing/Test/System.Drawing/SolidBrushTest.cs
mcs/class/System.Drawing/Test/System.Drawing/SystemFontsTest.cs
mcs/class/System.Drawing/Test/System.Drawing/SystemIconsTest.cs
mcs/class/System.Drawing/Test/System.Drawing/TestBitmap.cs
mcs/class/System.Drawing/Test/System.Drawing/TestBrushes.cs
mcs/class/System.Drawing/Test/System.Drawing/TestColor.cs
mcs/class/System.Drawing/Test/System.Drawing/TestFont.cs
mcs/class/System.Drawing/Test/System.Drawing/TestFontConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestGraphics.cs
mcs/class/System.Drawing/Test/System.Drawing/TestIcon.cs
mcs/class/System.Drawing/Test/System.Drawing/TestImage.cs
mcs/class/System.Drawing/Test/System.Drawing/TestImageConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPointConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestPointF.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRectangleConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestRegion.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSize.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSizeConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSizeF.cs
mcs/class/System.Drawing/Test/System.Drawing/TestSizeFConverter.cs
mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs
mcs/class/System.Drawing/Test/System.Drawing/TextureBrushTest.cs
mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj
mcs/class/System.Numerics/System.Numerics-net_4_x.csproj
mcs/class/System.Security/Makefile
mcs/class/System.Security/System.Security-net_4_x.csproj
mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
mcs/class/System.Security/System.Security.dll.sources
mcs/class/System.Security/System.Security_test.dll.sources
mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs
mcs/class/System.Security/corefx/SR.cs [new file with mode: 0644]
mcs/class/System.Windows.Forms/Makefile
mcs/class/System.Windows.Forms/System.Windows.Forms/MimeIcon.cs
mcs/class/System.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs
mcs/class/System.Windows.Forms/Test/simple/Program.cs [new file with mode: 0644]
mcs/class/System/Makefile
mcs/class/System/ReferenceSources/SR.cs
mcs/class/System/System-bare-net_4_x.csproj
mcs/class/System/System-net_4_x.csproj
mcs/class/System/System-secxml-net_4_x.csproj
mcs/class/System/System.Media/AudioDevice.cs
mcs/class/System/common.sources
mcs/class/System/corefx/SR.cs [new file with mode: 0644]
mcs/class/corlib/Makefile
mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs
mcs/class/corlib/System.Threading/Thread.cs
mcs/class/corlib/corefx/SR.cs [new file with mode: 0644]
mcs/class/corlib/corert/AddrofIntrinsics.cs [new file with mode: 0644]
mcs/class/corlib/corert/Debug.cs
mcs/class/corlib/corert/Interop.MemAllocFree.cs [new file with mode: 0644]
mcs/class/corlib/corert/Interop.cs [new file with mode: 0644]
mcs/class/corlib/corert/SR.cs [deleted file]
mcs/class/corlib/corlib-net_4_x.csproj
mcs/class/corlib/corlib.dll.sources
mcs/mcs/ecore.cs
mcs/tests/gtest-autoproperty-22.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/mkbundle/Makefile
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/resx2sr/resx2sr.cs
mcs/tools/security/cert-sync.cs
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/assembly-internals.h
mono/metadata/assembly.c
mono/metadata/attach.c
mono/metadata/class.c
mono/metadata/debug-internals.h [new file with mode: 0644]
mono/metadata/debug-mono-ppdb.c
mono/metadata/debug-mono-symfile.c
mono/metadata/debug-mono-symfile.h
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/metadata/gc.c
mono/metadata/handle.c
mono/metadata/handle.h
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image-internals.h
mono/metadata/image.c
mono/metadata/jit-info.c
mono/metadata/loader.c
mono/metadata/loader.h
mono/metadata/marshal.c
mono/metadata/metadata-internals.h
mono/metadata/monitor.c
mono/metadata/mono-debug-debugger.h [deleted file]
mono/metadata/mono-debug.c
mono/metadata/object-internals.h
mono/metadata/object-offsets.h
mono/metadata/object.c
mono/metadata/profiler.c
mono/metadata/sgen-mono.c
mono/metadata/threadpool-io-epoll.c
mono/metadata/threadpool-io-kqueue.c
mono/metadata/threadpool-io-poll.c
mono/metadata/threadpool-io.c
mono/metadata/threadpool-worker-default.c
mono/metadata/threadpool.h
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/metadata/w32file-unix.c
mono/metadata/w32process-unix-haiku.c
mono/metadata/w32process-unix-internals.h
mono/metadata/w32socket-unix.c
mono/metadata/w32socket-win32.c
mono/metadata/w32socket.c
mono/mini/.gitignore
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/basic-math.cs
mono/mini/debug-mini.c
mono/mini/debugger-agent.c
mono/mini/decompose.c
mono/mini/driver.c
mono/mini/dwarfwriter.c
mono/mini/dwarfwriter.h
mono/mini/exceptions-arm64.c
mono/mini/exceptions.cs
mono/mini/generics.cs
mono/mini/gshared.cs
mono/mini/iltests.il
mono/mini/interp/hacks.h [new file with mode: 0644]
mono/mini/interp/interp-internals.h [new file with mode: 0644]
mono/mini/interp/interp.c [new file with mode: 0644]
mono/mini/interp/interp.h [new file with mode: 0644]
mono/mini/interp/mintops.c [new file with mode: 0644]
mono/mini/interp/mintops.def [new file with mode: 0644]
mono/mini/interp/mintops.h [new file with mode: 0644]
mono/mini/interp/transform.c [new file with mode: 0644]
mono/mini/interpreter/hacks.h [deleted file]
mono/mini/interpreter/interp-internals.h [deleted file]
mono/mini/interpreter/interp.c [deleted file]
mono/mini/interpreter/interp.h [deleted file]
mono/mini/interpreter/mintops.c [deleted file]
mono/mini/interpreter/mintops.def [deleted file]
mono/mini/interpreter/mintops.h [deleted file]
mono/mini/interpreter/transform.c [deleted file]
mono/mini/jit-icalls.c
mono/mini/jit-icalls.h
mono/mini/lldb.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64-gsharedvt.c
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-arm64.c
mono/mini/mini-arm64.h
mono/mini/mini-exceptions.c
mono/mini/mini-llvm.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini-x86.h
mono/mini/mini.h
mono/mini/objects.cs
mono/mini/tramp-amd64-gsharedvt.c
mono/mini/tramp-amd64.c
mono/mini/tramp-arm.c
mono/mini/tramp-arm64-gsharedvt.c
mono/mini/tramp-arm64.c
mono/mini/tramp-ia64.c
mono/mini/tramp-x86.c
mono/mini/type-checking.c
mono/mini/unwind.c
mono/profiler/mono-profiler-vtune.c
mono/sgen/sgen-debug.c
mono/sgen/sgen-qsort.c
mono/tests/Makefile.am
mono/tests/method-access.il
mono/utils/Makefile.am
mono/utils/mono-context.h
mono/utils/mono-os-mutex.h
mono/utils/mono-proclib.c
mono/utils/mono-threads-haiku.c [new file with mode: 0644]
mono/utils/mono-threads-mach.c
mono/utils/mono-threads-posix-signals.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
msvc/mono.def
msvc/monosgen.def
msvc/scripts/order.xml
packaging/MacSDK/ironlangs.py
scripts/ci/run-test-default.sh
support/serial.c
support/sys-mman.c
support/sys-time.c
tools/nuget-hash-extractor/nuget-hash-extractor.cs
tools/offsets-tool/MonoAotOffsetsDumper.cs
tools/pedump/pedump.c

index c530d4a18bb485b86434447498efe899b984a1c2..87b011375061be7f0b91c045c3975cca6353354d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or
 | Windows      | amd64              | [![windows-amd64][15]][16]   |
 | Windows      | i386               | [![windows-amd64][17]][18]   |
 | CentOS       | s390x (cs)         | [![centos-s390x][19]][20]    |
+| Debian 8     | ppc64el (cs)       | [![debian-8-ppc64el][21]][22]|
 
 _(cs) = community supported architecture_
 
@@ -50,8 +51,10 @@ _(cs) = community supported architecture_
 [16]: https://jenkins.mono-project.com/job/z/label=w64/
 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
 [18]: https://jenkins.mono-project.com/job/z/label=w32/
-[19]: https://jenkins.mono-project.com/job/z/label=centos-s390x/badge/icon
-[20]: https://jenkins.mono-project.com/job/z/label=centos-s390x
+[19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
+[20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
+[21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el/badge/icon
+[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el
 
 Compilation and Installation
 ============================
index a8dcb129243b70243727efadf002dd69333022b1..0a6021c39e6e4146928e9f0506f4b5e24b30d488 100644 (file)
@@ -334,9 +334,13 @@ case "$host" in
                CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
                libmono_cflags="-D_REENTRANT -D_THREAD_SAFE"
                libdl=
-               LIBS="$LIBS -lnetwork"
+               LIBS="$LIBS -lnetwork -ltextencoding"
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID)
+               dnl Haiku does not support static TLS with __thread
+               with_tls=pthread
+               dnl Boehm is too much work to backport Haiku support for
+               support_boehm=no
                libgc_threads=pthreads
                use_sigposix=yes
                ;;
@@ -858,9 +862,9 @@ elif test x$with_runtime_preset = xfullaot; then
    mono_feature_disable_reflection_emit='yes'
    mono_feature_disable_appdomains='yes'
 
-   AOT_BUILD_FLAGS="-O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
+   AOT_BUILD_FLAGS="--runtime=mobile -O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
 
-   AOT_RUN_FLAGS="--full-aot"
+   AOT_RUN_FLAGS="--runtime=mobile --full-aot"
 elif test x$with_runtime_preset = xbitcode; then
    DISABLE_MCS_DOCS_default=yes
    with_testing_aot_full_default=yes
@@ -875,15 +879,15 @@ elif test x$with_runtime_preset = xbitcode; then
    mono_feature_disable_reflection_emit='yes'
    mono_feature_disable_appdomains='yes'
 
-   AOT_BUILD_FLAGS="--aot=llvmonly,$INVARIANT_AOT_OPTIONS"
-   AOT_RUN_FLAGS="--llvmonly"
+   AOT_BUILD_FLAGS="--runtime=mobile --aot=llvmonly,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--runtime=mobile --llvmonly"
 elif test x$with_runtime_preset = xhybridaot; then
    DISABLE_MCS_DOCS_default=yes
    with_testing_aot_hybrid_default=yes
    TEST_PROFILE=testing_aot_hybrid 
 
-   AOT_BUILD_FLAGS="--aot=hybrid,$INVARIANT_AOT_OPTIONS"
-   AOT_RUN_FLAGS="--hybrid-aot"
+   AOT_BUILD_FLAGS="--runtime=mobile --aot=hybrid,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--runtime=mobile --hybrid-aot"
 elif test x$with_runtime_preset = xaot; then
    with_profile4_x_default=yes
 
@@ -902,8 +906,8 @@ elif test x$with_runtime_preset = xwinaot; then
    mono_feature_disable_reflection_emit='yes'
    mono_feature_disable_appdomains='yes'
 
-   AOT_BUILD_FLAGS="--aot=full,$INVARIANT_AOT_OPTIONS"
-   AOT_RUN_FLAGS="--full-aot"
+   AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--runtime=mobile --full-aot"
 elif test x$with_runtime_preset = xorbis; then
    DISABLE_MCS_DOCS_default=yes
    with_orbis_default=yes
@@ -915,8 +919,8 @@ elif test x$with_runtime_preset = xorbis; then
    mono_feature_disable_reflection_emit='yes'
    mono_feature_disable_appdomains='yes'
 
-   AOT_BUILD_FLAGS="--aot=full,$INVARIANT_AOT_OPTIONS"
-   AOT_RUN_FLAGS="--full-aot"
+   AOT_BUILD_FLAGS="--runtime=mobile --aot=full,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--runtime=mobile --full-aot"
 else
    with_profile4_x_default=yes
 fi
@@ -1913,6 +1917,10 @@ if test x$host_win32 = xno; then
 # and libpthread does not exist
 #
        case "${host}" in
+               *-*-*haiku*)
+                       dnl Haiku has pthread in libroot (libc equiv)
+                       AC_CHECK_LIB(pthread, main, LIBS="$LIBS")
+               ;;
                *-*-*freebsd*)
                        AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
                ;;
@@ -2322,6 +2330,10 @@ if test x$host_win32 = xno; then
                AC_MSG_RESULT(no)
        ])
                        
+       dnl **********************************
+       dnl *** Checks for proclib         ***
+       dnl **********************************
+       AC_CHECK_HEADER(sys/errno.h, [AC_DEFINE(HAVE_SYS_ERRNO_H, 1, Define to 1 if you have the <sys/errno.h> header file.)])
        dnl **********************************
        dnl *** Checks for MonoPosixHelper ***
        dnl **********************************
index be83151429311d44e1c6d5aaa5c82df050a1aa74..282bc114950a16107bf961907b3270a3ccc90cdb 100644 (file)
        <dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
        <dllmap dll="libX11" target="@X11@" os="!windows" />
        <dllmap dll="libgdk-x11-2.0" target="@GDKX11@" os="!windows"/>
+       <dllmap dll="libgdk_pixbuf-2.0" target="libgdk_pixbuf-2.0.so.0" os="!windows"/>
        <dllmap dll="libgtk-x11-2.0" target="@GTKX11@" os="!windows"/>
+       <dllmap dll="libglib-2.0" target="libglib-2.0.so.0" os="!windows"/>
+       <dllmap dll="libgobject-2.0" target="libgobject-2.0.so.0" os="!windows"/>
+       <dllmap dll="libgnomeui-2" target="libgnomeui-2.so.0" os="!windows"/>
+       <dllmap dll="librsvg-2" target="librsvg-2.so.2" os="!windows"/>
        <dllmap dll="libXinerama" target="@XINERAMA@" os="!windows" />
+       <dllmap dll="libasound" target="libasound.so.2" os="!windows" />
        <dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
        <dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
        <dllmap dll="libcups" target="libcups.so.2" os="!windows"/>
index 764f2a4a9c9041896b4b8c53ba9827d3b631a193..8b8d4710bb441f248b4f5e424739e081581d3d45 100644 (file)
@@ -27,7 +27,6 @@ typedef enum {
 
 <h3>Opening and closing MonoImages</h3>
 
-<h4><a name="api:mono_load_image">mono_load_image</a></h4>
 <h4><a name="api:mono_image_open">mono_image_open</a></h4>
 <h4><a name="api:mono_image_open_full">mono_image_open_full</a></h4>
 <h4><a name="api:mono_image_open_from_data">mono_image_open_from_data</a></h4>
index 89f85d18e590434088b672fc593b3f2012052ead..92cd6156f94a94c466ada7cc817befedab309b57 100644 (file)
@@ -94,6 +94,9 @@ arm*-darwin*|aarch64*-*)
 i*86-*-darwin*)
     ORDER=G_LITTLE_ENDIAN
     ;;
+*-*-haiku*)
+    LDFLAGS="$LDFLAGS -ltextencoding"
+    ;;
 *-*-openbsd*)
     CFLAGS="$CFLAGS -pthread"
     LDFLAGS="$LDFLAGS -pthread"
index e8abd2e5568b32bd985befca308016d4526158ed..48abc0d4c2008b5d7d55748fab6bb7506ed9447d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e8abd2e5568b32bd985befca308016d4526158ed
+Subproject commit 48abc0d4c2008b5d7d55748fab6bb7506ed9447d
index f41352fa7dce0162d3172004617121fe28f06a88..1ab0b08ad40962d4f794f12ce042b98d2148df52 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f41352fa7dce0162d3172004617121fe28f06a88
+Subproject commit 1ab0b08ad40962d4f794f12ce042b98d2148df52
index c00dde208d25f180d881c37d465410ed2edd6939..bc85afcc18bfc5e8352350c2ee4c2bea5de1f03f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c00dde208d25f180d881c37d465410ed2edd6939
+Subproject commit bc85afcc18bfc5e8352350c2ee4c2bea5de1f03f
index d87c966d80c1274373ddafe3375bf1730cd430ed..31eda261991f9f6c1add1686b6d3799f835b2978 160000 (submodule)
@@ -1 +1 @@
-Subproject commit d87c966d80c1274373ddafe3375bf1730cd430ed
+Subproject commit 31eda261991f9f6c1add1686b6d3799f835b2978
diff --git a/mcs/class/Mono.Cecil/Consts.cs b/mcs/class/Mono.Cecil/Consts.cs
new file mode 100644 (file)
index 0000000..6ed785f
--- /dev/null
@@ -0,0 +1,5 @@
+static class Consts
+{
+       public const string AssemblyName = "Mono.Cecil";
+       public const string PublicKey = "002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df";
+}
\ No newline at end of file
index ed24c3b38adc0abf085454059925dbb5f36239d9..9cc36d56a35298de246498624b20fcb806adddac 100644 (file)
@@ -1,9 +1,94 @@
+Consts.cs
 ../../../external/cecil/ProjectInfo.cs
 ../../../external/cecil/Mono/*.cs
-../../../external/cecil/Mono.Cecil/*.cs
 ../../../external/cecil/Mono.Cecil.Cil/*.cs
 ../../../external/cecil/Mono.Cecil.Metadata/*.cs
 ../../../external/cecil/Mono.Cecil.PE/*.cs
 ../../../external/cecil/Mono.Collections.Generic/*.cs
 ../../../external/cecil/Mono.Security.Cryptography/*.cs
 ../../../external/cecil/System.Security.Cryptography/*.cs
+
+../../../external/cecil/Mono.Cecil/ArrayType.cs
+../../../external/cecil/Mono.Cecil/AssemblyDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyFlags.cs
+../../../external/cecil/Mono.Cecil/AssemblyHashAlgorithm.cs
+../../../external/cecil/Mono.Cecil/AssemblyInfo.cs
+../../../external/cecil/Mono.Cecil/AssemblyLinkedResource.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameDefinition.cs
+../../../external/cecil/Mono.Cecil/AssemblyNameReference.cs
+../../../external/cecil/Mono.Cecil/AssemblyReader.cs
+../../../external/cecil/Mono.Cecil/AssemblyWriter.cs
+../../../external/cecil/Mono.Cecil/BaseAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/CallSite.cs
+../../../external/cecil/Mono.Cecil/CustomAttribute.cs
+../../../external/cecil/Mono.Cecil/DefaultAssemblyResolver.cs
+../../../external/cecil/Mono.Cecil/EmbeddedResource.cs
+../../../external/cecil/Mono.Cecil/EventAttributes.cs
+../../../external/cecil/Mono.Cecil/EventDefinition.cs
+../../../external/cecil/Mono.Cecil/EventReference.cs
+../../../external/cecil/Mono.Cecil/ExportedType.cs
+../../../external/cecil/Mono.Cecil/FieldAttributes.cs
+../../../external/cecil/Mono.Cecil/FieldDefinition.cs
+../../../external/cecil/Mono.Cecil/FieldReference.cs
+../../../external/cecil/Mono.Cecil/FileAttributes.cs
+../../../external/cecil/Mono.Cecil/FunctionPointerType.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceMethod.cs
+../../../external/cecil/Mono.Cecil/GenericInstanceType.cs
+../../../external/cecil/Mono.Cecil/GenericParameter.cs
+../../../external/cecil/Mono.Cecil/GenericParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/IConstantProvider.cs
+../../../external/cecil/Mono.Cecil/ICustomAttributeProvider.cs
+../../../external/cecil/Mono.Cecil/IGenericInstance.cs
+../../../external/cecil/Mono.Cecil/IGenericParameterProvider.cs
+../../../external/cecil/Mono.Cecil/IMarshalInfoProvider.cs
+../../../external/cecil/Mono.Cecil/IMemberDefinition.cs
+../../../external/cecil/Mono.Cecil/IMetadataScope.cs
+../../../external/cecil/Mono.Cecil/IMetadataTokenProvider.cs
+../../../external/cecil/Mono.Cecil/IMethodSignature.cs
+../../../external/cecil/Mono.Cecil/Import.cs
+../../../external/cecil/Mono.Cecil/LinkedResource.cs
+../../../external/cecil/Mono.Cecil/ManifestResourceAttributes.cs
+../../../external/cecil/Mono.Cecil/MarshalInfo.cs
+../../../external/cecil/Mono.Cecil/MemberDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/MemberReference.cs
+../../../external/cecil/Mono.Cecil/MetadataResolver.cs
+../../../external/cecil/Mono.Cecil/MetadataSystem.cs
+../../../external/cecil/Mono.Cecil/MethodAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodCallingConvention.cs
+../../../external/cecil/Mono.Cecil/MethodDefinition.cs
+../../../external/cecil/Mono.Cecil/MethodImplAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodReference.cs
+../../../external/cecil/Mono.Cecil/MethodReturnType.cs
+../../../external/cecil/Mono.Cecil/MethodSemanticsAttributes.cs
+../../../external/cecil/Mono.Cecil/MethodSpecification.cs
+../../../external/cecil/Mono.Cecil/Modifiers.cs
+../../../external/cecil/Mono.Cecil/ModuleDefinition.cs
+../../../external/cecil/Mono.Cecil/ModuleKind.cs
+../../../external/cecil/Mono.Cecil/ModuleReference.cs
+../../../external/cecil/Mono.Cecil/NativeType.cs
+../../../external/cecil/Mono.Cecil/PInvokeAttributes.cs
+../../../external/cecil/Mono.Cecil/PInvokeInfo.cs
+../../../external/cecil/Mono.Cecil/ParameterAttributes.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinition.cs
+../../../external/cecil/Mono.Cecil/ParameterDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/ParameterReference.cs
+../../../external/cecil/Mono.Cecil/PinnedType.cs
+../../../external/cecil/Mono.Cecil/PointerType.cs
+../../../external/cecil/Mono.Cecil/PropertyAttributes.cs
+../../../external/cecil/Mono.Cecil/PropertyDefinition.cs
+../../../external/cecil/Mono.Cecil/PropertyReference.cs
+../../../external/cecil/Mono.Cecil/ReferenceType.cs
+../../../external/cecil/Mono.Cecil/Resource.cs
+../../../external/cecil/Mono.Cecil/SecurityDeclaration.cs
+../../../external/cecil/Mono.Cecil/SentinelType.cs
+../../../external/cecil/Mono.Cecil/TargetRuntime.cs
+../../../external/cecil/Mono.Cecil/Treatments.cs
+../../../external/cecil/Mono.Cecil/TypeAttributes.cs
+../../../external/cecil/Mono.Cecil/TypeDefinition.cs
+../../../external/cecil/Mono.Cecil/TypeDefinitionCollection.cs
+../../../external/cecil/Mono.Cecil/TypeParser.cs
+../../../external/cecil/Mono.Cecil/TypeReference.cs
+../../../external/cecil/Mono.Cecil/TypeSpecification.cs
+../../../external/cecil/Mono.Cecil/TypeSystem.cs
+../../../external/cecil/Mono.Cecil/VariantType.cs
+../../../external/cecil/Mono.Cecil/WindowsRuntimeProjections.cs
diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/Command.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/Command.xml
new file mode 100644 (file)
index 0000000..de2cda6
--- /dev/null
@@ -0,0 +1,286 @@
+<Type Name="Command" FullName="Mono.Options.Command">
+  <TypeSignature Language="C#" Value="public class Command" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Command extends System.Object" />
+  <AssemblyInfo>
+    <AssemblyName>Mono.Options</AssemblyName>
+    <AssemblyVersion>0.2.3.0</AssemblyVersion>
+  </AssemblyInfo>
+  <ThreadingSafetyStatement>
+    Public <c>static</c> members of this type are thread safe.
+    Any instance members are not guaranteed to be thread safe.
+  </ThreadingSafetyStatement>
+  <Base>
+    <BaseTypeName>System.Object</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>
+      Represents a program command.
+    </summary>
+    <remarks>
+      <para>
+        Many command-line utilities are <i>suites</i> of commands, with a single
+        "outer" command and multiple commands. Examples of this style of
+        utility includes <b>git</b>, <b>svn</b>, and <b>mdoc</b>.
+      </para>
+      <para>
+        A <c>Command</c> represents a specific command in such a suite.
+        It has a <see cref="P:Mono.Options.Command.Name" /> which is the
+        command name for invocation purposes, optional help text through
+        the <see cref="P:Mono.Options.Command.Help" /> property, an optional
+        <see cref="T:Mono.Options.OptionSet" /> accessible through the
+        <see cref="P:Mono.Options.Command.Options" /> property for command-line
+        parsing, and two ways to have code executed when a command is
+        invoked: the <see cref="P:Mono.Options.Command.Run" /> property and
+        the <see cref="M:Mono.Options.Command.Invoke" /> method.
+      </para>
+    </remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public Command (string name, string help = null);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name, string help) cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters>
+        <Parameter Name="name" Type="System.String" />
+        <Parameter Name="help" Type="System.String" />
+      </Parameters>
+      <Docs>
+        <param name="name">
+          A <see cref="T:System.String" /> which is the command name.
+        </param>
+        <param name="help">
+          A <see cref="T:System.String" /> which is the command help text.
+        </param>
+        <summary>
+          Creates and initializes a new instance of the <c>Command</c> class.
+        </summary>
+        <remarks>
+          <para>
+          This constructor initializes the
+          <see cref="P:Mono.Options.Command.Name" /> property of the new
+          instance using <paramref name="name" /> and initializes the
+          <see cref="P:Mono.Options.Command.Help" /> property of the new
+          instance using <paramref name="help" />.
+        </para>
+        </remarks>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="name" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="CommandSet">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet CommandSet { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class Mono.Options.CommandSet CommandSet" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          A <see cref="T:Mono.Options.CommandSet" /> instance which owns the
+          <c>Command</c>.
+        </summary>
+        <value>
+          A <see cref="T:Mono.Options.CommandSet" /> instance which owns the
+          <c>Command</c>.
+        </value>
+        <remarks>
+          <para>
+            A <c>Command</c> instance may belong to only one
+            <see cref="T:Mono.Options.CommandSet" /> instance.
+            The <c>CommandSet</c> property is set upon calling
+            <see cref="M:Mono.Options.CommandSet.Add(Mono.Options.Command)" />.
+          </para>
+          <para>
+            If the <c>Command</c> instance has not yet been added to a
+            <c>CommandSet</c>, then this property is <see langword="null" />.
+          </para>
+          <para>
+            Use the <c>CommandSet</c> instance from either the
+            <see cref="P:Mono.Options.Command.Run" /> property or an overridden
+            <see cref="M:Mono.Options.Command.Invoke" /> method to access
+            localization facilities through
+            <see cref="P:Mono.Options.CommandSet.MessageLocalizer" />, the
+            preferred message output stream through
+            <see cref="P:Mono.Options.CommandSet.Out" />, and other features.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Help">
+      <MemberSignature Language="C#" Value="public string Help { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string Help" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          A short, one-line, description of the <c>Command</c>.
+        </summary>
+        <value>
+          A <see cref="T:System.String" /> containing the optional help text
+          of the <c>Command</c>.
+        </value>
+        <remarks>
+          <para>
+            The <c>Help</c> property text is shown when the <c>help</c>
+            command is invoked.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Invoke">
+      <MemberSignature Language="C#" Value="public virtual int Invoke (System.Collections.Generic.IEnumerable&lt;string&gt; arguments);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 Invoke(class System.Collections.Generic.IEnumerable`1&lt;string&gt; arguments) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Int32</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="arguments" Type="System.Collections.Generic.IEnumerable&lt;System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="arguments">
+          A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" />
+          which contains the unprocessed command-line arguments.
+        </param>
+        <summary>
+          Invoked by <see cref="M:Mono.Options.CommandSet.Run" /> when a command
+          has been executed.
+        </summary>
+        <returns>
+          A <see cref="T:System.Int32" /> which should be treated as the process
+          exit value.
+        </returns>
+        <remarks>
+          <para>
+            The value returned by <c>Invoke()</c> is the return value of
+            <see cref="M:Mono.Options.CommandSet.Run" />, and should be treated
+            as a possible process exit value.
+          </para>
+          <block subset="none" type="behaviors">
+            <para>
+              If the <c>Invoke()</c> method is not overridden by a subclass,
+              the <c>Invoke()</c> method will use
+              <see cref="P:Mono.Options.Command.Options" /> to parse
+              <paramref name="arguments" />, and pass any un-processed values
+              on to <see cref="P:Mono.Options.Command.Run" />.
+            </para>
+            <para>
+              If the <c>Options</c> property is <see langword="null" />, then no
+              option processing will occur, and <paramref name="arguments" />
+              will be provided to the <c>Run</c> property as-is.
+            </para>
+            <para>
+              If the <c>Run</c> property is <see langword="null" />, then
+              no further processing occurs.
+            </para>
+          </block>
+          <block subset="none" type="overrides">
+            <para>
+              Method overrides do not need to call the base class method.
+            </para>
+          </block>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Name">
+      <MemberSignature Language="C#" Value="public string Name { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string Name" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          The name of the <c>Command</c>, which is used for command invocation.
+        </summary>
+        <value>
+          A <see cref="T:System.String" /> which is the name of the <c>Command</c>.
+        </value>
+        <remarks>
+          <para>
+            The <c>Name</c> value must be unique across all <c>Commmand</c> instances
+            referred to by a <see cref="T:Mono.Options.CommandSet" />.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Options">
+      <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Options { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class Mono.Options.OptionSet Options" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.OptionSet</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Optional command-line option information.
+        </summary>
+        <value>
+          A <see cref="T:Mono.Options.OptionSet" /> instance which contains the
+          available command-line options for the <c>Command</c>.
+        </value>
+        <remarks>
+          <para>
+            If the <c>Options</c> property is not <see langword="null" /> when
+            the command is processed,
+            <see cref="M:Mono.Options.OptionSet.Parse" /> will be invoked on
+            the <c>Options</c> instance, and the return value of
+            <c>OptionSet.Parse()</c> will be forwarded to
+            <see cref="M:Mono.Options.Command.Invoke" />.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Run">
+      <MemberSignature Language="C#" Value="public Action&lt;System.Collections.Generic.IEnumerable&lt;string&gt;&gt; Run { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class System.Action`1&lt;class System.Collections.Generic.IEnumerable`1&lt;string&gt;&gt; Run" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Action&lt;System.Collections.Generic.IEnumerable&lt;System.String&gt;&gt;</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Optional command handler.
+        </summary>
+        <value>
+          A <see cref="T:System.Action{System.Collections.Generic.IEnumerable{System.String}}" />
+          delegate which is executed by
+          <see cref="M:Mono.Options.Command.Invoke" />.
+        </value>
+        <remarks>
+          <para>
+            The <c>Run</c> property is executed by the the 
+            <see cref="M:Mono.Options.Command.Invoke" /> method when
+            <see cref="M:Mono.Options.CommandSet.Run" /> dispatches to a
+            <c>Command</c> instance.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/CommandSet.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/CommandSet.xml
new file mode 100644 (file)
index 0000000..5d82495
--- /dev/null
@@ -0,0 +1,1349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Type Name="CommandSet" FullName="Mono.Options.CommandSet">
+  <TypeSignature Language="C#" Value="public class CommandSet : System.Collections.ObjectModel.KeyedCollection&lt;string,Mono.Options.Command&gt;" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit CommandSet extends System.Collections.ObjectModel.KeyedCollection`2&lt;string, class Mono.Options.Command&gt;" />
+  <AssemblyInfo>
+    <AssemblyName>Mono.Options</AssemblyName>
+    <AssemblyVersion>0.2.3.0</AssemblyVersion>
+  </AssemblyInfo>
+  <ThreadingSafetyStatement>
+    Public <c>static</c> members of this type are thread safe.
+    Any instance members are not guaranteed to be thread safe.
+  </ThreadingSafetyStatement>
+  <Base>
+    <BaseTypeName>System.Collections.ObjectModel.KeyedCollection&lt;System.String,Mono.Options.Command&gt;</BaseTypeName>
+    <BaseTypeArguments>
+      <BaseTypeArgument TypeParamName="!0">System.String</BaseTypeArgument>
+      <BaseTypeArgument TypeParamName="!1">Mono.Options.Command</BaseTypeArgument>
+    </BaseTypeArguments>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>
+      A <i>suite</i> of commands, global program options, and associated documentation.
+    </summary>
+    <remarks>
+      <para>
+        A common requirement of some programs are discrete <i>commands</i>.
+        A <c>CommandSet</c> represents a <i>suite</i> of commands, intermixed
+        with suite documentation. Commands are managed by
+        <see cref="T:Mono.Options.Command" /> instances, which have a required
+        <i>name</i> and optional help text, and <c>CommandSet</c> will use the
+        intermixed documentation, options, and commands to produce <c>help</c>
+        command output.
+      </para>
+      <para>
+        To create a <c>CommandSet</c> instance, use the
+        <see cref="C:Mono.Options.CommandSet(System.String, System.Converter, System.IO.TextWriter, System.IO.TextWriter)" />
+        constructor. Only the suite name is required; all other parameters are
+        optional.
+      </para>
+      <para>
+        Once a <c>CommandSet</c> instance has been constructed, use the
+        <see cref="M:Mono.Options.CommandSet.Add" /> methods to add and
+        intermix suite documentation, global options, and commands.
+        Documentation is any string constant, global options are handled
+        by <see cref="T:Mono.Options.Option" /> instances and associated
+        <c>Add()</c> method overloads which implicitly create <c>Option</c>
+        instances, and commands are through <c>Command</c> instances.
+      </para>
+      <para>
+        Once the <c>CommandSet</c> instance has been initialized, call the
+        <see cref="M:Mono.Options.CommandSet.Run(System.String[])" />
+        method to process the arguments provided to <c>Main()</c>.
+        The appropriate <c>Command</c> instance will be determined, it's
+        options parsed, and <see cref="M:Mono.Options.Command.Invoke" />
+        will be executed. The return value of <c>Command.Invoke()</c>
+        is returned from <c>CommandSet.Run()</c>, and should be treated
+        as the process exit value.
+      </para>
+    </remarks>
+    <example>
+      <para>
+        The following <c>commands</c> example demonstrates some simple usage
+        of <see cref="T:Mono.Options.CommandSet" />.
+      </para>
+      <code lang="C#" src="examples/commands.cs">// Sub-commands with Mono.Options.CommandSet
+//
+// Compile as:
+//   mcs -r:Mono.Options.dll commands.cs
+
+using System;
+using System.Collections.Generic;
+
+using Mono.Options;
+
+class CommandDemo {
+       public static int Main (string[] args)
+       {
+               var commands = new CommandSet ("commands") {
+                       "usage: commands COMMAND [OPTIONS]",
+                       "",
+                       "Mono.Options.CommandSet sample app.",
+                       "",
+                       "Global options:",
+                       { "v:",
+                         "Output verbosity.",
+                         (int? n) =&gt; Verbosity = n.HasValue ? n.Value : Verbosity + 1 },
+                       "",
+                       "Available commands:",
+                       new Command ("echo", "Echo arguments to the screen") {
+                               Run = ca =&gt; Console.WriteLine ("{0}", string.Join (" ", ca)),
+                       },
+                       new RequiresArgs (),
+               };
+               return commands.Run (args);
+       }
+
+       public static int Verbosity;
+}
+
+class RequiresArgs : Command {
+
+       public RequiresArgs ()
+               : base ("requires-args", "Class-based Command subclass")
+       {
+               Options = new OptionSet () {
+                       "usage: commands requires-args [OPTIONS]",
+                       "",
+                       "Class-based Command subclass example.",
+                       { "name|n=",
+                         "{name} of person to greet.",
+                         v =&gt; Name = v },
+                       { "help|h|?",
+                         "Show this message and exit.",
+                         v =&gt; ShowHelp = v != null },
+               };
+       }
+
+       public        bool    ShowHelp    {get; private set;}
+       public  new   string  Name        {get; private set;}
+
+       public override int Invoke (IEnumerable&lt;string&gt; args)
+       {
+               try {
+                       var extra = Options.Parse (args);
+                       if (ShowHelp) {
+                               Options.WriteOptionDescriptions (CommandSet.Out);
+                               return 0;
+                       }
+                       if (string.IsNullOrEmpty (Name)) {
+                               Console.Error.WriteLine ("commands: Missing required argument `--name=NAME`.");
+                               Console.Error.WriteLine ("commands: Use `commands help requires-args` for details.");
+                               return 1;
+                       }
+                       Console.WriteLine ($"Hello, {Name}!");
+                       return 0;
+               }
+               catch (Exception e) {
+                       Console.Error.WriteLine ("commands: {0}", CommandDemo.Verbosity &gt;= 1 ? e.ToString () : e.Message);
+                       return 1;
+               }
+       }
+}
+</code>
+      <para>
+        The output, under the influence of different command-line arguments, is:
+      </para>
+      <code lang="sh" src="examples/commands.txt">$ mono commands.exe
+Use `commands help` for usage.
+
+$ mono commands.exe --help
+usage: commands COMMAND [OPTIONS]
+
+Mono.Options.CommandSet sample app.
+
+Global options:
+  -v[=VALUE]                 Output verbosity.
+
+Available commands:
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+
+$ mono commands.exe help
+usage: commands COMMAND [OPTIONS]
+
+Mono.Options.CommandSet sample app.
+
+Global options:
+  -v[=VALUE]                 Output verbosity.
+
+Available commands:
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+
+$ mono commands.exe help --help
+Usage: commands COMMAND [OPTIONS]
+Use `commands help COMMAND` for help on a specific command.
+
+Available commands:
+
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+        help                 Show this message and exit
+
+$ mono commands.exe help echo
+--help
+
+$ mono commands.exe echo --help
+--help
+
+$ mono commands.exe echo hello, world
+hello, world
+
+$ mono commands.exe requires-args
+commands: Missing required argument `--name=NAME`.
+commands: Use `commands help requires-args` for details.
+
+$ mono commands.exe help requires-args
+usage: commands requires-args [OPTIONS]
+
+Class-based Command subclass example.
+      --name, -n=name        name of person to greet.
+      --help, -h, -?         Show this message and exit.
+
+$ mono commands.exe requires-args --help
+usage: commands requires-args [OPTIONS]
+
+Class-based Command subclass example.
+      --name, -n=name        name of person to greet.
+      --help, -h, -?         Show this message and exit.
+
+$ mono commands.exe requires-args -n World
+Hello, World!
+
+$ mono commands.exe invalid-command
+commands: Unknown command: invalid-command
+commands: Use `commands help` for usage.
+
+$ mono commands.exe help invalid-command
+commands: Unknown command: invalid-command
+commands: Use `commands help` for usage.
+</code>
+      <para>
+        The <c>commands.exe</c> output is short, informing the user that
+        commands are required for use.
+      </para>
+      <para>
+        The <c>commands.exe --help</c> is identical to the <c>commands help</c>
+        output, and shows the provided suite documentation.
+      </para>
+      <para>
+        <c>commands.exe COMMAND --help</c> and <c>commands.exe help COMMAND</c>
+        output is likewise identical, and will attempt to generate documentation
+        for the specified command, if available. This is performed by invoking
+        <see cref="M:Mono.Options.Command.Invoke(System.Collections.Generic.IEnumerable{System.String})" />
+        with the value <c>{ "--help" }</c>. This can be seen in the
+        <c>commands.exe help echo</c> and <c>commands.exe echo --help</c>
+        output, which simply prints <c>--help</c>. If a command wants
+        to partake in <c>help COMMAND</c> support, it needs to explicitly
+        handle the <c>--help</c> option in its associated
+        <see cref="T:Mono.Options.OptionSet" /> instance, referenced by the
+        <see cref="P:Mono.Options.Command.Options" /> property.
+      </para>
+      <para>
+        Finally, if an invalid command is specified, then an error is written
+        to <see cref="P:Mono.Options.CommandSet.Error" />, prefixed with the
+        <see cref="P:Mono.Options.CommandSet.Suite" /> value.
+      </para>
+    </example>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public CommandSet (string suite, Converter&lt;string,string&gt; localizer = null, System.IO.TextWriter output = null, System.IO.TextWriter error = null);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string suite, class System.Converter`2&lt;string, string&gt; localizer, class System.IO.TextWriter output, class System.IO.TextWriter error) cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters>
+        <Parameter Name="suite" Type="System.String" />
+        <Parameter Name="localizer" Type="System.Converter&lt;System.String,System.String&gt;" />
+        <Parameter Name="output" Type="System.IO.TextWriter" />
+        <Parameter Name="error" Type="System.IO.TextWriter" />
+      </Parameters>
+      <Docs>
+        <param name="suite">
+          A <see cref="T:System.String" /> containing the name of the suite.
+          This value is used in default <c>help</c> text output.
+        </param>
+        <param name="localizer">
+          A <see cref="T:System.Converter{System.String,System.String}" />
+          instance that will be used to translate strings.
+          If <see langword="null" />, then no localization is performed.
+        </param>
+        <param name="output">
+          A <see cref="T:System.IO.TextWriter" /> where output messages will be
+          written to. If <see langword="null" />, then the
+          <see cref="P:System.Console.Out" /> property will be used.
+        </param>
+        <param name="error">
+          A <see cref="T:System.IO.TextWriter" /> where error messages will be
+          written to. If <see langword="null" />, then the
+          <see cref="P:System.Console.Error" /> property will be used.
+        </param>
+        <summary>
+          Creates and initializes a new <c>CommandSet</c> instance.
+        </summary>
+        <remarks>
+          <para>
+            This constructor initializes
+            the <see cref="P:Mono.Options.CommandSet.Suite" /> property
+            of the new instance using <paramref name="suite" />,
+            the <see cref="P:Mono.Options.CommandSet.MessageLocalizer" /> property
+            of the new instance using <paramref name="localizer" />,
+            the <see cref="P:Mono.Options.CommandSet.Out" /> property
+            of the new instance using <paramref name="output" />, and
+            the <see cref="P:Mono.Options.CommandSet.Error" /> property
+            of the new instance using <paramref name="error" />.
+          </para>
+        </remarks>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="suite" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (Mono.Options.ArgumentSource source);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(class Mono.Options.ArgumentSource source) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="source" Type="Mono.Options.ArgumentSource" />
+      </Parameters>
+      <Docs>
+        <param name="source">
+          A <see cref="T:Mono.Options.ArgumentSource" /> to register for
+          argument processing.
+        </param>
+        <summary>
+          Registers <paramref name="source" /> so that it may be consulted
+          during argument processing within
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="source" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (Mono.Options.Command value);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(class Mono.Options.Command value) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="value" Type="Mono.Options.Command" />
+      </Parameters>
+      <Docs>
+        <param name="value">
+          A <see cref="T:Mono.Options.Command" /> to add to the suite.
+        </param>
+        <summary>
+          Add a <c>Command</c> to the suite.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <exception cref="T:System.ArgumentException">
+          <para>
+            A <c>Command</c> with the same value for
+            <c><paramref name="value" />.Name</c>
+            has already been added to the <c>CommandSet</c>.
+          </para>
+          <para>-or-</para>
+          <para>
+            <paramref name="value" /> has been <c>Add()</c>ed to a different
+            <c>CommandSet</c> instance.
+          </para>
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="value" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (Mono.Options.Option option);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(class Mono.Options.Option option) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="option" Type="Mono.Options.Option" />
+      </Parameters>
+      <Docs>
+        <param name="option">
+          The <see cref="T:Mono.Options.Option" /> to register.
+        </param>
+        <summary>
+          Adds <paramref name="option" /> as a global suite option.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          <para>
+            Registers each option name returned by
+            <see cref="M:Mono.Options.Option.GetNames" />, ensuring that any
+            option with a matching name will be handled by the
+            <paramref name="option" /> instance.
+          </para>
+        </remarks>
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <paramref name="option" /> is <see langword="null" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string header);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string header) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="header" Type="System.String" />
+      </Parameters>
+      <Docs>
+        <param name="header">
+          A <see cref="T:System.String" /> containing the header to display
+          during <see cref="M:Mono.Options.CommandSet.Run" /><c>help</c> processing.
+        </param>
+        <summary>
+          Declare a header to be printed during for <c>help</c> output.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, Mono.Options.OptionAction&lt;string,string&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, class Mono.Options.OptionAction`2&lt;string, string&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          Calls 
+          <see cref="M:Mono.Options.CommandSet.Add(System.String,System.String,Mono.Options.OptionAction{System.String,System.String})" />
+          with a <paramref name="description" /> value of 
+          <see langword="null" />.
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(System.String,System.String,Mono.Options.OptionAction{System.String,System.String})" />
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="prototype" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, Action&lt;string&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, class System.Action`1&lt;string&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          Calls 
+          <see cref="M:Mono.Options.CommandSet.Add(System.String,System.String,System.Action{System.String})" />
+          with a <paramref name="description" /> value of 
+          <see langword="null" />.
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(System.String,System.String,System.Action{System.String})" />
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="prototype" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, string description, Mono.Options.OptionAction&lt;string,string&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, string description, class Mono.Options.OptionAction`2&lt;string, string&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> to be used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          <para>
+            Use this method when <paramref name="prototype" /> should accept
+            two values, generally a key and a value.
+          </para>
+          <block subset="none" type="note">
+            If <paramref name="prototype" /> specifies a 
+            <see cref="F:Mono.Options.OptionValueType.Optional" /> option,
+            then it's possible that both the key and the value will be
+            <see langword="null" /> in the callback function.
+          </block>
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="prototype" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, string description, Action&lt;string&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, string description, class System.Action`1&lt;string&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, string description, Mono.Options.OptionAction&lt;string,string&gt; action, bool hidden);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, string description, class Mono.Options.OptionAction`2&lt;string, string&gt; action, bool hidden) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
+        <Parameter Name="hidden" Type="System.Boolean" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <param name="hidden">
+          A <see cref="T:System.Boolean" /> specifying whether or not the
+          Option should be displayed in
+          <see cref="M:Mono.Options.CommandSet.Run" /><c>help</c> output.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add (string prototype, string description, Action&lt;string&gt; action, bool hidden);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add(string prototype, string description, class System.Action`1&lt;string&gt; action, bool hidden) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
+        <Parameter Name="hidden" Type="System.Boolean" />
+      </Parameters>
+      <Docs>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{System.String}" />
+          to invoke when an option is parsed.
+        </param>
+        <param name="hidden">
+          A <see cref="T:System.Boolean" /> specifying whether or not the
+          Option should be displayed in
+          <see cref="M:Mono.Options.CommandSet.Run" /><c>help</c> output.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+        </remarks>
+        <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add&lt;T&gt;">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add&lt;T&gt; (string prototype, Action&lt;T&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add&lt;T&gt;(string prototype, class System.Action`1&lt;!!T&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <TypeParameters>
+        <TypeParameter Name="T" />
+      </TypeParameters>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;T&gt;" />
+      </Parameters>
+      <Docs>
+        <typeparam name="T">
+          The type of the option to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{``0}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          Calls 
+          <see cref="M:Mono.Options.OptionSet.Add``1(System.String,System.String,System.Action{``0})" />
+          with a <paramref name="description" /> value of 
+          <see langword="null" />.
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <altmember cref="M:Mono.Options.CommandSet.Add``1(System.String,System.String,System.Action{``0})" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add&lt;T&gt;">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add&lt;T&gt; (string prototype, string description, Action&lt;T&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add&lt;T&gt;(string prototype, string description, class System.Action`1&lt;!!T&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <TypeParameters>
+        <TypeParameter Name="T" />
+      </TypeParameters>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="System.Action&lt;T&gt;" />
+      </Parameters>
+      <Docs>
+        <typeparam name="T">
+          The type of the option to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> containing to used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:System.Action{``0}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          <para>
+            Use this typed overload when you want strongly typed option values
+            that correspond to a managed type.
+            <see cref="M:System.ComponentModel.TypeDescriptor.GetConverter(System.Type)" />
+            is used to lookup the
+            <see cref="T:System.ComponentModel.TypeConverter" /> to use when
+            performing the string-to-type conversion.
+          </para>
+          <para>
+            Special support is provided for <see cref="T:System.Nullable{X}" />
+            types; <see cref="T:System.ComponentModel.TypeConverter" />
+            doesn't currently support their use, but if 
+            <typeparamref name="T" /> is a nullable type, then this method
+            will instead use the 
+            <see cref="T:System.ComponentModel.TypeConverter" /> for the 
+            <typeparamref name="X" /> type.  This allows straightforward use
+            of nullable types, identical to using any other strongly typed
+            value.
+          </para>
+          <block subset="none" type="note">
+            <para>
+              If <paramref name="prototype" /> specifies an
+              <see cref="F:Mono.Options.OptionValueType.Optional" /> value
+              and the value is not provided, then <c>default(T)</c> is
+              provided as the value to <paramref name="action" />.
+            </para>
+          </block>
+        </remarks>
+        <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="option" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add&lt;TKey,TValue&gt;">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add&lt;TKey,TValue&gt; (string prototype, Mono.Options.OptionAction&lt;TKey,TValue&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add&lt;TKey, TValue&gt;(string prototype, class Mono.Options.OptionAction`2&lt;!!TKey, !!TValue&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <TypeParameters>
+        <TypeParameter Name="TKey" />
+        <TypeParameter Name="TValue" />
+      </TypeParameters>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;TKey,TValue&gt;" />
+      </Parameters>
+      <Docs>
+        <typeparam name="TKey">
+          The type of the first argument to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <typeparam name="TValue">
+          The type of the second argument to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{TKey,TValue}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          Calls 
+          <see cref="M:Mono.Options.OptionSet.Add``2(System.String,System.String,Mono.Options.OptionAction{``0,``1})" />
+          with a <paramref name="description" /> value of 
+          <see langword="null" />.
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <altmember cref="M:Mono.Options.CommandSet.Add``2(System.String,System.String,Mono.Options.OptionAction{``0,``1})" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="prototype" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Add&lt;TKey,TValue&gt;">
+      <MemberSignature Language="C#" Value="public Mono.Options.CommandSet Add&lt;TKey,TValue&gt; (string prototype, string description, Mono.Options.OptionAction&lt;TKey,TValue&gt; action);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.CommandSet Add&lt;TKey, TValue&gt;(string prototype, string description, class Mono.Options.OptionAction`2&lt;!!TKey, !!TValue&gt; action) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>Mono.Options.CommandSet</ReturnType>
+      </ReturnValue>
+      <TypeParameters>
+        <TypeParameter Name="TKey" />
+        <TypeParameter Name="TValue" />
+      </TypeParameters>
+      <Parameters>
+        <Parameter Name="prototype" Type="System.String" />
+        <Parameter Name="description" Type="System.String" />
+        <Parameter Name="action" Type="Mono.Options.OptionAction&lt;TKey,TValue&gt;" />
+      </Parameters>
+      <Docs>
+        <typeparam name="TKey">
+          The type of the first argument to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <typeparam name="TValue">
+          The type of the second argument to parse and provide to the 
+          <paramref name="action" /> callback.
+        </typeparam>
+        <param name="prototype">
+          A <see cref="T:System.String" /> containing all option aliases to
+          register, an (optional) type specifier, and an (optional) value
+          separator list; see 
+          <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
+          for details.
+        </param>
+        <param name="description">
+          A <see cref="T:System.String" /> to be used to initialize
+          the <see cref="P:Mono.Options.Option.Description" /> property.
+        </param>
+        <param name="action">
+          A <see cref="T:Mono.Options.OptionAction{TKey,TValue}" />
+          to invoke when an option is parsed.
+        </param>
+        <summary>
+          Registers each alias within <paramref name="prototype" /> so that any 
+          options matching the aliases in <paramref name="prototype" /> will be
+          handled by <paramref name="action" /> during any subsequent
+          <see cref="M:Mono.Options.CommandSet.Run(System.Collections.Generic.IEnumerable{System.String})" />
+          calls.
+        </summary>
+        <returns>
+          The current <see cref="T:Mono.Options.CommandSet" /> instance.
+          This is to permit method chaining.
+        </returns>
+        <remarks>
+          <para>
+            Use this method when <paramref name="prototype" /> should accept
+            two typed values, generally a key and a value.
+          </para>
+          <block subset="none" type="note">
+            <para>
+              If <paramref name="prototype" /> specifies an
+              <see cref="F:Mono.Options.OptionValueType.Optional" /> value
+              and the value is not provided, then <c>default(TKey)</c> and
+              <c>default(TValue)</c> may be provided as the values to
+              <paramref name="action" />.
+            </para>
+          </block>
+        </remarks>
+        <altmember cref="M:Mono.Options.CommandSet.Add(Mono.Options.Option)" />
+        <exception cref="T:System.ArgumentException">
+          <paramref name="prototype" /> has an alias (as returned from
+          <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
+          a previously registered <see cref="T:Mono.Options.Option" />.
+        </exception>
+        <exception cref="T:System.ArgumentNullException">
+          <para>
+            <paramref name="prototype" /> is <see langword="null" /></para>
+          <para>-or-</para>
+          <para>
+            <paramref name="action" /> is <see langword="null" /></para>
+        </exception>
+      </Docs>
+    </Member>
+    <Member MemberName="Error">
+      <MemberSignature Language="C#" Value="public System.IO.TextWriter Error { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class System.IO.TextWriter Error" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.IO.TextWriter</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Where <c>CommandSet</c> should write error messages.
+        </summary>
+        <value>
+          A <see cref="T:System.IO.TextWriter" /> where error messages will
+          be written to.
+        </value>
+        <remarks>
+          <para>
+            This value may be set by providing the <paramref name="error" />
+            constructor parameter. If not specified, then
+            <see cref="P:System.Console.Error" /> will be used.
+          </para>
+          <para>
+            Error messages by <c>CommandSet</c> are written to the <c>Error</c>
+            property. <c>Command</c> instances may also choose to write error
+            messages to the <c>CommandSet.Error</c> property. This is suggested
+            to help with unit testing.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="GetKeyForItem">
+      <MemberSignature Language="C#" Value="protected override string GetKeyForItem (Mono.Options.Command item);" />
+      <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance string GetKeyForItem(class Mono.Options.Command item) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="item" Type="Mono.Options.Command" />
+      </Parameters>
+      <Docs>
+        <param name="item">
+          An <see cref="T:Mono.Options.Command" /> to return the key of.
+        </param>
+        <summary>
+          Returns <c><paramref name="item" />.Name</c>.
+        </summary>
+        <returns>
+          A <see cref="T:System.String" /> containing the command name.
+        </returns>
+        <remarks>
+          <para>
+            This is to support the
+            <see cref="T:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Command}" />
+            infrastructure.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="MessageLocalizer">
+      <MemberSignature Language="C#" Value="public Converter&lt;string,string&gt; MessageLocalizer { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class System.Converter`2&lt;string, string&gt; MessageLocalizer" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Converter&lt;System.String,System.String&gt;</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Permits access to the message localization facility.
+        </summary>
+        <value>
+          A <see cref="T:System.Converter{System.String,System.String}" />
+          that can be used to localize messages.
+        </value>
+        <remarks>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Out">
+      <MemberSignature Language="C#" Value="public System.IO.TextWriter Out { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance class System.IO.TextWriter Out" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.IO.TextWriter</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          Where <c>CommandSet</c> should write output messages.
+        </summary>
+        <value>
+          A <see cref="T:System.IO.TextWriter" /> where output messages will
+          be written to.
+        </value>
+        <remarks>
+          <para>
+            This value may be set by providing the <paramref name="output" />
+            constructor parameter. If not specified, then
+            <see cref="P:System.Console.Out" /> will be used.
+          </para>
+          <para>
+            Output messages by <c>CommandSet</c> are written to the <c>Out</c>
+            property. <c>Command</c> instances may also choose to write output
+            messages to the <c>CommandSet.Out</c> property. This is suggested
+            to help with unit testing.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Run">
+      <MemberSignature Language="C#" Value="public int Run (System.Collections.Generic.IEnumerable&lt;string&gt; arguments);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 Run(class System.Collections.Generic.IEnumerable`1&lt;string&gt; arguments) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Int32</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="arguments" Type="System.Collections.Generic.IEnumerable&lt;System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="arguments">
+          A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" />
+          containing the command-line arguments to process.
+        </param>
+        <summary>
+          Processes command-line arguments and invokes the specified command.
+        </summary>
+        <returns>
+          A <see cref="T:System.Int32" /> containing the command's exit value.
+          Normal Unix process exit values should be used: <c>0</c> for success,
+          non-zero values for failures.
+        </returns>
+        <remarks>
+          <para>
+            Processes <paramref name="arguments" />, parsing global options in the first pass.
+            The first unprocessed argument is treated as a command name, and the
+            <see cref="T:Mono.Options.Command" /> instance with a
+            <see cref="P:Mono.Options.Command.Name" /> value matching the command name
+            has its <see cref="M:Mono.Options.Command.Invoke" /> method invoked with the
+            unprocessed arguments.
+          </para>
+          <block subset="none" type="behaviors">
+            <para>
+              If no command is specified within <paramref name="arguments" /><i>or</i> an invalid command name is specified, then <c>1</c> is returned.
+              Otherwise, the value returned from
+              <see cref="M:Mono.Options.Command.Invoke" /> is returned.
+            </para>
+          </block>
+          <para>
+            If the <c>help</c> command is provided with no arguments, then the
+            suite help text will be written to
+            <see cref="P:Mono.Options.CommandSet.Out" />
+            consisting of the descriptive text ("headers"), options, and
+            <c>Command</c> values provided to
+            <see cref="M:Mono.Options.CommandSet.Add" />.
+          </para>
+          <para>
+            If the <c>help</c> command is provided with <c>--help</c> as an
+            argument, then all registered <c>Command</c> instances are written to
+            <see cref="P:Mono.Options.CommandSet.Out" />.
+          </para>
+          <para>
+            If the <c>help</c> command is provided with any other string, the
+            following value is treated as a command name, and the output of
+            <c>command --help</c> is written to
+            <see cref="P:Mono.Options.CommandSet.Out" />. If the specified
+            command name has not been registered, then an error message is written to
+            <see cref="P:Mono.Options.CommandSet.Error" />.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Suite">
+      <MemberSignature Language="C#" Value="public string Suite { get; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string Suite" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>
+          The name of the suite.
+        </summary>
+        <value>
+          A <see cref="T:System.String" /> containing the name of the command suite.
+        </value>
+        <remarks>
+          <para>
+            The <c>Suite</c> value is used when no command is specified, or
+            when an unregistered command name is provided.
+          </para>
+        </remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
\ No newline at end of file
diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/HelpCommand.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/HelpCommand.xml
new file mode 100644 (file)
index 0000000..74af856
--- /dev/null
@@ -0,0 +1,51 @@
+<Type Name="HelpCommand" FullName="Mono.Options.HelpCommand">
+  <TypeSignature Language="C#" Value="public class HelpCommand : Mono.Options.Command" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit HelpCommand extends Mono.Options.Command" />
+  <AssemblyInfo>
+    <AssemblyName>Mono.Options</AssemblyName>
+    <AssemblyVersion>0.2.3.0</AssemblyVersion>
+  </AssemblyInfo>
+  <Base>
+    <BaseTypeName>Mono.Options.Command</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public HelpCommand ();" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters />
+      <Docs>
+        <summary>To be added.</summary>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Invoke">
+      <MemberSignature Language="C#" Value="public override int Invoke (System.Collections.Generic.IEnumerable&lt;string&gt; arguments);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance int32 Invoke(class System.Collections.Generic.IEnumerable`1&lt;string&gt; arguments) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.2.3.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Int32</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="arguments" Type="System.Collections.Generic.IEnumerable&lt;System.String&gt;" />
+      </Parameters>
+      <Docs>
+        <param name="arguments">To be added.</param>
+        <summary>To be added.</summary>
+        <returns>To be added.</returns>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
index 67225ad77680005658a2e3e423e91d7120289bdc..56ba9fdfdbae727a7812af0e87eb613942f9b05e 100644 (file)
@@ -1059,7 +1059,7 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti
         <remarks>
         </remarks>
         <exception cref="T:System.ArgumentNullException">
-          <paramref name="option" /> is <see langword="null" />.
+          <paramref name="source" /> is <see langword="null" />.
         </exception>
       </Docs>
     </Member>
@@ -1137,8 +1137,8 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti
         </returns>
         <remarks>
           <para>
-            The <c>Add(string)</c> method can be used to provide option groupin
-            in the output generatedy by
+            The <c>Add(string)</c> method can be used to provide option grouping
+            in the output generated by
             <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />.
           </para>
         </remarks>
diff --git a/mcs/class/Mono.Options/Documentation/en/examples/commands.cs b/mcs/class/Mono.Options/Documentation/en/examples/commands.cs
new file mode 100644 (file)
index 0000000..d8c48e4
--- /dev/null
@@ -0,0 +1,78 @@
+// Sub-commands with Mono.Options.CommandSet
+//
+// Compile as:
+//   mcs -r:Mono.Options.dll commands.cs
+
+using System;
+using System.Collections.Generic;
+
+using Mono.Options;
+
+class CommandDemo {
+       public static int Main (string[] args)
+       {
+               var commands = new CommandSet ("commands") {
+                       "usage: commands COMMAND [OPTIONS]",
+                       "",
+                       "Mono.Options.CommandSet sample app.",
+                       "",
+                       "Global options:",
+                       { "v:",
+                         "Output verbosity.",
+                         (int? n) => Verbosity = n.HasValue ? n.Value : Verbosity + 1 },
+                       "",
+                       "Available commands:",
+                       new Command ("echo", "Echo arguments to the screen") {
+                               Run = ca => Console.WriteLine ("{0}", string.Join (" ", ca)),
+                       },
+                       new RequiresArgs (),
+               };
+               return commands.Run (args);
+       }
+
+       public static int Verbosity;
+}
+
+class RequiresArgs : Command {
+
+       public RequiresArgs ()
+               : base ("requires-args", "Class-based Command subclass")
+       {
+               Options = new OptionSet () {
+                       "usage: commands requires-args [OPTIONS]",
+                       "",
+                       "Class-based Command subclass example.",
+                       { "name|n=",
+                         "{name} of person to greet.",
+                         v => Name = v },
+                       { "help|h|?",
+                         "Show this message and exit.",
+                         v => ShowHelp = v != null },
+               };
+       }
+
+       public        bool    ShowHelp    {get; private set;}
+       public  new   string  Name        {get; private set;}
+
+       public override int Invoke (IEnumerable<string> args)
+       {
+               try {
+                       var extra = Options.Parse (args);
+                       if (ShowHelp) {
+                               Options.WriteOptionDescriptions (CommandSet.Out);
+                               return 0;
+                       }
+                       if (string.IsNullOrEmpty (Name)) {
+                               Console.Error.WriteLine ("commands: Missing required argument `--name=NAME`.");
+                               Console.Error.WriteLine ("commands: Use `commands help requires-args` for details.");
+                               return 1;
+                       }
+                       Console.WriteLine ($"Hello, {Name}!");
+                       return 0;
+               }
+               catch (Exception e) {
+                       Console.Error.WriteLine ("commands: {0}", CommandDemo.Verbosity >= 1 ? e.ToString () : e.Message);
+                       return 1;
+               }
+       }
+}
diff --git a/mcs/class/Mono.Options/Documentation/en/examples/commands.in b/mcs/class/Mono.Options/Documentation/en/examples/commands.in
new file mode 100644 (file)
index 0000000..96855a8
--- /dev/null
@@ -0,0 +1,25 @@
+mono Documentation/en/examples/commands.exe
+
+mono Documentation/en/examples/commands.exe --help
+
+mono Documentation/en/examples/commands.exe help
+
+mono Documentation/en/examples/commands.exe help --help
+
+mono Documentation/en/examples/commands.exe help echo
+
+mono Documentation/en/examples/commands.exe echo --help
+
+mono Documentation/en/examples/commands.exe echo hello, world
+
+mono Documentation/en/examples/commands.exe requires-args
+
+mono Documentation/en/examples/commands.exe help requires-args
+
+mono Documentation/en/examples/commands.exe requires-args --help
+
+mono Documentation/en/examples/commands.exe requires-args -n World
+
+mono Documentation/en/examples/commands.exe invalid-command
+
+mono Documentation/en/examples/commands.exe help invalid-command
diff --git a/mcs/class/Mono.Options/Documentation/en/examples/commands.txt b/mcs/class/Mono.Options/Documentation/en/examples/commands.txt
new file mode 100644 (file)
index 0000000..1930680
--- /dev/null
@@ -0,0 +1,74 @@
+$ mono commands.exe
+Use `commands help` for usage.
+
+$ mono commands.exe --help
+usage: commands COMMAND [OPTIONS]
+
+Mono.Options.CommandSet sample app.
+
+Global options:
+  -v[=VALUE]                 Output verbosity.
+
+Available commands:
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+
+$ mono commands.exe help
+usage: commands COMMAND [OPTIONS]
+
+Mono.Options.CommandSet sample app.
+
+Global options:
+  -v[=VALUE]                 Output verbosity.
+
+Available commands:
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+
+$ mono commands.exe help --help
+Usage: commands COMMAND [OPTIONS]
+Use `commands help COMMAND` for help on a specific command.
+
+Available commands:
+
+        echo                 Echo arguments to the screen
+        requires-args        Class-based Command subclass
+        help                 Show this message and exit
+
+$ mono commands.exe help echo
+--help
+
+$ mono commands.exe echo --help
+--help
+
+$ mono commands.exe echo hello, world
+hello, world
+
+$ mono commands.exe requires-args
+commands: Missing required argument `--name=NAME`.
+commands: Use `commands help requires-args` for details.
+
+$ mono commands.exe help requires-args
+usage: commands requires-args [OPTIONS]
+
+Class-based Command subclass example.
+      --name, -n=name        name of person to greet.
+      --help, -h, -?         Show this message and exit.
+
+$ mono commands.exe requires-args --help
+usage: commands requires-args [OPTIONS]
+
+Class-based Command subclass example.
+      --name, -n=name        name of person to greet.
+      --help, -h, -?         Show this message and exit.
+
+$ mono commands.exe requires-args -n World
+Hello, World!
+
+$ mono commands.exe invalid-command
+commands: Unknown command: invalid-command
+commands: Use `commands help` for usage.
+
+$ mono commands.exe help invalid-command
+commands: Unknown command: invalid-command
+commands: Use `commands help` for usage.
index 4cdca7c2a7d2479e0959d9ffa6cd53e0b0140c9c..f8fdaddee4279048f4b0cc8fdf5eab105de6cff5 100644 (file)
@@ -18,6 +18,9 @@
         <Attribute>
           <AttributeName>System.Reflection.AssemblyTitle("Mono.Options.dll")</AttributeName>
         </Attribute>
+        <Attribute>
+          <AttributeName>System.Runtime.CompilerServices.CompilationRelaxations(8)</AttributeName>
+        </Attribute>
         <Attribute>
           <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
         </Attribute>
@@ -30,6 +33,9 @@
   <Types>
     <Namespace Name="Mono.Options">
       <Type Name="ArgumentSource" Kind="Class" />
+      <Type Name="Command" Kind="Class" />
+      <Type Name="CommandSet" Kind="Class" />
+      <Type Name="HelpCommand" Kind="Class" />
       <Type Name="Option" Kind="Class" />
       <Type Name="OptionAction`2" DisplayName="OptionAction&lt;TKey,TValue&gt;" Kind="Delegate" />
       <Type Name="OptionContext" Kind="Class" />
index 2fb4724b28123360a10f265cb35ae4fe5ce77153..af1350df5b02c4100d85eb5eedd26bd63daee06d 100644 (file)
@@ -17,6 +17,16 @@ mono_options_DATA = Mono.Options/Options.cs
 
 include ../../build/library.make
 
+test-local: Mono.Options-PCL.dll
+
+clean-local: clean-pcl
+
+Mono.Options-PCL.dll: Mono.Options.dll.sources $(shell cat Mono.Options.dll.sources)
+       $(CSCOMPILE) -target:library -out:$@ -debug+ -d:PCL -r:../lib/$(PROFILE)/System.dll @$<
+
+clean-pcl:
+       -rm Mono.Options-PCL.dll
+
 install-local: install-source
 
 uninstall-local: uninstall-source
@@ -35,6 +45,7 @@ fixup-docs:
 
 DOC_EXAMPLES_OUTPUT = \
        Documentation/en/examples/bundling.txt \
+       Documentation/en/examples/commands.txt \
        Documentation/en/examples/context.txt \
        Documentation/en/examples/greet.txt \
        Documentation/en/examples/localization.txt \
@@ -44,10 +55,10 @@ $(the_libdir)/.doc-stamp: $(DOC_EXAMPLES_OUTPUT)
 
 Documentation/en/examples/Mono.Options.dll: $(the_lib)
        cp $^ $@
-       -cp $^.mdb $@.mdb
 
 %.exe: %.cs Documentation/en/examples/Mono.Options.dll
-       $(CSCOMPILE) -debug+ -r:Mono.Posix.dll -r:System.Core.dll -lib:Documentation/en/examples -r:Mono.Options.dll -out:$@ $<
+       $(CSCOMPILE) -debug:portable -r:$(topdir)/class/lib/$(PROFILE)/Mono.Posix.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll \
+       -r:$(topdir)/class/lib/$(PROFILE)/Mono.Options.dll -out:$@ $<
 
 Documentation/en/examples/locale/es/LC_MESSAGES/localization.mo: Documentation/en/examples/localization-es.po
        msgfmt $< -o $@
index 05810c39481db0174ff22f0c42d2954b5b044195..029bcb87dded329d093d7a039a36dc82472efb71 100644 (file)
@@ -2,13 +2,14 @@
 // Options.cs
 //
 // Authors:
-//  Jonathan Pryor <jpryor@novell.com>
+//  Jonathan Pryor <jpryor@novell.com>, <Jonathan.Pryor@microsoft.com>
 //  Federico Di Gregorio <fog@initd.org>
 //  Rolf Bjarne Kvinge <rolf@xamarin.com>
 //
 // Copyright (C) 2008 Novell (http://www.novell.com)
 // Copyright (C) 2009 Federico Di Gregorio.
 // Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
+// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -31,8 +32,8 @@
 //
 
 // Compile With:
-//   gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll
-//   gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll
+//   mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll
+//   mcs -debug+ -d:LINQ -r:System.Core Options.cs -o:Mono.Options.dll
 //
 // The LINQ version just changes the implementation of
 // OptionSet.Parse(IEnumerable<string>), and confers no semantic changes.
@@ -40,7 +41,7 @@
 //
 // A Getopt::Long-inspired option parsing library for C#.
 //
-// NDesk.Options.OptionSet is built upon a key/value table, where the
+// Mono.Options.OptionSet is built upon a key/value table, where the
 // key is a option format string and the value is a delegate that is 
 // invoked when the format string is matched.
 //
 //      p.Parse (new string[]{"-a-"});  // sets v == null
 //
 
+//
+// Mono.Options.CommandSet allows easily having separate commands and
+// associated command options, allowing creation of a *suite* along the
+// lines of **git**(1), **svn**(1), etc.
+//
+// CommandSet allows intermixing plain text strings for `--help` output,
+// Option values -- as supported by OptionSet -- and Command instances,
+// which have a name, optional help text, and an optional OptionSet.
+//
+//  var suite = new CommandSet ("suite-name") {
+//    // Use strings and option values, as with OptionSet
+//    "usage: suite-name COMMAND [OPTIONS]+",
+//    { "v:", "verbosity", (int? v) => Verbosity = v.HasValue ? v.Value : Verbosity+1 },
+//    // Commands may also be specified
+//    new Command ("command-name", "command help") {
+//      Options = new OptionSet {/*...*/},
+//      Run     = args => { /*...*/},
+//    },
+//    new MyCommandSubclass (),
+//  };
+//  return suite.Run (new string[]{...});
+//
+// CommandSet provides a `help` command, and forwards `help COMMAND`
+// to the registered Command instance by invoking Command.Invoke()
+// with `--help` as an option.
+//
+
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -414,7 +442,7 @@ namespace Mono.Options
                                ? new[]{prototype + this.GetHashCode ()}
                                : prototype.Split ('|');
 
-                       if (this is OptionSet.Category)
+                       if (this is OptionSet.Category || this is CommandOption)
                                return;
 
                        this.type        = ParsePrototype ();
@@ -585,6 +613,11 @@ namespace Mono.Options
 
                protected abstract void OnParseComplete (OptionContext c);
 
+               internal void InvokeOnParseComplete (OptionContext c)
+               {
+                       OnParseComplete (c);
+               }
+
                public override string ToString ()
                {
                        return Prototype;
@@ -732,20 +765,26 @@ namespace Mono.Options
        public class OptionSet : KeyedCollection<string, Option>
        {
                public OptionSet ()
-                       : this (delegate (string f) {return f;})
+                       : this (null)
                {
                }
 
                public OptionSet (MessageLocalizerConverter localizer)
                {
+                       this.roSources = new ReadOnlyCollection<ArgumentSource> (sources);
                        this.localizer = localizer;
-                       this.roSources = new ReadOnlyCollection<ArgumentSource>(sources);
+                       if (this.localizer == null) {
+                               this.localizer = delegate (string f) {
+                                       return f;
+                               };
+                       }
                }
 
                MessageLocalizerConverter localizer;
 
                public MessageLocalizerConverter MessageLocalizer {
                        get {return localizer;}
+                       internal set {localizer = value;}
                }
 
                List<ArgumentSource> sources = new List<ArgumentSource> ();
@@ -1210,6 +1249,9 @@ namespace Mono.Options
                private const int Description_FirstWidth  = 80 - OptionWidth;
                private const int Description_RemWidth    = 80 - OptionWidth - 2;
 
+               static  readonly    string      CommandHelpIndentStart       = new string (' ', OptionWidth);
+               static  readonly    string      CommandHelpIndentRemaining   = new string (' ', OptionWidth + 2);
+
                public void WriteOptionDescriptions (TextWriter o)
                {
                        foreach (Option p in this) {
@@ -1223,6 +1265,11 @@ namespace Mono.Options
                                        WriteDescription (o, p.Description, "", 80, 80);
                                        continue;
                                }
+                               CommandOption co = p as CommandOption;
+                               if (co != null) {
+                                       WriteCommandDescription (o, co.Command);
+                                       continue;
+                               }
 
                                if (!WriteOptionPrototype (o, p, ref written))
                                        continue;
@@ -1264,6 +1311,17 @@ namespace Mono.Options
                        }
                }
 
+               internal void WriteCommandDescription (TextWriter o, Command c)
+               {
+                       var name = new string (' ', 8) + c.Name;
+                       if (name.Length < OptionWidth - 1) {
+                               WriteDescription (o, name + new string (' ', OptionWidth - name.Length) + c.Help, CommandHelpIndentRemaining, 80, Description_RemWidth);
+                       } else {
+                               WriteDescription (o, name, "", 80, 80);
+                               WriteDescription (o, CommandHelpIndentStart + c.Help, CommandHelpIndentRemaining, 80, Description_RemWidth);
+                       }
+               }
+
                void WriteDescription (TextWriter o, string value, string prefix, int firstWidth, int remWidth)
                {
                        bool indent = false;
@@ -1403,5 +1461,341 @@ namespace Mono.Options
                        return StringCoda.WrappedLines (description, firstWidth, remWidth);
                }
        }
+
+       public class Command
+       {
+               public      string                              Name            {get;}
+               public      string                              Help            {get;}
+
+               public      OptionSet                           Options         {get; set;}
+               public      Action<IEnumerable<string>>         Run             {get; set;}
+
+               public      CommandSet                          CommandSet      {get; internal set;}
+
+               public Command (string name, string help = null)
+               {
+                       if (string.IsNullOrEmpty (name))
+                               throw new ArgumentNullException (nameof (name));
+
+                       Name    = name;
+                       Help    = help;
+               }
+
+               public virtual int Invoke (IEnumerable<string> arguments)
+               {
+                       var rest    = Options?.Parse (arguments) ?? arguments;
+                       Run?.Invoke (rest);
+                       return 0;
+               }
+       }
+
+       class CommandOption : Option
+       {
+               public      Command             Command         {get;}
+
+               // Prototype starts with '=' because this is an invalid prototype
+               // (see Option.ParsePrototype(), and thus it'll prevent Category
+               // instances from being accidentally used as normal options.
+               public CommandOption (Command command, bool hidden = false)
+                       : base ("=:Command:= " + command?.Name, command?.Name, maxValueCount: 0, hidden: hidden)
+               {
+                       if (command == null)
+                               throw new ArgumentNullException (nameof (command));
+                       Command = command;
+               }
+
+               protected override void OnParseComplete (OptionContext c)
+               {
+                       throw new NotSupportedException ("CommandOption.OnParseComplete should not be invoked.");
+               }
+       }
+
+       class HelpOption : Option
+       {
+               Option      option;
+               CommandSet  commands;
+
+               public HelpOption (CommandSet commands, Option d)
+                       : base (d.Prototype, d.Description, d.MaxValueCount, d.Hidden)
+               {
+                       this.commands   = commands;
+                       this.option     = d;
+               }
+
+               protected override void OnParseComplete (OptionContext c)
+               {
+                       commands.showHelp  = true;
+
+                       option?.InvokeOnParseComplete (c);
+               }
+       }
+
+       class CommandOptionSet : OptionSet
+       {
+               CommandSet  commands;
+
+               public CommandOptionSet (CommandSet commands, MessageLocalizerConverter localizer)
+                       : base (localizer)
+               {
+                       this.commands = commands;
+               }
+
+               protected override void SetItem (int index, Option item)
+               {
+                       if (ShouldWrapOption (item)) {
+                               base.SetItem (index, new HelpOption (commands, item));
+                               return;
+                       }
+                       base.SetItem (index, item);
+               }
+
+               bool ShouldWrapOption (Option item)
+               {
+                       if (item == null)
+                               return false;
+                       var help = item as HelpOption;
+                       if (help != null)
+                               return false;
+                       foreach (var n in item.Names) {
+                               if (n == "help")
+                                       return true;
+                       }
+                       return false;
+               }
+
+               protected override void InsertItem (int index, Option item)
+               {
+                       if (ShouldWrapOption (item)) {
+                               base.InsertItem (index, new HelpOption (commands, item));
+                               return;
+                       }
+                       base.InsertItem (index, item);
+               }
+       }
+
+       public class CommandSet : KeyedCollection<string, Command>
+       {
+               readonly    OptionSet       options;
+               readonly    TextWriter      outWriter;
+               readonly    TextWriter      errorWriter;
+               readonly    string          suite;
+
+               HelpCommand help;
+
+               internal    bool            showHelp;
+
+               internal    OptionSet       Options     => options;
+
+               public CommandSet (string suite, MessageLocalizerConverter localizer = null, TextWriter output = null, TextWriter error = null)
+               {
+                       if (suite == null)
+                               throw new ArgumentNullException (nameof (suite));
+                       this.suite  = suite;
+                       options     = new CommandOptionSet (this, localizer);
+                       outWriter   = output    ?? Console.Out;
+                       errorWriter = error     ?? Console.Error;
+               }
+
+               public  string                          Suite               => suite;
+               public  TextWriter                      Out                 => outWriter;
+               public  TextWriter                      Error               => errorWriter;
+               public  MessageLocalizerConverter       MessageLocalizer    => options.MessageLocalizer;
+
+               protected override string GetKeyForItem (Command item)
+               {
+                       return item?.Name;
+               }
+
+               public new CommandSet Add (Command value)
+               {
+                       if (value == null)
+                               throw new ArgumentNullException (nameof (value));
+                       AddCommand (value);
+                       options.Add (new CommandOption (value));
+                       return this;
+               }
+
+               void AddCommand (Command value)
+               {
+                       if (value.CommandSet != null && value.CommandSet != this) {
+                               throw new ArgumentException ("Command instances can only be added to a single CommandSet.", nameof (value));
+                       }
+                       value.CommandSet                = this;
+                       if (value.Options != null) {
+                               value.Options.MessageLocalizer  = options.MessageLocalizer;
+                       }
+
+                       base.Add (value);
+
+                       help    = help ?? value as HelpCommand;
+               }
+
+               public CommandSet Add (string header)
+               {
+                       options.Add (header);
+                       return this;
+               }
+
+               public CommandSet Add (Option option)
+               {
+                       options.Add (option);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, Action<string> action)
+               {
+                       options.Add (prototype, action);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, string description, Action<string> action)
+               {
+                       options.Add (prototype, description, action);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, string description, Action<string> action, bool hidden)
+               {
+                       options.Add (prototype, description, action, hidden);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, OptionAction<string, string> action)
+               {
+                       options.Add (prototype, action);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, string description, OptionAction<string, string> action)
+               {
+                       options.Add (prototype, description, action);
+                       return this;
+               }
+
+               public CommandSet Add (string prototype, string description, OptionAction<string, string> action, bool hidden)
+               {
+                       options.Add (prototype, description, action, hidden);
+                       return this;
+               }
+
+               public CommandSet Add<T> (string prototype, Action<T> action)
+               {
+                       options.Add (prototype, null, action);
+                       return this;
+               }
+
+               public CommandSet Add<T> (string prototype, string description, Action<T> action)
+               {
+                       options.Add (prototype, description, action);
+                       return this;
+               }
+
+               public CommandSet Add<TKey, TValue> (string prototype, OptionAction<TKey, TValue> action)
+               {
+                       options.Add (prototype, action);
+                       return this;
+               }
+
+               public CommandSet Add<TKey, TValue> (string prototype, string description, OptionAction<TKey, TValue> action)
+               {
+                       options.Add (prototype, description, action);
+                       return this;
+               }
+
+               public CommandSet Add (ArgumentSource source)
+               {
+                       options.Add (source);
+                       return this;
+               }
+
+               public int Run (IEnumerable<string> arguments)
+               {
+                       if (arguments == null)
+                               throw new ArgumentNullException (nameof (arguments));
+
+                       this.showHelp   = false;
+                       if (help == null) {
+                               help    = new HelpCommand ();
+                               AddCommand (help);
+                       }
+                       Action<string>  setHelp     = v => showHelp = v != null;
+                       if (!options.Contains ("help")) {
+                               options.Add ("help", "", setHelp, hidden: true);
+                       }
+                       if (!options.Contains ("?")) {
+                               options.Add ("?", "", setHelp, hidden: true);
+                       }
+                       var extra   = options.Parse (arguments);
+                       if (extra.Count == 0) {
+                               if (showHelp) {
+                                       return help.Invoke (extra);
+                               }
+                               Out.WriteLine (options.MessageLocalizer ($"Use `{Suite} help` for usage."));
+                               return 1;
+                       }
+                       var command = Contains (extra [0]) ? this [extra [0]] : null;
+                       if (command == null) {
+                               help.WriteUnknownCommand (extra [0]);
+                               return 1;
+                       }
+                       extra.RemoveAt (0);
+                       if (showHelp) {
+                               if (command.Options?.Contains ("help") ?? true) {
+                                       extra.Add ("--help");
+                                       return command.Invoke (extra);
+                               }
+                               command.Options.WriteOptionDescriptions (Out);
+                               return 0;
+                       }
+                       return command.Invoke (extra);
+               }
+       }
+
+       public class HelpCommand : Command
+       {
+               public HelpCommand ()
+                       : base ("help", help: "Show this message and exit")
+               {
+               }
+
+               public override int Invoke (IEnumerable<string> arguments)
+               {
+                       var extra   = new List<string> (arguments ?? new string [0]);
+                       var _       = CommandSet.Options.MessageLocalizer;
+                       if (extra.Count == 0) {
+                               CommandSet.Options.WriteOptionDescriptions (CommandSet.Out);
+                               return 0;
+                       }
+                       var command = CommandSet.Contains (extra [0])
+                               ? CommandSet [extra [0]]
+                               : null;
+                       if (command == this || extra [0] == "--help") {
+                               CommandSet.Out.WriteLine (_ ($"Usage: {CommandSet.Suite} COMMAND [OPTIONS]"));
+                               CommandSet.Out.WriteLine (_ ($"Use `{CommandSet.Suite} help COMMAND` for help on a specific command."));
+                               CommandSet.Out.WriteLine ();
+                               CommandSet.Out.WriteLine (_ ($"Available commands:"));
+                               CommandSet.Out.WriteLine ();
+                               foreach (var c in CommandSet) {
+                                       CommandSet.Options.WriteCommandDescription (CommandSet.Out, c);
+                               }
+                               return 0;
+                       }
+                       if (command == null) {
+                               WriteUnknownCommand (extra [0]);
+                               return 1;
+                       }
+                       if (command.Options != null) {
+                               command.Options.WriteOptionDescriptions (CommandSet.Out);
+                               return 0;
+                       }
+                       return command.Invoke (new [] { "--help" });
+               }
+
+               internal void WriteUnknownCommand (string unknownCommand)
+               {
+                       CommandSet.Error.WriteLine (CommandSet.Options.MessageLocalizer ($"{CommandSet.Suite}: Unknown command: {unknownCommand}"));
+                       CommandSet.Error.WriteLine (CommandSet.Options.MessageLocalizer ($"{CommandSet.Suite}: Use `{CommandSet.Suite} help` for usage."));
+               }
+       }
 }
 
index 686fa1244eff719ae8dccd11d0a6caefc9a1f9b4..7aa10fc7b9eb1840606275beca9efc2d848dc649 100644 (file)
@@ -1,5 +1,7 @@
 Mono.Options/BaseRocksFixture.cs
 Mono.Options/CollectionContract.cs
+Mono.Options/CommandTest.cs
+Mono.Options/CommandSetTest.cs
 Mono.Options/ListContract.cs
 Mono.Options/OptionContextTest.cs
 Mono.Options/OptionSetTest.cs
diff --git a/mcs/class/Mono.Options/Test/Mono.Options-Test-net_4_x.csproj b/mcs/class/Mono.Options/Test/Mono.Options-Test-net_4_x.csproj
new file mode 100644 (file)
index 0000000..83ffda6
--- /dev/null
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProjectGuid>{472A5C45-8331-4849-B89F-A872CF884DA3}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <RootNamespace>Mono.Options_Test_net_4_x</RootNamespace>\r
+    <AssemblyName>Mono.Options_Test_net_4_x</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <Optimize>false</Optimize>\r
+    <OutputPath>bin\Debug</OutputPath>\r
+    <DefineConstants>DEBUG;</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <Optimize>true</Optimize>\r
+    <OutputPath>bin\Release</OutputPath>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <Reference Include="System" />\r
+    <Reference Include="nunit.framework">\r
+      <HintPath>..\lib\net_4_x\nunit.framework.dll</HintPath>\r
+    </Reference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Compile Include="Mono.Options\BaseRocksFixture.cs" />\r
+    <Compile Include="Mono.Options\CategoryTest.cs" />\r
+    <Compile Include="Mono.Options\CollectionContract.cs" />\r
+    <Compile Include="Mono.Options\ListContract.cs" />\r
+    <Compile Include="Mono.Options\OptionContextTest.cs" />\r
+    <Compile Include="Mono.Options\OptionSetTest.cs" />\r
+    <Compile Include="Mono.Options\OptionTest.cs" />\r
+    <Compile Include="Mono.Options\Utils.cs" />\r
+    <Compile Include="Mono.Options\CommandSetTest.cs" />\r
+    <Compile Include="Mono.Options\CommandTest.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <ProjectReference Include="..\Mono.Options-net_4_x.csproj">\r
+      <Project>{115711B0-D1F2-4E50-83F9-63128E70CE05}</Project>\r
+      <Name>Mono.Options-net_4_x</Name>\r
+    </ProjectReference>\r
+  </ItemGroup>\r
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
+</Project>
\ No newline at end of file
diff --git a/mcs/class/Mono.Options/Test/Mono.Options/CommandSetTest.cs b/mcs/class/Mono.Options/Test/Mono.Options/CommandSetTest.cs
new file mode 100644 (file)
index 0000000..a195e43
--- /dev/null
@@ -0,0 +1,249 @@
+//
+// CommandSetTest.cs
+//
+// Authors:
+//  Jonathan Pryor <Jonathan.Pryor@microsoft.com>
+//
+// Copyright (C) 2017 Microsoft (http://www.microsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+#if NDESK_OPTIONS
+using NDesk.Options;
+#else
+using Mono.Options;
+#endif
+
+using Cadenza.Collections.Tests;
+
+using NUnit.Framework;
+
+#if NDESK_OPTIONS
+namespace Tests.NDesk.Options
+#else
+namespace MonoTests.Mono.Options
+#endif
+{
+       [TestFixture]
+       public class CommandSetTest : ListContract<Command>
+       {
+               protected override ICollection<Command> CreateCollection (IEnumerable<Command> values)
+               {
+                       var set = new CommandSet ("test");
+                       foreach (var value in values)
+                               set.Add (value);
+                       return set;
+               }
+
+               protected override Command CreateValueA ()
+               {
+                       return new Command (
+                               "foo",
+                               "foo help");
+               }
+
+               protected override Command CreateValueB ()
+               {
+                       return new Command (
+                               "bar",
+                               "bar help");
+               }
+
+               protected override Command CreateValueC ()
+               {
+                       return new Command (
+                               "baz",
+                               "baz help");
+               }
+
+               static IEnumerable<string> _ (params string [] a)
+               {
+                       return a;
+               }
+
+               [Test]
+               public void Constructor_SuiteRequired ()
+               {
+                       Assert.Throws<ArgumentNullException> (() => new CommandSet (null));
+               }
+
+               [Test]
+               public void Add_NullCommand ()
+               {
+                       var c = new CommandSet ("cs");
+                       Assert.Throws<ArgumentNullException> (() => c.Add ((Command)null));
+               }
+
+               [Test]
+               public void Add_CommandCanBeAddedToOnlyOneSet ()
+               {
+                       var cs1 = new CommandSet ("cs1");
+                       var cs2 = new CommandSet ("cs2");
+                       var c   = new Command ("command", "help");
+                       cs1.Add (c);
+                       Assert.Throws<ArgumentException> (() => cs2.Add (c));
+               }
+
+               [Test]
+               public void Add_SetsCommandSet ()
+               {
+                       var cs  = new CommandSet ("cs");
+                       var c   = new Command ("command");
+                       Assert.IsNull (c.CommandSet);
+                       cs.Add (c);
+                       Assert.AreSame (cs, c.CommandSet);
+               }
+
+               [Test]
+               public void Add_DuplicateCommand ()
+               {
+                       var s = new CommandSet ("set");
+                       s.Add (new Command ("value"));
+                       Assert.Throws<ArgumentException> (() => s.Add (new Command ("value")));
+               }
+
+               [Test]
+               public void Run_Help ()
+               {
+                       var o = new StringWriter ();
+                       var e = new StringWriter ();
+
+                       var showVersion = false;
+                       var showHelp    = false;
+
+                       var git = new CommandSet ("git", output: o, error: e) {
+                               "usage: git [--version] ... <command> [<args>]",
+                               "",
+                               "Common Options:",
+                               { "version",
+                                 "show version info",
+                                 v => showVersion = v != null },
+                               { "help",
+                                 "show this message and exit",
+                                 v => showHelp = v != null },
+                               "",
+                               "These are common Git commands used in various situations:",
+                               "",
+                               "start a working area (see also: git help tutorial)",
+                               new Command ("clone", "Clone a repository into a new directory"),
+                               new Command ("init",  "Create an empty Git repository or reinitialize an existing one"),
+                               new Command ("thisIsAVeryLongCommandNameInOrderToInduceWrapping", "Create an empty Git repository or reinitialize an existing one. Let's make this really long to cause a line wrap, shall we?"),
+                       };
+
+                       var expectedHelp = new StringWriter ();
+
+                       expectedHelp.WriteLine ("usage: git [--version] ... <command> [<args>]");
+                       expectedHelp.WriteLine ("");
+                       expectedHelp.WriteLine ("Common Options:");
+                       expectedHelp.WriteLine ("      --version              show version info");
+                       expectedHelp.WriteLine ("      --help                 show this message and exit");
+                       expectedHelp.WriteLine ("");
+                       expectedHelp.WriteLine ("These are common Git commands used in various situations:");
+                       expectedHelp.WriteLine ("");
+                       expectedHelp.WriteLine ("start a working area (see also: git help tutorial)");
+                       expectedHelp.WriteLine ("        clone                Clone a repository into a new directory");
+                       expectedHelp.WriteLine ("        init                 Create an empty Git repository or reinitialize an");
+                       expectedHelp.WriteLine ("                               existing one");
+                       expectedHelp.WriteLine ("        thisIsAVeryLongCommandNameInOrderToInduceWrapping");
+                       expectedHelp.WriteLine ("                             Create an empty Git repository or reinitialize an");
+                       expectedHelp.WriteLine ("                               existing one. Let's make this really long to");
+                       expectedHelp.WriteLine ("                               cause a line wrap, shall we?");
+
+                       Assert.AreEqual (0, git.Run (new [] { "help" }));
+                       Assert.AreEqual (expectedHelp.ToString (), o.ToString ());
+
+                       var expectedHelpHelp    = new StringWriter ();
+                       expectedHelpHelp.WriteLine ("Usage: git COMMAND [OPTIONS]");
+                       expectedHelpHelp.WriteLine ("Use `git help COMMAND` for help on a specific command.");
+                       expectedHelpHelp.WriteLine ();
+                       expectedHelpHelp.WriteLine ("Available commands:");
+                       expectedHelpHelp.WriteLine ();
+                       expectedHelpHelp.WriteLine ("        clone                Clone a repository into a new directory");
+                       expectedHelpHelp.WriteLine ("        init                 Create an empty Git repository or reinitialize an");
+                       expectedHelpHelp.WriteLine ("                               existing one");
+                       expectedHelpHelp.WriteLine ("        thisIsAVeryLongCommandNameInOrderToInduceWrapping");
+                       expectedHelpHelp.WriteLine ("                             Create an empty Git repository or reinitialize an");
+                       expectedHelpHelp.WriteLine ("                               existing one. Let's make this really long to");
+                       expectedHelpHelp.WriteLine ("                               cause a line wrap, shall we?");
+                       expectedHelpHelp.WriteLine ("        help                 Show this message and exit");
+
+                       o.GetStringBuilder ().Clear ();
+                       Assert.AreEqual (0, git.Run (new [] { "help", "--help" }));
+                       Assert.AreEqual (expectedHelpHelp.ToString (), o.ToString ());
+               }
+
+               [Test]
+               public void Run_Command ()
+               {
+                       var a = 0;
+                       var b = 0;
+                       var c = new CommandSet ("set") {
+                               new Command ("a") { Run = v => a = v.Count () },
+                               new Command ("b") { Run = v => b = v.Count () },
+                       };
+                       Assert.AreEqual (0, c.Run (new [] { "a", "extra" }));
+                       Assert.AreEqual (1, a);
+                       Assert.AreEqual (0, b);
+
+                       a = b = 0;
+                       Assert.AreEqual (0, c.Run (new [] { "b" }));
+                       Assert.AreEqual (0, a);
+                       Assert.AreEqual (0, b);
+
+                       Assert.AreEqual (0, c.Run (new [] { "b", "one", "two" }));
+                       Assert.AreEqual (0, a);
+                       Assert.AreEqual (2, b);
+               }
+
+               [Test]
+               public void Run_HelpCommandSendsHelpOption ()
+               {
+                       var e = new Command ("echo");
+                       e.Run = (args) => e.CommandSet.Out.WriteLine (string.Join (" ", args));
+
+                       var o = new StringWriter ();
+                       var c = new CommandSet ("set", output:o) {
+                               e,
+                       };
+                       Assert.AreEqual (0, c.Run (new [] { "help", "echo" }));
+
+                       var expected    = $"--help{Environment.NewLine}";
+                       var actual      = o.ToString ();
+                       Assert.AreEqual (expected, actual);
+               }
+
+               [Test]
+               public void Run_NullArgument ()
+               {
+                       var c = new CommandSet ("c");
+                       Assert.Throws<ArgumentNullException> (() => c.Run (null));
+               }
+       }
+}
+
diff --git a/mcs/class/Mono.Options/Test/Mono.Options/CommandTest.cs b/mcs/class/Mono.Options/Test/Mono.Options/CommandTest.cs
new file mode 100644 (file)
index 0000000..5805f28
--- /dev/null
@@ -0,0 +1,102 @@
+//
+// CommandSetTest.cs
+//
+// Authors:
+//  Jonathan Pryor <Jonathan.Pryor@microsoft.com>
+//
+// Copyright (C) 2017 Microsoft (http://www.microsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+#if NDESK_OPTIONS
+using NDesk.Options;
+#else
+using Mono.Options;
+#endif
+
+using Cadenza.Collections.Tests;
+
+using NUnit.Framework;
+
+#if NDESK_OPTIONS
+namespace Tests.NDesk.Options
+#else
+namespace MonoTests.Mono.Options
+#endif
+{
+       [TestFixture]
+       public class CommandTest
+       {
+               [Test]
+               public void Constructor_NameRequired ()
+               {
+                       Assert.Throws<ArgumentNullException> (() => new Command (name: null, help: null));
+               }
+
+               [Test]
+               public void Constructor ()
+               {
+                       var c = new Command ("command", "help");
+                       Assert.AreEqual ("command", c.Name);
+                       Assert.AreEqual ("help",    c.Help);
+               }
+
+               [Test]
+               public void Invoke_CallsRun ()
+               {
+                       bool runInvoked = false;
+                       var c = new Command ("command") {
+                               Run = v => runInvoked = true,
+                       };
+                       Assert.AreEqual (0, c.Invoke (null));
+                       Assert.IsTrue (runInvoked);
+               }
+
+               [Test]
+               public void Invoke_RequiresNothing ()
+               {
+                       var c = new Command ("c");
+                       Assert.AreEqual (0, c.Invoke (null));
+               }
+
+               [Test]
+               public void Invoke_UsesOptions ()
+               {
+                       bool showHelp = false;
+                       var c = new Command ("c") {
+                               Options = new OptionSet {
+                                       { "help", v => showHelp = v != null },
+                               },
+                       };
+                       Assert.AreEqual (0, c.Invoke (new [] { "--help" }));
+                       Assert.IsTrue (showHelp);
+               }
+       }
+}
+
index ee28ffdee4de65e97f859d64d88d023858a8a7e0..39d25ca11a0e5958488482c45b790c6178040575 100644 (file)
@@ -188,6 +188,8 @@ namespace Mono.Unix {
                        AssertValid ();
                        if (exitContext)
                                throw new InvalidOperationException ("exitContext is not supported");
+                       if (millisecondsTimeout == 0)
+                               return IsSet;           
                        return WaitAny (new UnixSignal[]{this}, millisecondsTimeout) == 0;
                }
                #endregion
index 19cd7e6be5df1d47f777be791aff7bdd0971a375..bbac05969d4e48f14f7b21022d2d6589c0d42e2d 100644 (file)
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Linq\Expressions\Compiler\DelegateHelpers.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Linq\Expressions\Compiler\DelegateHelpers.Generated.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\NotImplemented.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\BitHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\HashSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\HashSetEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\ICollectionDebugView.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Dynamic\*.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Dynamic\Utils\CachedReflectionInfo.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Dynamic\Utils\CollectionExtensions.cs" />\r
     <Compile Include="..\referencesource\System.Core\Microsoft\Scripting\Utils\Extension.cs" />\r
     <Compile Include="..\referencesource\System.Core\Microsoft\Scripting\Utils\Function.cs" />\r
     <Compile Include="..\referencesource\System.Core\Microsoft\Scripting\Utils\StrongBox.cs" />\r
-    <Compile Include="..\referencesource\System.Core\System\Collections\Generic\BitHelper.cs" />\r
-    <Compile Include="..\referencesource\System.Core\System\Collections\Generic\HashSet.cs" />\r
-    <Compile Include="..\referencesource\System.Core\System\Collections\Generic\HashSetDebugView.cs" />\r
-    <Compile Include="..\referencesource\System.Core\System\Collections\Generic\HashSetEqualityComparer.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\FuncAndAction.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\InvalidTimeZoneException.cs" />\r
     <Compile Include="..\referencesource\System.Core\System\IO\Enums.cs" />\r
index 8ffd53dc9526419b9bb93edc39770d4b434925bd..d42159fb41252e6bef574875f04ac5445dc1bdfa 100644 (file)
@@ -49,11 +49,6 @@ corefx/SR.missing.cs
 ../referencesource/System.Core/System/TimeZoneInfo.cs
 ../referencesource/System.Core/System/TimeZoneNotFoundException.cs
 
-../referencesource/System.Core/System/Collections/Generic/BitHelper.cs
-../referencesource/System.Core/System/Collections/Generic/HashSet.cs
-../referencesource/System.Core/System/Collections/Generic/HashSetDebugView.cs
-../referencesource/System.Core/System/Collections/Generic/HashSetEqualityComparer.cs
-
 ../referencesource/System.Core/System/IO/Enums.cs
 
 ../referencesource/System.Core/System/IO/MemoryMappedFiles/Enums.cs
@@ -93,6 +88,10 @@ System.Security.Cryptography/SHA256CryptoServiceProvider.cs
 System.Security.Cryptography/SHA384CryptoServiceProvider.cs
 System.Security.Cryptography/SHA512CryptoServiceProvider.cs
 
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/BitHelper.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/HashSet.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/HashSetEqualityComparer.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs
 
 ../../../external/corefx/src/System.Linq/src/System/Linq/*.cs
 
index 31b4842c845be0663c082ee879cadbe4a0470ce5..2f317250e596ceda4322e25df4b8cbfc0dd716c6 100644 (file)
@@ -113,7 +113,7 @@ namespace System.Drawing
                                // Optimization for known colors that were deserialized
                                // from an MS serialized stream.  
                                if (value == 0 && IsKnownColor) {
-                                       value = KnownColors.FromKnownColor ((KnownColor)knownColor).ToArgb () & 0xFFFFFFFF;
+                                       value = FromKnownColor ((KnownColor)knownColor).ToArgb () & 0xFFFFFFFF;
                                }
                                return value;
                        }
@@ -151,14 +151,28 @@ namespace System.Drawing
 
                public static Color FromKnownColor (KnownColor color)
                {
-                       return KnownColors.FromKnownColor (color);
+                       Color c;
+                       short n = (short)color;
+                       if ((n <= 0) || (n >= KnownColors.ArgbValues.Length)) {
+                               // This is what it returns!
+                               c = FromArgb (0, 0, 0, 0);
+                               c.state |= (short) ColorType.Named;
+                       } else {
+                               c = new Color ();
+                               c.state = (short) (ColorType.ARGB | ColorType.Known | ColorType.Named);
+                               if ((n < 27) || (n > 169))
+                                       c.state |= (short) ColorType.System;
+                               c.Value = KnownColors.ArgbValues [n];
+                       }
+                       c.knownColor = n;
+                       return c;
                }
 
                public static Color FromName (string name)
                {
                        try {
                                KnownColor kc = (KnownColor) Enum.Parse (typeof (KnownColor), name, true);
-                               return KnownColors.FromKnownColor (kc);
+                               return FromKnownColor (kc);
                        }
                        catch {
                                // This is what it returns!      
@@ -422,567 +436,567 @@ namespace System.Drawing
 
 
                static public Color Transparent {
-                       get { return KnownColors.FromKnownColor (KnownColor.Transparent); }
+                       get { return FromKnownColor (KnownColor.Transparent); }
                }
 
                static public Color AliceBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.AliceBlue); }
+                       get { return FromKnownColor (KnownColor.AliceBlue); }
                }
 
                static public Color AntiqueWhite {
-                       get { return KnownColors.FromKnownColor (KnownColor.AntiqueWhite); }
+                       get { return FromKnownColor (KnownColor.AntiqueWhite); }
                }
 
                static public Color Aqua {
-                       get { return KnownColors.FromKnownColor (KnownColor.Aqua); }
+                       get { return FromKnownColor (KnownColor.Aqua); }
                }
 
                static public Color Aquamarine {
-                       get { return KnownColors.FromKnownColor (KnownColor.Aquamarine); }
+                       get { return FromKnownColor (KnownColor.Aquamarine); }
                }
 
                static public Color Azure {
-                       get { return KnownColors.FromKnownColor (KnownColor.Azure); }
+                       get { return FromKnownColor (KnownColor.Azure); }
                }
 
                static public Color Beige {
-                       get { return KnownColors.FromKnownColor (KnownColor.Beige); }
+                       get { return FromKnownColor (KnownColor.Beige); }
                }
 
                static public Color Bisque {
-                       get { return KnownColors.FromKnownColor (KnownColor.Bisque); }
+                       get { return FromKnownColor (KnownColor.Bisque); }
                }
 
                static public Color Black {
-                       get { return KnownColors.FromKnownColor (KnownColor.Black); }
+                       get { return FromKnownColor (KnownColor.Black); }
                }
 
                static public Color BlanchedAlmond {
-                       get { return KnownColors.FromKnownColor (KnownColor.BlanchedAlmond); }
+                       get { return FromKnownColor (KnownColor.BlanchedAlmond); }
                }
 
                static public Color Blue {
-                       get { return KnownColors.FromKnownColor (KnownColor.Blue); }
+                       get { return FromKnownColor (KnownColor.Blue); }
                }
 
                static public Color BlueViolet {
-                       get { return KnownColors.FromKnownColor (KnownColor.BlueViolet); }
+                       get { return FromKnownColor (KnownColor.BlueViolet); }
                }
 
                static public Color Brown {
-                       get { return KnownColors.FromKnownColor (KnownColor.Brown); }
+                       get { return FromKnownColor (KnownColor.Brown); }
                }
 
                static public Color BurlyWood {
-                       get { return KnownColors.FromKnownColor (KnownColor.BurlyWood); }
+                       get { return FromKnownColor (KnownColor.BurlyWood); }
                }
 
                static public Color CadetBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.CadetBlue); }
+                       get { return FromKnownColor (KnownColor.CadetBlue); }
                }
 
                static public Color Chartreuse {
-                       get { return KnownColors.FromKnownColor (KnownColor.Chartreuse); }
+                       get { return FromKnownColor (KnownColor.Chartreuse); }
                }
 
                static public Color Chocolate {
-                       get { return KnownColors.FromKnownColor (KnownColor.Chocolate); }
+                       get { return FromKnownColor (KnownColor.Chocolate); }
                }
 
                static public Color Coral {
-                       get { return KnownColors.FromKnownColor (KnownColor.Coral); }
+                       get { return FromKnownColor (KnownColor.Coral); }
                }
 
                static public Color CornflowerBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.CornflowerBlue); }
+                       get { return FromKnownColor (KnownColor.CornflowerBlue); }
                }
 
                static public Color Cornsilk {
-                       get { return KnownColors.FromKnownColor (KnownColor.Cornsilk); }
+                       get { return FromKnownColor (KnownColor.Cornsilk); }
                }
 
                static public Color Crimson {
-                       get { return KnownColors.FromKnownColor (KnownColor.Crimson); }
+                       get { return FromKnownColor (KnownColor.Crimson); }
                }
 
                static public Color Cyan {
-                       get { return KnownColors.FromKnownColor (KnownColor.Cyan); }
+                       get { return FromKnownColor (KnownColor.Cyan); }
                }
 
                static public Color DarkBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkBlue); }
+                       get { return FromKnownColor (KnownColor.DarkBlue); }
                }
 
                static public Color DarkCyan {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkCyan); }
+                       get { return FromKnownColor (KnownColor.DarkCyan); }
                }
 
                static public Color DarkGoldenrod {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkGoldenrod); }
+                       get { return FromKnownColor (KnownColor.DarkGoldenrod); }
                }
 
                static public Color DarkGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkGray); }
+                       get { return FromKnownColor (KnownColor.DarkGray); }
                }
 
                static public Color DarkGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkGreen); }
+                       get { return FromKnownColor (KnownColor.DarkGreen); }
                }
 
                static public Color DarkKhaki {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkKhaki); }
+                       get { return FromKnownColor (KnownColor.DarkKhaki); }
                }
 
                static public Color DarkMagenta {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkMagenta); }
+                       get { return FromKnownColor (KnownColor.DarkMagenta); }
                }
 
                static public Color DarkOliveGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkOliveGreen); }
+                       get { return FromKnownColor (KnownColor.DarkOliveGreen); }
                }
 
                static public Color DarkOrange {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkOrange); }
+                       get { return FromKnownColor (KnownColor.DarkOrange); }
                }
 
                static public Color DarkOrchid {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkOrchid); }
+                       get { return FromKnownColor (KnownColor.DarkOrchid); }
                }
 
                static public Color DarkRed {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkRed); }
+                       get { return FromKnownColor (KnownColor.DarkRed); }
                }
 
                static public Color DarkSalmon {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkSalmon); }
+                       get { return FromKnownColor (KnownColor.DarkSalmon); }
                }
 
                static public Color DarkSeaGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkSeaGreen); }
+                       get { return FromKnownColor (KnownColor.DarkSeaGreen); }
                }
 
                static public Color DarkSlateBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkSlateBlue); }
+                       get { return FromKnownColor (KnownColor.DarkSlateBlue); }
                }
 
                static public Color DarkSlateGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkSlateGray); }
+                       get { return FromKnownColor (KnownColor.DarkSlateGray); }
                }
 
                static public Color DarkTurquoise {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkTurquoise); }
+                       get { return FromKnownColor (KnownColor.DarkTurquoise); }
                }
 
                static public Color DarkViolet {
-                       get { return KnownColors.FromKnownColor (KnownColor.DarkViolet); }
+                       get { return FromKnownColor (KnownColor.DarkViolet); }
                }
 
                static public Color DeepPink {
-                       get { return KnownColors.FromKnownColor (KnownColor.DeepPink); }
+                       get { return FromKnownColor (KnownColor.DeepPink); }
                }
 
                static public Color DeepSkyBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.DeepSkyBlue); }
+                       get { return FromKnownColor (KnownColor.DeepSkyBlue); }
                }
 
                static public Color DimGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.DimGray); }
+                       get { return FromKnownColor (KnownColor.DimGray); }
                }
 
                static public Color DodgerBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.DodgerBlue); }
+                       get { return FromKnownColor (KnownColor.DodgerBlue); }
                }
 
                static public Color Firebrick {
-                       get { return KnownColors.FromKnownColor (KnownColor.Firebrick); }
+                       get { return FromKnownColor (KnownColor.Firebrick); }
                }
 
                static public Color FloralWhite {
-                       get { return KnownColors.FromKnownColor (KnownColor.FloralWhite); }
+                       get { return FromKnownColor (KnownColor.FloralWhite); }
                }
 
                static public Color ForestGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.ForestGreen); }
+                       get { return FromKnownColor (KnownColor.ForestGreen); }
                }
 
                static public Color Fuchsia {
-                       get { return KnownColors.FromKnownColor (KnownColor.Fuchsia); }
+                       get { return FromKnownColor (KnownColor.Fuchsia); }
                }
 
                static public Color Gainsboro {
-                       get { return KnownColors.FromKnownColor (KnownColor.Gainsboro); }
+                       get { return FromKnownColor (KnownColor.Gainsboro); }
                }
 
                static public Color GhostWhite {
-                       get { return KnownColors.FromKnownColor (KnownColor.GhostWhite); }
+                       get { return FromKnownColor (KnownColor.GhostWhite); }
                }
 
                static public Color Gold {
-                       get { return KnownColors.FromKnownColor (KnownColor.Gold); }
+                       get { return FromKnownColor (KnownColor.Gold); }
                }
 
                static public Color Goldenrod {
-                       get { return KnownColors.FromKnownColor (KnownColor.Goldenrod); }
+                       get { return FromKnownColor (KnownColor.Goldenrod); }
                }
 
                static public Color Gray {
-                       get { return KnownColors.FromKnownColor (KnownColor.Gray); }
+                       get { return FromKnownColor (KnownColor.Gray); }
                }
 
                static public Color Green {
-                       get { return KnownColors.FromKnownColor (KnownColor.Green); }
+                       get { return FromKnownColor (KnownColor.Green); }
                }
 
                static public Color GreenYellow {
-                       get { return KnownColors.FromKnownColor (KnownColor.GreenYellow); }
+                       get { return FromKnownColor (KnownColor.GreenYellow); }
                }
 
                static public Color Honeydew {
-                       get { return KnownColors.FromKnownColor (KnownColor.Honeydew); }
+                       get { return FromKnownColor (KnownColor.Honeydew); }
                }
 
                static public Color HotPink {
-                       get { return KnownColors.FromKnownColor (KnownColor.HotPink); }
+                       get { return FromKnownColor (KnownColor.HotPink); }
                }
 
                static public Color IndianRed {
-                       get { return KnownColors.FromKnownColor (KnownColor.IndianRed); }
+                       get { return FromKnownColor (KnownColor.IndianRed); }
                }
 
                static public Color Indigo {
-                       get { return KnownColors.FromKnownColor (KnownColor.Indigo); }
+                       get { return FromKnownColor (KnownColor.Indigo); }
                }
 
                static public Color Ivory {
-                       get { return KnownColors.FromKnownColor (KnownColor.Ivory); }
+                       get { return FromKnownColor (KnownColor.Ivory); }
                }
 
                static public Color Khaki {
-                       get { return KnownColors.FromKnownColor (KnownColor.Khaki); }
+                       get { return FromKnownColor (KnownColor.Khaki); }
                }
 
                static public Color Lavender {
-                       get { return KnownColors.FromKnownColor (KnownColor.Lavender); }
+                       get { return FromKnownColor (KnownColor.Lavender); }
                }
 
                static public Color LavenderBlush {
-                       get { return KnownColors.FromKnownColor (KnownColor.LavenderBlush); }
+                       get { return FromKnownColor (KnownColor.LavenderBlush); }
                }
 
                static public Color LawnGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.LawnGreen); }
+                       get { return FromKnownColor (KnownColor.LawnGreen); }
                }
 
                static public Color LemonChiffon {
-                       get { return KnownColors.FromKnownColor (KnownColor.LemonChiffon); }
+                       get { return FromKnownColor (KnownColor.LemonChiffon); }
                }
 
                static public Color LightBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightBlue); }
+                       get { return FromKnownColor (KnownColor.LightBlue); }
                }
 
                static public Color LightCoral {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightCoral); }
+                       get { return FromKnownColor (KnownColor.LightCoral); }
                }
 
                static public Color LightCyan {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightCyan); }
+                       get { return FromKnownColor (KnownColor.LightCyan); }
                }
 
                static public Color LightGoldenrodYellow {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightGoldenrodYellow); }
+                       get { return FromKnownColor (KnownColor.LightGoldenrodYellow); }
                }
 
                static public Color LightGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightGreen); }
+                       get { return FromKnownColor (KnownColor.LightGreen); }
                }
 
                static public Color LightGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightGray); }
+                       get { return FromKnownColor (KnownColor.LightGray); }
                }
 
                static public Color LightPink {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightPink); }
+                       get { return FromKnownColor (KnownColor.LightPink); }
                }
 
                static public Color LightSalmon {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightSalmon); }
+                       get { return FromKnownColor (KnownColor.LightSalmon); }
                }
 
                static public Color LightSeaGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightSeaGreen); }
+                       get { return FromKnownColor (KnownColor.LightSeaGreen); }
                }
 
                static public Color LightSkyBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightSkyBlue); }
+                       get { return FromKnownColor (KnownColor.LightSkyBlue); }
                }
 
                static public Color LightSlateGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightSlateGray); }
+                       get { return FromKnownColor (KnownColor.LightSlateGray); }
                }
 
                static public Color LightSteelBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightSteelBlue); }
+                       get { return FromKnownColor (KnownColor.LightSteelBlue); }
                }
 
                static public Color LightYellow {
-                       get { return KnownColors.FromKnownColor (KnownColor.LightYellow); }
+                       get { return FromKnownColor (KnownColor.LightYellow); }
                }
 
                static public Color Lime {
-                       get { return KnownColors.FromKnownColor (KnownColor.Lime); }
+                       get { return FromKnownColor (KnownColor.Lime); }
                }
 
                static public Color LimeGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.LimeGreen); }
+                       get { return FromKnownColor (KnownColor.LimeGreen); }
                }
 
                static public Color Linen {
-                       get { return KnownColors.FromKnownColor (KnownColor.Linen); }
+                       get { return FromKnownColor (KnownColor.Linen); }
                }
 
                static public Color Magenta {
-                       get { return KnownColors.FromKnownColor (KnownColor.Magenta); }
+                       get { return FromKnownColor (KnownColor.Magenta); }
                }
 
                static public Color Maroon {
-                       get { return KnownColors.FromKnownColor (KnownColor.Maroon); }
+                       get { return FromKnownColor (KnownColor.Maroon); }
                }
 
                static public Color MediumAquamarine {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumAquamarine); }
+                       get { return FromKnownColor (KnownColor.MediumAquamarine); }
                }
 
                static public Color MediumBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumBlue); }
+                       get { return FromKnownColor (KnownColor.MediumBlue); }
                }
 
                static public Color MediumOrchid {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumOrchid); }
+                       get { return FromKnownColor (KnownColor.MediumOrchid); }
                }
 
                static public Color MediumPurple {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumPurple); }
+                       get { return FromKnownColor (KnownColor.MediumPurple); }
                }
 
                static public Color MediumSeaGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumSeaGreen); }
+                       get { return FromKnownColor (KnownColor.MediumSeaGreen); }
                }
 
                static public Color MediumSlateBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumSlateBlue); }
+                       get { return FromKnownColor (KnownColor.MediumSlateBlue); }
                }
 
                static public Color MediumSpringGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumSpringGreen); }
+                       get { return FromKnownColor (KnownColor.MediumSpringGreen); }
                }
 
                static public Color MediumTurquoise {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumTurquoise); }
+                       get { return FromKnownColor (KnownColor.MediumTurquoise); }
                }
 
                static public Color MediumVioletRed {
-                       get { return KnownColors.FromKnownColor (KnownColor.MediumVioletRed); }
+                       get { return FromKnownColor (KnownColor.MediumVioletRed); }
                }
 
                static public Color MidnightBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.MidnightBlue); }
+                       get { return FromKnownColor (KnownColor.MidnightBlue); }
                }
 
                static public Color MintCream {
-                       get { return KnownColors.FromKnownColor (KnownColor.MintCream); }
+                       get { return FromKnownColor (KnownColor.MintCream); }
                }
 
                static public Color MistyRose {
-                       get { return KnownColors.FromKnownColor (KnownColor.MistyRose); }
+                       get { return FromKnownColor (KnownColor.MistyRose); }
                }
 
                static public Color Moccasin {
-                       get { return KnownColors.FromKnownColor (KnownColor.Moccasin); }
+                       get { return FromKnownColor (KnownColor.Moccasin); }
                }
 
                static public Color NavajoWhite {
-                       get { return KnownColors.FromKnownColor (KnownColor.NavajoWhite); }
+                       get { return FromKnownColor (KnownColor.NavajoWhite); }
                }
 
                static public Color Navy {
-                       get { return KnownColors.FromKnownColor (KnownColor.Navy); }
+                       get { return FromKnownColor (KnownColor.Navy); }
                }
 
                static public Color OldLace {
-                       get { return KnownColors.FromKnownColor (KnownColor.OldLace); }
+                       get { return FromKnownColor (KnownColor.OldLace); }
                }
 
                static public Color Olive {
-                       get { return KnownColors.FromKnownColor (KnownColor.Olive); }
+                       get { return FromKnownColor (KnownColor.Olive); }
                }
 
                static public Color OliveDrab {
-                       get { return KnownColors.FromKnownColor (KnownColor.OliveDrab); }
+                       get { return FromKnownColor (KnownColor.OliveDrab); }
                }
 
                static public Color Orange {
-                       get { return KnownColors.FromKnownColor (KnownColor.Orange); }
+                       get { return FromKnownColor (KnownColor.Orange); }
                }
 
                static public Color OrangeRed {
-                       get { return KnownColors.FromKnownColor (KnownColor.OrangeRed); }
+                       get { return FromKnownColor (KnownColor.OrangeRed); }
                }
 
                static public Color Orchid {
-                       get { return KnownColors.FromKnownColor (KnownColor.Orchid); }
+                       get { return FromKnownColor (KnownColor.Orchid); }
                }
 
                static public Color PaleGoldenrod {
-                       get { return KnownColors.FromKnownColor (KnownColor.PaleGoldenrod); }
+                       get { return FromKnownColor (KnownColor.PaleGoldenrod); }
                }
 
                static public Color PaleGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.PaleGreen); }
+                       get { return FromKnownColor (KnownColor.PaleGreen); }
                }
 
                static public Color PaleTurquoise {
-                       get { return KnownColors.FromKnownColor (KnownColor.PaleTurquoise); }
+                       get { return FromKnownColor (KnownColor.PaleTurquoise); }
                }
 
                static public Color PaleVioletRed {
-                       get { return KnownColors.FromKnownColor (KnownColor.PaleVioletRed); }
+                       get { return FromKnownColor (KnownColor.PaleVioletRed); }
                }
 
                static public Color PapayaWhip {
-                       get { return KnownColors.FromKnownColor (KnownColor.PapayaWhip); }
+                       get { return FromKnownColor (KnownColor.PapayaWhip); }
                }
 
                static public Color PeachPuff {
-                       get { return KnownColors.FromKnownColor (KnownColor.PeachPuff); }
+                       get { return FromKnownColor (KnownColor.PeachPuff); }
                }
 
                static public Color Peru {
-                       get { return KnownColors.FromKnownColor (KnownColor.Peru); }
+                       get { return FromKnownColor (KnownColor.Peru); }
                }
 
                static public Color Pink {
-                       get { return KnownColors.FromKnownColor (KnownColor.Pink); }
+                       get { return FromKnownColor (KnownColor.Pink); }
                }
 
                static public Color Plum {
-                       get { return KnownColors.FromKnownColor (KnownColor.Plum); }
+                       get { return FromKnownColor (KnownColor.Plum); }
                }
 
                static public Color PowderBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.PowderBlue); }
+                       get { return FromKnownColor (KnownColor.PowderBlue); }
                }
 
                static public Color Purple {
-                       get { return KnownColors.FromKnownColor (KnownColor.Purple); }
+                       get { return FromKnownColor (KnownColor.Purple); }
                }
 
                static public Color Red {
-                       get { return KnownColors.FromKnownColor (KnownColor.Red); }
+                       get { return FromKnownColor (KnownColor.Red); }
                }
 
                static public Color RosyBrown {
-                       get { return KnownColors.FromKnownColor (KnownColor.RosyBrown); }
+                       get { return FromKnownColor (KnownColor.RosyBrown); }
                }
 
                static public Color RoyalBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.RoyalBlue); }
+                       get { return FromKnownColor (KnownColor.RoyalBlue); }
                }
 
                static public Color SaddleBrown {
-                       get { return KnownColors.FromKnownColor (KnownColor.SaddleBrown); }
+                       get { return FromKnownColor (KnownColor.SaddleBrown); }
                }
 
                static public Color Salmon {
-                       get { return KnownColors.FromKnownColor (KnownColor.Salmon); }
+                       get { return FromKnownColor (KnownColor.Salmon); }
                }
 
                static public Color SandyBrown {
-                       get { return KnownColors.FromKnownColor (KnownColor.SandyBrown); }
+                       get { return FromKnownColor (KnownColor.SandyBrown); }
                }
 
                static public Color SeaGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.SeaGreen); }
+                       get { return FromKnownColor (KnownColor.SeaGreen); }
                }
 
                static public Color SeaShell {
-                       get { return KnownColors.FromKnownColor (KnownColor.SeaShell); }
+                       get { return FromKnownColor (KnownColor.SeaShell); }
                }
 
                static public Color Sienna {
-                       get { return KnownColors.FromKnownColor (KnownColor.Sienna); }
+                       get { return FromKnownColor (KnownColor.Sienna); }
                }
 
                static public Color Silver {
-                       get { return KnownColors.FromKnownColor (KnownColor.Silver); }
+                       get { return FromKnownColor (KnownColor.Silver); }
                }
 
                static public Color SkyBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.SkyBlue); }
+                       get { return FromKnownColor (KnownColor.SkyBlue); }
                }
 
                static public Color SlateBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.SlateBlue); }
+                       get { return FromKnownColor (KnownColor.SlateBlue); }
                }
 
                static public Color SlateGray {
-                       get { return KnownColors.FromKnownColor (KnownColor.SlateGray); }
+                       get { return FromKnownColor (KnownColor.SlateGray); }
                }
 
                static public Color Snow {
-                       get { return KnownColors.FromKnownColor (KnownColor.Snow); }
+                       get { return FromKnownColor (KnownColor.Snow); }
                }
 
                static public Color SpringGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.SpringGreen); }
+                       get { return FromKnownColor (KnownColor.SpringGreen); }
                }
 
                static public Color SteelBlue {
-                       get { return KnownColors.FromKnownColor (KnownColor.SteelBlue); }
+                       get { return FromKnownColor (KnownColor.SteelBlue); }
                }
 
                static public Color Tan {
-                       get { return KnownColors.FromKnownColor (KnownColor.Tan); }
+                       get { return FromKnownColor (KnownColor.Tan); }
                }
 
                static public Color Teal {
-                       get { return KnownColors.FromKnownColor (KnownColor.Teal); }
+                       get { return FromKnownColor (KnownColor.Teal); }
                }
 
                static public Color Thistle {
-                       get { return KnownColors.FromKnownColor (KnownColor.Thistle); }
+                       get { return FromKnownColor (KnownColor.Thistle); }
                }
 
                static public Color Tomato {
-                       get { return KnownColors.FromKnownColor (KnownColor.Tomato); }
+                       get { return FromKnownColor (KnownColor.Tomato); }
                }
 
                static public Color Turquoise {
-                       get { return KnownColors.FromKnownColor (KnownColor.Turquoise); }
+                       get { return FromKnownColor (KnownColor.Turquoise); }
                }
 
                static public Color Violet {
-                       get { return KnownColors.FromKnownColor (KnownColor.Violet); }
+                       get { return FromKnownColor (KnownColor.Violet); }
                }
 
                static public Color Wheat {
-                       get { return KnownColors.FromKnownColor (KnownColor.Wheat); }
+                       get { return FromKnownColor (KnownColor.Wheat); }
                }
 
                static public Color White {
-                       get { return KnownColors.FromKnownColor (KnownColor.White); }
+                       get { return FromKnownColor (KnownColor.White); }
                }
 
                static public Color WhiteSmoke {
-                       get { return KnownColors.FromKnownColor (KnownColor.WhiteSmoke); }
+                       get { return FromKnownColor (KnownColor.WhiteSmoke); }
                }
 
                static public Color Yellow {
-                       get { return KnownColors.FromKnownColor (KnownColor.Yellow); }
+                       get { return FromKnownColor (KnownColor.Yellow); }
                }
 
                static public Color YellowGreen {
-                       get { return KnownColors.FromKnownColor (KnownColor.YellowGreen); }
+                       get { return FromKnownColor (KnownColor.YellowGreen); }
                }
        }
 }
index 969d9ac7853d680eadfb019306104c73559d6c54..c5af3c18e1bb7092d4c6c13353113f5a4f7ee898 100644 (file)
@@ -32,7 +32,6 @@
 //
 
 using System;
-using System.Runtime.Remoting;
 using System.Runtime.Serialization;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
index 77b1b16251dbcf5bf7b840ec3918670b371097bd..fa3c787811ef1063b81283b295fdbfdaccba3822 100644 (file)
@@ -269,21 +269,7 @@ namespace System.Drawing {
 
                public static Color FromKnownColor (KnownColor kc)
                {
-                       Color c;
-                       short n = (short)kc;
-                       if ((n <= 0) || (n >= ArgbValues.Length)) {
-                               // This is what it returns!
-                               c = Color.FromArgb (0, 0, 0, 0);
-                               c.state |= (short) Color.ColorType.Named;
-                       } else {
-                               c = new Color ();
-                               c.state = (short) (Color.ColorType.ARGB | Color.ColorType.Known | Color.ColorType.Named);
-                               if ((n < 27) || (n > 169))
-                                       c.state |= (short) Color.ColorType.System;
-                               c.Value = ArgbValues [n];
-                       }
-                       c.knownColor = n;
-                       return c;
+                       return Color.FromKnownColor (kc);
                }
 
                public static string GetName (short kc)
index a8ee4551a930133dbe9290c1fd78669c7c1fe149..876202f39fde38676e8e8288940074094d45abde 100644 (file)
@@ -73,7 +73,6 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void CopyData_NullPoints ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -81,13 +80,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = null;
                                        byte [] types = new byte [1];
-                                       Assert.AreEqual (0, gpi.CopyData (ref points, ref types, 0, 1));
+                                       Assert.Throws<NullReferenceException> (() => gpi.CopyData (ref points, ref types, 0, 1));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void CopyData_NullTypes ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -95,13 +93,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = new PointF [1];
                                        byte [] types = null;
-                                       Assert.AreEqual (0, gpi.CopyData (ref points, ref types, 0, 1));
+                                       Assert.Throws<NullReferenceException> (() =>gpi.CopyData (ref points, ref types, 0, 1));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void CopyData_DifferentSize ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -109,13 +106,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = new PointF [1];
                                        byte [] types = new byte [2];
-                                       Assert.AreEqual (0, gpi.CopyData (ref points, ref types, 0, 1));
+                                       Assert.Throws<ArgumentException> (() => gpi.CopyData (ref points, ref types, 0, 1));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Enumerate_NullPoints ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -123,13 +119,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = null;
                                        byte [] types = new byte [2];
-                                       Assert.AreEqual (0, gpi.Enumerate (ref points, ref types));
+                                       Assert.Throws<NullReferenceException> (() => gpi.Enumerate (ref points, ref types));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Enumerate_NullTypes ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -137,13 +132,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = new PointF [1];
                                        byte [] types = null;
-                                       Assert.AreEqual (0, gpi.Enumerate (ref points, ref types));
+                                       Assert.Throws<NullReferenceException> (() => gpi.Enumerate (ref points, ref types));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Enumerate_DifferentSize ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -151,7 +145,7 @@ namespace MonoTests.System.Drawing.Drawing2D {
                                using (GraphicsPathIterator gpi = new GraphicsPathIterator (gp)) {
                                        PointF [] points = new PointF [1];
                                        byte [] types = new byte [2];
-                                       Assert.AreEqual (0, gpi.Enumerate (ref points, ref types));
+                                       Assert.Throws<ArgumentException> (() => gpi.Enumerate (ref points, ref types));
                                }
                        }
                }
index 1d44f318763de5d215b9aaed666c3b779e3f5df9..9674c311abbd4f19156908c4fa3b2d4bc7427100 100644 (file)
@@ -59,45 +59,39 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Point_Null_Byte ()
                {
-                       new GraphicsPath ((Point[]) null, new byte[1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((Point[]) null, new byte[1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_Point_Byte_Null ()
                {
-                       new GraphicsPath (new Point[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath (new Point[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Point_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new Point[1], new byte [2]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new Point[1], new byte [2]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_PointF_Null_Byte ()
                {
-                       new GraphicsPath ((PointF[])null, new byte [1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((PointF[])null, new byte [1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_PointF_Byte_Null ()
                {
-                       new GraphicsPath ( new PointF[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath ( new PointF[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_PointF_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new PointF[2], new byte [1]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new PointF[2], new byte [1]));
                }
 
                [Test]
@@ -116,17 +110,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathPoints ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathPoints);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathPoints));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathTypes ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathTypes);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathTypes));
                }
 
                [Test]
@@ -172,14 +164,13 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void FillMode_Invalid ()
                {
                        // constructor accept an invalid FillMode
                        GraphicsPath gp = new GraphicsPath ((FillMode) Int32.MaxValue);
                        Assert.AreEqual (Int32.MaxValue, (int) gp.FillMode, "MaxValue");
                        // but you can't set the FillMode property to an invalid value ;-)
-                       gp.FillMode = (FillMode) Int32.MaxValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => gp.FillMode = (FillMode) Int32.MaxValue);
                }
 
                [Test]
@@ -388,18 +379,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddBeziers_Point_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_Points ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) }));
                }
 
                [Test]
@@ -411,18 +400,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddBeziers_PointF_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_PointFs ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) }));
                }
 
                [Test]
@@ -641,19 +628,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_Point_Null ()
                {
-                       new GraphicsPath ().AddLines ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new Point[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new Point[0]));
                }
 
                [Test]
@@ -675,19 +659,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_PointF_Null ()
                {
-                       new GraphicsPath ().AddLines ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new PointF[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new PointF[0]));
                }
 
                [Test]
@@ -846,33 +827,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_Point_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -884,33 +861,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_PointF_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -1084,20 +1057,17 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddRectangles_Int_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((Rectangle[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((Rectangle[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Int_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles (new Rectangle[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles (new Rectangle[0]));
                }
 
                [Test]
@@ -1109,20 +1079,17 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddRectangles_Float_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((RectangleF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((RectangleF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Float_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ( new RectangleF[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles ( new RectangleF[0]));
                }
 
                [Test]
@@ -1163,10 +1130,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPath_Null ()
                {
-                       new GraphicsPath ().AddPath (null, false);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPath (null, false));
                }
 
                [Test]
@@ -1199,34 +1165,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point [0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point [0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -1238,34 +1200,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -1332,26 +1290,23 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddCurve ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
@@ -1375,35 +1330,31 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3I
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
@@ -1427,11 +1378,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3
                }
 
@@ -1445,27 +1395,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_ZeroSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_NegativeSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_OffsetTooLarge ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f));
                }
 
                [Test]
@@ -1572,12 +1519,11 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void AddString_NullString ()
                {
                        GraphicsPath gp = new GraphicsPath ();
                        FontFamily ff = GetFontFamily ();
-                       gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<NullReferenceException> (() => gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1590,11 +1536,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddString_NullFontFamily ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<ArgumentException> (() => gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1779,10 +1724,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new GraphicsPath ().Transform (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Transform (null));
                }
                [Test]
                public void Transform_Empty ()
@@ -1976,17 +1920,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Warp_Null ()
                {
-                       new GraphicsPath ().Warp (null, new RectangleF ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Warp (null, new RectangleF ()));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Warp_NoPoints ()
                {
-                       new GraphicsPath ().Warp (new PointF[0], new RectangleF ());
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().Warp (new PointF[0], new RectangleF ()));
                }
 
                [Test]
@@ -2461,10 +2403,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null ()
                {
-                       new GraphicsPath ().Widen (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null));
                }
 
                [Test]
@@ -2520,10 +2461,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null_Matrix ()
                {
-                       new GraphicsPath ().Widen (null, new Matrix ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null, new Matrix ()));
                }
 
                [Test]
@@ -2538,14 +2478,13 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Widen_SinglePoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (new Point[1] { new Point (1, 1) });
                                // Special case - a line with a single point is valid
                                Assert.AreEqual (1, gp.PointCount, "PointCount");
-                               gp.Widen (Pens.Red);
+                               Assert.Throws<OutOfMemoryException> (() => gp.Widen (Pens.Red));
                                // oops ;-)
                        }
                }
@@ -2669,31 +2608,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_IntNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1, 1, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1, 1, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_FloatNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new Point (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new Point (), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointFNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new PointF (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new PointF (), null));
                }
 
                private void IsOutlineVisible_Line (Graphics graphics)
index bb97b81288c7fb4ecd3a95d24a5255f6d26502e3..937c9ebbc792cae616e995b0e53c62cfb8248d3d 100644 (file)
@@ -325,33 +325,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void InterpolationColors_Colors_InvalidBlend ()
                {
                        // default Blend doesn't allow getting this property
-                       Assert.IsNotNull (default_brush.InterpolationColors.Colors);
+                       Assert.Throws<ArgumentException> (() => { var x = default_brush.InterpolationColors.Colors; });
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void InterpolationColors_Positions_InvalidBlend ()
                {
                        // default Blend doesn't allow getting this property
-                       Assert.IsNotNull (default_brush.InterpolationColors.Positions);
+                       Assert.Throws<ArgumentException> (() => { var x = default_brush.InterpolationColors.Positions; });
                }
 
                [Test]
-               [ExpectedException (typeof (IndexOutOfRangeException))]
                public void LinearColors_Empty ()
                {
-                       default_brush.LinearColors = new Color[0];
+                       Assert.Throws<IndexOutOfRangeException> (() => default_brush.LinearColors = new Color[0]);
                }
 
                [Test]
-               [ExpectedException (typeof (IndexOutOfRangeException))]
                public void LinearColors_One ()
                {
-                       default_brush.LinearColors = new Color[1];
+                       Assert.Throws<IndexOutOfRangeException> (() => default_brush.LinearColors = new Color[1]);
                }
 
                [Test]
@@ -400,10 +396,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       default_brush.Transform = null;
+                       Assert.Throws<ArgumentNullException> (() => default_brush.Transform = null);
                }
 
                [Test]
@@ -415,10 +410,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Transform_NonInvertible ()
                {
-                       default_brush.Transform = new Matrix (123, 24, 82, 16, 47, 30);
+                       Assert.Throws<ArgumentException> (() => default_brush.Transform = new Matrix (123, 24, 82, 16, 47, 30));
                }
 
                [Test]
@@ -436,17 +430,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void WrapMode_Clamp ()
                {
-                       default_brush.WrapMode = WrapMode.Clamp;
+                       Assert.Throws<ArgumentException> (() => default_brush.WrapMode = WrapMode.Clamp);
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void WrapMode_Invalid ()
                {
-                       default_brush.WrapMode = (WrapMode) Int32.MinValue;
+                       Assert.Throws<InvalidEnumArgumentException> (() => default_brush.WrapMode = (WrapMode) Int32.MinValue);
                }
 
 
@@ -466,17 +458,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform1_Null ()
                {
-                       default_brush.MultiplyTransform (null);
+                       Assert.Throws<ArgumentNullException> (() => default_brush.MultiplyTransform (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform2_Null ()
                {
-                       default_brush.MultiplyTransform (null, MatrixOrder.Append);
+                       Assert.Throws<ArgumentNullException> (() => default_brush.MultiplyTransform (null, MatrixOrder.Append));
                }
 
                [Test]
@@ -486,11 +476,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MultiplyTransform_NonInvertible ()
                {
                        Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30);
-                       default_brush.MultiplyTransform (noninvertible);
+                       Assert.Throws<ArgumentException> (() => default_brush.MultiplyTransform (noninvertible));
                }
 
                [Test]
@@ -550,11 +539,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateTransform_InvalidOrder ()
                {
                        LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
-                       lgb.RotateTransform (720, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => lgb.RotateTransform (720, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -603,11 +591,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_InvalidOrder ()
                {
                        LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
-                       lgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => lgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -643,31 +630,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_FocusTooSmall ()
                {
-                       default_brush.SetBlendTriangularShape (-1);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (-1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_FocusTooBig ()
                {
-                       default_brush.SetBlendTriangularShape (1.01f);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1.01f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_ScaleTooSmall ()
                {
-                       default_brush.SetBlendTriangularShape (1, -1);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1, -1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_ScaleTooBig ()
                {
-                       default_brush.SetBlendTriangularShape (1, 1.01f);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetBlendTriangularShape (1, 1.01f));
                }
 
                [Test]
@@ -703,31 +686,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_FocusTooSmall ()
                {
-                       default_brush.SetSigmaBellShape (-1);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (-1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_FocusTooBig ()
                {
-                       default_brush.SetSigmaBellShape (1.01f);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1.01f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_ScaleTooSmall ()
                {
-                       default_brush.SetSigmaBellShape (1, -1);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1, -1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_ScaleTooBig ()
                {
-                       default_brush.SetSigmaBellShape (1, 1.01f);
+                       Assert.Throws<ArgumentException> (() => default_brush.SetSigmaBellShape (1, 1.01f));
                }
 
                [Test]
@@ -755,11 +734,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TranslateTransform_InvalidOrder ()
                {
                        LinearGradientBrush lgb = new LinearGradientBrush (pt1, pt2, c1, c2);
-                       lgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => lgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -875,42 +853,37 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void LinearColors_Null ()
                {
-                       default_brush.LinearColors = null;
+                       Assert.Throws<NullReferenceException> (() => default_brush.LinearColors = null);
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void InterpolationColors_Null ()
                {
-                       default_brush.InterpolationColors = null;
+                       Assert.Throws<ArgumentException> (() => default_brush.InterpolationColors = null);
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Blend_Null ()
                {
-                       default_brush.Blend = null;
+                       Assert.Throws<NullReferenceException> (() => default_brush.Blend = null);
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ZeroWidthRectangle ()
                {
                        Rectangle r = new Rectangle (10, 10, 0, 10);
                        Assert.AreEqual (0, r.Width, "Width");
-                       new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical);
+                       Assert.Throws<ArgumentException> (() => new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ZeroHeightRectangleF ()
                {
                        RectangleF r = new RectangleF (10.0f, 10.0f, 10.0f, 0.0f);
                        Assert.AreEqual (0.0f, r.Height, "Height");
-                       new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical);
+                       Assert.Throws<ArgumentException> (() => new LinearGradientBrush (r, Color.Red, Color.Blue, LinearGradientMode.Vertical));
                }
        }
 }
index bc7cd5d368f449758047fa1ed67aa06549d85f60..509fe22d5efb1b1ee853bd33144e74ca58d526f6 100644 (file)
@@ -91,30 +91,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new PathGradientBrush (gp);
+                       Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_GraphicsPath_Empty ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
-                               new PathGradientBrush (gp);
+                               Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (gp));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_GraphicsPath_SinglePoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (new Point[1] { new Point (1, 1) });
                                // Special case - a line with a single point is valid
-                               new PathGradientBrush (gp);
+                               Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (gp));
                        }
                }
 
@@ -131,27 +128,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Point_Null ()
                {
                        Point[] pts = null;
-                       new PathGradientBrush (pts);
+                       Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_Point_Empty ()
                {
                        Point[] pts = new Point [0];
-                       new PathGradientBrush (pts);
+                       Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_Point_One ()
                {
                        Point[] pts = new Point[1] { new Point (1, 1) };
-                       new PathGradientBrush (pts);
+                       Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
@@ -209,27 +203,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_PointF_Null ()
                {
                        PointF[] pts = null;
-                       new PathGradientBrush (pts);
+                       Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_PointF_Empty ()
                {
                        PointF[] pts = new PointF[0];
-                       new PathGradientBrush (pts);
+                       Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Constructor_PointF_One ()
                {
                        PointF[] pts = new PointF[1] { new PointF (1, 1) };
-                       new PathGradientBrush (pts);
+                       Assert.Throws<OutOfMemoryException> (() => new PathGradientBrush (pts));
                }
 
                [Test]
@@ -242,10 +233,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void Constructor_PointF_WrapMode_Invalid ()
                {
-                       PathGradientBrush pgb = new PathGradientBrush (pts_2f, (WrapMode)Int32.MinValue);
+                       Assert.Throws<InvalidEnumArgumentException> (() => new PathGradientBrush (pts_2f, (WrapMode)Int32.MinValue));
                }
 
                [Test]
@@ -398,11 +388,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SurroundColors_Empty ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.TileFlipXY)) {
-                               pgb.SurroundColors = new Color[0];
+                               Assert.Throws<ArgumentException> (() => pgb.SurroundColors = new Color[0]);
                        }
                }
 
@@ -448,10 +437,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new PathGradientBrush (pts_2f, WrapMode.Clamp).Transform = null;
+                       Assert.Throws<ArgumentNullException> (() => new PathGradientBrush (pts_2f, WrapMode.Clamp).Transform = null);
                }
 
                [Test]
@@ -464,11 +452,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Transform_NonInvertible ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.Transform = new Matrix (123, 24, 82, 16, 47, 30);
+                               Assert.Throws<ArgumentException> (() => pgb.Transform = new Matrix (123, 24, 82, 16, 47, 30));
                        }
                }
 
@@ -484,11 +471,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void WrapMode_Invalid ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.WrapMode = (WrapMode) Int32.MinValue;
+                               Assert.Throws<InvalidEnumArgumentException> (() => pgb.WrapMode = (WrapMode) Int32.MinValue);
                        }
                }
 
@@ -507,20 +493,18 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform1_Null ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.MultiplyTransform (null);
+                               Assert.Throws<ArgumentNullException> (() => pgb.MultiplyTransform (null));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform2_Null ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.MultiplyTransform (null, MatrixOrder.Append);
+                               Assert.Throws<ArgumentNullException> (() => pgb.MultiplyTransform (null, MatrixOrder.Append));
                        }
                }
 
@@ -533,12 +517,11 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MultiplyTransform_NonInvertible ()
                {
                        using (Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30)) {
                                using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                                       pgb.MultiplyTransform (noninvertible);
+                                       Assert.Throws<ArgumentException> (() => pgb.MultiplyTransform (noninvertible));
                                }
                        }
                }
@@ -607,11 +590,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateTransform_InvalidOrder ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.RotateTransform (720, (MatrixOrder) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => pgb.RotateTransform (720, (MatrixOrder) Int32.MinValue));
                        }
                }
 
@@ -649,11 +631,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_InvalidOrder ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => pgb.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
                        }
                }
 
@@ -692,38 +673,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_FocusTooSmall ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetBlendTriangularShape (-1);
+                               Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (-1));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_FocusTooBig ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetBlendTriangularShape (1.01f);
+                               Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1.01f));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_ScaleTooSmall ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetBlendTriangularShape (1, -1);
+                               Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1, -1));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetBlendTriangularShape_ScaleTooBig ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetBlendTriangularShape (1, 1.01f);
+                               Assert.Throws<ArgumentException> (() => pgb.SetBlendTriangularShape (1, 1.01f));
                        }
                }
 
@@ -762,38 +739,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_FocusTooSmall ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetSigmaBellShape (-1);
+                               Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (-1));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_FocusTooBig ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetSigmaBellShape (1.01f);
+                               Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1.01f));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_ScaleTooSmall ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetSigmaBellShape (1, -1);
+                               Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1, -1));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetSigmaBellShape_ScaleTooBig ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.SetSigmaBellShape (1, 1.01f);
+                               Assert.Throws<ArgumentException> (() => pgb.SetSigmaBellShape (1, 1.01f));
                        }
                }
 
@@ -823,11 +796,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TranslateTransform_InvalidOrder ()
                {
                        using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
-                               pgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => pgb.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
                        }
                }
 
@@ -877,37 +849,34 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Blend_Null ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (pts_2f);
                                using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
-                                       pgb.Blend = null;
+                                       Assert.Throws<NullReferenceException> (() => pgb.Blend = null);
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void InterpolationColors_Null ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (pts_2f);
                                using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
-                                       pgb.InterpolationColors = null;
+                                       Assert.Throws<NullReferenceException> (() => pgb.InterpolationColors = null);
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void SurroundColors_Null ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (pts_2f);
                                using (PathGradientBrush pgb = new PathGradientBrush (gp)) {
-                                       pgb.SurroundColors = null;
+                                       Assert.Throws<NullReferenceException> (() => pgb.SurroundColors = null);
                                }
                        }
                }
index ffe43baaf86bdf10cd476cccb24a0b04745e53b2..79c3bdc55074b5a50396207dd55a1dfeb4c24941 100644 (file)
@@ -96,10 +96,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (OverflowException))]
                public void ColorBlend_Negative ()
                {
-                       ColorBlend cb = new ColorBlend (-1);
+                       Assert.Throws<OverflowException> (() => new ColorBlend (-1));
                }
 
                [Test]
index 4907c5b21e0126e9e201735f50c179e3c8a33c59..438f86fb270a4adb68b727f9f4c0744964d85ca7 100644 (file)
@@ -39,16 +39,6 @@ namespace MonoTests.System.Drawing.Drawing2D
        [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
        public class MatrixTest {
 
-               private Matrix default_matrix;
-               private Rectangle rect;
-               private RectangleF rectf;
-
-               [TestFixtureSetUp]
-               public void FixtureSetUp ()
-               {
-                       default_matrix = new Matrix ();
-               }
-
                [Test]
                public void Constructor_Default ()
                {
@@ -83,24 +73,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Int_Null ()
                {
-                       new Matrix (rect, null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (default (Rectangle), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Int_Empty ()
                {
-                       new Matrix (rect, new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (default (Rectangle), new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Int_4Point ()
                {
-                       new Matrix (rect, new Point[4]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (default (Rectangle), new Point[4]));
                }
 
                [Test]
@@ -118,24 +105,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Float_Null ()
                {
-                       new Matrix (rectf, null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (default (RectangleF), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Float_Empty ()
                {
-                       new Matrix (rectf, new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (default (RectangleF), new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Float_2PointF ()
                {
-                       new Matrix (rectf, new PointF[2]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (default (RectangleF), new PointF[2]));
                }
 
                [Test]
@@ -332,10 +316,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Rotate_InvalidOrder ()
                {
-                       new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -353,17 +336,15 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateAt_InvalidOrder ()
                {
-                       new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Multiply_Null ()
                {
-                       new Matrix (10, 20, 30, 40, 50, 60).Multiply (null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null));
                }
 
                [Test]
@@ -381,10 +362,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Multiply_Null_Order ()
                {
-                       new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append));
                }
 
                [Test]
@@ -416,11 +396,10 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Multiply_InvalidOrder ()
                {
                        Matrix matrix = new Matrix (10, 20, 30, 40, 50, 60);
-                       matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue));
                }
 
                [Test]
@@ -513,10 +492,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Scale_InvalidOrder ()
                {
-                       new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue));
                }
                
                [Test]
@@ -544,10 +522,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Shear_InvalidOrder ()
                {
-                       new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue));
                }
                
                [Test]
@@ -571,31 +548,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformPoints_Point_Null ()
                {
-                       new Matrix ().TransformPoints ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformPoints_PointF_Null ()
                {
-                       new Matrix ().TransformPoints ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformPoints_Point_Empty ()
                {
-                       new Matrix ().TransformPoints (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformPoints_PointF_Empty ()
                {
-                       new Matrix ().TransformPoints (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new PointF[0]));
                }
                
                [Test]
@@ -619,31 +592,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformVectors_Point_Null ()
                {
-                       new Matrix ().TransformVectors ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformVectors_PointF_Null ()
                {
-                       new Matrix ().TransformVectors ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformVectors_Point_Empty ()
                {
-                       new Matrix ().TransformVectors (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformVectors_PointF_Empty ()
                {
-                       new Matrix ().TransformVectors (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new PointF[0]));
                }
 
                [Test]
@@ -661,24 +630,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Translate_InvalidOrder ()
                {
-                       new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void VectorTransformPoints_Null ()
                {
-                       new Matrix ().VectorTransformPoints ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().VectorTransformPoints ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void VectorTransformPoints_Empty ()
                {
-                       new Matrix ().VectorTransformPoints (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().VectorTransformPoints (new Point[0]));
                }
        }
 }
index 56e96bc789c822b944da0a4436cb715c3b6ae7f7..c89706d04770b1b674ed5b17d07b844f2efd71ba 100644 (file)
@@ -57,32 +57,28 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_Stream_Null ()
                {
-                       new Metafile ((Stream)null);
+                       Assert.Throws<ArgumentException> (() => new Metafile ((Stream)null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Metafile_String_Null ()
                {
-                       new Metafile ((string) null);
+                       Assert.Throws<ArgumentNullException> (() => new Metafile ((string) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_String_Empty ()
                {
-                       new Metafile (String.Empty);
+                       Assert.Throws<ArgumentException> (() => new Metafile (String.Empty));
                }
 
                [Test]
-               [ExpectedException (typeof (ExternalException))]
                public void Metafile_String_FileDoesNotExists ()
                {
                        string filename = getInFile ("telescope_02.wmf");
-                       new Metafile (filename);
+                       Assert.Throws<ExternalException> (() => new Metafile (filename));
                }
 
                [Test]
@@ -94,10 +90,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ExternalException))]
                public void GetMetafileHeader_Bitmap ()
                {
-                       new Metafile (getInFile (Bitmap));
+                       Assert.Throws<ExternalException> (() => new Metafile (getInFile (Bitmap)));
                }
 
                static public void Check_MetaHeader_WmfPlaceable (MetaHeader mh)
@@ -284,10 +279,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Static_GetMetafileHeader_Stream_Null ()
                {
-                       MetafileHeader header = Metafile.GetMetafileHeader ((Stream)null);
+                       Assert.Throws<NullReferenceException> (() => Metafile.GetMetafileHeader ((Stream)null));
                }
 
                [Test]
@@ -301,10 +295,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Static_GetMetafileHeader_Filename_Null ()
                {
-                       MetafileHeader header = Metafile.GetMetafileHeader ((string) null);
+                       Assert.Throws<ArgumentNullException> (() => Metafile.GetMetafileHeader ((string) null));
                }
 
                [Test]
@@ -332,14 +325,12 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Static_GetMetafileHeader_IntPtr_Zero ()
                {
-                       Metafile.GetMetafileHeader (IntPtr.Zero);
+                       Assert.Throws<ArgumentException> (() => Metafile.GetMetafileHeader (IntPtr.Zero));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Static_GetMetafileHeader_IntPtr ()
                {
                        string filename = MetafileTest.getInFile (MetafileTest.WmfPlaceable);
@@ -348,22 +339,20 @@ namespace MonoTests.System.Drawing.Imaging {
                                IntPtr hemf = mf.GetHenhmetafile ();
                                Assert.IsTrue (hemf != IntPtr.Zero, "GetHenhmetafile");
 
-                               Metafile.GetMetafileHeader (hemf);
+                               Assert.Throws<ArgumentException> (() => Metafile.GetMetafileHeader (hemf));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_IntPtrBool_Zero ()
                {
-                       new Metafile (IntPtr.Zero, false);
+                       Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, false));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_IntPtrEmfType_Zero ()
                {
-                       new Metafile (IntPtr.Zero, EmfType.EmfOnly);
+                       Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, EmfType.EmfOnly));
                }
 
                private void CheckEmptyHeader (Metafile mf, EmfType type)
@@ -407,10 +396,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_IntPtrEmfType_Invalid ()
                {
-                       Metafile_IntPtrEmfType ((EmfType)Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => Metafile_IntPtrEmfType ((EmfType)Int32.MinValue));
                }
 
                [Test]
@@ -432,10 +420,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_IntPtrRectangle_Zero ()
                {
-                       new Metafile (IntPtr.Zero, new Rectangle (1, 2, 3, 4));
+                       Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, new Rectangle (1, 2, 3, 4)));
                }
 
                [Test]
@@ -456,10 +443,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_IntPtrRectangleF_Zero ()
                {
-                       new Metafile (IntPtr.Zero, new RectangleF (1, 2, 3, 4));
+                       Assert.Throws<ArgumentException> (() => new Metafile (IntPtr.Zero, new RectangleF (1, 2, 3, 4)));
                }
 
                [Test]
@@ -496,10 +482,9 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Metafile_StreamIntPtrEmfType_Null ()
                {
-                       Metafile_StreamEmfType (null, EmfType.EmfOnly);
+                       Assert.Throws<NullReferenceException> (() => Metafile_StreamEmfType (null, EmfType.EmfOnly));
                }
 
                [Test]
@@ -511,11 +496,10 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Metafile_StreamIntPtrEmfType_Invalid ()
                {
                        using (MemoryStream ms = new MemoryStream ()) {
-                               Metafile_StreamEmfType (ms, (EmfType)Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => Metafile_StreamEmfType (ms, (EmfType)Int32.MinValue));
                        }
                }
 
@@ -575,24 +559,21 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CreateFilename_MultipleGraphics_EmfOnly ()
                {
-                       CreateFilename (EmfType.EmfOnly, false);
+                       Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfOnly, false));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CreateFilename_MultipleGraphics_EmfPlusDual ()
                {
-                       CreateFilename (EmfType.EmfPlusDual, false);
+                       Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfPlusDual, false));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CreateFilename_MultipleGraphics_EmfPlusOnly ()
                {
-                       CreateFilename (EmfType.EmfPlusOnly, false);
+                       Assert.Throws<OutOfMemoryException> (() => CreateFilename (EmfType.EmfPlusOnly, false));
                }
 
                [Test]
index ecce1ac458bc1ea1ef0248445371d54137a6ca55..b80e8a548bf70d3797ab77192a61e493c5c4a970 100644 (file)
@@ -40,40 +40,36 @@ namespace MonoTests.System.Drawing.Imaging {
        public class ColorMatrixTest {\r
 \r
                [Test]\r
-               [ExpectedException (typeof (NullReferenceException))]\r
                public void Constructor_Null ()\r
                {\r
-                       new ColorMatrix (null);\r
+                       Assert.Throws<NullReferenceException> (() => new ColorMatrix (null));\r
                }\r
 \r
                [Test]\r
-               [ExpectedException (typeof (IndexOutOfRangeException))]\r
                public void Constructor_TooSmallArraySize ()\r
                {\r
-                       new ColorMatrix (new float[][] { });\r
+                       Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] { }));\r
                }\r
 \r
                [Test]\r
-               [ExpectedException (typeof (IndexOutOfRangeException))]\r
                public void Constructor_TooWideArraySize ()\r
                {\r
-                       new ColorMatrix (new float[][] {\r
+                       Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] {\r
                                new float[] { 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f }\r
-                       });\r
+                       }));\r
                }\r
 \r
                [Test]\r
-               [ExpectedException (typeof (IndexOutOfRangeException))]\r
                public void Constructor_TooTallArraySize ()\r
                {\r
-                       new ColorMatrix (new float[][] {\r
+                       Assert.Throws<IndexOutOfRangeException> (() => new ColorMatrix (new float[][] {\r
                                new float[] { 0.0f },\r
                                new float[] { 1.0f },\r
                                new float[] { 2.0f },\r
                                new float[] { 3.0f },\r
                                new float[] { 4.0f },\r
                                new float[] { 5.0f }\r
-                       });\r
+                       }));\r
                }\r
 \r
                [Test]\r
@@ -116,7 +112,6 @@ namespace MonoTests.System.Drawing.Imaging {
                }\r
 \r
                [Test]\r
-               [ExpectedException (typeof (IndexOutOfRangeException))]\r
                public void TooBigItems ()\r
                {\r
                        ColorMatrix cm = new ColorMatrix (new float[][] {\r
@@ -127,7 +122,7 @@ namespace MonoTests.System.Drawing.Imaging {
                                new float[] { 4.0f, 4.1f, 4.2f, 4.3f, 4.4f, 4.5f },\r
                                new float[] { 5.0f, 5.1f, 5.2f, 5.3f, 5.4f, 5.5f }\r
                        });\r
-                       Assert.AreEqual (5.5f, cm[5,5], "out");\r
+                       Assert.Throws<IndexOutOfRangeException> (() => { var x = cm[5, 5]; });\r
                }\r
 \r
                [Test]\r
@@ -169,10 +164,10 @@ namespace MonoTests.System.Drawing.Imaging {
                {\r
                        ColorMatrix cm = new ColorMatrix (new float[][] {\r
                                new float[] {0.393f, 0.349f, 0.272f, 0, 0},\r
-                               new float[] {0.769f, 0.686f, 0.534f, 0, 0},\r
-                               new float[] {0.189f, 0.168f, 0.131f, 0, 0},\r
-                               new float[] {     0,      0,      0, 1, 0},\r
-                               new float[] {     0,      0,      0, 0, 1}\r
+                               new float[] {0.769f, 0.686f, 0.534f, 0, 0},\r
+                               new float[] {0.189f, 0.168f, 0.131f, 0, 0},\r
+                               new float[] {     0,      0,      0, 1, 0},\r
+                               new float[] {     0,      0,      0, 0, 1}\r
                        });\r
 \r
                        Assert.AreEqual (0.393f, cm.Matrix00, "00");\r
index b4724040e1e4b1908ca15fe12af82095708422a4..75860915c3cec463c961084bcb2dcb8c81b40cdf 100644 (file)
@@ -174,11 +174,10 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_Null ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (null);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (null));
                        }
                }
 
@@ -196,92 +195,82 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_Default_Any ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Any);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Any));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_Default_Count ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Count);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, ColorAdjustType.Count));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Any ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Any);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Any));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Bitmap ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Bitmap);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Bitmap));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Brush ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Brush);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Brush));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Count ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Count);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Count));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Default ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Default);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Default));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Pen ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Pen);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Pen));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_AltGrays_Text ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Text);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.AltGrays, ColorAdjustType.Text));
                        }
                }
 
@@ -299,47 +288,42 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_SkipGrays_Any ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Any);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Any));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_SkipGrays_Count ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Count);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.SkipGrays, ColorAdjustType.Count));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_InvalidFlag ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, (ColorMatrixFlag) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, (ColorMatrixFlag) Int32.MinValue));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrix_InvalidType()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType)Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrix (global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType)Int32.MinValue));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrices_Null_ColorMatrix ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrices (null, global_color_matrix);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (null, global_color_matrix));
                        }
                }
 
@@ -354,11 +338,10 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrices_ColorMatrix_Null_AltGrays ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrices (global_color_matrix, null, ColorMatrixFlag.AltGrays);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, null, ColorMatrixFlag.AltGrays));
                        }
                }
 
@@ -400,20 +383,18 @@ namespace MonoTests.System.Drawing.Imaging {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrices_InvalidFlags ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrices (global_color_matrix, global_color_matrix, (ColorMatrixFlag) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, global_color_matrix, (ColorMatrixFlag) Int32.MinValue));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetColorMatrices_InvalidType ()
                {
                        using (ImageAttributes ia = new ImageAttributes ()) {
-                               ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType) Int32.MinValue);
+                               Assert.Throws<ArgumentException> (() => ia.SetColorMatrices (global_color_matrix, global_color_matrix, ColorMatrixFlag.Default, (ColorAdjustType) Int32.MinValue));
                        }
                }
 
index 3c2b8b5bd0e8795c1713e84ab2b18195114aec9d..2687d712b7e64d6fb7e6f0ad7091236b42f8c11e 100644 (file)
@@ -52,31 +52,28 @@ namespace MonoCasTests.System.Drawing.Text {
                // TODO - tests for AddFontFile
 
                [Test]
-               [ExpectedException (typeof (SecurityException))]
                [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
                public void AddMemoryFont_Deny_UnmanagedCode () 
                {
-                       new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024);
+                       Assert.Throws<SecurityException> (() => new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
                public void AddMemoryFont_PermitOnly_UnmanagedCode ()
                {
-                       new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024);
+                       Assert.Throws<ArgumentException> (() => new PrivateFontCollection ().AddMemoryFont (IntPtr.Zero, 1024));
                }
 
                // yes, that fails with FileNotFoundException ;-)
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
                public void AddMemoryFont_NegativeLength ()
                {
                        IntPtr ptr = Marshal.AllocHGlobal (1024);
                        try {
-                               new PrivateFontCollection ().AddMemoryFont (ptr, -1024);
+                               Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddMemoryFont (ptr, -1024));
                        }
                        finally {
                                Marshal.FreeHGlobal (ptr);
@@ -84,13 +81,12 @@ namespace MonoCasTests.System.Drawing.Text {
                }
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                [SecurityPermission (SecurityAction.PermitOnly, UnmanagedCode = true)]
                public void AddMemoryFont_InvalidData ()
                {
                        IntPtr ptr = Marshal.AllocHGlobal (1024);
                        try {
-                               new PrivateFontCollection ().AddMemoryFont (ptr, 1024);
+                               Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddMemoryFont (ptr, 1024));
                        }
                        finally {
                                Marshal.FreeHGlobal (ptr);
index 4eed43bc81ba764ee7d0c04bade41df208c0bdfb..c0d131870207c473a471b02b583e91b91581af31 100644 (file)
@@ -49,40 +49,36 @@ namespace MonoTests.System.Drawing.Text {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddFontFile_Null ()
                {
-                       new PrivateFontCollection ().AddFontFile (null);
+                       Assert.Throws<ArgumentNullException> (() => new PrivateFontCollection ().AddFontFile (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddFontFile_Empty ()
                {
                        // badly formetted filename
-                       new PrivateFontCollection ().AddFontFile (String.Empty);
+                       Assert.Throws<ArgumentException> (() => new PrivateFontCollection ().AddFontFile (String.Empty));
                }
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                [Category ("NotWorking")] // it seems fontconfig doesn't validate on add...
                public void AddFontFile_NotAFontFile ()
                {
                        string file = Path.GetTempFileName ();
                        Assert.IsTrue (File.Exists (file), "Exists");
                        // even if the file exists....
-                       new PrivateFontCollection ().AddFontFile (file);
+                       Assert.Throws<FileNotFoundException> (() => new PrivateFontCollection ().AddFontFile (file));
                }
 
                // tests for AddMemoryFont are available in the CAS unit tests
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Family ()
                {
                        PrivateFontCollection pfc = new PrivateFontCollection ();
                        pfc.Dispose ();
-                       Assert.IsNotNull (pfc.Families);
+                       Assert.Throws<ArgumentException> (() => { var x = pfc.Families; });
                        // no it's not a ObjectDisposedException
                }
        }
index 34cb3aa190976e52807d0bea65890082a09f86ba..4877f496996b847baa5f131a26a54a155ff620d9 100644 (file)
@@ -167,72 +167,63 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFrom_x1 ()
                {
-                               colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "10, 20");
+                       Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "10, 20"));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFrom_x2 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "-10, 20, 30");
+                       Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, "-10, 20, 30"));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFrom_x3 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                                       "1, 1, 1, 1, 1");
+                       Assert.Throws<ArgumentException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                                       "1, 1, 1, 1, 1"));
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void ConvertFrom_x4 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                               "*1, 1");
+                       Assert.Throws<Exception> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                               "*1, 1"));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_x5 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                                       new Point (10, 10));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                                       new Point (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_x6 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                                       new PointF (10, 10));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                                       new PointF (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_x7 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                                       new Size (10, 10));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                                       new Size (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_x8 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
-                                       new SizeF (10, 10));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture,
+                                       new SizeF (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_x9 ()
                {
-                       colconv.ConvertFrom (null, CultureInfo.InvariantCulture, 0x10);
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertFrom (null, CultureInfo.InvariantCulture, 0x10));
                }
 
                [Test]
@@ -264,43 +255,38 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_x1 ()
                {
-                       colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
-                                       typeof (Color));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
+                                       typeof (Color)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_x2 ()
                {
-                       colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
-                                       typeof (SizeF));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
+                                       typeof (SizeF)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_x3 ()
                {
-                       colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
-                                       typeof (Point));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
+                                       typeof (Point)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_x4 ()
                {
-                       colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
-                                       typeof (PointF));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
+                                       typeof (PointF)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_x5 ()
                {
-                       colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
-                                       typeof (int));
+                       Assert.Throws<NotSupportedException> (() => colconv.ConvertTo (null, CultureInfo.InvariantCulture, col,
+                                       typeof (int)));
                }
 
                [Test]
@@ -351,10 +337,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_InvalidComponentCount ()
                {
-                       colconv.ConvertFromInvariantString ("1, 2, 3, 4, 5");
+                       Assert.Throws<ArgumentException> (() => colconv.ConvertFromInvariantString ("1, 2, 3, 4, 5"));
                }
 
                [Test]
@@ -378,12 +363,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_InvalidComponentCount ()
                {
                        CultureInfo culture = CultureInfo.CurrentCulture;
-                       colconv.ConvertFromString (string.Format (culture,
-                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator[0]));
+                       Assert.Throws<ArgumentException> (() => colconv.ConvertFromString (string.Format (culture,
+                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator[0])));
                }
 
                [Test]
@@ -428,10 +412,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void ConvertFromString_FromHtml_PoundTooLarge ()
                {
-                       colconv.ConvertFromString ("#100000000");
+                       Assert.Throws<Exception> (() => colconv.ConvertFromString ("#100000000"));
                }
        }
 }
index 27ee0f55305493680b0b4796047f2bdd5a171aaf..85401b1d04e5fd375ad04d4948ab9caf7e9f132d 100644 (file)
@@ -84,24 +84,21 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void FromHtml_PoundNegative ()
                {
-                       ColorTranslator.FromHtml ("#-1");
+                       Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("#-1"));
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void FromHtml_PoundTooLarge ()
                {
-                       ColorTranslator.FromHtml ("#100000000");
+                       Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("#100000000"));
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void FromHtml_Unknown ()
                {
-                       ColorTranslator.FromHtml ("unknown-color-test");
+                       Assert.Throws<Exception> (() => ColorTranslator.FromHtml ("unknown-color-test"));
                }
 
                [Test]
index 3de56a5215255346e75a780efcdc6a4dbd358123..69f6a44f4f94b9bfb998760bed047fabc7c3187a 100644 (file)
@@ -59,18 +59,16 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FontFamily_String_Null ()
                {
-                       new FontFamily (null);
+                       Assert.Throws<ArgumentException> (() => new FontFamily (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")] // libgdiplus/fontconfig always return something
                public void FontFamily_String_Empty ()
                {
-                       new FontFamily (String.Empty);
+                       Assert.Throws<ArgumentException> (() => new FontFamily (String.Empty));
                }
 
                private void CheckMono (FontFamily ff)
@@ -110,10 +108,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FontFamily_String_PrivateFontCollection ()
                {
-                       new FontFamily (name, new PrivateFontCollection ());
+                       Assert.Throws<ArgumentException> (() => new FontFamily (name, new PrivateFontCollection ()));
                }
 
                [Test]
@@ -179,10 +176,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void GetFamilies_Null ()
                {
-                       FontFamily.GetFamilies (null);
+                       Assert.Throws<ArgumentNullException> (() => FontFamily.GetFamilies (null));
                }
 
                [Test]
@@ -201,12 +197,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_UseAfter ()
                {
                        FontFamily ff = FontFamily.GenericMonospace;
                        ff.Dispose ();
-                       Assert.AreEqual (name, ff.Name, "Name");
+                       Assert.Throws<ArgumentException> (() => { var x = ff.Name; });
                }
        }
 }
index d81f63c593cedb2676fc8d93072f342eab0e1c25..958aa0bb31907f87a009abc73daa667031716b1e 100644 (file)
@@ -911,7 +911,6 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                public void GdipLoadImageFromFile_FileNotFound ()
                {
                        string filename = "filenotfound";
@@ -921,11 +920,10 @@ namespace MonoTests.System.Drawing {
                        Assert.AreEqual (IntPtr.Zero, image, "image handle");
 
                        // this doesn't throw a OutOfMemoryException
-                       Image.FromFile (filename);
+                       Assert.Throws<FileNotFoundException> (() => Image.FromFile (filename));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GdipCreateBitmapFromFile_FileNotFound ()
                {
                        string filename = "filenotfound";
@@ -934,7 +932,7 @@ namespace MonoTests.System.Drawing {
                        Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipCreateBitmapFromFile (filename, out bitmap), "GdipCreateBitmapFromFile");
                        Assert.AreEqual (IntPtr.Zero, bitmap, "bitmap handle");
 
-                       new Bitmap (filename);
+                       Assert.Throws<ArgumentException> (() => new Bitmap (filename));
                }
 
                [Test]
@@ -1182,8 +1180,8 @@ namespace MonoTests.System.Drawing {
                                         "DrawCurve with 1 pt");
                        Assert.AreEqual (Status.Ok,
                                         GDIPlus.GdipDrawCurveI (graphics, pen,
-                                                                new Point [] { new Point (1, 1),
-                                                                               new Point (2, 2) }, 2),
+                                                                new Point [] { new Point (1, 1),
+                                                                               new Point (2, 2) }, 2),
                                         "DrawCurve with 2 pts");
 
                        // DrawClosedCurve
@@ -1193,12 +1191,12 @@ namespace MonoTests.System.Drawing {
                                         "DrawClosedCurve with no pts");
                        Assert.AreEqual (Status.InvalidParameter,
                                         GDIPlus.GdipDrawClosedCurveI (graphics, pen,
-                                                                      new Point [] { new Point (1, 1) }, 1),
+                                                                      new Point [] { new Point (1, 1) }, 1),
                                         "DrawClosedCurve with 1 pt");
                        Assert.AreEqual (Status.InvalidParameter,
                                         GDIPlus.GdipDrawClosedCurveI (graphics, pen,
-                                                                      new Point [] { new Point (1, 1),
-                                                                                     new Point (2, 2) }, 2),
+                                                                      new Point [] { new Point (1, 1),
+                                                                                     new Point (2, 2) }, 2),
                                         "DrawClosedCurve with 2 pt2");
 
                        // DrawPolygon
@@ -1208,7 +1206,7 @@ namespace MonoTests.System.Drawing {
                                         "DrawPolygon with no pts");
                        Assert.AreEqual (Status.InvalidParameter,
                                         GDIPlus.GdipDrawPolygonI (graphics, pen,
-                                                                  new Point [] { new Point (1, 1) }, 1),
+                                                                  new Point [] { new Point (1, 1) }, 1),
                                         "DrawPolygon with only one pt");
 
                        GDIPlus.GdipDeletePen (pen);                    
@@ -1224,12 +1222,12 @@ namespace MonoTests.System.Drawing {
                                         "FillClosedCurve with no pts");
                        Assert.AreEqual (Status.Ok,
                                         GDIPlus.GdipFillClosedCurveI (graphics, brush, 
-                                                                      new Point [] { new Point (1, 1) }, 1),
+                                                                                               new Point [] { new Point (1, 1) }, 1),
                                         "FillClosedCurve with 1 pt");
                        Assert.AreEqual (Status.Ok,
                                         GDIPlus.GdipFillClosedCurveI (graphics, brush,
-                                                                      new Point [] { new Point (1, 1),
-                                                                                     new Point (2, 2) }, 2),
+                                                                      new Point [] { new Point (1, 1),
+                                                                                     new Point (2, 2) }, 2),
                                         "FillClosedCurve with 2 pts");
                        
                        GDIPlus.GdipDeleteBrush (brush);
index 8ceeb112c59a0415e99115d199e1f82274132f93..bc050f3daab24ba5ba19a1293c1d24e5e4a1922e 100644 (file)
@@ -122,10 +122,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Brush_Null ()
                {
-                       new Pen ((Brush) null);
+                       Assert.Throws<ArgumentNullException> (() => new Pen ((Brush) null));
                }
 
                [Test]
@@ -138,10 +137,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Brush_Float_Null ()
                {
-                       new Pen ((Brush) null, Single.MaxValue);
+                       Assert.Throws<ArgumentNullException> (() => new Pen ((Brush) null, Single.MaxValue));
                }
 
                [Test]
@@ -212,10 +210,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void Alignment_Invalid ()
                {
-                       default_pen.Alignment = (PenAlignment) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.Alignment = (PenAlignment) Int32.MinValue);
                }
 
                [Test]
@@ -235,10 +232,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Brush_Null ()
                {
-                       default_pen.Brush = null;
+                       Assert.Throws<ArgumentNullException> (() => default_pen.Brush = null);
                }
 
                [Test]
@@ -253,11 +249,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")] // not supported by libgdiplus
                public void CustomEndCap_Default ()
                {
-                       CustomLineCap clc = default_pen.CustomEndCap;
+                       Assert.Throws<ArgumentException> (() => { var x = default_pen.CustomEndCap; });
                }
 
                [Test]
@@ -272,11 +267,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")] // not supported by libgdiplus
                public void CustomStartCap_Default ()
                {
-                       CustomLineCap clc = default_pen.CustomStartCap;
+                       Assert.Throws<ArgumentException> (() => { var x = default_pen.CustomStartCap; });
                }
 
                [Test]
@@ -293,10 +287,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void DashCap_Invalid ()
                {
-                       default_pen.DashCap = (DashCap) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.DashCap = (DashCap) Int32.MinValue);
                }
 
                [Test]
@@ -324,10 +317,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DashPattern_Empty ()
                {
-                       default_pen.DashPattern = new float[0];
+                       Assert.Throws<ArgumentException> (() => default_pen.DashPattern = new float[0]);
                }
 
                [Test]
@@ -342,10 +334,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void DashStyle_Invalid ()
                {
-                       default_pen.DashStyle = (DashStyle) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.DashStyle = (DashStyle) Int32.MinValue);
                }
 
                [Test]
@@ -428,11 +419,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                [Category ("NotWorking")] // MS bug reported as FDBK50053
                public void DashPattern_Default ()
                {
-                       float[] pattern = default_pen.DashPattern;
+                       Assert.Throws<OutOfMemoryException> (() => { var x = default_pen.DashPattern; });
                }
 
                [Test]
@@ -447,10 +437,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void EndCap_Invalid ()
                {
-                       default_pen.EndCap = (LineCap) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.EndCap = (LineCap) Int32.MinValue);
                }
 
                [Test]
@@ -465,10 +454,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void LineJoin_Invalid ()
                {
-                       default_pen.LineJoin = (LineJoin) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.LineJoin = (LineJoin) Int32.MinValue);
                }
 
                [Test]
@@ -496,25 +484,22 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void StartCap_Invalid ()
                {
-                       default_pen.StartCap = (LineCap) Int32.MinValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => default_pen.StartCap = (LineCap) Int32.MinValue);
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       default_pen.Transform = null;
+                       Assert.Throws<ArgumentNullException> (() => default_pen.Transform = null);
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Transform_NonInvertible ()
                {
                        using (Pen p = new Pen (Brushes.Snow, Single.MaxValue)) {
-                               p.Transform = new Matrix (123, 24, 82, 16, 47, 30);
+                               Assert.Throws<ArgumentException> (() => p.Transform = new Matrix (123, 24, 82, 16, 47, 30));
                        }
                }
 
@@ -541,12 +526,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose ()
                {
                        Pen p = new Pen (Brushes.Red);
                        p.Dispose ();
-                       p.Alignment = PenAlignment.Center;
+                       Assert.Throws<ArgumentException> (() => p.Alignment = PenAlignment.Center);
                        // exception but not an ObjectDisposedException
                }
 
@@ -606,18 +590,16 @@ namespace MonoTests.System.Drawing {
 
                [Test]
                //[ExpectedException (typeof (ArgumentNullException))] // reported as FDBK50058
-               [ExpectedException (typeof (NullReferenceException))]
                public void MultiplyTransform1_Null ()
                {
-                       default_pen.MultiplyTransform (null);
+                       Assert.Throws<NullReferenceException> (() => default_pen.MultiplyTransform (null));
                }
 
                [Test]
                //[ExpectedException (typeof (ArgumentNullException))] // reported as FDBK50058
-               [ExpectedException (typeof (NullReferenceException))]
                public void MultiplyTransform2_Null ()
                {
-                       default_pen.MultiplyTransform (null, MatrixOrder.Append);
+                       Assert.Throws<NullReferenceException> (() => default_pen.MultiplyTransform (null, MatrixOrder.Append));
                }
 
                [Test]
@@ -643,12 +625,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MultiplyTransform_NonInvertible ()
                {
                        using (Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30)) {
                                using (Pen p = new Pen (Brushes.Red)) {
-                                       p.MultiplyTransform (noninvertible);
+                                       Assert.Throws<ArgumentException> (() => p.MultiplyTransform (noninvertible));
                                }
                        }
                }
@@ -685,10 +666,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateTransform_InvalidOrder ()
                {
-                       default_pen.RotateTransform (720, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => default_pen.RotateTransform (720, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -725,10 +705,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_InvalidOrder ()
                {
-                       default_pen.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => default_pen.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -756,10 +735,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TranslateTransform_InvalidOrder ()
                {
-                       default_pen.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => default_pen.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
index 0b491065b688cbe90fc04a6a3ab1fd3c510052df..e34bc8484646236738ed4dab008eb4c12ec25bad 100644 (file)
@@ -58,13 +58,12 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void RegionData_Null ()
                {
                        RegionData data = new Region ().GetRegionData ();
                        data.Data = null;
                        Assert.IsNull (data.Data, "Data");
-                       Region region = new Region (data);
+                       Assert.Throws<NullReferenceException> (() => new Region (data));
                }
 
                [Test]
index fda32858ec6709ebe341b8c5afc86ea93dbf7d7e..b854d6f5401a5cdc1f025129541b28c11fd07e2c 100644 (file)
@@ -58,12 +58,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Clone ()
                {
                        SolidBrush sb = new SolidBrush (Color.Transparent);
                        sb.Dispose ();
-                       sb.Clone ();
+                       Assert.Throws<ArgumentException> (() => sb.Clone ());
                }
 
                [Test]
index 6811e253df7ef1a64f3ee936fe5a5596567cbccd..9d8c73f321e1cd8c052eb86f03accb3a2352dd9d 100644 (file)
@@ -130,13 +130,12 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Instance ()
                {
                        Font f1 = SystemFonts.CaptionFont;
                        float height = f1.GetHeight (72f);
                        f1.Dispose ();
-                       f1.GetHeight (72f);
+                       Assert.Throws<ArgumentException> (() => f1.GetHeight (72f));
                }
 
                [Test]
index e99d108443dfa91a5728ddb80d66dc82dadd0433..bc5a5d9e9d42a63d09b19aa4c585764b81c237d8 100644 (file)
@@ -62,14 +62,13 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ObjectDisposedException))]
                public void Clone_Dispose ()
                {
                        // Clones of SystemIcons icon's can be disposed
                        Icon app = SystemIcons.Application;
                        Icon clone = (Icon) app.Clone ();
                        clone.Dispose ();
-                       Assert.IsNotNull (clone.ToBitmap ());
+                       Assert.Throws<ObjectDisposedException> (() => clone.ToBitmap ());
                }
        }
 }
index 71fa94ba5874dbea84e8056cdf749a0fe4fdbfd4..270037efe4342fff9ac70b0fda3c22c7b5b242bd 100644 (file)
@@ -36,7 +36,9 @@ using System.IO;
 using System.Runtime.InteropServices;
 using System.Runtime.Serialization;
 using System.Runtime.Serialization.Formatters.Binary;
+#if !NETCOREAPP2_0
 using System.Runtime.Serialization.Formatters.Soap;
+#endif
 using System.Security.Cryptography;
 using System.Security.Permissions;
 using System.Text;
@@ -121,30 +123,24 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void LockBits_IndexedWrite_NonIndexed ()
                {
                        using (Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format8bppIndexed)) {
                                Rectangle rect = new Rectangle (0, 0, bmp.Width, bmp.Height);
-                               bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+                               Assert.Throws<ArgumentException> (() => bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void LockBits_NonIndexedWrite_ToIndexed ()
                {
                        using (Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format32bppRgb)) {
+                               BitmapData bd = new BitmapData ();
                                Rectangle rect = new Rectangle (0, 0, bmp.Width, bmp.Height);
-                               BitmapData bd = new BitmapData ();
-                               try {
-                                       bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, bd);
-                               }
-                               catch (ArgumentException) {
-                                       // test to see if there's a leak or not in this case
-                                       Assert.AreEqual (IntPtr.Zero, bd.Scan0, "Scan0");
-                                       throw;
-                               }
+                               Assert.Throws<ArgumentException> (() => bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed, bd));
+
+                               // test to see if there's a leak or not in this case
+                               Assert.AreEqual (IntPtr.Zero, bd.Scan0, "Scan0");
                        }
                }
 
@@ -182,14 +178,13 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
                public void LockBits_Double ()
                {
                        using (Bitmap bmp = new Bitmap (10, 10, PixelFormat.Format24bppRgb)) {
                                Rectangle r = new Rectangle (4, 4, 4, 4);
                                BitmapData data = bmp.LockBits (r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
                                try {
-                                       bmp.LockBits (r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
+                                       Assert.Throws<InvalidOperationException> (() => bmp.LockBits (r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb));
                                }
                                finally {
                                        bmp.UnlockBits (data);
@@ -198,17 +193,15 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void LockBits_Disposed ()
                {
                        Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format32bppRgb);
                        Rectangle rect = new Rectangle (0, 0, bmp.Width, bmp.Height);
                        bmp.Dispose ();
-                       bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
+                       Assert.Throws<ArgumentException> (() => bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("Valgrind")] // this test is known to leak memory (API design limitation)
                public void UnlockBits_Disposed ()
                {
@@ -216,26 +209,24 @@ namespace MonoTests.System.Drawing {
                        Rectangle rect = new Rectangle (0, 0, bmp.Width, bmp.Height);
                        BitmapData data = bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
                        bmp.Dispose ();
-                       bmp.UnlockBits (data);
+                       Assert.Throws<ArgumentException> (() => bmp.UnlockBits (data));
                        // and that results in something like this when executed under Valgrind 
                        // "40,000 bytes in 1 blocks are possibly lost in loss record 88 of 92"
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void UnlockBits_Null ()
                {
                        using (Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format32bppRgb)) {
-                               bmp.UnlockBits (null);
+                               Assert.Throws<ArgumentException> (() => bmp.UnlockBits (null));
                        }
                }
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void LockBits_BitmapData_Null ()
                {
                        using (Bitmap bmp = new Bitmap (100, 100, PixelFormat.Format32bppRgb)) {
                                Rectangle rect = new Rectangle (0, 0, bmp.Width, bmp.Height);
-                               bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, null);
+                               Assert.Throws<ArgumentException> (() => bmp.LockBits (rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb, null));
                        }
                }
 
@@ -300,46 +291,42 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
                public void Format1bppIndexed ()
                {
                        using (Bitmap bmp = new Bitmap (1, 1, PixelFormat.Format1bppIndexed)) {
                                Color c = bmp.GetPixel (0, 0);
                                Assert.AreEqual (-16777216, c.ToArgb (), "Color");
-                               bmp.SetPixel (0, 0, c);
+                               Assert.Throws<InvalidOperationException> (() => bmp.SetPixel (0, 0, c));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
                public void Format4bppIndexed ()
                {
                        using (Bitmap bmp = new Bitmap (1, 1, PixelFormat.Format4bppIndexed)) {
                                Color c = bmp.GetPixel (0, 0);
                                Assert.AreEqual (-16777216, c.ToArgb (), "Color");
-                               bmp.SetPixel (0, 0, c);
+                               Assert.Throws<InvalidOperationException> (() => bmp.SetPixel (0, 0, c));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidOperationException))]
                public void Format8bppIndexed ()
                {
                        using (Bitmap bmp = new Bitmap (1, 1, PixelFormat.Format8bppIndexed)) {
                                Color c = bmp.GetPixel (0, 0);
                                Assert.AreEqual (-16777216, c.ToArgb (), "Color");
-                               bmp.SetPixel (0, 0, c);
+                               Assert.Throws<InvalidOperationException> (() => bmp.SetPixel (0, 0, c));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")] // libgdiplus doesn't support this format
                public void Format16bppGrayScale ()
                {
                        using (Bitmap bmp = new Bitmap (1, 1, PixelFormat.Format16bppGrayScale)) {
                                // and MS GDI+ support seems quite limited too
-                               bmp.GetPixel (0, 0);
+                               Assert.Throws<ArgumentException> (() => bmp.GetPixel (0, 0));
                        }
                }
 
@@ -587,10 +574,9 @@ namespace MonoTests.System.Drawing {
                }
                
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FileDoesNotExists ()
                {                       
-                       Bitmap  bmp = new Bitmap ("FileDoesNotExists.jpg");                     
+                       Assert.Throws<ArgumentException> (() => new Bitmap ("FileDoesNotExists.jpg"));                  
                }
 
                static string ByteArrayToString(byte[] arrInput)
@@ -1110,6 +1096,7 @@ namespace MonoTests.System.Drawing {
                        }
                }
 
+#if !NETCOREAPP2_0
                private Stream SoapSerialize (object o)
                {
                        MemoryStream ms = new MemoryStream ();
@@ -1176,6 +1163,7 @@ namespace MonoTests.System.Drawing {
                                }
                        }
                }
+#endif
 
                [Test]
                [Category ("NotWorking")]       // http://bugzilla.ximian.com/show_bug.cgi?id=80558
@@ -1513,87 +1501,75 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void BitmapImageCtor ()
                {
-                       new Bitmap ((Image) null);
+                       Assert.Throws<NullReferenceException> (() => new Bitmap ((Image) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapImageSizeCtor ()
                {
-                       new Bitmap ((Image) null, Size.Empty);
+                       Assert.Throws<ArgumentException> (() => new Bitmap ((Image) null, Size.Empty));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapImageIntIntCtor ()
                {
-                       new Bitmap ((Image) null, Int32.MinValue, Int32.MaxValue);
+                       Assert.Throws<ArgumentException> (() => new Bitmap ((Image) null, Int32.MinValue, Int32.MaxValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapIntIntCtor ()
                {
-                       new Bitmap (Int32.MinValue, Int32.MaxValue);
+                       Assert.Throws<ArgumentException> (() => new Bitmap (Int32.MinValue, Int32.MaxValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void BitmapIntIntGraphicCtor ()
                {
-                       new Bitmap (1, 1, null);
+                       Assert.Throws<ArgumentNullException> (() => new Bitmap (1, 1, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapIntIntPixelFormatCtor ()
                {
-                       new Bitmap (Int32.MinValue, Int32.MaxValue, PixelFormat.Format1bppIndexed);
+                       Assert.Throws<ArgumentException> (() => new Bitmap (Int32.MinValue, Int32.MaxValue, PixelFormat.Format1bppIndexed));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapStreamCtor ()
                {
-                       new Bitmap ((Stream) null);
+                       Assert.Throws<ArgumentException> (() => new Bitmap ((Stream) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapStreamBoolCtor ()
                {
-                       new Bitmap ((Stream) null, true);
+                       Assert.Throws<ArgumentException> (() => new Bitmap ((Stream) null, true));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void BitmapStringCtor ()
                {
-                       new Bitmap ((string) null);
+                       Assert.Throws<ArgumentNullException> (() => new Bitmap ((string) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void BitmapStringBoolCtor ()
                {
-                       new Bitmap ((string) null, false);
+                       Assert.Throws<ArgumentNullException> (() => new Bitmap ((string) null, false));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void BitmapTypeStringCtor1 ()
                {
-                       new Bitmap ((Type) null, "mono");
+                       Assert.Throws<NullReferenceException> (() => new Bitmap ((Type) null, "mono"));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BitmapTypeStringCtor2 ()
                {
-                       new Bitmap (typeof (Bitmap), null);
+                       Assert.Throws<ArgumentException> (() => new Bitmap (typeof (Bitmap), null));
                }
 
                private void SetResolution (float x, float y)
@@ -1604,24 +1580,21 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetResolution_Zero ()
                {
-                       SetResolution (0.0f, 0.0f);
+                       Assert.Throws<ArgumentException> (() => SetResolution (0.0f, 0.0f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetResolution_Negative_X ()
                {
-                       SetResolution (-1.0f, 1.0f);
+                       Assert.Throws<ArgumentException> (() => SetResolution (-1.0f, 1.0f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetResolution_Negative_Y ()
                {
-                       SetResolution (1.0f, -1.0f);
+                       Assert.Throws<ArgumentException> (() => SetResolution (1.0f, -1.0f));
                }
 
                [Test]
@@ -1637,17 +1610,15 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetResolution_NaN ()
                {
-                       SetResolution (Single.NaN, Single.NaN);
+                       Assert.Throws<ArgumentException> (() => SetResolution (Single.NaN, Single.NaN));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void SetResolution_NegativeInfinity ()
                {
-                       SetResolution (Single.NegativeInfinity, Single.NegativeInfinity);
+                       Assert.Throws<ArgumentException> (() => SetResolution (Single.NegativeInfinity, Single.NegativeInfinity));
                }
        }
 
@@ -1710,13 +1681,12 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")] // libgdiplus has lost track of the original 1bpp state
                public void Hicon48 ()
                {
                        using (Icon icon = new Icon (TestBitmap.getInFile ("bitmaps/48x48x1.ico"))) {
                                // looks like 1bbp icons aren't welcome as bitmaps ;-)
-                               Bitmap.FromHicon (icon.Handle);
+                               Assert.Throws<ArgumentException> (() => Bitmap.FromHicon (icon.Handle));
                        }
                }
 
index 6b922e2a719b5d228e05d0807c669ca62c7d3e93..4eb5b5b79c4a2831f602830ef4d8c5f23494b239 100644 (file)
@@ -48,12 +48,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose ()
                {
                        Brushes.YellowGreen.Dispose ();
                        // a "normal" SolidBrush would throw an ArgumentException here
-                       Brushes.YellowGreen.Clone ();
+                       Assert.Throws<ArgumentException> (() => Brushes.YellowGreen.Clone ());
                        // and it is! so watch your brushes ;-)
                }
 
index c5df6c531ed3c3e5e5cc19ad810ff06973a200b5..1b6eb6a89f0ae7a574f2e338c2cb3d3a9f0fded9 100644 (file)
@@ -908,12 +908,12 @@ namespace MonoTests.System.Drawing {
                        Assert.AreEqual (1.0f, Color.White.GetBrightness (), "BrightnessWhite");
                
                        Color c1 = Color.FromArgb (0, 13, 45, 7); //just some random color
-                       Assert.IsTrue (       FloatsAlmostEqual (110.5263f, c1.GetHue ()), "Hue1");
+                       Assert.IsTrue (FloatsAlmostEqual (110.5263f, c1.GetHue ()), "Hue1");
                        Assert.IsTrue (FloatsAlmostEqual (0.1019608f, c1.GetBrightness ()), "Brightness1");
                        Assert.IsTrue (FloatsAlmostEqual (0.7307692f, c1.GetSaturation ()), "Saturation1");
        
                        Color c2 = Color.FromArgb (0, 112, 75, 29); //another random color
-                       Assert.IsTrue (       FloatsAlmostEqual (33.25302f, c2.GetHue ()), "Hue2");
+                       Assert.IsTrue (FloatsAlmostEqual (33.25302f, c2.GetHue ()), "Hue2");
                        Assert.IsTrue (FloatsAlmostEqual (0.2764706f, c2.GetBrightness ()), "Brightness2");
                        Assert.IsTrue (FloatsAlmostEqual (0.5886525f, c2.GetSaturation ()), "Saturation2");
                }
@@ -1019,115 +1019,99 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidAlpha1 ()
                {
-                       Color.FromArgb (-1, Color.Red);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (-1, Color.Red));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidAlpha2 ()
                {
-                       Color.FromArgb (256, Color.Red);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (256, Color.Red));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidAlpha3 ()
                {
-                       Color.FromArgb (-1, 0, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (-1, 0, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidAlpha4 ()
                {
-                       Color.FromArgb (256, 0, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (256, 0, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidRed1 ()
                {
-                       Color.FromArgb (-1, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (-1, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidRed2 ()
                {
-                       Color.FromArgb (256, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (256, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidRed3 ()
                {
-                       Color.FromArgb (0, -1, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, -1, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidRed4 ()
                {
-                       Color.FromArgb (0, 256, 0, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 256, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidGreen1 ()
                {
-                       Color.FromArgb (0, -1, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, -1, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidGreen2 ()
                {
-                       Color.FromArgb (0, 256, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 256, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidGreen3 ()
                {
-                       Color.FromArgb (0, 0, -1, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, -1, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidGreen4 ()
                {
-                       Color.FromArgb (0, 0, 256, 0);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, 256, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidBlue1 ()
                {
-                       Color.FromArgb (0, 0, -1);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, -1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidBlue2 ()
                {
-                       Color.FromArgb (0, 0, 256);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, 256));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidBlue3 ()
                {
-                       Color.FromArgb (0, 0, 0, -1);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, 0, -1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromArgb_InvalidBlue4 ()
                {
-                       Color.FromArgb (0, 0, 0, 256);
+                       Assert.Throws<ArgumentException> (() => Color.FromArgb (0, 0, 0, 256));
                }
 
                [Test]
index 50c2f83271f8df98cb9d077aee786ff0b4d33ca4..e1f3660f707e9689ef4ebbd09bbaaecdd32a8528 100644 (file)
@@ -120,7 +120,6 @@ namespace MonoTests.System.Drawing{
 
                [Test]
                [Category ("CAS")]
-               [ExpectedException (typeof (SecurityException))]
                [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
                public void ToLogFont_DenyUnmanagedCode ()
                {
@@ -130,7 +129,7 @@ namespace MonoTests.System.Drawing{
                        lf = new LOGFONT();
                        f = new Font("Arial", 10);
 
-                       f.ToLogFont(lf);
+                       Assert.Throws<SecurityException> (() => f.ToLogFont(lf));
                }
 
                [Test]
@@ -167,12 +166,11 @@ namespace MonoTests.System.Drawing{
 
                [Test]
                [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
-               [ExpectedException (typeof (ArgumentException))]
                public void ToLogFont_TooSmall ()
                {
                        Font f = new Font ("Arial", 10);
                        object o = new object ();
-                       f.ToLogFont (o);
+                       Assert.Throws<ArgumentException> (() => f.ToLogFont (o));
                        // no PInvoke conversion exists !?!?
                }
 
@@ -188,11 +186,10 @@ namespace MonoTests.System.Drawing{
 
                [Test]
                [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
-               [ExpectedException (typeof (AccessViolationException))]
                public void ToLogFont_Null ()
                {
                        Font f = new Font ("Arial", 10);
-                       f.ToLogFont (null);
+                       Assert.Throws<AccessViolationException> (() => f.ToLogFont (null));
                }
                [Test]
                public void Font_StringNull_Float ()
@@ -260,10 +257,9 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Font_String_Float_FontStyle_GraphicsUnit_Display ()
                {
-                       new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Display);
+                       Assert.Throws<ArgumentException> (() => new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Display));
                }
 
                [Test]
@@ -303,19 +299,17 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Font_FontFamilyNull_Float ()
                {
                        FontFamily ff = null;
-                       new Font (ff, 12.5f);
+                       Assert.Throws<ArgumentNullException> (() => new Font (ff, 12.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Font_FontNull_FontStyle ()
                {
                        Font f = null;
-                       new Font (f, FontStyle.Bold);
+                       Assert.Throws<NullReferenceException> (() => new Font (f, FontStyle.Bold));
                }
 
                [Test]
@@ -373,10 +367,9 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Display ()
                {
-                       new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Display);
+                       Assert.Throws<ArgumentException> (() => new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Display));
                }
 
                [Test]
@@ -435,22 +428,20 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Height ()
                {
                        Font f = new Font (name, 12.5f);
                        f.Dispose ();
-                       Assert.AreEqual (0, f.Height, "Name");
+                       Assert.Throws<ArgumentException> (() => { var x = f.Height; });
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_ToLogFont ()
                {
                        Font f = new Font (name, 12.5f);
                        f.Dispose ();
                        LOGFONT lf = new LOGFONT();
-                       f.ToLogFont (lf);
+                       Assert.Throws<ArgumentException> (() => f.ToLogFont (lf));
                }
 
                [Test]
@@ -503,22 +494,20 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_ToHFont ()
                {
                        Font f = new Font (name, 12.5f);
                        f.Dispose ();
-                       f.ToHfont ();
+                       Assert.Throws<ArgumentException> (() => f.ToHfont ());
                }
                
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                [Category ("NotWorking")]
                public void UnavailableStyleException ()
                {
                        // Marked NotWorking because it is dependent on what fonts/styles are available
                        // on the OS.  This test is written for Windows.
-                       Font f = new Font ("Monotype Corsiva", 8, FontStyle.Regular);
+                       Assert.Throws<ArgumentException> (() => new Font ("Monotype Corsiva", 8, FontStyle.Regular));
                }
 
                [Test]
@@ -547,11 +536,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void GetHeight_Graphics_Null ()
                {
                        using (Font f = new Font (name, 12.5f)) {
-                               Assert.AreEqual (0, f.GetHeight (null), "0");
+                               Assert.Throws<ArgumentNullException> (() => f.GetHeight (null));
                        }
                }
 
@@ -566,36 +554,36 @@ namespace MonoTests.System.Drawing{
                        Assert.IsFalse (f1.GetHashCode () == f3.GetHashCode (), "2) Fonts with different styles should have different HashCodes");
                }
 
-        [Test]
-        public void GetHashCode_UnitDiffers_HashesNotEqual()
-        {
-            Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
-            Font f2 = new Font("Arial", 8.25F, GraphicsUnit.Pixel);
+               [Test]
+               public void GetHashCode_UnitDiffers_HashesNotEqual()
+               {
+                       Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
+                       Font f2 = new Font("Arial", 8.25F, GraphicsUnit.Pixel);
 
-            Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
-                "Hashcodes should differ if _unit member differs");
-        }
+                       Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
+                               "Hashcodes should differ if _unit member differs");
+               }
 
-        [Test]
-        public void GetHashCode_NameDiffers_HashesNotEqual()
-        {
-            Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
-            Font f2 = new Font("Courier New", 8.25F, GraphicsUnit.Point);
+               [Test]
+               public void GetHashCode_NameDiffers_HashesNotEqual()
+               {
+                       Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
+                       Font f2 = new Font("Courier New", 8.25F, GraphicsUnit.Point);
 
                        if (f1.Name != f2.Name) {
                                Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
                                                           "Hashcodes should differ if _name member differs");
                        }
-        }
+               }
 
-        [Test]
-        public void GetHashCode_StyleEqualsGdiCharSet_HashesNotEqual()
-        {
-            Font f1 = new Font("Arial", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
-            Font f2 = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(1)));
+               [Test]
+               public void GetHashCode_StyleEqualsGdiCharSet_HashesNotEqual()
+               {
+                       Font f1 = new Font("Arial", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
+                       Font f2 = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(1)));
 
-            Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
-                "Hashcodes should differ if _style member differs");
-        }
+                       Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
+                               "Hashcodes should differ if _style member differs");
+               }
        }
 }
index 08264e3f548d459433f03d90e0a9acddd1603de4..1fcacd6a35ae9147b22f24288225b820e3a8d940 100644 (file)
@@ -47,21 +47,19 @@ namespace MonoTests.System.Drawing{
                        Assert.IsTrue (f.GetStandardValuesSupported (), "standard values supported");
                        Assert.IsFalse (f.GetStandardValuesExclusive (), "standard values exclusive");
                }
-               
-               [ExpectedException (typeof (NotSupportedException))]
+
                [Test]
                public void ExTestConvertFrom ()
                {
                        FontConverter.FontNameConverter f = new FontConverter.FontNameConverter ();
-                       f.ConvertFrom (null);
+                       Assert.Throws<NotSupportedException> (() => f.ConvertFrom (null));
                }
 
-               [ExpectedException (typeof (NotSupportedException))]
                [Test]
                public void ExTestConvertFrom2 ()
                {
                        FontConverter.FontNameConverter f = new FontConverter.FontNameConverter ();
-                       f.ConvertFrom (1);
+                       Assert.Throws<NotSupportedException> (() => f.ConvertFrom (1));
                }
        }
 }
index 6f8e3a61406915c6979749fd17fd232663f9df4f..cb8bd1d1b0fc55cbee85bfef5a59a6bd710a7fea 100644 (file)
@@ -379,7 +379,6 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (Exception))]
                public void LoadIndexed_BmpFile ()
                {
                        // Tests that we can load an indexed file, but...
@@ -387,15 +386,14 @@ namespace MonoTests.System.Drawing {
                        // note: file is misnamed (it's a 4bpp bitmap)
                        using (Image img = Image.FromFile (sInFile)) {
                                Assert.AreEqual (PixelFormat.Format4bppIndexed, img.PixelFormat, "PixelFormat");
-                               Graphics.FromImage (img);
+                               Assert.Throws<Exception> (() => Graphics.FromImage (img));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FromImage ()
                {
-                       Graphics g = Graphics.FromImage (null);
+                       Assert.Throws<ArgumentNullException> (() => Graphics.FromImage (null));
                }
 
                private Graphics Get (int w, int h)
@@ -458,32 +456,29 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Transform_NonInvertibleMatrix ()
                {
                        Matrix matrix = new Matrix (123, 24, 82, 16, 47, 30);
                        Assert.IsFalse (matrix.IsInvertible, "IsInvertible");
                        Graphics g = Get (16, 16);
-                       g.Transform = matrix;
+                       Assert.Throws<ArgumentException> (() => g.Transform = matrix);
                }
 
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Multiply_NonInvertibleMatrix ()
                {
                        Matrix matrix = new Matrix (123, 24, 82, 16, 47, 30);
                        Assert.IsFalse (matrix.IsInvertible, "IsInvertible");
                        Graphics g = Get (16, 16);
-                       g.MultiplyTransform (matrix);
+                       Assert.Throws<ArgumentException> (() => g.MultiplyTransform (matrix));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Multiply_Null ()
                {
                        Graphics g = Get (16, 16);
-                       g.MultiplyTransform (null);
+                       Assert.Throws<ArgumentNullException> (() => g.MultiplyTransform (null));
                }
 
                private void CheckBounds (string msg, RectangleF bounds, float x, float y, float w, float h)
@@ -757,19 +752,17 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_X0 ()
                {
                        Graphics g = Get (16, 16);
-                       g.ScaleTransform (0, 1);
+                       Assert.Throws<ArgumentException> (() => g.ScaleTransform (0, 1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_Y0 ()
                {
                        Graphics g = Get (16, 16);
-                       g.ScaleTransform (1, 0);
+                       Assert.Throws<ArgumentException> (() => g.ScaleTransform (1, 0));
                }
 
                [Test]
@@ -814,30 +807,27 @@ namespace MonoTests.System.Drawing {
                static PointF[] LargeCurveF = new PointF[4] { new PointF (0, 0), new PointF (15, 5), new PointF (5, 15), new PointF (0, 20) };
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawCurve_PenNull ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (null, SmallCurveF);
+                       Assert.Throws<ArgumentNullException> (() => g.DrawCurve (null, SmallCurveF));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawCurve_PointFNull ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, (PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => g.DrawCurve (Pens.Black, (PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawCurve_PointNull ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, (Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => g.DrawCurve (Pens.Black, (Point[]) null));
                }
 
                [Test]
@@ -855,22 +845,20 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawCurve_SinglePoint ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, new Point[1] { new Point (10, 10) }, 0.5f);
+                       Assert.Throws<ArgumentException> (() => g.DrawCurve (Pens.Black, new Point[1] { new Point (10, 10) }, 0.5f));
                        // a single point isn't enough
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawCurve3_NotEnoughPoints ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, TooSmallCurve, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => g.DrawCurve (Pens.Black, TooSmallCurve, 0, 2, 0.5f));
                        // aha, this is API dependent
                }
 
@@ -912,31 +900,28 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawCurve_ZeroSegments ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, SmallCurveF, 0, 0);
+                       Assert.Throws<ArgumentException> (() => g.DrawCurve (Pens.Black, SmallCurveF, 0, 0));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawCurve_NegativeSegments ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.DrawCurve (Pens.Black, SmallCurveF, 0, -1);
+                       Assert.Throws<ArgumentException> (() => g.DrawCurve (Pens.Black, SmallCurveF, 0, -1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawCurve_OffsetTooLarge ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
                        // starting offset 1 doesn't give 3 points to make a curve
-                       g.DrawCurve (Pens.Black, SmallCurveF, 1, 2);
+                       Assert.Throws<ArgumentException> (() => g.DrawCurve (Pens.Black, SmallCurveF, 1, 2));
                        // and in this case 2 points aren't enough to draw something
                }
 
@@ -1205,10 +1190,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BeginContainer_GraphicsUnit_Display ()
                {
-                       BeginContainer_GraphicsUnit (GraphicsUnit.Display);
+                       Assert.Throws<ArgumentException> (() => BeginContainer_GraphicsUnit(GraphicsUnit.Display));
                }
 
                [Test]
@@ -1222,26 +1206,23 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BeginContainer_GraphicsUnit_World ()
                {
-                       BeginContainer_GraphicsUnit (GraphicsUnit.World);
+                       Assert.Throws<ArgumentException> (() => BeginContainer_GraphicsUnit(GraphicsUnit.World));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void BeginContainer_GraphicsUnit_Bad ()
                {
-                       BeginContainer_GraphicsUnit ((GraphicsUnit) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => BeginContainer_GraphicsUnit((GraphicsUnit) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void EndContainer_Null ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.EndContainer (null);
+                       Assert.Throws<ArgumentNullException> (() => g.EndContainer (null));
                }
 
                [Test]
@@ -1286,76 +1267,69 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Restore_Null ()
                {
                        Bitmap bitmap = new Bitmap (20, 20);
                        Graphics g = Graphics.FromImage (bitmap);
-                       g.Restore (null);
+                       Assert.Throws<NullReferenceException> (() => g.Restore (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillRectangles_BrushNull_Rectangle ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (null, new Rectangle[1]);
+                                       Assert.Throws<ArgumentNullException> (() => g.FillRectangles (null, new Rectangle[1]));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillRectangles_Rectangle_Null ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (Brushes.Red, (Rectangle[]) null);
+                                       Assert.Throws<ArgumentNullException> (() => g.FillRectangles (Brushes.Red, (Rectangle[]) null));
                                }
                        }
                }
 
                [Test] // see bug #78408
-               [ExpectedException (typeof (ArgumentException))]
                public void FillRectanglesZeroRectangle ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (Brushes.Red, new Rectangle[0]);
+                                       Assert.Throws<ArgumentException> (() => g.FillRectangles (Brushes.Red, new Rectangle[0]));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillRectangles_BrushNull_RectangleF ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (null, new RectangleF[1]);
+                                       Assert.Throws<ArgumentNullException> (() => g.FillRectangles (null, new RectangleF[1]));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillRectangles_RectangleF_Null ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (Brushes.Red, (RectangleF[]) null);
+                                       Assert.Throws<ArgumentNullException> (() => g.FillRectangles (Brushes.Red, (RectangleF[]) null));
                                }
                        }
                }
 
                [Test] // see bug #78408
-               [ExpectedException (typeof (ArgumentException))]
                public void FillRectanglesZeroRectangleF ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.FillRectangles (Brushes.Red, new RectangleF[0]);
+                                       Assert.Throws<ArgumentException> (() => g.FillRectangles (Brushes.Red, new RectangleF[0]));
                                }
                        }
                }
@@ -1860,12 +1834,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MeasureString_StringFont_Null ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.MeasureString ("a", null);
+                                       Assert.Throws<ArgumentNullException> (() => g.MeasureString ("a", null));
                                }
                        }
                }
@@ -2157,12 +2130,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MeasureCharacterRanges_FontNull ()
                {
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.MeasureCharacterRanges ("a", null, new RectangleF (), null);
+                                       Assert.Throws<ArgumentNullException> (() => g.MeasureCharacterRanges ("a", null, new RectangleF (), null));
                                }
                        }
                }
@@ -2216,19 +2188,17 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MeasureCharacterRanges_FirstTooFar ()
                {
                        string text = "this\nis a test";
-                       MeasureCharacterRanges (text, text.Length, 1);
+                       Assert.Throws<ArgumentException> (() => MeasureCharacterRanges(text, text.Length, 1));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MeasureCharacterRanges_LengthTooLong ()
                {
                        string text = "this\nis a test";
-                       MeasureCharacterRanges (text, 0, text.Length + 1);
+                       Assert.Throws<ArgumentException> (() => MeasureCharacterRanges(text, 0, text.Length + 1));
                }
 
                [Test]
@@ -2270,7 +2240,6 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MeasureCharacterRanges_NullStringFormat ()
                {
                        if (font == null)
@@ -2278,7 +2247,7 @@ namespace MonoTests.System.Drawing {
 
                        using (Bitmap bitmap = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bitmap)) {
-                                       g.MeasureCharacterRanges ("Mono", font, new RectangleF (), null);
+                                       Assert.Throws<ArgumentException> (() => g.MeasureCharacterRanges ("Mono", font, new RectangleF (), null));
                                }
                        }
                }
@@ -2458,10 +2427,10 @@ namespace MonoTests.System.Drawing {
                }
 
                static CharacterRange [] ranges = new CharacterRange [] {
-                    new CharacterRange (0, 1),
-                    new CharacterRange (1, 1),
-                    new CharacterRange (2, 1)
-                };
+                                       new CharacterRange (0, 1),
+                                       new CharacterRange (1, 1),
+                                       new CharacterRange (2, 1)
+                               };
 
                Region [] Measure (Graphics gfx, RectangleF rect)
                {
@@ -2608,25 +2577,23 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ReleaseHdcInternal_IntPtrZero ()
                {
                        using (Bitmap b = new Bitmap (10, 10)) {
                                using (Graphics g = Graphics.FromImage (b)) {
-                                       g.ReleaseHdcInternal (IntPtr.Zero);
+                                       Assert.Throws<ArgumentException> (() => g.ReleaseHdcInternal (IntPtr.Zero));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ReleaseHdcInternal_TwoTimes ()
                {
                        using (Bitmap b = new Bitmap (10, 10)) {
                                using (Graphics g = Graphics.FromImage (b)) {
                                        IntPtr hdc = g.GetHdc ();
                                        g.ReleaseHdcInternal (hdc);
-                                       g.ReleaseHdcInternal (hdc);
+                                       Assert.Throws<ArgumentException> (() => g.ReleaseHdcInternal (hdc));
                                }
                        }
                }
@@ -2645,25 +2612,23 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TestReleaseHdcException ()
                {
                        using (Bitmap b = new Bitmap (10, 10)) {
                                using (Graphics g = Graphics.FromImage (b)) {
-                                       g.ReleaseHdc ();
+                                       Assert.Throws<ArgumentException> (() => g.ReleaseHdc ());
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TestReleaseHdcException2 ()
                {
                        using (Bitmap b = new Bitmap (10, 10)) {
                                using (Graphics g = Graphics.FromImage (b)) {
                                        g.GetHdc ();
                                        g.ReleaseHdc ();
-                                       g.ReleaseHdc ();
+                                       Assert.Throws<ArgumentException> (() => g.ReleaseHdc ());
                                }
                        }
                }
@@ -2802,12 +2767,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawIcon_NullRectangle ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawIcon (null, new Rectangle (0, 0, 32, 32));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawIcon (null, new Rectangle (0, 0, 32, 32)));
                                }
                        }
                }
@@ -2831,12 +2795,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawIcon_NullIntInt ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawIcon (null, 4, 2);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawIcon (null, 4, 2));
                                }
                        }
                }
@@ -2853,12 +2816,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawIconUnstretched_NullRectangle ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawIconUnstretched (null, new Rectangle (0, 0, 40, 20));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawIconUnstretched (null, new Rectangle (0, 0, 40, 20)));
                                }
                        }
                }
@@ -2882,12 +2844,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullRectangleF ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new RectangleF (0, 0, 0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new RectangleF (0, 0, 0, 0)));
                                }
                        }
                }
@@ -2906,12 +2867,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPointF ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new PointF (0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new PointF (0, 0)));
                                }
                        }
                }
@@ -2927,34 +2887,31 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPointFArray ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new PointF[0]);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new PointF[0]));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_ImagePointFArrayNull ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, (PointF[]) null);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (bmp, (PointF[]) null));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePointFArrayEmpty ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, new PointF[0]);
+                                       Assert.Throws<ArgumentException> (() => g.DrawImage (bmp, new PointF[0]));
                                }
                        }
                }
@@ -2971,12 +2928,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullRectangle ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new Rectangle (0, 0, 0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new Rectangle (0, 0, 0, 0)));
                                }
                        }
                }
@@ -2999,12 +2955,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPoint ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new Point (0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new Point (0, 0)));
                                }
                        }
                }
@@ -3020,34 +2975,31 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPointArray ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new Point[0]);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new Point[0]));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_ImagePointArrayNull ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, (Point[]) null);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (bmp, (Point[]) null));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePointArrayEmpty ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, new Point[0]);
+                                       Assert.Throws<ArgumentException> (() => g.DrawImage (bmp, new Point[0]));
                                }
                        }
                }
@@ -3064,23 +3016,21 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullIntInt ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, Int32.MaxValue, Int32.MinValue);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, Int32.MaxValue, Int32.MinValue));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (OverflowException))]
                public void DrawImage_ImageIntInt_Overflow ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, Int32.MaxValue, Int32.MinValue);
+                                       Assert.Throws<OverflowException> (() => g.DrawImage (bmp, Int32.MaxValue, Int32.MinValue));
                                }
                        }
                }
@@ -3096,23 +3046,21 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullFloat ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, Single.MaxValue, Single.MinValue);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, Single.MaxValue, Single.MinValue));
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (OverflowException))]
                public void DrawImage_ImageFloatFloat_Overflow ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (bmp, Single.MaxValue, Single.MinValue);
+                                       Assert.Throws<OverflowException> (() => g.DrawImage (bmp, Single.MaxValue, Single.MinValue));
                                }
                        }
                }
@@ -3128,12 +3076,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullRectangleRectangleGraphicsUnit ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, new Rectangle (), new Rectangle (), GraphicsUnit.Display);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, new Rectangle (), new Rectangle (), GraphicsUnit.Display));
                                }
                        }
                }
@@ -3149,31 +3096,27 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_Display ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Display);
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Display));
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_Document ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Document);
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Document));
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_Inch ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Inch);
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit(GraphicsUnit.Inch));
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_Millimeter ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Millimeter);
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Millimeter));
                }
 
                [Test]
@@ -3184,28 +3127,25 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_Point ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Point);
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.Point));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImageRectangleRectangleGraphicsUnit_World ()
                {
-                       DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.World);
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImageRectangleRectangleGraphicsUnit (GraphicsUnit.World));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPointRectangleGraphicsUnit ()
                {
                        Rectangle r = new Rectangle (1, 2, 3, 4);
                        Point[] pts = new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) };
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, pts, r, GraphicsUnit.Pixel);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, pts, r, GraphicsUnit.Pixel));
                                }
                        }
                }
@@ -3221,33 +3161,29 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_ImageNullRectangleGraphicsUnit ()
                {
-                       DrawImage_ImagePointRectangleGraphicsUnit (null);
+                       Assert.Throws<ArgumentNullException> (() => DrawImage_ImagePointRectangleGraphicsUnit (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePoint0RectangleGraphicsUnit ()
                {
-                       DrawImage_ImagePointRectangleGraphicsUnit (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointRectangleGraphicsUnit (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePoint1RectangleGraphicsUnit ()
                {
                        Point p = new Point (1, 1);
-                       DrawImage_ImagePointRectangleGraphicsUnit (new Point[1] { p });
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointRectangleGraphicsUnit (new Point[1] { p }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePoint2RectangleGraphicsUnit ()
                {
                        Point p = new Point (1, 1);
-                       DrawImage_ImagePointRectangleGraphicsUnit (new Point[2] { p, p });
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointRectangleGraphicsUnit (new Point[2] { p, p }));
                }
 
                [Test]
@@ -3258,22 +3194,20 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImagePoint4RectangleGraphicsUnit ()
                {
                        Point p = new Point (1, 1);
-                       DrawImage_ImagePointRectangleGraphicsUnit (new Point[4] { p, p, p, p });
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImagePointRectangleGraphicsUnit (new Point[4] { p, p, p, p }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_NullPointFRectangleGraphicsUnit ()
                {
                        Rectangle r = new Rectangle (1, 2, 3, 4);
                        PointF[] pts = new PointF[3] { new PointF (1, 1), new PointF (2, 2), new PointF (3, 3) };
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImage (null, pts, r, GraphicsUnit.Pixel);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImage (null, pts, r, GraphicsUnit.Pixel));
                                }
                        }
                }
@@ -3289,33 +3223,29 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImage_ImageNullFRectangleGraphicsUnit ()
                {
-                       DrawImage_ImagePointFRectangleGraphicsUnit (null);
+                       Assert.Throws<ArgumentNullException> (() => DrawImage_ImagePointFRectangleGraphicsUnit (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePointF0RectangleGraphicsUnit ()
                {
-                       DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePointF1RectangleGraphicsUnit ()
                {
                        PointF p = new PointF (1, 1);
-                       DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[1] { p });
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[1] { p }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void DrawImage_ImagePointF2RectangleGraphicsUnit ()
                {
                        PointF p = new PointF (1, 1);
-                       DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[2] { p, p });
+                       Assert.Throws<ArgumentException> (() => DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[2] { p, p }));
                }
 
                [Test]
@@ -3326,11 +3256,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NotImplementedException))]
                public void DrawImage_ImagePointF4RectangleGraphicsUnit ()
                {
                        PointF p = new PointF (1, 1);
-                       DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[4] { p, p, p, p });
+                       Assert.Throws<NotImplementedException> (() => DrawImage_ImagePointFRectangleGraphicsUnit (new PointF[4] { p, p, p, p }));
                }
 
                [Test]
@@ -3361,12 +3290,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImageUnscaled_NullPoint ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImageUnscaled (null, new Point (0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImageUnscaled (null, new Point (0, 0)));
                                }
                        }
                }
@@ -3382,12 +3310,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImageUnscaled_NullRectangle ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImageUnscaled (null, new Rectangle (0, 0, -1, -1));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImageUnscaled (null, new Rectangle (0, 0, -1, -1)));
                                }
                        }
                }
@@ -3403,12 +3330,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImageUnscaled_NullIntInt ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImageUnscaled (null, 0, 0);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImageUnscaled (null, 0, 0));
                                }
                        }
                }
@@ -3424,12 +3350,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImageUnscaled_NullIntIntIntInt ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImageUnscaled (null, 0, 0, -1, -1);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImageUnscaled (null, 0, 0, -1, -1));
                                }
                        }
                }
@@ -3444,12 +3369,11 @@ namespace MonoTests.System.Drawing {
                        }
                }
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawImageUnscaledAndClipped_Null ()
                {
                        using (Bitmap bmp = new Bitmap (40, 40)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawImageUnscaledAndClipped (null, new Rectangle (0, 0, 0, 0));
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawImageUnscaledAndClipped (null, new Rectangle (0, 0, 0, 0)));
                                }
                        }
                }
@@ -3476,25 +3400,23 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawPath_Pen_Null ()
                {
                        using (Bitmap bmp = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
                                        using (GraphicsPath path = new GraphicsPath ()) {
-                                               g.DrawPath (null, path);
+                                               Assert.Throws<ArgumentNullException> (() => g.DrawPath (null, path));
                                        }
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void DrawPath_Path_Null ()
                {
                        using (Bitmap bmp = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.DrawPath (Pens.Black, null);
+                                       Assert.Throws<ArgumentNullException> (() => g.DrawPath (Pens.Black, null));
                                }
                        }
                }
@@ -3529,25 +3451,23 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillPath_Brush_Null ()
                {
                        using (Bitmap bmp = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
                                        using (GraphicsPath path = new GraphicsPath ()) {
-                                               g.FillPath (null, path);
+                                               Assert.Throws<ArgumentNullException> (() => g.FillPath (null, path));
                                        }
                                }
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void FillPath_Path_Null ()
                {
                        using (Bitmap bmp = new Bitmap (20, 20)) {
                                using (Graphics g = Graphics.FromImage (bmp)) {
-                                       g.FillPath (Brushes.Black, null);
+                                       Assert.Throws<ArgumentNullException> (() => g.FillPath (Brushes.Black, null));
                                }
                        }
                }
index b24af54e3d6d9cfb3b944fd5dc2896c3b28c4e87..e4d0fa0758d671f385ac3d7a7f671878946ccd1d 100644 (file)
@@ -29,6 +29,7 @@
 //
 
 using System;
+using System.ComponentModel;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO;
@@ -93,10 +94,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_IconNull_Int_Int ()
                {
-                       new Icon ((Icon)null, 32, 32);
+                       Assert.Throws<ArgumentException> (() => new Icon ((Icon)null, 32, 32));
                }
 
                [Test]
@@ -108,10 +108,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_IconNull_Size ()
                {
-                       new Icon ((Icon) null, new Size (32, 32));
+                       Assert.Throws<ArgumentException> (() => new Icon ((Icon) null, new Size (32, 32)));
                }
 
                [Test]
@@ -173,58 +172,50 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_StreamNull ()
                {
-                       new Icon ((Stream) null);
+                       Assert.Throws<ArgumentException> (() => new Icon ((Stream) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_StreamNull_Int_Int ()
                {
-                       new Icon ((Stream) null, 32, 32);
+                       Assert.Throws<ArgumentException> (() => new Icon ((Stream) null, 32, 32));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_StringNull ()
                {
-                       new Icon ((string) null);
+                       Assert.Throws<ArgumentNullException> (() => new Icon ((string) null));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_TypeNull_String ()
                {
-                       new Icon ((Type) null, "mono.ico");
+                       Assert.Throws<NullReferenceException> (() => new Icon ((Type) null, "mono.ico"));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Type_StringNull ()
                {
-                       new Icon (typeof (Icon), null);
+                       Assert.Throws<ArgumentException> (() => new Icon (typeof (Icon), null));
                }
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_StreamNull_Size ()
                {
-                       new Icon ((Stream) null, new Size (32, 32));
+                       Assert.Throws<ArgumentException> (() => new Icon ((Stream) null, new Size (32, 32)));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_StringNull_Size ()
                {
-                       new Icon ((string) null, new Size (32, 32));
+                       Assert.Throws<ArgumentNullException> (() => new Icon ((string) null, new Size (32, 32)));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_StringNull_Int_Int ()
                {
-                       new Icon ((string) null, 32, 32);
+                       Assert.Throws<ArgumentNullException> (() => new Icon ((string) null, 32, 32));
                }
 
                [Test]
@@ -380,10 +371,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Save_Null ()
                {
-                       icon.Save (null);
+                       Assert.Throws<NullReferenceException> (() => icon.Save (null));
                }
 
                [Test]
@@ -499,34 +489,31 @@ namespace MonoTests.System.Drawing {
                        }
                }
 
-               [Test, ExpectedException ()] //ToDo: System.ComponentModel.Win32Exception
+               [Test]
                public void Only256InFile ()
                {
                        using (FileStream fs = File.OpenRead (TestBitmap.getInFile ("bitmaps/only256.ico"))) {
-                               Icon icon = new Icon (fs, 0, 0);
+                               Assert.Throws<Win32Exception> (() => new Icon (fs, 0, 0));
                        }
                }
 
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ExtractAssociatedIcon_Null ()
                {
-                       Icon.ExtractAssociatedIcon (null);
+                       Assert.Throws<ArgumentException> (() => Icon.ExtractAssociatedIcon (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ExtractAssociatedIcon_Empty ()
                {
-                       Icon.ExtractAssociatedIcon (String.Empty);
+                       Assert.Throws<ArgumentException> (() => Icon.ExtractAssociatedIcon (String.Empty));
                }
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                public void ExtractAssociatedIcon_DoesNotExists ()
                {
-                       Icon.ExtractAssociatedIcon ("does-not-exists.png");
+                       Assert.Throws<FileNotFoundException> (() => Icon.ExtractAssociatedIcon ("does-not-exists.png"));
                }
 
                private static bool RunningOnUnix {
index e064a4337a3e551072f28241e66773d459380806..c53d061bad056434bb99b5d5871f1cc8fe2155dc 100644 (file)
@@ -69,10 +69,9 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (FileNotFoundException))]
                public void FileDoesNotExists ()
                {
-                       Image.FromFile ("FileDoesNotExists.jpg");
+                       Assert.Throws<FileNotFoundException> (() => Image.FromFile ("FileDoesNotExists.jpg"));
                }
 
                private bool CallbackTrue ()
@@ -101,20 +100,18 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void GetThumbnailImage_Height_Zero ()
                {
                        using (Bitmap bmp = new Bitmap (10, 10)) {
-                               Image tn = bmp.GetThumbnailImage (5, 0, new Image.GetThumbnailImageAbort (CallbackFalse), IntPtr.Zero);
+                               Assert.Throws<OutOfMemoryException> (() => bmp.GetThumbnailImage (5, 0, new Image.GetThumbnailImageAbort (CallbackFalse), IntPtr.Zero));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void GetThumbnailImage_Width_Negative ()
                {
                        using (Bitmap bmp = new Bitmap (10, 10)) {
-                               Image tn = bmp.GetThumbnailImage (-5, 5, new Image.GetThumbnailImageAbort (CallbackFalse), IntPtr.Zero);
+                               Assert.Throws<OutOfMemoryException> (() => bmp.GetThumbnailImage (-5, 5, new Image.GetThumbnailImageAbort (CallbackFalse), IntPtr.Zero));
                        }
                }
 
@@ -245,13 +242,12 @@ namespace MonoTests.System.Drawing{
 
                [Test]
                [Category ("NotWorking")] // https://bugzilla.novell.com/show_bug.cgi?id=338779
-               [ExpectedException (typeof (ArgumentException))]
                public void FromStream_Metafile_Wmf_NotOrigin ()
                {
                        string filename = TestBitmap.getInFile ("bitmaps/telescope_01.wmf");
                        using (FileStream fs = File.OpenRead (filename)) {
                                fs.Position = fs.Length / 2;
-                               Image.FromStream (fs);
+                               Assert.Throws<ArgumentException> (() => Image.FromStream (fs));
                        }
                }
 
@@ -287,31 +283,28 @@ namespace MonoTests.System.Drawing{
 
                [Test]
                [Category ("NotWorking")] // https://bugzilla.novell.com/show_bug.cgi?id=338779
-               [ExpectedException (typeof (ArgumentException))]
                public void FromStream_Metafile_Emf_NotOrigin ()
                {
                        string filename = TestBitmap.getInFile ("bitmaps/milkmateya01.emf");
                        using (FileStream fs = File.OpenRead (filename)) {
                                fs.Position = fs.Length / 2;
-                               Image.FromStream (fs);
+                               Assert.Throws<ArgumentException> (() => Image.FromStream (fs));
                        }
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void FromFile_Invalid ()
                {
                        string filename = Assembly.GetExecutingAssembly ().Location;
-                       Image.FromFile (filename);
+                       Assert.Throws<OutOfMemoryException> (() => Image.FromFile (filename));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromStream_Invalid ()
                {
                        string filename = Assembly.GetExecutingAssembly ().Location;
                        using (FileStream fs = File.OpenRead (filename)) {
-                               Image.FromStream (fs);
+                               Assert.Throws<ArgumentException> (() => Image.FromStream (fs));
                        }
                }
 
@@ -350,7 +343,6 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void StreamJunkSaveLoad ()
                {
                        using (MemoryStream ms = new MemoryStream ()) {
@@ -363,7 +355,7 @@ namespace MonoTests.System.Drawing{
                                        bmp.Save (ms, ImageFormat.Bmp);
                                        Assert.IsTrue (ms.Position > 2, "Position-2");
                                        // exception here
-                                       Image.FromStream (ms);
+                                       Assert.Throws<ArgumentException> (() => Image.FromStream (ms));
                                }
                        }
                }
index ef4752ae037eaccc191d62b224780afd9190bc8a..33d4b51d1df52528f16e6869d8ac97d95354bb01 100644 (file)
@@ -157,87 +157,75 @@ namespace MonoTests.System.Drawing
                }
                
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_BadString ()
                {
-                       imgConv.ConvertFrom ("System.Drawing.String");
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom ("System.Drawing.String"));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_BadString_WithCulture ()
                {
-                       imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, "System.Drawing.String");
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, "System.Drawing.String"));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_Bitmap ()
                {
-                       imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Bitmap (20, 20));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Bitmap (20, 20)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_Point ()
                {
-                       imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Point (10, 10));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Point (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_SizeF ()
                {
-                       imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new SizeF (10, 10));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new SizeF (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFrom_Object ()
                {
-                       imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Object ());
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertFrom (null, CultureInfo.InvariantCulture, new Object ()));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_BadString ()
                {
-                       imgConvFrmTD.ConvertFrom ("System.Drawing.String");
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom ("System.Drawing.String"));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_BadString_Culture ()
                {
-                       imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, "System.Drawing.String");
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, "System.Drawing.String"));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_Bitmap ()
                {
-                       imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Bitmap (20, 20));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Bitmap (20, 20)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_Point ()
                {
-                       imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Point (10, 10));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Point (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_SizeF ()
                {
-                       imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new SizeF (10, 10));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new SizeF (10, 10)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertFrom_Object ()
                {
-                       imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Object ());
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertFrom (null, CultureInfo.InvariantCulture, new Object ()));
                }
 
                [Test]
@@ -278,115 +266,99 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Rectangle ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Rectangle));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Rectangle)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Image ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, image.GetType ());
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, image.GetType ()));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Size ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Size));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Size)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Bitmap ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Bitmap));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Bitmap)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Point ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Point));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Point)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Metafile ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Metafile));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Metafile)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Object ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Object));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Object)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertTo_Int ()
                {
-                       imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (int));
+                       Assert.Throws<NotSupportedException> (() => imgConv.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (int)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Rectangle ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Rectangle));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Rectangle)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Image ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, image.GetType ());
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, image.GetType ()));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Size ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Size));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Size)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Bitmap ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Bitmap));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Bitmap)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Point ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Point));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Point)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Metafile ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Metafile));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Metafile)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Object ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Object));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (Object)));
                }
 
                [Test]
-               [ExpectedException (typeof (NotSupportedException))]
                public void TypeDescriptor_ConvertTo_Int ()
                {
-                       imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (int));
+                       Assert.Throws<NotSupportedException> (() => imgConvFrmTD.ConvertTo (null, CultureInfo.InvariantCulture, image, typeof (int)));
                }
 
                [Test]
index 346ae6f1d509e20445a1db4fc8c384d4229e860f..a12a498f81ee82321f7ec41f9bccc946abb063a8 100644 (file)
@@ -66,7 +66,9 @@ namespace MonoTests.System.Drawing{
                [Test]
                public void EqualityOpTest () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (pt1_1 == pt1_1, "#1");
+#pragma warning restore 1718
                        Assert.IsTrue (pt1_1 == new Point (1, 1), "#2");
                        Assert.IsTrue (!(pt1_1 == pt1_0), "#3");
                        Assert.IsTrue (!(pt1_1 == pt0_1), "#4");
@@ -76,7 +78,9 @@ namespace MonoTests.System.Drawing{
                [Test]
                public void InequalityOpTest () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (!(pt1_1 != pt1_1), "#1");
+#pragma warning restore 1718
                        Assert.IsTrue (!(pt1_1 != new Point (1, 1)), "#2");
                        Assert.IsTrue (pt1_1 != pt1_0, "#3");
                        Assert.IsTrue (pt1_1 != pt0_1, "#4");
index 0a0a6d0914fc7c5eb57f621f819c3343e840b775..ad7c2ffe2691f62be457f3832cf50677f92c7612 100644 (file)
@@ -222,7 +222,7 @@ namespace MonoTests.System.Drawing
                        try {
                                // culture == null
                                ptconv.ConvertTo (null, null, pt, typeof (string));
-                       } catch (NullReferenceException e) {
+                       } catch (NullReferenceException) {
                                Assert.Fail ("CT#8: must not throw NullReferenceException");
                        }
                }
@@ -253,13 +253,12 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TestCreateInstance_CaseSensitive ()
                {
                        Hashtable ht = new Hashtable ();
                        ht.Add ("x", 2);
                        ht.Add ("Y", 3);
-                       ptconv.CreateInstance (null, ht);
+                       Assert.Throws<ArgumentException> (() => ptconv.CreateInstance (null, ht));
                }
 
                [Test]
@@ -305,10 +304,9 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_string_exc_1 ()
                {
-                       ptconv.ConvertFromInvariantString ("1");
+                       Assert.Throws<ArgumentException> (() => ptconv.ConvertFromInvariantString ("1"));
                }
 
                [Test]
@@ -341,10 +339,9 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_string_exc_1 ()
                {
-                       ptconv.ConvertFromString ("1");
+                       Assert.Throws<ArgumentException> (() => ptconv.ConvertFromString ("1"));
                }
 
                [Test]
index 43f18d14d1040518d5aac4b6bd9f680ea6c11414..3d41155cb9701ceea7d26ce2e968c79a72eef003 100644 (file)
@@ -104,7 +104,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestEqualityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (pt11_99 == pt11_99, "EOP#1");
+#pragma warning restore 1718
                        Assert.IsTrue (pt11_99 == new PointF (1.1F, 9.9F), "EOP#2");
                        Assert.IsFalse (pt11_99 == pt11_0, "EOP#3");
                        Assert.IsFalse (pt11_99 == pt0_11, "EOP#4");
@@ -114,7 +116,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestInequalityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsFalse (pt11_99 != pt11_99, "IOP#1");
+#pragma warning restore 1718
                        Assert.IsFalse (pt11_99 != new PointF (1.1F, 9.9F), "IOP#2");
                        Assert.IsTrue (pt11_99 != pt11_0, "IOP#3");
                        Assert.IsTrue (pt11_99 != pt0_11, "IOP#4");
index aa0b9e68ae9ece01725a1c25219b7f87529c4d7c..f75a06926d16ee8baff64901c0f4093057b90ece 100644 (file)
@@ -305,7 +305,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TestCreateInstance_CaseSensitive ()
                {
                        Hashtable ht = new Hashtable ();
@@ -313,7 +312,7 @@ namespace MonoTests.System.Drawing
                        ht.Add ("Y", -10);
                        ht.Add ("Width", 20);
                        ht.Add ("Height", 30);
-                       rconv.CreateInstance (null, ht);
+                       Assert.Throws<ArgumentException> (() => rconv.CreateInstance (null, ht));
                }
 
                [Test]
@@ -374,10 +373,9 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_string_exc_1 ()
                {
-                       rconv.ConvertFromInvariantString ("1, 2, 3");
+                       Assert.Throws<ArgumentException> (() => rconv.ConvertFromInvariantString ("1, 2, 3"));
                }
 
                [Test]
@@ -410,12 +408,11 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_string_exc_1 ()
                {
                        CultureInfo culture = CultureInfo.CurrentCulture;
-                       rconv.ConvertFromString (string.Format(culture,
-                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator));
+                       Assert.Throws<ArgumentException> (() => rconv.ConvertFromString (string.Format(culture,
+                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator)));
                }
 
                [Test]
index d57515cab06ed34b08b443c7f5f066929786c00f..86f99ad338a0ae23eee719273da2a88f053bb8f7 100644 (file)
@@ -1048,35 +1048,31 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       Region r = new Region (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_RegionData_Null ()
                {
                        RegionData rd = null;
-                       Region r = new Region (rd);
+                       Assert.Throws<ArgumentNullException> (() => new Region (rd));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Union_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new Region ().Union (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Union (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Union_Region_Null ()
                {
                        Region r = null;
-                       new Region ().Union (r);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Union (r));
                }
 
                [Test]
@@ -1091,74 +1087,65 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Intersect_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new Region ().Intersect (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Intersect (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Intersect_Region_Null ()
                {
                        Region r = null;
-                       new Region ().Intersect (r);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Intersect (r));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Complement_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new Region ().Complement (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Complement (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Complement_Region_Null ()
                {
                        Region r = null;
-                       new Region ().Complement (r);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Complement (r));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Exclude_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new Region ().Exclude (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Exclude (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Exclude_Region_Null ()
                {
                        Region r = null;
-                       new Region ().Exclude (r);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Exclude (r));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Xor_GraphicsPath_Null ()
                {
                        GraphicsPath gp = null;
-                       new Region ().Xor (gp);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Xor (gp));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Xor_Region_Null ()
                {
                        Region r = null;
-                       new Region ().Xor (r);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Xor (r));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void GetBounds_Null ()
                {
-                       new Region ().GetBounds (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().GetBounds (null));
                }
 
                [Test]
@@ -1214,53 +1201,46 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsEmpty_Null ()
                {
-                       new Region ().IsEmpty (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().IsEmpty (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsInfinite_Null ()
                {
-                       new Region ().IsInfinite (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().IsInfinite (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Equals_NullGraphics ()
                {
-                       new Region ().Equals (null, Graphics.FromImage (new Bitmap (10, 10)));
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Equals (null, Graphics.FromImage (new Bitmap (10, 10))));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Equals_RegionNull ()
                {
-                       new Region ().Equals (new Region (), null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Equals (new Region (), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                [Category ("NotWorking")] // caused regression in SWF
                public void GetHrgn_Null ()
                {
-                       new Region ().GetHrgn (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().GetHrgn (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void GetRegionScans_Null ()
                {
-                       new Region ().GetRegionScans (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().GetRegionScans (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new Region ().Transform (null);
+                       Assert.Throws<ArgumentNullException> (() => new Region ().Transform (null));
                }
 
                // an "empty ctor" Region is infinite
@@ -1575,17 +1555,15 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void FromHrgn_Zero ()
                {
-                       Region.FromHrgn (IntPtr.Zero);
+                       Assert.Throws<ArgumentException> (() => Region.FromHrgn (IntPtr.Zero));
                }
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void ReleaseHrng_Zero ()
                {
                        Region r = new Region (new GraphicsPath ());
-                       r.ReleaseHrgn (IntPtr.Zero);
+                       Assert.Throws<ArgumentNullException> (() => r.ReleaseHrgn (IntPtr.Zero));
                }
 
                [Test]
index 335bcbca3fa28d9068cc86640761e0d754b72e48..87862ab74f28a3f83d71d76ee70146b2efbce979 100644 (file)
@@ -142,7 +142,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestEqualityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (sz1_1 == sz1_1, "EOP#1");
+#pragma warning restore 1718
                        Assert.IsTrue (sz1_1 == new Size (1, 1), "EOP#2");
                        Assert.IsTrue (! (sz1_1 == sz1_0), "EOP#3");
                        Assert.IsTrue (! (sz1_1 == sz0_1), "EOP#4");
@@ -152,7 +154,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestInequalityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (! (sz1_1 != sz1_1), "IOP#1");
+#pragma warning restore 1718
                        Assert.IsTrue (! (sz1_1 != new Size (1, 1)), "IOP#2");
                        Assert.IsTrue (sz1_1 != sz1_0, "IOP#3");
                        Assert.IsTrue (sz1_1 != sz0_1, "IOP#4");
index 7e10230544ae01cc9e83d2776640e34d491235a4..8f8a5fa8c4e084ebaa2f4c6b058fdee52e4965dc 100644 (file)
@@ -225,7 +225,7 @@ namespace MonoTests.System.Drawing
                        try {
                                // culture == null
                                szconv.ConvertTo (null, null, sz, typeof (string));
-                       } catch (NullReferenceException e) {
+                       } catch (NullReferenceException) {
                                Assert.Fail ("CT#8: must not throw NullReferenceException");
                        }
                }
@@ -256,13 +256,12 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TestCreateInstance_CaseSensitive ()
                {
                        Hashtable ht = new Hashtable ();
                        ht.Add ("width", 20);
                        ht.Add ("Height", 30);
-                       szconv.CreateInstance (null, ht);
+                       Assert.Throws<ArgumentException> (() => szconv.CreateInstance (null, ht));
                }
 
                [Test]
@@ -310,10 +309,9 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_string_exc_1 ()
                {
-                       szconv.ConvertFromInvariantString ("1, 2, 3");
+                       Assert.Throws<ArgumentException> (() => szconv.ConvertFromInvariantString ("1, 2, 3"));
                }
 
                [Test]
@@ -346,12 +344,11 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_string_exc_1 ()
                {
                        CultureInfo culture = CultureInfo.CurrentCulture;
-                       szconv.ConvertFromString (string.Format(culture,
-                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator));
+                       Assert.Throws<ArgumentException> (() => szconv.ConvertFromString (string.Format(culture,
+                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator)));
                }
 
                [Test]
index dc94bcf1a127d61d94dc3abde7996bd40ff09b64..e982e5061ec5da6d3d211f808b1914c1e530cda4 100644 (file)
@@ -132,7 +132,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestEqualityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsTrue (sz11_99 == sz11_99, "EOP#1");
+#pragma warning restore 1718
                        Assert.IsTrue (sz11_99 == new SizeF (1.1F, 9.9F), "EOP#2");
                        Assert.IsFalse (sz11_99 == sz11_0, "EOP#3");
                        Assert.IsFalse (sz11_99 == sz0_11, "EOP#4");
@@ -142,7 +144,9 @@ namespace MonoTests.System.Drawing
                [Test]
                public void TestInequalityOp () 
                {
+#pragma warning disable 1718 // Comparison made to same variable
                        Assert.IsFalse (sz11_99 != sz11_99, "IOP#1");
+#pragma warning restore 1718
                        Assert.IsFalse (sz11_99 != new SizeF (1.1F, 9.9F), "IOP#2");
                        Assert.IsTrue (sz11_99 != sz11_0, "IOP#3");
                        Assert.IsTrue (sz11_99 != sz0_11, "IOP#4");
index 3277b2281cf969d80f5a80bf5579cc448a43a84f..67714cf26401f57f2d11016f2322c3259deaf3c1 100644 (file)
@@ -250,23 +250,21 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidCastException))]
                public void TestCreateInstance_Int ()
                {
                        Hashtable ht = new Hashtable ();
                        ht.Add ("Width", 10);
                        ht.Add ("Height", 20);
-                       szconv.CreateInstance (null, ht);
+                       Assert.Throws<InvalidCastException> (() => szconv.CreateInstance (null, ht));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void TestCreateInstance_CaseSensitive ()
                {
                        Hashtable ht = new Hashtable ();
                        ht.Add ("width", 20);
                        ht.Add ("Height", 30);
-                       szconv.CreateInstance (null, ht);
+                       Assert.Throws<NullReferenceException> (() => szconv.CreateInstance (null, ht));
                }
 
                [Test]
@@ -314,10 +312,9 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_string_exc_1 ()
                {
-                       szconv.ConvertFromInvariantString ("1, 2, 3");
+                       Assert.Throws<ArgumentException> (() => szconv.ConvertFromInvariantString ("1, 2, 3"));
                }
 
                [Test]
@@ -350,12 +347,11 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_string_exc_1 ()
                {
                        CultureInfo culture = CultureInfo.CurrentCulture;
-                       szconv.ConvertFromString (string.Format(culture,
-                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator));
+                       Assert.Throws<ArgumentException> (() => szconv.ConvertFromString (string.Format(culture,
+                               "1{0} 2{0} 3{0} 4{0} 5", culture.TextInfo.ListSeparator)));
                }
 
                [Test]
index e8b68c56f4d3eaf7702952dde3af77ea941fe6c2..6e20da75335b9320fe45509ad510dfd993367e40 100644 (file)
@@ -66,19 +66,17 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Default_Dispose ()
                {
                        StringFormat sf = new StringFormat ();
                        sf.Dispose ();
-                       sf.ToString ();
+                       Assert.Throws<ArgumentException> (() => sf.ToString ());
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void ctor_StringFormat_Null ()
                {
-                       new StringFormat (null);
+                       Assert.Throws<ArgumentNullException> (() => new StringFormat (null));
                }
 
                [Test]
@@ -120,12 +118,11 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GenericDefault_Local_Dispose ()
                {
                        StringFormat sf = StringFormat.GenericDefault;
                        sf.Dispose (); // can't be cached
-                       CheckDefaults (sf);
+                       Assert.Throws<ArgumentException> (() => CheckDefaults (sf));
                }
 
                private void CheckTypographic (StringFormat sf)
@@ -155,12 +152,11 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GenericTypographic_Local_Dispose ()
                {
                        StringFormat sf = StringFormat.GenericTypographic;
                        sf.Dispose (); // can't be cached
-                       CheckTypographic (sf);
+                       Assert.Throws<ArgumentException> (() => CheckTypographic (sf));
                }
 
                [Test]
@@ -175,11 +171,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void Alignment_Invalid ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.Alignment = (StringAlignment) Int32.MinValue;
+                               Assert.Throws<InvalidEnumArgumentException> (() => sf.Alignment = (StringAlignment) Int32.MinValue);
                        }
                }
 
@@ -195,11 +190,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void HotkeyPrefix_Invalid ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.HotkeyPrefix = (HotkeyPrefix) Int32.MinValue;
+                               Assert.Throws<InvalidEnumArgumentException> (() => sf.HotkeyPrefix = (HotkeyPrefix) Int32.MinValue);
                        }
                }
 
@@ -215,11 +209,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void LineAlignment_Invalid ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.LineAlignment = (StringAlignment) Int32.MinValue;
+                               Assert.Throws<InvalidEnumArgumentException> (() => sf.LineAlignment = (StringAlignment) Int32.MinValue);
                        }
                }
 
@@ -235,11 +228,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void Trimming_Invalid ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.Trimming = (StringTrimming) Int32.MinValue;
+                               Assert.Throws<InvalidEnumArgumentException> (() => sf.Trimming = (StringTrimming) Int32.MinValue);
                        }
                }
 
@@ -311,11 +303,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void SetTabStops_Null ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.SetTabStops (Single.NaN, null);
+                               Assert.Throws<NullReferenceException> (() => sf.SetTabStops (Single.NaN, null));
                        }
                }
 
@@ -330,11 +321,10 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void SetMeasurableCharacterRanges_Null ()
                {
                        using (StringFormat sf = new StringFormat ()) {
-                               sf.SetMeasurableCharacterRanges (null);
+                               Assert.Throws<NullReferenceException> (() => sf.SetMeasurableCharacterRanges (null));
                        }
                }
 
@@ -357,12 +347,11 @@ namespace MonoTests.System.Drawing{
                }
 
                [Test]
-               [ExpectedException (typeof (OverflowException))]
                public void SetMeasurableCharacterRanges_TooBig ()
                {
                        using (StringFormat sf = new StringFormat ()) {
                                CharacterRange[] range = new CharacterRange[33];
-                               sf.SetMeasurableCharacterRanges (range);
+                               Assert.Throws<OverflowException> (() => sf.SetMeasurableCharacterRanges (range));
                        }
                }
        }
index cc2dcd23ea94999a23aeb578f9ef9a1502d4c22d..f5b342291daa7ea7a563bc96b2bc0cc801143566 100644 (file)
@@ -67,10 +67,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null ()
                {
-                       new TextureBrush (null);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null));
                }
 
                [Test]
@@ -81,10 +80,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null_WrapMode ()
                {
-                       new TextureBrush (null, WrapMode.Clamp);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null, WrapMode.Clamp));
                }
 
                [Test]
@@ -97,24 +95,21 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void CtorImageWrapMode_Invalid ()
                {
-                       new TextureBrush (image, (WrapMode) Int32.MinValue);
+                       Assert.Throws<InvalidEnumArgumentException> (() => new TextureBrush (image, (WrapMode) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null_Rectangle ()
                {
-                       new TextureBrush (null, rect);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null, rect));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CtorImageRectangle_Empty ()
                {
-                       new TextureBrush (image, new Rectangle ());
+                       Assert.Throws<OutOfMemoryException> (() => new TextureBrush (image, new Rectangle ()));
                }
 
                [Test]
@@ -125,17 +120,15 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null_RectangleF ()
                {
-                       new TextureBrush (null, rectf);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null, rectf));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CtorImageRectangleF_Empty ()
                {
-                       new TextureBrush (image, new RectangleF ());
+                       Assert.Throws<OutOfMemoryException> (() => new TextureBrush (image, new RectangleF ()));
                }
 
                [Test]
@@ -146,17 +139,15 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null_RectangleAttributes ()
                {
-                       new TextureBrush (null, rect, attr);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null, rect, attr));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CtorImageRectangle_Empty_Attributes ()
                {
-                       new TextureBrush (image, new Rectangle (), attr);
+                       Assert.Throws<OutOfMemoryException> (() => new TextureBrush (image, new Rectangle (), attr));
                }
 
                [Test]
@@ -174,17 +165,15 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void CtorImage_Null_RectangleFAttributes ()
                {
-                       new TextureBrush (null, rectf, attr);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (null, rectf, attr));
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void CtorImageRectangleF_Empty_Attributes ()
                {
-                       new TextureBrush (image, new RectangleF ());
+                       Assert.Throws<OutOfMemoryException> (() => new TextureBrush (image, new RectangleF ()));
                }
 
                [Test]
@@ -211,10 +200,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void CtorImageWrapMode_Invalid_Rectangle ()
                {
-                       new TextureBrush (image, (WrapMode) Int32.MinValue, rect);
+                       Assert.Throws<InvalidEnumArgumentException> (() => new TextureBrush (image, (WrapMode) Int32.MinValue, rect));
                }
 
                [Test]
@@ -227,10 +215,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void CtorImageWrapMode_Invalid_RectangleF ()
                {
-                       new TextureBrush (image, (WrapMode) Int32.MinValue, rectf);
+                       Assert.Throws<InvalidEnumArgumentException> (() => new TextureBrush (image, (WrapMode) Int32.MinValue, rectf));
                }
 
                [Test]
@@ -249,20 +236,18 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void TextureBush_RectangleOutsideBitmap ()
                {
                        Rectangle r = new Rectangle (50, 50, 50, 50);
                        Assert.IsFalse (r.Y + r.Height <= bmp.Height, "Height");
                        Assert.IsFalse (r.X + r.Width <= bmp.Width, "Width");
-                       new TextureBrush (bmp, r);
+                       Assert.Throws<OutOfMemoryException> (() => new TextureBrush (bmp, r));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new TextureBrush (image).Transform = null;
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (image).Transform = null);
                }
 
                [Test]
@@ -285,10 +270,9 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidEnumArgumentException))]
                public void WrapMode_Invalid ()
                {
-                       new TextureBrush (image).WrapMode = (WrapMode)Int32.MinValue;
+                       Assert.Throws<InvalidEnumArgumentException> (() => new TextureBrush (image).WrapMode = (WrapMode)Int32.MinValue);
                }
 
                [Test]
@@ -300,12 +284,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Clone ()
                {
                        TextureBrush t = new TextureBrush (image);
                        t.Dispose ();
-                       t.Clone ();
+                       Assert.Throws<ArgumentException> (() => t.Clone ());
                }
 
                [Test]
@@ -318,26 +301,23 @@ namespace MonoTests.System.Drawing {
 
                [Test]
                [NUnit.Framework.Category ("NotDotNet")] // AccessViolationException under 2.0
-               [ExpectedException (typeof (ArgumentException))]
                public void Dispose_Image ()
                {
                        TextureBrush t = new TextureBrush (image);
                        t.Dispose ();
-                       Assert.IsNotNull (t.Image, "Image");
+                       Assert.Throws<ArgumentException> (() => Assert.IsNotNull (t.Image, "Image"));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform_Null ()
                {
-                       new TextureBrush (image).MultiplyTransform (null);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (image).MultiplyTransform (null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void MultiplyTransform_Null_Order ()
                {
-                       new TextureBrush (image).MultiplyTransform (null, MatrixOrder.Append);
+                       Assert.Throws<ArgumentNullException> (() => new TextureBrush (image).MultiplyTransform (null, MatrixOrder.Append));
                }
 
                [Test]
@@ -348,12 +328,11 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void MultiplyTransform_NonInvertible ()
                {
                        TextureBrush t = new TextureBrush (image);
                        Matrix noninvertible = new Matrix (123, 24, 82, 16, 47, 30);
-                       t.MultiplyTransform (noninvertible);
+                       Assert.Throws<ArgumentException> (() => t.MultiplyTransform (noninvertible));
                }
 
                [Test]
@@ -384,11 +363,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateTransform_InvalidOrder ()
                {
                        TextureBrush t = new TextureBrush (image);
-                       t.RotateTransform (720, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => t.RotateTransform (720, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -423,11 +401,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ScaleTransform_InvalidOrder ()
                {
                        TextureBrush t = new TextureBrush (image);
-                       t.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => t.ScaleTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -454,11 +431,10 @@ namespace MonoTests.System.Drawing {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TranslateTransform_InvalidOrder ()
                {
                        TextureBrush t = new TextureBrush (image);
-                       t.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => t.TranslateTransform (1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                private void Alpha_81828 (WrapMode mode, bool equals)
index d624f2e4c80f202b4b6fba87d480e4d02e08762c..1466512e844a34268377b6c94c11e2b900d66b3f 100644 (file)
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\Numerics\Hashing\HashHelpers.cs" />\r
-    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\\JitIntrinsicAttribute.cs" />\r
-    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\\Register.cs" />\r
-    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\\Vector.cs" />\r
-    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\\Vector_Operations.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\ConstantHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\JitIntrinsicAttribute.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Register.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector_Operations.cs" />\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
     <Compile Include="Assembly\TypeForwarders.cs" />\r
-    <Compile Include="SR.cs" />\r  </ItemGroup>\r
+    <Compile Include="corefx\SR.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
index 598f385ec36d0144c13c6bc53d55a87bd152c67a..60a63a261c5646709fe3bb4542612d0e91808271 100644 (file)
@@ -8,7 +8,7 @@
     <SchemaVersion>2.0</SchemaVersion>\r
     <ProjectGuid>{BD2FFDDC-BD89-4041-82F5-A696C941C7BE}</ProjectGuid>\r
     <OutputType>Library</OutputType>\r
-    <NoWarn>1699,414,436</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <OutputPath>./../../class/lib/net_4_x</OutputPath>\r
     <IntermediateOutputPath>obj-net_4_x</IntermediateOutputPath>\r
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
@@ -27,7 +27,7 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
     <DebugSymbols>true</DebugSymbols>\r
     <DebugType>full</DebugType>\r
-    <NoWarn>1699,414,436</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>false</Optimize>\r
     <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
@@ -35,7 +35,7 @@
   </PropertyGroup>\r
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
     <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,414,436</NoWarn>\r
+    <NoWarn>1699</NoWarn>\r
     <Optimize>true</Optimize>\r
     <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>\r
     <ErrorReport>prompt</ErrorReport>\r
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Globalization\FormatProvider.Number.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Numerics\Hashing\HashHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\JitIntrinsicAttribute.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Matrix3x2.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Matrix4x4.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Plane.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Quaternion.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector2.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector2_Intrinsics.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector3.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector3_Intrinsics.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector4.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Numerics.Vectors\src\System\Numerics\Vector4_Intrinsics.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Globalization\FormatProvider.BigInteger.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Globalization\FormatProvider.NumberBuffer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigInteger.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.AddSub.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.BitsBuffer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.DivRem.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.FastReducer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.GcdInv.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.PowMod.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigIntegerCalculator.SquMul.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\BigNumber.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\Complex.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime.Numerics\src\System\Numerics\NumericsHelpers.cs" />\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\BigInteger.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\BigIntegerBuilder.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\BigNumber.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Complex.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\HashCodeHelper.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\JITIntrinsicAttribute.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Matrix3x2.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Matrix4x4.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\NumericsHelpers.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Plane.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Quaternion.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector_Operations.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector2.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector2_Intrinsics.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector3.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector3_Intrinsics.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector4.cs" />\r
-    <Compile Include="..\referencesource\System.Numerics\System\Numerics\Vector4_Intrinsics.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
-    <Compile Include="ReferenceSources\SR.cs" />\r  </ItemGroup>\r
+    <Compile Include="corefx\SR.cs" />\r
+    <Compile Include="corefx\Vector.cs" />\r  </ItemGroup>\r
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
        Other similar extension points exist, see Microsoft.Common.targets.\r
   <Target Name="BeforeBuild">\r
index 145f30f4b6ccd9d7acf6a9c1650b765c85b89d6e..8602d8ff40a137e2acdefca3b2a680759e2291ac 100644 (file)
@@ -25,6 +25,8 @@ EXTRA_DISTFILES = \
        Test/System.Security.Cryptography.Pkcs/detached.data \
        Test/System.Security.Cryptography.Pkcs/detached.p7
 
+RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx
+
 include ../../build/library.make
 
 $(build_lib): $(secxml_libdir)/System.dll $(MONO_SECURITY_DLL)
index 7a1464321c01bfde4fd1178fa7cce7ec19a3578a..ab9f2401ef1891a33b3ba3e3ab79622278c46014 100644 (file)
@@ -53,6 +53,7 @@
     <Compile Include="..\..\build\common\Locale.cs" />\r
     <Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />\r
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />\r
     <Compile Include="Mono.Xml\XmlCanonicalizer.cs" />\r
index 05c2b091d98b229262f43bc1c25577656f0009a2..2ebec9809470e239cd1a6902fa06ead25ef57bf5 100644 (file)
@@ -624,34 +624,36 @@ namespace System.Security.Cryptography.Xml {
 
                public void ComputeSignature () 
                {
-                       if (key != null) {
-                               if (m_signature.SignedInfo.SignatureMethod == null)
-                                       // required before hashing
-                                       m_signature.SignedInfo.SignatureMethod = key.SignatureAlgorithm;
-                               else if (m_signature.SignedInfo.SignatureMethod != key.SignatureAlgorithm)
-                                       throw new CryptographicException ("Specified SignatureAlgorithm is not supported by the signing key.");
-                               DigestReferences ();
-
-                               AsymmetricSignatureFormatter signer = null;
-                               // in need for a CryptoConfig factory
-                               if (key is DSA)
-                                       signer = new DSASignatureFormatter (key);
-                               else if (key is RSA) 
-                                       signer = new RSAPKCS1SignatureFormatter (key);
-
-                               if (signer != null) {
-                                       SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (m_signature.SignedInfo.SignatureMethod);
-
-                                       HashAlgorithm hash = GetHash (sd.DigestAlgorithm, false);
-                                       // get the hash of the C14N SignedInfo element
-                                       byte[] digest = hash.ComputeHash (SignedInfoTransformed ());
-
-                                       signer.SetHashAlgorithm ("SHA1");
-                                       m_signature.SignatureValue = signer.CreateSignature (digest);
+                       DigestReferences ();
+
+                       if (key == null)
+                               throw new CryptographicException (SR.Cryptography_Xml_LoadKeyFailed);
+
+                       // Check the signature algorithm associated with the key so that we can accordingly set the signature method
+                       if (SignedInfo.SignatureMethod == null) {
+                               if (key is DSA) {
+                                       SignedInfo.SignatureMethod = XmlDsigDSAUrl;
+                               } else if (key is RSA) {
+                                       // Default to RSA-SHA1
+                                       SignedInfo.SignatureMethod = XmlDsigRSASHA1Url;
+                               } else {
+                                       throw new CryptographicException (SR.Cryptography_Xml_CreatedKeyFailed);
                                }
                        }
-                       else
-                               throw new CryptographicException ("signing key is not specified");
+
+                       // See if there is a signature description class defined in the Config file
+                       SignatureDescription signatureDescription = CryptoConfig.CreateFromName (SignedInfo.SignatureMethod) as SignatureDescription;
+                       if (signatureDescription == null)
+                               throw new CryptographicException (SR.Cryptography_Xml_SignatureDescriptionNotCreated);
+
+                       HashAlgorithm hashAlg = signatureDescription.CreateDigest ();
+                       if (hashAlg == null)
+                               throw new CryptographicException (SR.Cryptography_Xml_CreateHashAlgorithmFailed);
+
+                       byte[] hashvalue = hashAlg.ComputeHash (SignedInfoTransformed ());
+                       AsymmetricSignatureFormatter asymmetricSignatureFormatter = signatureDescription.CreateFormatter (key);
+
+                       m_signature.SignatureValue = asymmetricSignatureFormatter.CreateSignature (hashAlg);
                }
 
                public void ComputeSignature (KeyedHashAlgorithm macAlg) 
index 0b94dd5b9ac2f3461dd68b18acb8c72893653133..0beec42df40124230256753d403f70956e215061 100644 (file)
@@ -1,4 +1,5 @@
 Assembly/AssemblyInfo.cs
+corefx/SR.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
 Mono.Security.Cryptography/ManagedProtection.cs
index 90a4d3517e716609680bee5657e831f24c269a22..b8059fe7a16d9d672772055366d449c76a326e79 100644 (file)
@@ -1,3 +1,4 @@
+../corefx/SR.cs
 System.Security.Cryptography/CryptographicAttributeObjectCollectionTest.cs
 System.Security.Cryptography/CryptographicAttributeObjectEnumeratorTest.cs
 System.Security.Cryptography/CryptographicAttributeTest.cs
index 0a71f570a9e440a6c8aa84cde7d0b0f5e78b59b6..1c1d7a977724df2da860817edfe6c26e63ad9a19 100644 (file)
@@ -30,8 +30,68 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                }
        }
 
+       /// <summary>
+       /// This class is for testing purposes only. It allows to reproduce an error
+       /// that happens when an unsupported signing key is being used
+       /// while computing a signature.
+       /// </summary>
+       internal sealed class CustomAsymmetricAlgorithm : AsymmetricAlgorithm {
+       }
+
+       /// <summary>
+       /// This class is for testing purposes only. It allows to reproduce an error
+       /// that happens when the hash algorithm cannot be created.
+       /// </summary>
+       public sealed class BadHashAlgorithmSignatureDescription : SignatureDescription {
+               public BadHashAlgorithmSignatureDescription ()
+               {
+                       KeyAlgorithm = RSA.Create ().GetType ().FullName;
+                       DigestAlgorithm = SHA1.Create ().GetType ().FullName;
+                       FormatterAlgorithm = typeof (RSAPKCS1SignatureFormatter).FullName;
+                       DeformatterAlgorithm = typeof (RSAPKCS1SignatureDeformatter).FullName;
+               }
+
+               public override HashAlgorithm CreateDigest ()
+               {
+                       return null;
+               }
+       }
+
+       /// <summary>
+       /// This class is for testing purposes only.
+       /// It represents a correctly defined custom signature description.
+       /// </summary>
+       public sealed class RsaPkcs1Sha512SignatureDescription : SignatureDescription {
+               private const string Sha512HashAlgorithm = "SHA512";
+
+               public RsaPkcs1Sha512SignatureDescription ()
+               {
+                       KeyAlgorithm = RSA.Create ().GetType ().FullName;
+                       DigestAlgorithm = SHA512.Create ().GetType ().FullName;
+                       FormatterAlgorithm = typeof (RSAPKCS1SignatureFormatter).FullName;
+                       DeformatterAlgorithm = typeof (RSAPKCS1SignatureDeformatter).FullName;
+               }
+
+               public override AsymmetricSignatureFormatter CreateFormatter (AsymmetricAlgorithm key)
+               {
+                       var formatter = new RSAPKCS1SignatureFormatter (key);
+                       formatter.SetHashAlgorithm (Sha512HashAlgorithm);
+
+                       return formatter;
+               }
+
+               public override AsymmetricSignatureDeformatter CreateDeformatter (AsymmetricAlgorithm key)
+               {
+                       var deformatter = new RSAPKCS1SignatureDeformatter (key);
+                       deformatter.SetHashAlgorithm (Sha512HashAlgorithm);
+
+                       return deformatter;
+               }
+       }
+
        [TestFixture]
        public class SignedXmlTest {
+               private const string XmlDsigNamespacePrefix = "ds";
 
                private const string signature = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>CTnnhjxUQHJmD+t1MjVXrOW+MCA=</DigestValue></Reference></SignedInfo><SignatureValue>dbFt6Zw3vR+Xh7LbM/vuifyFA7gPh/NlDM2Glz/SJBsveISieuTBpZlk/zavAeuXR/Nu0Ztt4OP4tCOg09a2RNlrTP0dhkeEfL1jTzpnVaLHuQbCiwOWCgbRif7Xt7N12FuiHYb3BltP/YyXS4E12NxlGlqnDiFA1v/mkK5+C1o=</SignatureValue><KeyInfo><KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>hEfTJNa2idz2u+fSYDDG4Lx/xuk4aBbvOPVNqgc1l9Y8t7Pt+ZyF+kkF3uUl8Y0700BFGAsprnhwrWENK+PGdtvM5796ZKxCCa0ooKkofiT4355HqK26hpV8dvj38vq/rkJe1jHZgkTKa+c/0vjcYZOI/RT/IZv9JfXxVWLuLxk=</Modulus><Exponent>EQ==</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><ObjectListTag xmlns=\"\" /></Object></Signature>";
 
@@ -1548,5 +1608,164 @@ namespace MonoTests.System.Security.Cryptography.Xml {
                        SignedXml sign = GetSignedXml (xml);
                        sign.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue")));
                }
+
+               [Test]
+               public void ComputeSignature_WhenSigningKeyIsNotSpecified_ThrowsCryptographicException ()
+               {
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.AddReference (reference);
+
+                       var ex = Assert.Throws<CryptographicException> (() => signedXml.ComputeSignature(), "Exception");
+                       Assert.That (ex.Message, Is.EqualTo (SR.Cryptography_Xml_LoadKeyFailed), "Message");
+               }
+
+               [Test]
+               public void ComputeSignature_WhenSignatureMethodIsNotSpecifiedAndRsaSigningKeyIsUsed_UsesRsaSha1Algorithm ()
+               {
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = RSA.Create ();
+                       signedXml.AddReference (reference);
+
+                       signedXml.ComputeSignature ();
+
+                       var signature = signedXml.GetXml ();
+
+                       var namespaceManager = new XmlNamespaceManager (signature.OwnerDocument.NameTable);
+                       namespaceManager.AddNamespace ("ds", SignedXml.XmlDsigNamespaceUrl);
+
+                       var signatureMethodElement = signature.SelectSingleNode (
+                               string.Format ("/{0}:SignedInfo/{0}:SignatureMethod", XmlDsigNamespacePrefix),
+                               namespaceManager);
+
+                       Assert.That (signatureMethodElement.Attributes["Algorithm"].Value, Is.EqualTo (SignedXml.XmlDsigRSASHA1Url));
+               }
+
+               [Test]
+               public void ComputeSignature_WhenSignatureMethodIsNotSpecifiedAndDsaSigningKeyIsUsed_UsesDsaSha1Algorithm ()
+               {
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = DSA.Create ();
+                       signedXml.AddReference (reference);
+
+                       signedXml.ComputeSignature ();
+
+                       var signature = signedXml.GetXml ();
+
+                       var namespaceManager = new XmlNamespaceManager (signature.OwnerDocument.NameTable);
+                       namespaceManager.AddNamespace ("ds", SignedXml.XmlDsigNamespaceUrl);
+
+                       var signatureMethodElement = signature.SelectSingleNode (
+                               string.Format ("/{0}:SignedInfo/{0}:SignatureMethod", XmlDsigNamespacePrefix),
+                               namespaceManager);
+
+                       Assert.That (signatureMethodElement.Attributes["Algorithm"].Value, Is.EqualTo (SignedXml.XmlDsigDSAUrl));
+               }
+
+               [Test]
+               public void ComputeSignature_WhenSignatureMethodIsNotSpecifiedAndNotSupportedSigningKeyIsUsed_ThrowsCryptographicException ()
+               {
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = new CustomAsymmetricAlgorithm ();
+                       signedXml.AddReference (reference);
+
+                       var ex = Assert.Throws<CryptographicException> (() => signedXml.ComputeSignature (), "Exception");
+                       Assert.That (ex.Message, Is.EqualTo (SR.Cryptography_Xml_CreatedKeyFailed), "Message");
+               }
+
+               [Test]
+               public void ComputeSignature_WhenNotSupportedSignatureMethodIsSpecified_ThrowsCryptographicException ()
+               {
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = RSA.Create ();
+                       signedXml.SignedInfo.SignatureMethod = "not supported signature method";
+                       signedXml.AddReference (reference);
+
+                       var ex = Assert.Throws<CryptographicException> (() => signedXml.ComputeSignature(), "Exception");
+                       Assert.That (ex.Message, Is.EqualTo (SR.Cryptography_Xml_SignatureDescriptionNotCreated), "Message");
+               }
+
+               [Test]
+               public void ComputeSignature_WhenNotSupportedSignatureHashAlgorithmIsSpecified_ThrowsCryptographicException ()
+               {
+                       const string algorithmName = "not supported signature hash algorithm";
+
+                       CryptoConfig.AddAlgorithm (typeof (BadHashAlgorithmSignatureDescription), algorithmName);
+
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = RSA.Create ();
+                       signedXml.SignedInfo.SignatureMethod = algorithmName;
+                       signedXml.AddReference (reference);
+
+                       var ex = Assert.Throws<CryptographicException> (() => signedXml.ComputeSignature (), "Exception");
+                       Assert.That (ex.Message, Is.EqualTo (SR.Cryptography_Xml_CreateHashAlgorithmFailed), "Message");
+               }
+
+               [Test]
+               public void ComputeSignature_WhenCustomSignatureMethodIsSpecified_UsesCustomAlgorithm ()
+               {
+                       const string algorithmName = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
+
+                       CryptoConfig.AddAlgorithm (typeof (RsaPkcs1Sha512SignatureDescription), algorithmName);
+
+                       var unsignedXml = new XmlDocument ();
+                       unsignedXml.LoadXml ("<test />");
+
+                       var reference = new Reference { Uri = "" };
+                       reference.AddTransform (new XmlDsigEnvelopedSignatureTransform ());
+
+                       var signedXml = new SignedXml (unsignedXml);
+                       signedXml.SigningKey = RSA.Create ();
+                       signedXml.SignedInfo.SignatureMethod = algorithmName;
+                       signedXml.AddReference (reference);
+
+                       signedXml.ComputeSignature ();
+
+                       var signature = signedXml.GetXml ();
+
+                       var namespaceManager = new XmlNamespaceManager (signature.OwnerDocument.NameTable);
+                       namespaceManager.AddNamespace ("ds", SignedXml.XmlDsigNamespaceUrl);
+
+                       var signatureMethodElement = signature.SelectSingleNode (
+                               string.Format ("/{0}:SignedInfo/{0}:SignatureMethod", XmlDsigNamespacePrefix),
+                               namespaceManager);
+
+                       Assert.That (signatureMethodElement.Attributes["Algorithm"].Value, Is.EqualTo (algorithmName));
+               }
        }
-}
+}
\ No newline at end of file
diff --git a/mcs/class/System.Security/corefx/SR.cs b/mcs/class/System.Security/corefx/SR.cs
new file mode 100644 (file)
index 0000000..6b6ac47
--- /dev/null
@@ -0,0 +1,93 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string ArgumentOutOfRange_Index = "Index was out of range.  Must be non-negative and less than the size of the collection.";
+       public const string Arg_EmptyOrNullString = "String cannot be empty or null.";
+       public const string Cryptography_Partial_Chain = "A certificate chain could not be built to a trusted root authority.";
+       public const string Cryptography_Xml_BadWrappedKeySize = "Bad wrapped key size.";
+       public const string Cryptography_Xml_CipherValueElementRequired = "A Cipher Data element should have either a CipherValue or a CipherReference element.";
+       public const string Cryptography_Xml_CreateHashAlgorithmFailed = "Could not create hash algorithm object.";
+       public const string Cryptography_Xml_CreateTransformFailed = "Could not create the XML transformation identified by the URI {0}.";
+       public const string Cryptography_Xml_CreatedKeyFailed = "Failed to create signing key.";
+       public const string Cryptography_Xml_DigestMethodRequired = "A DigestMethod must be specified on a Reference prior to generating XML.";
+       public const string Cryptography_Xml_DigestValueRequired = "A Reference must contain a DigestValue.";
+       public const string Cryptography_Xml_EnvelopedSignatureRequiresContext = "An XmlDocument context is required for enveloped transforms.";
+       public const string Cryptography_Xml_InvalidElement = "Malformed element {0}.";
+       public const string Cryptography_Xml_InvalidEncryptionProperty = "Malformed encryption property element.";
+       public const string Cryptography_Xml_InvalidKeySize = "The key size should be a non negative integer.";
+       public const string Cryptography_Xml_InvalidReference = "Malformed reference element.";
+       public const string Cryptography_Xml_InvalidSignatureLength = "The length of the signature with a MAC should be less than the hash output length.";
+       public const string Cryptography_Xml_InvalidSignatureLength2 = "The length in bits of the signature with a MAC should be a multiple of 8.";
+       public const string Cryptography_Xml_KeyInfoRequired = "A KeyInfo element is required to check the signature.";
+       public const string Cryptography_Xml_KW_BadKeySize = "The length of the encrypted data in Key Wrap is either 32, 40 or 48 bytes.";
+       public const string Cryptography_Xml_LoadKeyFailed = "Signing key is not loaded.";
+       public const string Cryptography_Xml_MissingAlgorithm = "Symmetric algorithm is not specified.";
+       public const string Cryptography_Xml_MissingCipherData = "Cipher data is not specified.";
+       public const string Cryptography_Xml_MissingDecryptionKey = "Unable to retrieve the decryption key.";
+       public const string Cryptography_Xml_MissingEncryptionKey = "Unable to retrieve the encryption key.";
+       public const string Cryptography_Xml_NotSupportedCryptographicTransform = "The specified cryptographic transform is not supported.";
+       public const string Cryptography_Xml_ReferenceElementRequired = "At least one Reference element is required.";
+       public const string Cryptography_Xml_ReferenceTypeRequired = "The Reference type must be set in an EncryptedReference object.";
+       public const string Cryptography_Xml_SelfReferenceRequiresContext = "An XmlDocument context is required to resolve the Reference Uri {0}.";
+       public const string Cryptography_Xml_SignatureDescriptionNotCreated = "SignatureDescription could not be created for the signature algorithm supplied.";
+       public const string Cryptography_Xml_SignatureMethodKeyMismatch = "The key does not fit the SignatureMethod.";
+       public const string Cryptography_Xml_SignatureMethodRequired = "A signature method is required.";
+       public const string Cryptography_Xml_SignatureValueRequired = "Signature requires a SignatureValue.";
+       public const string Cryptography_Xml_SignedInfoRequired = "Signature requires a SignedInfo.";
+       public const string Cryptography_Xml_TransformIncorrectInputType = "The input type was invalid for this transform.";
+       public const string Cryptography_Xml_IncorrectObjectType = "Type of input object is invalid.";
+       public const string Cryptography_Xml_UnknownTransform = "Unknown transform has been encountered.";
+       public const string Cryptography_Xml_UriNotResolved = "Unable to resolve Uri {0}.";
+       public const string Cryptography_Xml_UriNotSupported = " The specified Uri is not supported.";
+       public const string Cryptography_Xml_UriRequired = "A Uri attribute is required for a CipherReference element.";
+       public const string Cryptography_Xml_XrmlMissingContext = "Null Context property encountered.";
+       public const string Cryptography_Xml_XrmlMissingIRelDecryptor = "IRelDecryptor is required.";
+       public const string Cryptography_Xml_XrmlMissingIssuer = "Issuer node is required.";
+       public const string Cryptography_Xml_XrmlMissingLicence = "License node is required.";
+       public const string Cryptography_Xml_XrmlUnableToDecryptGrant = "Unable to decrypt grant content.";
+       public const string NotSupported_KeyAlgorithm = "The certificate key algorithm is not supported.";
+       public const string Log_ActualHashValue = "Actual hash value: {0}";
+       public const string Log_BeginCanonicalization = "Beginning canonicalization using \"{0}\" ({1}).";
+       public const string Log_BeginSignatureComputation = "Beginning signature computation.";
+       public const string Log_BeginSignatureVerification = "Beginning signature verification.";
+       public const string Log_BuildX509Chain = "Building and verifying the X509 chain for certificate {0}.";
+       public const string Log_CanonicalizationSettings = "Canonicalization transform is using resolver {0} and base URI \"{1}\".";
+       public const string Log_CanonicalizedOutput = "Output of canonicalization transform: {0}";
+       public const string Log_CertificateChain = "Certificate chain:";
+       public const string Log_CheckSignatureFormat = "Checking signature format using format validator \"[{0}] {1}.{2}\".";
+       public const string Log_CheckSignedInfo = "Checking signature on SignedInfo with id \"{0}\".";
+       public const string Log_FormatValidationSuccessful = "Signature format validation was successful.";
+       public const string Log_FormatValidationNotSuccessful = "Signature format validation failed.";
+       public const string Log_KeyUsages = "Found key usages \"{0}\" in extension {1} on certificate {2}.";
+       public const string Log_NoNamespacesPropagated = "No namespaces are being propagated.";
+       public const string Log_PropagatingNamespace = "Propagating namespace {0}=\"{1}\".";
+       public const string Log_RawSignatureValue = "Raw signature: {0}";
+       public const string Log_ReferenceHash = "Reference {0} hashed with \"{1}\" ({2}) has hash value {3}, expected hash value {4}.";
+       public const string Log_RevocationMode = "Revocation mode for chain building: {0}.";
+       public const string Log_RevocationFlag = "Revocation flag for chain building: {0}.";
+       public const string Log_SigningAsymmetric = "Calculating signature with key {0} using signature description {1}, hash algorithm {2}, and asymmetric signature formatter {3}.";
+       public const string Log_SigningHmac = "Calculating signature using keyed hash algorithm {0}.";
+       public const string Log_SigningReference = "Hashing reference {0}, Uri \"{1}\", Id \"{2}\", Type \"{3}\" with hash algorithm \"{4}\" ({5}).";
+       public const string Log_TransformedReferenceContents = "Transformed reference contents: {0}";
+       public const string Log_UnsafeCanonicalizationMethod = "Canonicalization method \"{0}\" is not on the safe list. Safe canonicalization methods are: {1}.";
+       public const string Log_UrlTimeout = "URL retrieval timeout for chain building: {0}.";
+       public const string Log_VerificationFailed = "Verification failed checking {0}.";
+       public const string Log_VerificationFailed_References = "references";
+       public const string Log_VerificationFailed_SignedInfo = "SignedInfo";
+       public const string Log_VerificationFailed_X509Chain = "X509 chain verification";
+       public const string Log_VerificationFailed_X509KeyUsage = "X509 key usage verification";
+       public const string Log_VerificationFlag = "Verification flags for chain building: {0}.";
+       public const string Log_VerificationTime = "Verification time for chain building: {0}.";
+       public const string Log_VerificationWithKeySuccessful = "Verification with key {0} was successful.";
+       public const string Log_VerificationWithKeyNotSuccessful = "Verification with key {0} was not successful.";
+       public const string Log_VerifyReference = "Processing reference {0}, Uri \"{1}\", Id \"{2}\", Type \"{3}\".";
+       public const string Log_VerifySignedInfoAsymmetric = "Verifying SignedInfo using key {0}, signature description {1}, hash algorithm {2}, and asymmetric signature deformatter {3}.";
+       public const string Log_VerifySignedInfoHmac = "Verifying SignedInfo using keyed hash algorithm {0}.";
+       public const string Log_X509ChainError = "Error building X509 chain: {0}: {1}.";
+       public const string Log_XmlContext = "Using context: {0}";
+       public const string Log_SignedXmlRecursionLimit = "Signed xml recursion limit hit while trying to decrypt the key. Reference {0} hashed with \"{1}\" and ({2}).";
+       public const string Log_UnsafeTransformMethod = "Transform method \"{0}\" is not on the safe list. Safe transform methods are: {1}.";
+}
\ No newline at end of file
index 06eacbcbcf7cd073d64de672105b60d866fa266a..0e4fb4ef46d1bc097411a2d11d8aa3550585f207 100644 (file)
@@ -89,6 +89,7 @@ TEST_DISTFILES = \
        Test/System.Resources/compat_1_1.resx \
        Test/System.Resources/compat_2_0.resx \
        Test/System.Windows.Forms/bitmaps/a.png \
+       Test/simple/Program.cs \
        Test/DummyAssembly/AnotherSerializable.cs \
        Test/DummyAssembly/Convertable.cs \
        Test/DummyAssembly/Properties/AssemblyInfo.cs \
@@ -127,3 +128,9 @@ $(PREBUILT): %.prebuilt: %
        cp $* $@
 
 dist-default: $(PREBUILT)
+
+simple-test.exe: Test/simple/Program.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll
+       $(CSCOMPILE) -out:$@ Test/simple/Program.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll
+
+test-simple: simple-test.exe
+       $(TEST_RUNTIME) simple-test.exe
index ae3622b9b6e31f7d48cbd359b3e9812e67747590..d56abff246526a806e0d990d0658dab3338ac3fb 100644 (file)
@@ -397,13 +397,13 @@ namespace System.Windows.Forms
        
        internal class GnomeUtil
        {
-               const string libgdk = "libgdk-x11-2.0.so.0";
-               const string libgdk_pixbuf = "libgdk_pixbuf-2.0.so.0";
-               const string libgtk = "libgtk-x11-2.0.so.0";
-               const string libglib = "libglib-2.0.so.0";
-               const string libgobject = "libgobject-2.0.so.0";
-               const string libgnomeui = "libgnomeui-2.so.0";
-               const string librsvg = "librsvg-2.so.2";
+               const string libgdk = "libgdk-x11-2.0";
+               const string libgdk_pixbuf = "libgdk_pixbuf-2.0";
+               const string libgtk = "libgtk-x11-2.0";
+               const string libglib = "libglib-2.0";
+               const string libgobject = "libgobject-2.0";
+               const string libgnomeui = "libgnomeui-2";
+               const string librsvg = "librsvg-2";
                
                [DllImport(librsvg)]
                static extern IntPtr rsvg_pixbuf_from_file_at_size (string file_name, int  width, int  height, out IntPtr error);
index a1389ca77c36ad96c25bf345afa686fdcd7cc3f8..a004e0cce8460e96a5bcd8bc691879e37c4e04bb 100644 (file)
@@ -267,8 +267,8 @@ namespace System.Windows.Forms {
                #endregion      // Methods
 
                #region DllImports
-               const string libgdk = "libgdk-x11-2.0.so.0";
-               const string libgtk = "libgtk-x11-2.0.so.0";
+               const string libgdk = "libgdk-x11-2.0";
+               const string libgtk = "libgtk-x11-2.0";
                
                [DllImport(libgtk)]
                static extern bool gtk_init_check (IntPtr argc, IntPtr argv);
diff --git a/mcs/class/System.Windows.Forms/Test/simple/Program.cs b/mcs/class/System.Windows.Forms/Test/simple/Program.cs
new file mode 100644 (file)
index 0000000..a2ff1d1
--- /dev/null
@@ -0,0 +1,39 @@
+//
+// Program.cs
+//
+// Author:
+//     Alexander Köplinger (alexander.koeplinger@xamarin.com)
+// 
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace SimpleTest {
+       public static class Program {
+               public static int Main ()
+               {
+                       // use the simplest WinForms code that invokes the XplatUI
+                       // and causes the X connection to be established, if this fails
+                       // then something is seriously wrong
+                       System.Windows.Forms.Application.Idle += null;
+                       return 0;
+               }
+       }
+}
\ No newline at end of file
index 23554997cb6a1f6bbc10ffebbdc6f1a9e587e2c3..c71e98acfbb3de983040762641d00a4dd7083846 100644 (file)
@@ -14,6 +14,10 @@ RESOURCE_FILES = \
        resources/Question.wav
 endif
 
+RESX_RESOURCE_STRING = \
+       ../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx \
+       ../../../external/corefx/src/System.Collections/src/Resources/Strings.resx
+
 TEST_RESOURCES = \
        Test/System/test-uri-props.txt \
        Test/System/test-uri-props-manual.txt \
index 171360d9052ed685b4dbe768b6b6e200a47c62b9..7fd9f4e617cb14446f1c0b378f89c4cf8428b896 100644 (file)
@@ -73,65 +73,8 @@ partial class SR
        public const string Argument_FrameworkNameInvalidVersion = "FrameworkName version component is invalid.";
        public const string Argument_FrameworkNameMissingVersion = "FrameworkName version component is missing.";
        public const string ArgumentNull_Key = "Key cannot be null.";
-       public const string Argument_AddingDuplicate = "An entry with the same key already exists.";
        public const string Argument_InvalidValue = "Argument {0} should be larger than {1}.";
-       public const string ArgumentOutOfRange_NeedNonNegNum = "Index is less than zero.";
-       public const string ArgumentOutOfRange_InvalidThreshold = "The specified threshold for creating dictionary is out of range.";
-       public const string InvalidOperation_EnumFailedVersion = "Collection was modified after the enumerator was instantiated.";
-       public const string InvalidOperation_EnumOpCantHappen = "Enumerator is positioned before the first element or after the last element of the collection.";
        public const string Arg_MultiRank = "Multi dimension array is not supported on this operation.";
-       public const string Arg_NonZeroLowerBound = "The lower bound of target array must be zero.";
-       public const string Arg_InsufficientSpace = "Insufficient space in the target location to copy the information.";
-       public const string NotSupported_EnumeratorReset = "Reset is not supported on the Enumerator.";
-       public const string Invalid_Array_Type = "Target array type is not compatible with the type of items in the collection.";
-       public const string Serialization_InvalidOnDeser = "OnDeserialization method was called while the object was not being deserialized.";
-       public const string Serialization_MissingValues = "The values for this collection are missing.";
-       public const string Serialization_MismatchedCount = "The serialized Count information doesn't match the number of items.";
-       public const string ExternalLinkedListNode = "The LinkedList node does not belong to current LinkedList.";
-       public const string LinkedListNodeIsAttached = "The LinkedList node already belongs to a LinkedList.";
-       public const string LinkedListEmpty = "The LinkedList is empty.";
-       public const string Arg_WrongType = "The value \"{0}\" isn't of type \"{1}\" and can't be used in this generic collection.";
-       public const string Argument_ItemNotExist = "The specified item does not exist in this KeyedCollection.";
-       public const string Argument_ImplementIComparable = "At least one object must implement IComparable.";
-       public const string InvalidOperation_EmptyCollection = "This operation is not valid on an empty collection.";
-       public const string InvalidOperation_EmptyQueue = "Queue empty.";
-       public const string InvalidOperation_EmptyStack = "Stack empty.";
-       public const string InvalidOperation_CannotRemoveFromStackOrQueue = "Removal is an invalid operation for Stack or Queue.";
-       public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection.";
-       public const string ArgumentOutOfRange_SmallCapacity = "capacity was less than the current size.";
-       public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length.";
-       public const string NotSupported_KeyCollectionSet = "Mutating a key collection derived from a dictionary is not allowed.";
-       public const string NotSupported_ValueCollectionSet = "Mutating a value collection derived from a dictionary is not allowed.";
-       public const string NotSupported_ReadOnlyCollection = "Collection is read-only.";
-       public const string NotSupported_SortedListNestedWrite = "This operation is not supported on SortedList nested types because they require modifying the original SortedList.";
-       public const string BlockingCollection_ctor_BoundedCapacityRange = "The boundedCapacity argument must be positive.";
-       public const string BlockingCollection_ctor_CountMoreThanCapacity = "The collection argument contains more items than are allowed by the boundedCapacity.";
-       public const string BlockingCollection_Add_ConcurrentCompleteAdd = "CompleteAdding may not be used concurrently with additions to the collection.";
-       public const string BlockingCollection_Add_Failed = "The underlying collection didn't accept the item.";
-       public const string BlockingCollection_Take_CollectionModified = "The underlying collection was modified from outside of the BlockingCollection<T>.";
-       public const string BlockingCollection_Completed = "The collection has been marked as complete with regards to additions.";
-       public const string BlockingCollection_Disposed = "The collection has been disposed.";
-       public const string BlockingCollection_TimeoutInvalid = "The specified timeout must represent a value between -1 and {0}, inclusive.";
-       public const string BlockingCollection_CantTakeWhenDone = "The collection argument is empty and has been marked as complete with regards to additions.";
-       public const string BlockingCollection_CantAddAnyWhenCompleted = "At least one of the specified collections is marked as complete with regards to additions.";
-       public const string BlockingCollection_CantTakeAnyWhenAllDone = "All collections are marked as complete with regards to additions.";
-       public const string BlockingCollection_ValidateCollectionsArray_ZeroSize = "The collections argument is a zero-length array.";
-       public const string BlockingCollection_ValidateCollectionsArray_LargeSize = "The collections length is greater than the supported range for 32 bit machine.";
-       public const string BlockingCollection_ValidateCollectionsArray_NullElems = "The collections argument contains at least one null element.";
-       public const string BlockingCollection_ValidateCollectionsArray_DispElems = "The collections argument contains at least one disposed element.";
-       public const string BlockingCollection_CompleteAdding_AlreadyDone = "The collection argument has already been marked as complete with regards to additions.";
-       public const string BlockingCollection_CopyTo_NonNegative = "The index argument must be greater than or equal zero.";
-       public const string BlockingCollection_CopyTo_TooManyElems = "The number of elements in the collection is greater than the available space from index to the end of the destination array.";
-       public const string BlockingCollection_CopyTo_MultiDim = "The array argument is multidimensional.";
-       public const string BlockingCollection_CopyTo_IncorrectType = "The array argument is of the incorrect type.";
-       public const string ConcurrentBag_Ctor_ArgumentNullException = "The collection argument is null.";
-       public const string ConcurrentBag_CopyTo_ArgumentNullException = "The array argument is null.";
-       public const string ConcurrentBag_CopyTo_ArgumentOutOfRangeException = "The index argument must be greater than or equal zero.";
-       public const string ConcurrentBag_CopyTo_ArgumentException_IndexGreaterThanLength = "The index argument must be less than the array length.";
-       public const string ConcurrentBag_CopyTo_ArgumentException_NoEnoughSpace = "The number of elements in the bag is greater than the available space from index to the end of the destination array.";
-       public const string ConcurrentBag_CopyTo_ArgumentException_InvalidArrayType = "The array argument is multidimensional or of an incorrect type.";
-       public const string ConcurrentCollection_SyncRoot_NotSupported = "The SyncRoot property may not be used for the synchronization of concurrent collections.";
-       public const string Common_OperationCanceled = "The operation was canceled.";
        public const string Barrier_ctor_ArgumentOutOfRange = "The participantCount argument must be non-negative and less than or equal to 32767.";
        public const string Barrier_AddParticipants_NonPositive_ArgumentOutOfRange = "The participantCount argument must be a positive value.";
        public const string Barrier_AddParticipants_Overflow_ArgumentOutOfRange = "Adding participantCount participants would result in the number of participants exceeding the maximum number allowed.";
@@ -296,7 +239,6 @@ partial class SR
        public const string CountTooSmall = "Count cannot be less than -1.";
        public const string EnumNotStarted = "Enumeration has either not started or has already finished.";
        public const string Arg_InvalidArrayType = "Target array type is not compatible with the type of items in the collection.";
-       public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action.";
        public const string RegexMatchTimeoutException_Occurred = "The RegEx engine has timed out while trying to match a pattern to an input string. This can occur for many reasons, including very large inputs or excessive backtracking caused by nested quantifiers, back-references and other factors.";
        public const string IllegalDefaultRegexMatchTimeoutInAppDomain = "AppDomain data '{0}' contains an invalid value or object for specifying a default matching timeout for System.Text.RegularExpressions.Regex.";
        public const string FileObject_AlreadyOpen = "The file is already open.  Call Close before trying to open the FileObject again.";
@@ -325,7 +267,6 @@ partial class SR
        public const string Arg_EmptyOrNullArray = "Array cannot be empty or null.";
        public const string Argument_InvalidClassAttribute = "The value of \"class\" attribute is invalid.";
        public const string Argument_InvalidNameType = "The value of \"nameType\" is invalid.";
-       public const string InvalidOperation_EnumNotStarted = "Enumeration has not started.  Call MoveNext.";
        public const string InvalidOperation_DuplicateItemNotAllowed = "Duplicate items are not allowed in the collection.";
        public const string Cryptography_Asn_MismatchedOidInCollection = "The AsnEncodedData object does not have the same OID for the collection.";
        public const string Cryptography_Cms_Envelope_Empty_Content = "Cannot create CMS enveloped for empty content.";
@@ -1379,7 +1320,6 @@ partial class SR
        public const string Arg_InvalidSerialPort = "The given port name does not start with COM/com or does not resolve to a valid serial port.";
        public const string Arg_InvalidSerialPortExtended = "The given port name is invalid.  It may be a valid port, but not a serial port.";
        public const string Arg_SecurityException = "The port name cannot start with '\\'.";
-       public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
        public const string ArgumentNull_Array = "Array cannot be null.";
        public const string ArgumentNull_Buffer = "Buffer cannot be null.";
        public const string ArgumentOutOfRange_Bounds_Lower_Upper = "Argument must be between {0} and {1}.";
@@ -1566,7 +1506,6 @@ partial class SR
        public const string KeyedCollKeyNotFound = "Cannot find the key {0} in the collection.";
        public const string KeyedCollInvalidKey = "Keys must be non-null non-empty Strings.";
        public const string KeyedCollCapacityOverflow = "Capacity overflowed and went negative.  Check capacity of the collection.";
-       public const string InvalidOperation_EnumEnded = "The enumeration has already completed.";
        public const string OrderedDictionary_ReadOnly = "The OrderedDictionary is readonly and cannot be modified.";
        public const string OrderedDictionary_SerializationMismatch = "There was an error deserializing the OrderedDictionary.  The ArrayList does not contain DictionaryEntries.";
        public const string Async_ExceptionOccurred = "An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.";
index 51afd4cef7b7944cb3ba85b3abd3435423f0ce8f..7dd5a83d0fd4325bb0ba0639641f22c36699fc24 100644 (file)
@@ -52,6 +52,9 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeObject.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReference.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReferenceCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ArrayBuilder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\EnumerableHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\LargeArrayBuilder.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CSharpHelpers.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\TempFileCollection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\Microsoft\CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\FieldDirection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\MemberAttributes.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\Collections\Specialized\FixedStringLookup.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\BlockingCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\BitHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\ICollectionDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\IDictionaryDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\LinkedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Queue.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\QueueDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedDictionary.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.TreeSubSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSetEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Stack.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\StackDebugView.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionLevel.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionMode.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\GZipStream.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Runtime.Extensions\src\System\CodeDom\Compiler\IndentedTextWriter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime\src\System\Collections\Generic\ISet.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="..\referencesource\System\compmod\microsoft\win32\safehandles\SafeProcessHandle.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\codedom\compiler\GeneratedCodeAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\bithelper.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\debugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\iset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\linkedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\queue.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sorteddictionary.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedsetdebugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\stack.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\throwhelper.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\observablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\readonlyobservablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\specialized\bitvector32.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\threading\semaphore.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\windows\markup\ValueSerializerAttribute.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
     <Compile Include="corefx\ZLibNative.cs" />\r
     <Compile Include="Microsoft.CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
index 088e73f7b1097713fb4cbc13e5c3d9793d3d964d..edf92db6572ae2ccdf81cc6f98b3763b93ee598c 100644 (file)
@@ -52,6 +52,9 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeObject.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReference.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReferenceCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ArrayBuilder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\EnumerableHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\LargeArrayBuilder.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CSharpHelpers.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\TempFileCollection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\Microsoft\CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\FieldDirection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\MemberAttributes.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\Collections\Specialized\FixedStringLookup.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\BlockingCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\BitHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\ICollectionDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\IDictionaryDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\LinkedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Queue.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\QueueDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedDictionary.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.TreeSubSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSetEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Stack.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\StackDebugView.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionLevel.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionMode.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\GZipStream.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Runtime.Extensions\src\System\CodeDom\Compiler\IndentedTextWriter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime\src\System\Collections\Generic\ISet.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="..\referencesource\System\compmod\microsoft\win32\safehandles\SafeProcessHandle.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\codedom\compiler\GeneratedCodeAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\bithelper.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\debugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\iset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\linkedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\queue.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sorteddictionary.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedsetdebugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\stack.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\throwhelper.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\observablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\readonlyobservablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\specialized\bitvector32.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\threading\semaphore.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\windows\markup\ValueSerializerAttribute.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
     <Compile Include="corefx\ZLibNative.cs" />\r
     <Compile Include="Microsoft.CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
index 575b6497c248d1f06d675d7bb8e544cf6a929f17..eca6f313214232790709a2f230a257ae159abb0e 100644 (file)
@@ -52,6 +52,9 @@
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeObject.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReference.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CodeDom\CodeTypeReferenceCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ArrayBuilder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\EnumerableHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\LargeArrayBuilder.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\CSharpHelpers.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\Common\src\System\IO\TempFileCollection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\Microsoft\CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\FieldDirection.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\CodeDom\MemberAttributes.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.CodeDom\src\System\Collections\Specialized\FixedStringLookup.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\BlockingCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentBag.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\BitHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\ICollectionDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\IDictionaryDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\LinkedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Queue.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\QueueDebugView.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedDictionary.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedList.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSet.TreeSubSet.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\SortedSetEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\Stack.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections\src\System\Collections\Generic\StackDebugView.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionLevel.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionMode.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\GZipStream.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Runtime.Extensions\src\System\CodeDom\Compiler\IndentedTextWriter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Runtime\src\System\Collections\Generic\ISet.cs" />\r
     <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="..\referencesource\System\compmod\microsoft\win32\safehandles\SafeProcessHandle.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\codedom\compiler\GeneratedCodeAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\bithelper.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\debugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\iset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\linkedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\queue.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sorteddictionary.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedlist.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedset.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\sortedsetdebugview.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\stack.cs" />\r
-    <Compile Include="..\referencesource\System\compmod\system\collections\generic\throwhelper.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\observablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\objectmodel\readonlyobservablecollection.cs" />\r
     <Compile Include="..\referencesource\System\compmod\system\collections\specialized\bitvector32.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\ElapsedEventHandler.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\Timer.cs" />\r
     <Compile Include="..\referencesource\System\services\timers\system\timers\TimersDescriptionAttribute.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\BlockingCollection.cs" />\r
-    <Compile Include="..\referencesource\System\sys\system\collections\concurrent\ConcurrentBag.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\Diagnostics\CodeAnalysis\ExcludeFromCodeCoverageAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\IO\ports\InternalResources.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\runtime\interopservices\DefaultParameterValueAttribute.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\threading\semaphore.cs" />\r
     <Compile Include="..\referencesource\System\sys\system\windows\markup\ValueSerializerAttribute.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
     <Compile Include="corefx\ZLibNative.cs" />\r
     <Compile Include="Microsoft.CSharp\CSharpCodeGenerator.cs" />\r
     <Compile Include="Microsoft.VisualBasic\VBCodeGenerator.cs" />\r
index a1d0896dba63d84bb0927be9b160ec03b54c5996..5053aadace9566d6f38a4d7299f20b0e12e4feec 100644 (file)
@@ -92,85 +92,85 @@ namespace Mono.Audio {
                IntPtr hw_param;
                IntPtr sw_param;
                
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_open (ref IntPtr handle, string pcm_name, int stream, int mode);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_close (IntPtr handle);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_drain (IntPtr handle);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_writei (IntPtr handle, byte[] buf, int size);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_set_params (IntPtr handle, int format, int access, int channels, int rate, int soft_resample, int latency);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_state (IntPtr handle);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_prepare (IntPtr handle);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params (IntPtr handle, IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_malloc (ref IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern void snd_pcm_hw_params_free (IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_any (IntPtr handle, IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_access (IntPtr handle, IntPtr param, int access);
                
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_format (IntPtr handle, IntPtr param, int format);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_channels (IntPtr handle, IntPtr param, uint channel);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_rate_near (IntPtr handle, IntPtr param, ref uint rate, ref int dir);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_period_time_near (IntPtr handle, IntPtr param, ref uint period, ref int dir);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_get_period_size (IntPtr param, ref uint period, ref int dir);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_buffer_size_near (IntPtr handle, IntPtr param, ref uint buff_size);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_get_buffer_time_max(IntPtr param, ref uint buffer_time, ref int dir);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_set_buffer_time_near(IntPtr handle, IntPtr param, ref uint BufferTime, ref int dir);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_hw_params_get_buffer_size(IntPtr param, ref uint BufferSize);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_sw_params (IntPtr handle, IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_sw_params_malloc (ref IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern void snd_pcm_sw_params_free (IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_sw_params_current(IntPtr handle, IntPtr param);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_sw_params_set_avail_min(IntPtr handle, IntPtr param, uint frames);
 
-               [DllImport ("libasound.so.2")]
+               [DllImport ("libasound")]
                static extern int snd_pcm_sw_params_set_start_threshold(IntPtr handle, IntPtr param, uint StartThreshold);
 
                public AlsaDevice (string name) {
index 0efb5c416616ff5afe66dca900605ad7dfb2d037..15322fe8fc26a42a87007a96db58e7da3639c757 100644 (file)
@@ -354,21 +354,6 @@ ReferenceSources/Win32Exception.cs
 ../referencesource/System/regex/system/text/regularexpressions/compiledregexrunner.cs
 ../referencesource/System/regex/system/text/regularexpressions/compiledregexrunnerfactory.cs
 
-../referencesource/System/sys/system/collections/concurrent/BlockingCollection.cs
-../referencesource/System/sys/system/collections/concurrent/ConcurrentBag.cs
-
-../referencesource/System/compmod/system/collections/generic/bithelper.cs
-../referencesource/System/compmod/system/collections/generic/debugview.cs
-../referencesource/System/compmod/system/collections/generic/iset.cs
-../referencesource/System/compmod/system/collections/generic/linkedlist.cs
-../referencesource/System/compmod/system/collections/generic/queue.cs
-../referencesource/System/compmod/system/collections/generic/sorteddictionary.cs
-../referencesource/System/compmod/system/collections/generic/sortedlist.cs
-../referencesource/System/compmod/system/collections/generic/sortedset.cs
-../referencesource/System/compmod/system/collections/generic/sortedsetdebugview.cs
-../referencesource/System/compmod/system/collections/generic/stack.cs
-../referencesource/System/compmod/system/collections/generic/throwhelper.cs
-
 ../referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs
 ../referencesource/System/compmod/system/collections/objectmodel/readonlyobservablecollection.cs
 
@@ -924,8 +909,34 @@ ReferenceSources/Win32Exception.cs
 
 ../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs
 
-../../../external/corefx/src/System.Runtime.Extensions/src/System/CodeDom/Compiler/IndentedTextWriter.cs
+corefx/SR.cs
+
+../../../external/corefx/src/Common/src/System/Collections/Generic/ArrayBuilder.cs
+../../../external/corefx/src/Common/src/System/Collections/Generic/EnumerableHelpers.cs
+../../../external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs
+
+../../../external/corefx/src/System.Runtime/src/System/Collections/Generic/ISet.cs
+
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/BitHelper.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/ICollectionDebugView.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/IDictionaryDebugView.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/LinkedList.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/Queue.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/QueueDebugView.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/SortedDictionary.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/SortedList.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSet.TreeSubSet.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/SortedSetEqualityComparer.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/Stack.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/StackDebugView.cs
+
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/BlockingCollection.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentBag.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
 
 ../../../external/corefx/src/System.IO.Compression/src/System/IO/Compression/CompressionLevel.cs
 ../../../external/corefx/src/System.IO.Compression/src/System/IO/Compression/CompressionMode.cs
 ../../../external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
+
+../../../external/corefx/src/System.Runtime.Extensions/src/System/CodeDom/Compiler/IndentedTextWriter.cs
diff --git a/mcs/class/System/corefx/SR.cs b/mcs/class/System/corefx/SR.cs
new file mode 100644 (file)
index 0000000..d4b44ad
--- /dev/null
@@ -0,0 +1,82 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string BlockingCollection_Add_ConcurrentCompleteAdd = "CompleteAdding may not be used concurrently with additions to the collection.";
+       public const string BlockingCollection_Add_Failed = "The underlying collection didn't accept the item.";
+       public const string BlockingCollection_CantAddAnyWhenCompleted = "At least one of the specified collections is marked as complete with regards to additions.";
+       public const string BlockingCollection_CantTakeAnyWhenAllDone = "All collections are marked as complete with regards to additions.";
+       public const string BlockingCollection_CantTakeWhenDone = "The collection argument is empty and has been marked as complete with regards to additions.";
+       public const string BlockingCollection_Completed = "The collection has been marked as complete with regards to additions.";
+       public const string BlockingCollection_CopyTo_IncorrectType = "The array argument is of the incorrect type.";
+       public const string BlockingCollection_CopyTo_MultiDim = "The array argument is multidimensional.";
+       public const string BlockingCollection_CopyTo_NonNegative = "The index argument must be greater than or equal zero.";
+       public const string Collection_CopyTo_TooManyElems = "The number of elements in the collection is greater than the available space from index to the end of the destination array.";
+       public const string BlockingCollection_ctor_BoundedCapacityRange = "The boundedCapacity argument must be positive.";
+       public const string BlockingCollection_ctor_CountMoreThanCapacity = "The collection argument contains more items than are allowed by the boundedCapacity.";
+       public const string BlockingCollection_Disposed = "The collection has been disposed.";
+       public const string BlockingCollection_Take_CollectionModified = "The underlying collection was modified from outside of the BlockingCollection<T>.";
+       public const string BlockingCollection_TimeoutInvalid = "The specified timeout must represent a value between -1 and {0}, inclusive.";
+       public const string BlockingCollection_ValidateCollectionsArray_DispElems = "The collections argument contains at least one disposed element.";
+       public const string BlockingCollection_ValidateCollectionsArray_LargeSize = "The collections length is greater than the supported range for 32 bit machine.";
+       public const string BlockingCollection_ValidateCollectionsArray_NullElems = "The collections argument contains at least one null element.";
+       public const string BlockingCollection_ValidateCollectionsArray_ZeroSize = "The collections argument is a zero-length array.";
+       public const string Common_OperationCanceled = "The operation was canceled.";
+       public const string ConcurrentBag_Ctor_ArgumentNullException = "The collection argument is null.";
+       public const string ConcurrentBag_CopyTo_ArgumentNullException = "The array argument is null.";
+       public const string Collection_CopyTo_ArgumentOutOfRangeException = "The index argument must be greater than or equal zero.";
+       public const string ConcurrentCollection_SyncRoot_NotSupported = "The SyncRoot property may not be used for the synchronization of concurrent collections.";
+       public const string ConcurrentDictionary_ArrayIncorrectType = "The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array.";
+       public const string ConcurrentDictionary_SourceContainsDuplicateKeys = "The source argument contains duplicate keys.";
+       public const string ConcurrentDictionary_ConcurrencyLevelMustBePositive = "The concurrencyLevel argument must be positive.";
+       public const string ConcurrentDictionary_CapacityMustNotBeNegative = "The capacity argument must be greater than or equal to zero.";
+       public const string ConcurrentDictionary_IndexIsNegative = "The index argument is less than zero.";
+       public const string ConcurrentDictionary_ArrayNotLargeEnough = "The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.";
+       public const string ConcurrentDictionary_KeyAlreadyExisted = "The key already existed in the dictionary.";
+       public const string ConcurrentDictionary_ItemKeyIsNull = "TKey is a reference type and item.Key is null.";
+       public const string ConcurrentDictionary_TypeOfKeyIncorrect = "The key was of an incorrect type for this dictionary.";
+       public const string ConcurrentDictionary_TypeOfValueIncorrect = "The value was of an incorrect type for this dictionary.";
+       public const string ConcurrentStack_PushPopRange_CountOutOfRange = "The count argument must be greater than or equal to zero.";
+       public const string ConcurrentStack_PushPopRange_InvalidCount = "The sum of the startIndex and count arguments must be less than or equal to the collection's Count.";
+       public const string ConcurrentStack_PushPopRange_StartOutOfRange = "The startIndex argument must be greater than or equal to zero.";
+       public const string Partitioner_DynamicPartitionsNotSupported = "Dynamic partitions are not supported by this partitioner.";
+       public const string PartitionerStatic_CanNotCallGetEnumeratorAfterSourceHasBeenDisposed = "Can not call GetEnumerator on partitions after the source enumerable is disposed";
+       public const string PartitionerStatic_CurrentCalledBeforeMoveNext = "MoveNext must be called at least once before calling Current.";
+       public const string ConcurrentBag_Enumerator_EnumerationNotStartedOrAlreadyFinished = "Enumeration has either not started or has already finished.";
+       public const string Arg_NonZeroLowerBound = "The lower bound of target array must be zero.";
+       public const string Arg_WrongType = "The value '{0}' is not of type '{1}' and cannot be used in this generic collection.";
+       public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length.";
+       public const string ArgumentOutOfRange_NeedNonNegNum = "Non-negative number required.";
+       public const string ArgumentOutOfRange_SmallCapacity = "capacity was less than the current size.";
+       public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
+       public const string Argument_AddingDuplicate = "An item with the same key has already been added. Key: {0}";
+       public const string InvalidOperation_EmptyQueue = "Queue empty.";
+       public const string InvalidOperation_EnumOpCantHappen = "Enumeration has either not started or has already finished.";
+       public const string InvalidOperation_EnumFailedVersion = "Collection was modified; enumeration operation may not execute.";
+       public const string InvalidOperation_EmptyStack = "Stack empty.";
+       public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext.";
+       public const string InvalidOperation_EnumEnded = "Enumeration already finished.";
+       public const string NotSupported_KeyCollectionSet = "Mutating a key collection derived from a dictionary is not allowed.";
+       public const string NotSupported_ValueCollectionSet = "Mutating a value collection derived from a dictionary is not allowed.";
+       public const string Arg_ArrayLengthsDiffer = "Array lengths must be the same.";
+       public const string Arg_BitArrayTypeUnsupported = "Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[].";
+       public const string Arg_HSCapacityOverflow = "HashSet capacity is too big.";
+       public const string Arg_HTCapacityOverflow = "Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.";
+       public const string Arg_InsufficientSpace = "Insufficient space in the target location to copy the information.";
+       public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action.";
+       public const string Argument_ArrayTooLarge = "The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.";
+       public const string Argument_InvalidArrayType = "Target array type is not compatible with the type of items in the collection.";
+       public const string ArgumentOutOfRange_BiggerThanCollection = "Must be less than or equal to the size of the collection.";
+       public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection.";
+       public const string ExternalLinkedListNode = "The LinkedList node does not belong to current LinkedList.";
+       public const string LinkedListEmpty = "The LinkedList is empty.";
+       public const string LinkedListNodeIsAttached = "The LinkedList node already belongs to a LinkedList.";
+       public const string NotSupported_SortedListNestedWrite = "This operation is not supported on SortedList nested types because they require modifying the original SortedList.";
+       public const string SortedSet_LowerValueGreaterThanUpperValue = "Must be less than or equal to upperValue.";
+       public const string Serialization_InvalidOnDeser = "OnDeserialization method was called while the object was not being deserialized.";
+       public const string Serialization_MismatchedCount = "The serialized Count information doesn't match the number of items.";
+       public const string Serialization_MissingKeys = "The keys for this dictionary are missing.";
+       public const string Serialization_MissingValues = "The values for this dictionary are missing.";
+}
index 965d85ddee25896086b8259c498b5cfecab9abf4..19b9392fc781fcc43d1aab962c74c3f167b36d2e 100644 (file)
@@ -27,7 +27,8 @@ endif
 RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt
 
 RESX_RESOURCE_STRING = \
-       ../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx
+       ../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx \
+       ../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx
 
 LIBRARY_COMPILE = $(BOOT_COMPILE)
 LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
index e6ebd1ff2aa8aace6e9f3649a0474baff66891aa..f93c538069a8246f93c83129caabd3b90242caa1 100644 (file)
@@ -184,5 +184,11 @@ namespace System.Runtime.CompilerServices
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                static extern void RunModuleConstructor (IntPtr module);
+
+               [MonoTODO]
+               public static bool IsReferenceOrContainsReferences<T>()
+               {
+                       return true;
+               }
        }
 }
index 26222aca533fc40cfcf949e47a8cdb0b9cd800c7..c6564db34730f631515ea77b99de90790a6a32c4 100644 (file)
@@ -51,9 +51,7 @@ namespace System.Threading {
                // stores a thread handle
                IntPtr handle;
                IntPtr native_handle; // used only on Win32
-
-               /* Note this is an opaque object (an array), not a CultureInfo */
-               private object cached_culture_info;
+               IntPtr unused3;
                /* accessed only from unmanaged code */
                private IntPtr name;
                private int name_len; 
@@ -62,7 +60,7 @@ namespace System.Threading {
                private int abort_state_handle;
                /* thread_id is only accessed from unmanaged code */
                internal Int64 thread_id;
-               private IntPtr stack_ptr;
+               private IntPtr debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works
                private UIntPtr static_data; /* GC-tracked */
                private IntPtr runtime_thread_info;
                /* current System.Runtime.Remoting.Contexts.Context instance
@@ -83,7 +81,7 @@ namespace System.Threading {
                internal int managed_id;
                private int small_id;
                private IntPtr manage_callback;
-               private IntPtr interrupt_on_stop;
+               private IntPtr unused4;
                private IntPtr flags;
                private IntPtr thread_pinning_ref;
                private IntPtr abort_protected_block_count;
diff --git a/mcs/class/corlib/corefx/SR.cs b/mcs/class/corlib/corefx/SR.cs
new file mode 100644 (file)
index 0000000..0666360
--- /dev/null
@@ -0,0 +1,719 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string Arg_AccessException = "Cannot access member.";
+       public const string Arg_AccessViolationException = "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.";
+       public const string Arg_ApplicationException = "Error in the application.";
+       public const string Arg_ArgumentException = "Value does not fall within the expected range.";
+       public const string Arg_ArgumentOutOfRangeException = "Specified argument was out of the range of valid values.";
+       public const string Arg_ArithmeticException = "Overflow or underflow in the arithmetic operation.";
+       public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length.";
+       public const string Arg_ArrayTypeMismatchException = "Attempted to access an element as a type incompatible with the array.";
+       public const string Arg_ArrayZeroError = "Array must not be of length zero.";
+       public const string Arg_BadImageFormatException = "Format of the executable (.exe) or library (.dll) is invalid.";
+       public const string Arg_BogusIComparer = "Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.";
+       public const string Arg_CannotBeNaN = "TimeSpan does not accept floating point Not-a-Number values.";
+       public const string Arg_CannotHaveNegativeValue = "String cannot contain a minus sign if the base is not 10.";
+       public const string Arg_CopyNonBlittableArray = "Arrays must contain only blittable data in order to be copied to unmanaged memory.";
+       public const string Arg_CopyOutOfRange = "Requested range extends past the end of the array.";
+       public const string Arg_CryptographyException = "Error occurred during a cryptographic operation.";
+       public const string Arg_DataMisalignedException = "A datatype misalignment was detected in a load or store instruction.";
+       public const string Arg_DateTimeRange = "Combination of arguments to the DateTime constructor is out of the legal range.";
+       public const string Arg_DirectoryNotFoundException = "Attempted to access a path that is not on the disk.";
+       public const string Arg_DecBitCtor = "Decimal byte array constructor requires an array of length four containing valid decimal bytes.";
+       public const string Arg_DivideByZero = "Attempted to divide by zero.";
+       public const string Arg_DriveNotFoundException = "Attempted to access a drive that is not available.";
+       public const string Arg_DlgtNullInst = "Delegate to an instance method cannot have null 'this'.";
+       public const string Arg_DuplicateWaitObjectException = "Duplicate objects in argument.";
+       public const string Arg_EnumAndObjectMustBeSameType = "Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.";
+       public const string Arg_EntryPointNotFoundException = "Entry point was not found.";
+       public const string Arg_EnumIllegalVal = "Illegal enum value: {0}.";
+       public const string Arg_ExecutionEngineException = "Internal error in the runtime.";
+       public const string Arg_ExternalException = "External component has thrown an exception.";
+       public const string Arg_FieldAccessException = "Attempted to access a field that is not accessible by the caller.";
+       public const string Arg_FormatException = "One of the identified items was in an invalid format.";
+       public const string Arg_GuidArrayCtor = "Byte array for GUID must be exactly {0} bytes long.";
+       public const string Arg_HexStyleNotSupported = "The number style AllowHexSpecifier is not supported on floating point data types.";
+       public const string Arg_HTCapacityOverflow = "Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.";
+       public const string Arg_IndexOutOfRangeException = "Index was outside the bounds of the array.";
+       public const string Arg_InsufficientExecutionStackException = "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.";
+       public const string Arg_InvalidBase = "Invalid Base.";
+       public const string Arg_InvalidCastException = "Specified cast is not valid.";
+       public const string Arg_InvalidHexStyle = "With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.";
+       public const string Arg_InvalidOperationException = "Operation is not valid due to the current state of the object.";
+       public const string Arg_OleAutDateInvalid = " Not a legal OleAut date.";
+       public const string Arg_OleAutDateScale = "OleAut date did not convert to a DateTime correctly.";
+       public const string Arg_InvalidRuntimeTypeHandle = "Invalid RuntimeTypeHandle.";
+       public const string Arg_IOException = "I/O error occurred.";
+       public const string Arg_KeyNotFound = "The given key was not present in the dictionary.";
+       public const string Arg_LongerThanSrcString = "Source string was not long enough. Check sourceIndex and count.";
+       public const string Arg_LowerBoundsMustMatch = "The arrays' lower bounds must be identical.";
+       public const string Arg_MissingFieldException = "Attempted to access a non-existing field.";
+       public const string Arg_MethodAccessException = "Attempt to access the method failed.";
+       public const string Arg_MissingMemberException = "Attempted to access a missing member.";
+       public const string Arg_MissingMethodException = "Attempted to access a missing method.";
+       public const string Arg_MulticastNotSupportedException = "Attempted to add multiple callbacks to a delegate that does not support multicast.";
+       public const string Arg_MustBeBoolean = "Object must be of type Boolean.";
+       public const string Arg_MustBeByte = "Object must be of type Byte.";
+       public const string Arg_MustBeChar = "Object must be of type Char.";
+       public const string Arg_MustBeDateTime = "Object must be of type DateTime.";
+       public const string Arg_MustBeDateTimeOffset = "Object must be of type DateTimeOffset.";
+       public const string Arg_MustBeDecimal = "Object must be of type Decimal.";
+       public const string Arg_MustBeDouble = "Object must be of type Double.";
+       public const string Arg_MustBeEnum = "Type provided must be an Enum.";
+       public const string Arg_MustBeGuid = "Object must be of type GUID.";
+       public const string Arg_MustBeInt16 = "Object must be of type Int16.";
+       public const string Arg_MustBeInt32 = "Object must be of type Int32.";
+       public const string Arg_MustBeInt64 = "Object must be of type Int64.";
+       public const string Arg_MustBePrimArray = "Object must be an array of primitives.";
+       public const string Arg_MustBeSByte = "Object must be of type SByte.";
+       public const string Arg_MustBeSingle = "Object must be of type Single.";
+       public const string Arg_MustBeString = "Object must be of type String.";
+       public const string Arg_MustBeStringPtrNotAtom = "The pointer passed in as a String must not be in the bottom 64K of the process's address space.";
+       public const string Arg_MustBeTimeSpan = "Object must be of type TimeSpan.";
+       public const string Arg_MustBeUInt16 = "Object must be of type UInt16.";
+       public const string Arg_MustBeUInt32 = "Object must be of type UInt32.";
+       public const string Arg_MustBeUInt64 = "Object must be of type UInt64.";
+       public const string Arg_MustBeVersion = "Object must be of type Version.";
+       public const string Arg_NeedAtLeast1Rank = "Must provide at least one rank.";
+       public const string Arg_Need2DArray = "Array was not a two-dimensional array.";
+       public const string Arg_Need3DArray = "Array was not a three-dimensional array.";
+       public const string Arg_NegativeArgCount = "Argument count must not be negative.";
+       public const string Arg_NotFiniteNumberException = "Arg_NotFiniteNumberException = Number encountered was not a finite quantity.";
+       public const string Arg_NonZeroLowerBound = "The lower bound of target array must be zero.";
+       public const string Arg_NotGenericParameter = "Method may only be called on a Type for which Type.IsGenericParameter is true.";
+       public const string Arg_NotImplementedException = "The method or operation is not implemented.";
+       public const string Arg_NotSupportedException = "Specified method is not supported.";
+       public const string Arg_NotSupportedMultidim = "Multi-dimensional arrays are not supported.";
+       public const string Arg_NotSupportedNonZeroLowerBound = "Arrays with non-zero lower bounds are not supported.";
+       public const string Arg_NullReferenceException = "Object reference not set to an instance of an object.";
+       public const string Arg_ObjObjEx = "Object of type '{0}' cannot be converted to type '{1}'.";
+       public const string Arg_OverflowException = "Arithmetic operation resulted in an overflow.";
+       public const string Arg_OutOfMemoryException = "Insufficient memory to continue the execution of the program.";
+       public const string Arg_PlatformNotSupported = "Operation is not supported on this platform.";
+       public const string Arg_ParamName_Name = "Parameter name: {0}";
+       public const string Arg_Path2IsRooted = "Second path fragment must not be a drive or UNC name.";
+       public const string Arg_PathIllegal = "The path is not of a legal form.";
+       public const string Arg_PathIllegalUNC = "The UNC path should be of the form \\\\\\\\server\\\\share.";
+       public const string Arg_RankException = "Attempted to operate on an array with the incorrect number of dimensions.";
+       public const string Arg_RankIndices = "Indices length does not match the array rank.";
+       public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action.";
+       public const string Arg_RanksAndBounds = "Number of lengths and lowerBounds must match.";
+       public const string Arg_RegGetOverflowBug = "RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.";
+       public const string Arg_RegKeyNotFound = "The specified registry key does not exist.";
+       public const string Arg_SecurityException = "Security error.";
+       public const string Arg_StackOverflowException = "Operation caused a stack overflow.";
+       public const string Arg_SynchronizationLockException = "Object synchronization method was called from an unsynchronized block of code.";
+       public const string Arg_SystemException = "System error.";
+       public const string Arg_TargetInvocationException = "Exception has been thrown by the target of an invocation.";
+       public const string Arg_TargetParameterCountException = "Number of parameters specified does not match the expected number.";
+       public const string Arg_DefaultValueMissingException = "Missing parameter does not have a default value.";
+       public const string Arg_TimeoutException = "The operation has timed out.";
+       public const string Arg_TypeAccessException = "Attempt to access the type failed.";
+       public const string Arg_TypeLoadException = "Failure has occurred while loading a type.";
+       public const string Arg_UnauthorizedAccessException = "Attempted to perform an unauthorized operation.";
+       public const string Arg_VersionString = "Version string portion was too short or too long.";
+       public const string Arg_WrongType = "The value '{0}' is not of type '{1}' and cannot be used in this generic collection.";
+       public const string Argument_AddingDuplicate = "An item with the same key has already been added. Key: {0}";
+       public const string Argument_AddingDuplicate__ = "Item has already been added. Key in dictionary: '{0}'  Key being added: '{1}'";
+       public const string Argument_AdjustmentRulesNoNulls = "The AdjustmentRule array cannot contain null elements.";
+       public const string Argument_AdjustmentRulesOutOfOrder = "The elements of the AdjustmentRule array must be in chronological order and must not overlap.";
+       public const string Argument_BadFormatSpecifier = "Format specifier was invalid.";
+       public const string Argument_CodepageNotSupported = "{0} is not a supported code page.";
+       public const string Argument_CompareOptionOrdinal = "CompareOption.Ordinal cannot be used with other options.";
+       public const string Argument_ConflictingDateTimeRoundtripStyles = "The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.";
+       public const string Argument_ConflictingDateTimeStyles = "The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.";
+       public const string Argument_ConversionOverflow = "Conversion buffer overflow.";
+       public const string Argument_ConvertMismatch = "The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly.  For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.";
+       public const string Argument_CultureInvalidIdentifier = "{0} is an invalid culture identifier.";
+       public const string Argument_CultureIetfNotSupported = "Culture IETF Name {0} is not a recognized IETF name.";
+       public const string Argument_CultureIsNeutral = "Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.";
+       public const string Argument_CultureNotSupported = "Culture is not supported.";
+       public const string Argument_CustomCultureCannotBePassedByNumber = "Customized cultures cannot be passed by LCID, only by name.";
+       public const string Argument_DateTimeBadBinaryData = "The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
+       public const string Argument_DateTimeHasTicks = "The supplied DateTime must have the Year, Month, and Day properties set to 1.  The time cannot be specified more precisely than whole milliseconds.";
+       public const string Argument_DateTimeHasTimeOfDay = "The supplied DateTime includes a TimeOfDay setting.   This is not supported.";
+       public const string Argument_DateTimeIsInvalid = "The supplied DateTime represents an invalid time.  For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.";
+       public const string Argument_DateTimeIsNotAmbiguous = "The supplied DateTime is not in an ambiguous time range.";
+       public const string Argument_DateTimeKindMustBeUnspecified = "The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified.";
+       public const string Argument_DateTimeOffsetInvalidDateTimeStyles = "The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.";
+       public const string Argument_DateTimeOffsetIsNotAmbiguous = "The supplied DateTimeOffset is not in an ambiguous time range.";
+       public const string Argument_EmptyDecString = "Decimal separator cannot be the empty string.";
+       public const string Argument_EmptyName = "Empty name is not legal.";
+       public const string Argument_EmptyWaithandleArray = "Waithandle array may not be empty.";
+       public const string Argument_EncoderFallbackNotEmpty = "Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.";
+       public const string Argument_EncodingConversionOverflowBytes = "The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.";
+       public const string Argument_EncodingConversionOverflowChars = "The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.";
+       public const string Argument_EncodingNotSupported = "'{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
+       public const string Argument_EnumTypeDoesNotMatch = "The argument type, '{0}', is not the same as the enum type '{1}'.";
+       public const string Argument_FallbackBufferNotEmpty = "Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.";
+       public const string Argument_IdnBadLabelSize = "IDN labels must be between 1 and 63 characters long.";
+       public const string Argument_IdnBadPunycode = "Invalid IDN encoded string.";
+       public const string Argument_IdnIllegalName = "Decoded string is not a valid IDN name.";
+       public const string Argument_ImplementIComparable = "At least one object must implement IComparable.";
+       public const string Argument_InvalidArgumentForComparison = "Type of argument is not compatible with the generic comparer.";
+       public const string Argument_InvalidArrayLength = "Length of the array must be {0}.";
+       public const string Argument_InvalidArrayType = "Target array type is not compatible with the type of items in the collection.";
+       public const string Argument_InvalidCalendar = "Not a valid calendar for the given culture.";
+       public const string Argument_InvalidCharSequence = "Invalid Unicode code point found at index {0}.";
+       public const string Argument_InvalidCharSequenceNoIndex = "String contains invalid Unicode code points.";
+       public const string Argument_InvalidCodePageBytesIndex = "Unable to translate bytes {0} at index {1} from specified code page to Unicode.";
+       public const string Argument_InvalidCodePageConversionIndex = "Unable to translate Unicode character \\\\u{0:X4} at index {1} to specified code page.";
+       public const string Argument_InvalidCultureName = "Culture name '{0}' is not supported.";
+       public const string Argument_InvalidDateTimeKind = "Invalid DateTimeKind value.";
+       public const string Argument_InvalidDateTimeStyles = "An undefined DateTimeStyles value is being used.";
+       public const string Argument_InvalidDigitSubstitution = "The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.";
+       public const string Argument_InvalidEnumValue = "The value '{0}' is not valid for this usage of the type {1}.";
+       public const string Argument_InvalidFlag = "Value of flags is invalid.";
+       public const string Argument_InvalidGroupSize = "Every element in the value array should be between one and nine, except for the last element, which can be zero.";
+       public const string Argument_InvalidHighSurrogate = "Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
+       public const string Argument_InvalidId = "The specified ID parameter '{0}' is not supported.";
+       public const string Argument_InvalidLowSurrogate = "Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
+       public const string Argument_InvalidNativeDigitCount = "The NativeDigits array must contain exactly ten members.";
+       public const string Argument_InvalidNativeDigitValue = "Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.";
+       public const string Argument_InvalidNeutralRegionName = "The region name {0} should not correspond to neutral culture; a specific culture name is required.";
+       public const string Argument_InvalidNormalizationForm = "Invalid normalization form.";
+       public const string Argument_InvalidNumberStyles = "An undefined NumberStyles value is being used.";
+       public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
+       public const string Argument_InvalidPathChars = "Illegal characters in path.";
+       public const string Argument_InvalidREG_TZI_FORMAT = "The REG_TZI_FORMAT structure is corrupt.";
+       public const string Argument_InvalidResourceCultureName = "The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.";
+       public const string Argument_InvalidSerializedString = "The specified serialized string '{0}' is not supported.";
+       public const string Argument_InvalidTimeSpanStyles = "An undefined TimeSpanStyles value is being used.";
+       public const string Argument_MustBeFalse = "Argument must be initialized to false";
+       public const string Argument_NoEra = "No Era was supplied.";
+       public const string Argument_NoRegionInvariantCulture = "There is no region associated with the Invariant Culture (Culture ID: 0x7F).";
+       public const string Argument_NotIsomorphic = "Object contains non-primitive or non-blittable data.";
+       public const string Argument_OffsetLocalMismatch = "The UTC Offset of the local dateTime parameter does not match the offset argument.";
+       public const string Argument_OffsetPrecision = "Offset must be specified in whole minutes.";
+       public const string Argument_OffsetOutOfRange = "Offset must be within plus or minus 14 hours.";
+       public const string Argument_OffsetUtcMismatch = "The UTC Offset for Utc DateTime instances must be 0.";
+       public const string Argument_OneOfCulturesNotSupported = "Culture name {0} or {1} is not supported.";
+       public const string Argument_OnlyMscorlib = "Only mscorlib's assembly is valid.";
+       public const string Argument_OutOfOrderDateTimes = "The DateStart property must come before the DateEnd property.";
+       public const string ArgumentOutOfRange_HugeArrayNotSupported = "Arrays larger than 2GB are not supported.";
+       public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection.";
+       public const string ArgumentOutOfRange_NeedNonNegNum = "Non-negative number required.";
+       public const string ArgumentOutOfRange_NeedNonNegNumRequired = "Non-negative number required.";
+       public const string Argument_PathEmpty = "Path cannot be the empty string or all whitespace.";
+       public const string Argument_PathFormatNotSupported = "The given path's format is not supported.";
+       public const string Argument_RecursiveFallback = "Recursive fallback not allowed for character \\\\u{0:X4}.";
+       public const string Argument_RecursiveFallbackBytes = "Recursive fallback not allowed for bytes {0}.";
+       public const string Argument_ResultCalendarRange = "The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
+       public const string Argument_SemaphoreInitialMaximum = "The initial count for the semaphore must be greater than or equal to zero and less than the maximum count.";
+       public const string Argument_TimeSpanHasSeconds = "The TimeSpan parameter cannot be specified more precisely than whole minutes.";
+       public const string Argument_TimeZoneNotFound = "The time zone ID '{0}' was not found on the local computer.";
+       public const string Argument_TimeZoneInfoBadTZif = "The tzfile does not begin with the magic characters 'TZif'.  Please verify that the file is not corrupt.";
+       public const string Argument_TimeZoneInfoInvalidTZif = "The TZif data structure is corrupt.";
+       public const string Argument_TransitionTimesAreIdentical = "The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.";
+       public const string Argument_UTCOutOfRange = "The UTC time represented when the offset is applied must be between year 0 and 10,000.";
+       public const string Argument_WaitHandleNameTooLong = "The name can be no more than 260 characters in length.";
+       public const string ArgumentException_OtherNotArrayOfCorrectLength = "Object is not a array with the same number of elements as the array to compare it to.";
+       public const string ArgumentException_TupleIncorrectType = "Argument must be of type {0}.";
+       public const string ArgumentException_TupleLastArgumentNotATuple = "The last element of an eight element tuple must be a Tuple.";
+       public const string ArgumentException_ValueTupleIncorrectType = "Argument must be of type {0}.";
+       public const string ArgumentException_ValueTupleLastArgumentNotATuple = "The TRest type argument of ValueTuple`8 must be a ValueTuple.";
+       public const string ArgumentNull_Array = "Array cannot be null.";
+       public const string ArgumentNull_ArrayElement = "At least one element in the specified array was null.";
+       public const string ArgumentNull_ArrayValue = "Found a null value within an array.";
+       public const string ArgumentNull_Generic = "Value cannot be null.";
+       public const string ArgumentNull_Key = "Key cannot be null.";
+       public const string ArgumentNull_Obj = "Object cannot be null.";
+       public const string ArgumentNull_String = "String reference not set to an instance of a String.";
+       public const string ArgumentNull_Waithandles = "The waitHandles parameter cannot be null.";
+       public const string ArgumentNull_WithParamName = "Parameter '{0}' cannot be null.";
+       public const string ArgumentOutOfRange_AddValue = "Value to add was out of range.";
+       public const string ArgumentOutOfRange_ActualValue = "Actual value was {0}.";
+       public const string ArgumentOutOfRange_BadYearMonthDay = "Year, Month, and Day parameters describe an un-representable DateTime.";
+       public const string ArgumentOutOfRange_BadHourMinuteSecond = "Hour, Minute, and Second parameters describe an un-representable DateTime.";
+       public const string ArgumentOutOfRange_BiggerThanCollection = "Must be less than or equal to the size of the collection.";
+       public const string ArgumentOutOfRange_Bounds_Lower_Upper = "Argument must be between {0} and {1}.";
+       public const string ArgumentOutOfRange_CalendarRange = "Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
+       public const string ArgumentOutOfRange_Capacity = "Capacity exceeds maximum capacity.";
+       public const string ArgumentOutOfRange_Count = "Count must be positive and count must refer to a location within the string/array/collection.";
+       public const string ArgumentOutOfRange_DateArithmetic = "The added or subtracted value results in an un-representable DateTime.";
+       public const string ArgumentOutOfRange_DateTimeBadMonths = "Months value must be between +/-120000.";
+       public const string ArgumentOutOfRange_DateTimeBadTicks = "Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
+       public const string ArgumentOutOfRange_DateTimeBadYears = "Years value must be between +/-10000.";
+       public const string ArgumentOutOfRange_Day = "Day must be between 1 and {0} for month {1}.";
+       public const string ArgumentOutOfRange_DayOfWeek = "The DayOfWeek enumeration must be in the range 0 through 6.";
+       public const string ArgumentOutOfRange_DayParam = "The Day parameter must be in the range 1 through 31.";
+       public const string ArgumentOutOfRange_DecimalRound = "Decimal can only round to between 0 and 28 digits of precision.";
+       public const string ArgumentOutOfRange_DecimalScale = "Decimal's scale value must be between 0 and 28, inclusive.";
+       public const string ArgumentOutOfRange_EndIndexStartIndex = "endIndex cannot be greater than startIndex.";
+       public const string ArgumentOutOfRange_Enum = "Enum value was out of legal range.";
+       public const string ArgumentOutOfRange_Era = "Time value was out of era range.";
+       public const string ArgumentOutOfRange_FileTimeInvalid = "Not a valid Win32 FileTime.";
+       public const string ArgumentOutOfRange_GenericPositive = "Value must be positive.";
+       public const string ArgumentOutOfRange_GetByteCountOverflow = "Too many characters. The resulting number of bytes is larger than what can be returned as an int.";
+       public const string ArgumentOutOfRange_GetCharCountOverflow = "Too many bytes. The resulting number of chars is larger than what can be returned as an int.";
+       public const string ArgumentOutOfRange_IndexCount = "Index and count must refer to a location within the string.";
+       public const string ArgumentOutOfRange_IndexCountBuffer = "Index and count must refer to a location within the buffer.";
+       public const string ArgumentOutOfRange_IndexLength = "Index and length must refer to a location within the string.";
+       public const string ArgumentOutOfRange_InvalidEraValue = "Era value was not valid.";
+       public const string ArgumentOutOfRange_InvalidHighSurrogate = "A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.";
+       public const string ArgumentOutOfRange_InvalidLowSurrogate = "A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.";
+       public const string ArgumentOutOfRange_InvalidUTF32 = "A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).";
+       public const string ArgumentOutOfRange_LengthTooLarge = "The specified length exceeds the maximum value of {0}.";
+       public const string ArgumentOutOfRange_LengthGreaterThanCapacity = "The length cannot be greater than the capacity.";
+       public const string ArgumentOutOfRange_ListInsert = "Index must be within the bounds of the List.";
+       public const string ArgumentOutOfRange_ListItem = "Index was out of range. Must be non-negative and less than the size of the list.";
+       public const string ArgumentOutOfRange_ListRemoveAt = "Index was out of range. Must be non-negative and less than the size of the list.";
+       public const string ArgumentOutOfRange_Month = "Month must be between one and twelve.";
+       public const string ArgumentOutOfRange_MonthParam = "The Month parameter must be in the range 1 through 12.";
+       public const string ArgumentOutOfRange_MustBeNonNegInt32 = "Value must be non-negative and less than or equal to Int32.MaxValue.";
+       public const string ArgumentOutOfRange_MustBeNonNegNum = "'{0}' must be non-negative.";
+       public const string ArgumentOutOfRange_MustBePositive = "'{0}' must be greater than zero.";
+       public const string ArgumentOutOfRange_NeedNonNegOrNegative1 = "Number must be either non-negative and less than or equal to Int32.MaxValue or -1.";
+       public const string ArgumentOutOfRange_NeedPosNum = "Positive number required.";
+       public const string ArgumentOutOfRange_NegativeCapacity = "Capacity must be positive.";
+       public const string ArgumentOutOfRange_NegativeCount = "Count cannot be less than zero.";
+       public const string ArgumentOutOfRange_NegativeLength = "Length cannot be less than zero.";
+       public const string ArgumentOutOfRange_OffsetLength = "Offset and length must refer to a position in the string.";
+       public const string ArgumentOutOfRange_OffsetOut = "Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.";
+       public const string ArgumentOutOfRange_PartialWCHAR = "Pointer startIndex and length do not refer to a valid string.";
+       public const string ArgumentOutOfRange_Range = "Valid values are between {0} and {1}, inclusive.";
+       public const string ArgumentOutOfRange_RoundingDigits = "Rounding digits must be between 0 and 15, inclusive.";
+       public const string ArgumentOutOfRange_SmallCapacity = "capacity was less than the current size.";
+       public const string ArgumentOutOfRange_SmallMaxCapacity = "MaxCapacity must be one or greater.";
+       public const string ArgumentOutOfRange_StartIndex = "StartIndex cannot be less than zero.";
+       public const string ArgumentOutOfRange_StartIndexLargerThanLength = "startIndex cannot be larger than length of string.";
+       public const string ArgumentOutOfRange_StartIndexLessThanLength = "startIndex must be less than length of string.";
+       public const string ArgumentOutOfRange_UtcOffset = "The TimeSpan parameter must be within plus or minus 14.0 hours.";
+       public const string ArgumentOutOfRange_UtcOffsetAndDaylightDelta = "The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours.";
+       public const string ArgumentOutOfRange_Version = "Version's parameters must be greater than or equal to zero.";
+       public const string ArgumentOutOfRange_Week = "The Week parameter must be in the range 1 through 5.";
+       public const string ArgumentOutOfRange_Year = "Year must be between 1 and 9999.";
+       public const string Arithmetic_NaN = "Function does not accept floating point Not-a-Number values.";
+       public const string ArrayTypeMismatch_CantAssignType = "Source array type cannot be assigned to destination array type.";
+       public const string BadImageFormatException_CouldNotLoadFileOrAssembly = "Could not load file or assembly '{0}'. An attempt was made to load a program with an incorrect format.";
+       public const string CollectionCorrupted = "A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted.";
+       public const string Exception_EndOfInnerExceptionStack = "--- End of inner exception stack trace ---";
+       public const string Exception_WasThrown = "Exception of type '{0}' was thrown.";
+       public const string Format_BadBase64Char = "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.";
+       public const string Format_BadBase64CharArrayLength = "Invalid length for a Base-64 char array or string.";
+       public const string Format_BadBoolean = "String was not recognized as a valid Boolean.";
+       public const string Format_BadFormatSpecifier = "Format specifier was invalid.";
+       public const string Format_BadQuote = "Cannot find a matching quote character for the character '{0}'.";
+       public const string Format_EmptyInputString = "Input string was either empty or contained only whitespace.";
+       public const string Format_GuidHexPrefix = "Expected hex 0x in '{0}'.";
+       public const string Format_GuidInvLen = "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).";
+       public const string Format_GuidInvalidChar = "Guid string should only contain hexadecimal characters.";
+       public const string Format_GuidBrace = "Expected {0xdddddddd, etc}.";
+       public const string Format_GuidComma = "Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.).";
+       public const string Format_GuidBraceAfterLastNumber = "Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.).";
+       public const string Format_GuidDashes = "Dashes are in the wrong position for GUID parsing.";
+       public const string Format_GuidEndBrace = "Could not find the ending brace.";
+       public const string Format_ExtraJunkAtEnd = "Additional non-parsable characters are at the end of the string.";
+       public const string Format_GuidUnrecognized = "Unrecognized Guid format.";
+       public const string Format_IndexOutOfRange = "Index (zero based) must be greater than or equal to zero and less than the size of the argument list.";
+       public const string Format_InvalidGuidFormatSpecification = "Format String can be only 'D', 'd', 'N', 'n', 'P', 'p', 'B', 'b', 'X' or 'x'.";
+       public const string Format_InvalidString = "Input string was not in a correct format.";
+       public const string Format_NeedSingleChar = "String must be exactly one character long.";
+       public const string Format_NoParsibleDigits = "Could not find any recognizable digits.";
+       public const string Format_BadTimeSpan = "String was not recognized as a valid TimeSpan.";
+       public const string InvalidCast_CannotCastNullToValueType = "Null object cannot be converted to a value type.";
+       public const string InvalidCast_DownCastArrayElement = "At least one element in the source array could not be cast down to the destination array type.";
+       public const string InvalidCast_FromTo = "Invalid cast from '{0}' to '{1}'.";
+       public const string InvalidCast_IConvertible = "Object must implement IConvertible.";
+       public const string InvalidCast_StoreArrayElement = "Object cannot be stored in an array of this type.";
+       public const string InvalidNullEmptyArgument = "Argument {0} cannot be null or zero-length.";
+       public const string InvalidOperation_Calling = "WinRT Interop has already been initialized and cannot be initialized again.";
+       public const string InvalidOperation_DateTimeParsing = "Internal Error in DateTime and Calendar operations.";
+       public const string InvalidOperation_GetCodepageInfo = "Internal Error in getting codepage data.";
+       public const string InvalidOperation_EnumEnded = "Enumeration already finished.";
+       public const string InvalidOperation_EnumFailedVersion = "Collection was modified; enumeration operation may not execute.";
+       public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext.";
+       public const string InvalidOperation_EnumOpCantHappen = "Enumeration has either not started or has already finished.";
+       public const string InvalidOperation_HandleIsNotInitialized = "Handle is not initialized.";
+       public const string InvalidOperation_IComparerFailed = "Failed to compare two elements in the array.";
+       public const string InvalidOperation_Monitor_UseConditionDirectly = "TBD";
+       public const string InvalidOperation_NoValue = "Nullable object must have a value.";
+       public const string InvalidOperation_NullArray = "The underlying array is null.";
+       public const string InvalidOperation_ReadOnly = "Instance is read-only.";
+       public const string InvalidOperation_UnknownEnumType = "Unknown enum type.";
+       public const string InvalidOperation_ArrayCreateInstance_NotARuntimeType = "Array.CreateInstance() can only accept Type objects created by the runtime.";
+       public const string InvalidOperation_ExpectedEEType = "Internal Error: Did not expect an uninstantiated generic type here.";
+       public const string InvalidOperation_ExpectedSpecialLdTokenResult = "Internal Error: Expected an uninstantiated generic type here.";
+       public const string InvalidOperation_TooEarly = "Internal Error: This operation cannot be invoked in an eager class constructor.";
+       public const string InvalidProgram_Default = "Common Language Runtime detected an invalid program.";
+       public const string InvalidProgram_Specific = "Common Language Runtime detected an invalid program. The body of method '{0}' is invalid.";
+       public const string InvalidProgram_Vararg = "Method '{0}' has a variable argument list. Variable argument lists are not supported in .NET Core.";
+       public const string InvalidTimeZone_InvalidRegistryData = "The time zone ID '{0}' was found on the local computer, but the registry information was corrupt.";
+       public const string IO_DriveNotFound_Drive = "Could not find the drive '{0}'. The drive might not be ready or might not be mapped.";
+       public const string IO_FileExists_Name = "The file '{0}' already exists.";
+       public const string IO_FileName_Name = "File name: '{0}'";
+       public const string IO_FileNotFound = "Unable to find the specified file.";
+       public const string IO_FileNotFound_FileName = "Could not load file or assembly '{0}'. The system cannot find the file specified.";
+       public const string IO_FileLoad = "Could not load the specified file.";
+       public const string IO_NoPermissionToDirectoryName = "<Path discovery permission to the specified directory was denied.%gt;";
+       public const string IO_PathNotFound_NoPathName = "Could not find a part of the path.";
+       public const string IO_PathNotFound_Path = "Could not find a part of the path '{0}'.";
+       public const string IO_PathTooLong = "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.";
+       public const string IO_SharingViolation_File = "The process cannot access the file '{0}' because it is being used by another process.";
+       public const string IO_SharingViolation_NoFileName = "The process cannot access the file because it is being used by another process.";
+       public const string IO_AlreadyExists_Name = "Cannot create '{0}' because a file or directory with the same name already exists.";
+       public const string UnauthorizedAccess_IODenied_NoPathName = "Access to the path is denied.";
+       public const string UnauthorizedAccess_IODenied_Path = "Access to the path '{0}' is denied.";
+       public const string Lazy_CreateValue_NoParameterlessCtorForT = "The lazily-initialized type does not have a public, parameterless constructor.";
+       public const string Lazy_ctor_ModeInvalid = "The mode argument specifies an invalid value.";
+       public const string Lazy_StaticInit_InvalidOperation = "ValueFactory returned null.";
+       public const string Lazy_ToString_ValueNotCreated = "Value is not created.";
+       public const string Lazy_Value_RecursiveCallsToValue = "ValueFactory attempted to access the Value property of this instance.";
+       public const string MissingConstructor_Name = "Constructor on type '{0}' not found.";
+       public const string MustUseCCRewrite = "An assembly (probably '{1}') must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined.  Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild.  CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \\r\\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane.  Ensure that 'Perform Runtime Contract Checking' is enabled, which will define CONTRACTS_FULL.";
+       public const string net_uri_AlreadyRegistered = "A URI scheme name '{0}' already has a registered custom parser.";
+       public const string net_uri_BadAuthority = "Invalid URI: The Authority/Host could not be parsed.";
+       public const string net_uri_BadAuthorityTerminator = "Invalid URI: The Authority/Host cannot end with a backslash character ('\\\\').";
+       public const string net_uri_BadFormat = "Invalid URI: The format of the URI could not be determined.";
+       public const string net_uri_BadHostName = "Invalid URI: The hostname could not be parsed.";
+       public const string net_uri_BadPort = "Invalid URI: Invalid port specified.";
+       public const string net_uri_BadScheme = "Invalid URI: The URI scheme is not valid.";
+       public const string net_uri_BadString = "Invalid URI: There is an invalid sequence in the string.";
+       public const string net_uri_BadUserPassword = "Invalid URI: The username:password construct is badly formed.";
+       public const string net_uri_CannotCreateRelative = "A relative URI cannot be created because the 'uriString' parameter represents an absolute URI.";
+       public const string net_uri_SchemeLimit = "Invalid URI: The Uri scheme is too long.";
+       public const string net_uri_EmptyUri = "Invalid URI: The URI is empty.";
+       public const string net_uri_InvalidUriKind = "The value '{0}' passed for the UriKind parameter is invalid.";
+       public const string net_uri_MustRootedPath = "Invalid URI: A Dos path must be rooted, for example, 'c:\\\\'.";
+       public const string net_uri_NeedFreshParser = "The URI parser instance passed into 'uriParser' parameter is already registered with the scheme name '{0}'.";
+       public const string net_uri_NotAbsolute = "This operation is not supported for a relative URI.";
+       public const string net_uri_PortOutOfRange = "A derived type '{0}' has reported an invalid value for the Uri port '{1}'.";
+       public const string net_uri_SizeLimit = "Invalid URI: The Uri string is too long.";
+       public const string net_uri_UserDrivenParsing = "A derived type '{0}' is responsible for parsing this Uri instance. The base implementation must not be used.";
+       public const string net_uri_NotJustSerialization = "UriComponents.SerializationInfoString must not be combined with other UriComponents.";
+       public const string net_uri_BadUnicodeHostForIdn = "An invalid Unicode character by IDN standards was specified in the host.";
+       public const string NotSupported_FixedSizeCollection = "Collection was of a fixed size.";
+       public const string NotSupported_MaxWaitHandles = "The number of WaitHandles must be less than or equal to 64.";
+       public const string NotSupported_OpenType = "Cannot create arrays of open type.";
+       public const string NotSupported_NoCodepageData = "No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
+       public const string NotSupported_ReadOnlyCollection = "Collection is read-only.";
+       public const string NotSupported_StringComparison = "The string comparison type passed in is currently not supported.";
+       public const string NotSupported_VoidArray = "Arrays of System.Void are not supported.";
+       public const string NotSupported_WaitAllSTAThread = "WaitAll for multiple handles on a STA thread is not supported.";
+       public const string ObjectDisposed_Generic = "Cannot access a disposed object.";
+       public const string ObjectDisposed_ObjectName_Name = "Object name: '{0}'.";
+       public const string ObjectDisposed_WriterClosed = "Cannot write to a closed TextWriter.";
+       public const string Overflow_Byte = "Value was either too large or too small for an unsigned byte.";
+       public const string Overflow_Char = "Value was either too large or too small for a character.";
+       public const string Overflow_Decimal = "Value was either too large or too small for a Decimal.";
+       public const string Overflow_Double = "Value was either too large or too small for a Double.";
+       public const string Overflow_TimeSpanElementTooLarge = "The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.";
+       public const string Overflow_Duration = "The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue.";
+       public const string Overflow_Int16 = "Value was either too large or too small for an Int16.";
+       public const string Overflow_Int32 = "Value was either too large or too small for an Int32.";
+       public const string Overflow_Int64 = "Value was either too large or too small for an Int64.";
+       public const string Overflow_NegateTwosCompNum = "Negating the minimum value of a twos complement number is invalid.";
+       public const string Overflow_NegativeUnsigned = "The string was being parsed as an unsigned number and could not have a negative sign.";
+       public const string Overflow_SByte = "Value was either too large or too small for a signed byte.";
+       public const string Overflow_Single = "Value was either too large or too small for a Single.";
+       public const string Overflow_TimeSpanTooLong = "TimeSpan overflowed because the duration is too long.";
+       public const string Overflow_UInt16 = "Value was either too large or too small for a UInt16.";
+       public const string Overflow_UInt32 = "Value was either too large or too small for a UInt32.";
+       public const string Overflow_UInt64 = "Value was either too large or too small for a UInt64.";
+       public const string PlatformNotSupported_MakePointerType = "MakePointerType() is not supported on this platform.";
+       public const string Rank_MultiDimNotSupported = "Only single dimension arrays are supported here.";
+       public const string RuntimeWrappedException = "An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.";
+       public const string SpinWait_SpinUntil_ArgumentNull = "The condition argument is null.";
+       public const string Serialization_CorruptField = "The value of the field '{0}' is invalid.  The serialized data is corrupt.";
+       public const string Serialization_InvalidData = "An error occurred while deserializing the object.  The serialized data is corrupt.";
+       public const string Serialization_InvalidEscapeSequence = "The serialized data contained an invalid escape sequence '\\\\{0}'.";
+       public const string SpinWait_SpinUntil_TimeoutWrong = "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
+       public const string Threading_AbandonedMutexException = "The wait completed due to an abandoned mutex.";
+       public const string Threading_SemaphoreFullException = "Adding the specified count to the semaphore would cause it to exceed its maximum count.";
+       public const string Threading_WaitHandleCannotBeOpenedException = "No handle of the given name exists.";
+       public const string Threading_WaitHandleCannotBeOpenedException_InvalidHandle = "A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.";
+       public const string TimeZoneNotFound_MissingRegistryData = "The time zone ID '{0}' was not found on the local computer.";
+       public const string TypeInitialization_Default = "Type constructor threw an exception.";
+       public const string TypeInitialization_Type = "The type initializer for '{0}' threw an exception.";
+       public const string TypeInitialization_Type_NoTypeAvailable = "A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.";
+       public const string Verification_Exception = "Operation could destabilize the runtime.";
+       public const string Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType = "Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.";
+       public const string Format_InvalidEnumFormatSpecification = "Format String can be only 'G', 'g', 'X', 'x', 'F', 'f', 'D' or 'd'.";
+       public const string Arg_MustBeEnumBaseTypeOrEnum = "The value passed in must be an enum base or an underlying type for an enum, such as an Int32.";
+       public const string Arg_EnumUnderlyingTypeAndObjectMustBeSameType = "Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.";
+       public const string Arg_MustBeType = "Type must be a type provided by the runtime.";
+       public const string Arg_MustContainEnumInfo = "Must specify valid information for parsing in the string.";
+       public const string Arg_EnumValueNotFound = "Requested value '{0}' was not found.";
+       public const string Argument_StringZeroLength = "String cannot be of zero length.";
+       public const string Argument_StringFirstCharIsZero = "The first char in the string is the null character.";
+       public const string Argument_LongEnvVarValue = "Environment variable name or value is too long.";
+       public const string Argument_IllegalEnvVarName = "Environment variable name cannot contain equal character.";
+       public const string AssumptionFailed = "Assumption failed.";
+       public const string AssumptionFailed_Cnd = "Assumption failed: {0}";
+       public const string AssertionFailed = "Assertion failed.";
+       public const string AssertionFailed_Cnd = "Assertion failed: {0}";
+       public const string Debug_Fail = "Fail: {0}";
+       public const string PreconditionFailed = "Precondition failed.";
+       public const string PreconditionFailed_Cnd = "Precondition failed: {0}";
+       public const string PostconditionFailed = "Postcondition failed.";
+       public const string PostconditionFailed_Cnd = "Postcondition failed: {0}";
+       public const string PostconditionOnExceptionFailed = "Postcondition failed after throwing an exception.";
+       public const string PostconditionOnExceptionFailed_Cnd = "Postcondition failed after throwing an exception: {0}";
+       public const string InvariantFailed = "Invariant failed.";
+       public const string InvariantFailed_Cnd = "Invariant failed: {0}";
+       public const string MissingEncodingNameResource = "Could not find a resource entry for the encoding codepage '{0} - {1}'";
+       public const string Globalization_cp_1200 = "Unicode";
+       public const string Globalization_cp_1201 = "Unicode (Big-Endian)";
+       public const string Globalization_cp_12000 = "Unicode (UTF-32)";
+       public const string Globalization_cp_12001 = "Unicode (UTF-32 Big-Endian)";
+       public const string Globalization_cp_20127 = "US-ASCII";
+       public const string Globalization_cp_28591 = "Western European (ISO)";
+       public const string Globalization_cp_65000 = "Unicode (UTF-7)";
+       public const string Globalization_cp_65001 = "Unicode (UTF-8)";
+       public const string DebugAssertBanner = "---- DEBUG ASSERTION FAILED ----";
+       public const string DebugAssertLongMessage = "---- Assert Long Message ----";
+       public const string DebugAssertShortMessage = "---- Assert Short Message ----";
+       public const string InvalidCast_Empty = "Object cannot be cast to Empty.";
+       public const string Arg_UnknownTypeCode = "Unknown TypeCode value.";
+       public const string Format_BadDatePattern = "Could not determine the order of year, month, and date from '{0}'.";
+       public const string Format_BadDateTime = "String was not recognized as a valid DateTime.";
+       public const string Format_BadDateTimeCalendar = "The DateTime represented by the string is not supported in calendar {0}.";
+       public const string Format_BadDayOfWeek = "String was not recognized as a valid DateTime because the day of week was incorrect.";
+       public const string Format_DateOutOfRange = "The DateTime represented by the string is out of range.";
+       public const string Format_MissingIncompleteDate = "There must be at least a partial date with a year present in the input.";
+       public const string Format_OffsetOutOfRange = "The time zone offset must be within plus or minus 14 hours.";
+       public const string Format_RepeatDateTimePattern = "DateTime pattern '{0}' appears more than once with different values.";
+       public const string Format_UnknowDateTimeWord = "The string was not recognized as a valid DateTime. There is an unknown word starting at index {0}.";
+       public const string Format_UTCOutOfRange = "The UTC representation of the date falls outside the year range 1-9999.";
+       public const string InvalidOperation_ComputerName = "Computer name could not be obtained.";
+       public const string RFLCT_Ambiguous = "Ambiguous match found.";
+       public const string AggregateException_ctor_DefaultMessage = "One or more errors occurred.";
+       public const string AggregateException_ctor_InnerExceptionNull = "An element of innerExceptions was null.";
+       public const string AggregateException_DeserializationFailure = "The serialization stream contains no inner exceptions.";
+       public const string AggregateException_InnerException = "(Inner Exception #{0}) "; // {entry.Item3}
+       public const string ArgumentOutOfRange_TimeoutTooLarge = "Time-out interval must be less than 2^32-2.";
+       public const string ArgumentOutOfRange_PeriodTooLarge = "Period must be less than 2^32-2.";
+       public const string TaskScheduler_FromCurrentSynchronizationContext_NoCurrent = "The current SynchronizationContext may not be used as a TaskScheduler.";
+       public const string TaskScheduler_ExecuteTask_WrongTaskScheduler = "ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler.";
+       public const string TaskScheduler_InconsistentStateAfterTryExecuteTaskInline = "The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked.";
+       public const string TaskSchedulerException_ctor_DefaultMessage = "An exception was thrown by a TaskScheduler.";
+       public const string Task_MultiTaskContinuation_FireOptions = "It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.";
+       public const string Task_ContinueWith_ESandLR = "The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously.  Synchronous continuations should not be long running.";
+       public const string Task_MultiTaskContinuation_EmptyTaskList = "The tasks argument contains no tasks.";
+       public const string Task_MultiTaskContinuation_NullTask = "The tasks argument included a null value.";
+       public const string Task_FromAsync_PreferFairness = "It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync.";
+       public const string Task_FromAsync_LongRunning = "It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync.";
+       public const string AsyncMethodBuilder_InstanceNotInitialized = "The builder was not properly initialized.";
+       public const string TaskT_TransitionToFinal_AlreadyCompleted = "An attempt was made to transition a task to a final state when it had already completed.";
+       public const string TaskT_DebuggerNoResult = "{Not yet computed}";
+       public const string OperationCanceled = "The operation was canceled.";
+       public const string CancellationToken_CreateLinkedToken_TokensIsEmpty = "No tokens were supplied.";
+       public const string CancellationTokenSource_Disposed = "The CancellationTokenSource has been disposed.";
+       public const string CancellationToken_SourceDisposed = "The CancellationTokenSource associated with this CancellationToken has been disposed.";
+       public const string TaskExceptionHolder_UnknownExceptionType = "(Internal)Expected an Exception or an IEnumerable<Exception>";
+       public const string TaskExceptionHolder_UnhandledException = "A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.";
+       public const string Task_Delay_InvalidMillisecondsDelay = "The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer.";
+       public const string Task_Delay_InvalidDelay = "The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue.";
+       public const string Task_WaitMulti_NullTask = "The tasks array included at least one null element.";
+       public const string Task_ContinueWith_NotOnAnything = "The specified TaskContinuationOptions excluded all continuation kinds.";
+       public const string Task_RunSynchronously_AlreadyStarted = "RunSynchronously may not be called on a task that was already started.";
+       public const string Task_ThrowIfDisposed = "The task has been disposed.";
+       public const string Task_RunSynchronously_TaskCompleted = "RunSynchronously may not be called on a task that has already completed.";
+       public const string Task_RunSynchronously_Promise = "RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.";
+       public const string Task_RunSynchronously_Continuation = "RunSynchronously may not be called on a continuation task.";
+       public const string Task_Start_AlreadyStarted = "Start may not be called on a task that was already started.";
+       public const string Task_Start_ContinuationTask = "Start may not be called on a continuation task.";
+       public const string Task_Start_Promise = "Start may not be called on a promise-style task.";
+       public const string Task_Start_TaskCompleted = "Start may not be called on a task that has completed.";
+       public const string TaskCanceledException_ctor_DefaultMessage = "A task was canceled.";
+       public const string TaskCompletionSourceT_TrySetException_NoExceptions = "The exceptions collection was empty.";
+       public const string TaskCompletionSourceT_TrySetException_NullException = "The exceptions collection included at least one null element.";
+       public const string Argument_MinMaxValue = "'{0}' cannot be greater than {1}.";
+       public const string InvalidOperation_NullContext = "Cannot call Set on a null context";
+       public const string ExecutionContext_ExceptionInAsyncLocalNotification = "An exception was not handled in an AsyncLocal<T> notification callback.";
+       public const string InvalidOperation_WrongAsyncResultOrEndCalledMultiple = "Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult.";
+       public const string SpinLock_IsHeldByCurrentThread = "Thread tracking is disabled.";
+       public const string SpinLock_TryEnter_LockRecursionException = "The calling thread already holds the lock.";
+       public const string SpinLock_Exit_SynchronizationLockException = "The calling thread does not hold the lock.";
+       public const string SpinLock_TryReliableEnter_ArgumentException = "The tookLock argument must be set to false before calling this method.";
+       public const string SpinLock_TryEnter_ArgumentOutOfRange = "The timeout must be a value between -1 and Int32.MaxValue, inclusive.";
+       public const string ManualResetEventSlim_Disposed = "The event has been disposed.";
+       public const string ManualResetEventSlim_ctor_SpinCountOutOfRange = "The spinCount argument must be in the range 0 to {0}, inclusive.";
+       public const string ManualResetEventSlim_ctor_TooManyWaiters = "There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported.";
+       public const string InvalidOperation_SendNotSupportedOnWindowsRTSynchronizationContext = "Send is not supported in the Windows Runtime SynchronizationContext";
+       public const string SemaphoreSlim_Disposed = "The semaphore has been disposed.";
+       public const string SemaphoreSlim_Release_CountWrong = "The releaseCount argument must be greater than zero.";
+       public const string SemaphoreSlim_Wait_TimeoutWrong = "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
+       public const string SemaphoreSlim_ctor_MaxCountWrong = "The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter.";
+       public const string SemaphoreSlim_ctor_InitialCountWrong = "The initialCount argument must be non-negative and less than or equal to the maximumCount.";
+       public const string ThreadLocal_ValuesNotAvailable = "The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true.";
+       public const string ThreadLocal_Value_RecursiveCallsToValue = "ValueFactory attempted to access the Value property of this instance.";
+       public const string ThreadLocal_Disposed = "The ThreadLocal object has been disposed.";
+       public const string LockRecursionException_WriteAfterReadNotAllowed = "Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.";
+       public const string LockRecursionException_RecursiveWriteNotAllowed = "Recursive write lock acquisitions not allowed in this mode.";
+       public const string LockRecursionException_ReadAfterWriteNotAllowed = "A read lock may not be acquired with the write lock held in this mode.";
+       public const string LockRecursionException_RecursiveUpgradeNotAllowed = "Recursive upgradeable lock acquisitions not allowed in this mode.";
+       public const string LockRecursionException_RecursiveReadNotAllowed = "Recursive read lock acquisitions not allowed in this mode.";
+       public const string SynchronizationLockException_IncorrectDispose = "The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock.";
+       public const string SynchronizationLockException_MisMatchedWrite = "The write lock is being released without being held.";
+       public const string LockRecursionException_UpgradeAfterReadNotAllowed = "Upgradeable lock may not be acquired with read lock held.";
+       public const string LockRecursionException_UpgradeAfterWriteNotAllowed = "Upgradeable lock may not be acquired with write lock held in this mode. Acquiring Upgradeable lock gives the ability to read along with an option to upgrade to a writer.";
+       public const string SynchronizationLockException_MisMatchedUpgrade = "The upgradeable lock is being released without being held.";
+       public const string SynchronizationLockException_MisMatchedRead = "The read lock is being released without being held.";
+       public const string InvalidOperation_TimeoutsNotSupported = "Timeouts are not supported on this stream.";
+       public const string NotSupported_UnreadableStream = "Stream does not support reading.";
+       public const string NotSupported_UnwritableStream = "Stream does not support writing.";
+       public const string ObjectDisposed_StreamClosed = "Cannot access a closed Stream.";
+       public const string NotSupported_SubclassOverride = "Derived classes must provide an implementation.";
+       public const string InvalidOperation_NoPublicRemoveMethod = "Cannot remove the event handler since no public remove method exists for the event.";
+       public const string InvalidOperation_NoPublicAddMethod = "Cannot add the event handler since no public add method exists for the event.";
+       public const string SerializationException = "Serialization error.";
+       public const string Serialization_NotFound = "Member '{0}' was not found.";
+       public const string Serialization_OptionalFieldVersionValue = "Version value must be positive.";
+       public const string Serialization_SameNameTwice = "Cannot add the same member twice to a SerializationInfo object.";
+       public const string NotSupported_AbstractNonCLS = "This non-CLS method is not implemented.";
+       public const string NotSupported_NoTypeInfo = "Cannot resolve {0} to a TypeInfo object.";
+       public const string ReflectionTypeLoad_LoadFailed = "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.";
+       public const string Arg_CustomAttributeFormatException = "Binary format of the specified custom attribute was invalid.";
+       public const string Argument_InvalidMemberForNamedArgument = "The member must be either a field or a property.";
+       public const string Arg_InvalidFilterCriteriaException = "Specified filter criteria was invalid.";
+       public const string Arg_ParmArraySize = "Must specify one or more parameters.";
+       public const string Arg_MustBePointer = "Type must be a Pointer.";
+       public const string Arg_InvalidHandle = "Invalid handle.";
+       public const string Argument_InvalidEnum = "The Enum type should contain one and only one instance field.";
+       public const string Argument_MustHaveAttributeBaseClass = "Type passed in must be derived from System.Attribute or System.Attribute itself.";
+       public const string InvalidFilterCriteriaException_CritString = "A String must be provided for the filter criteria.";
+       public const string InvalidFilterCriteriaException_CritInt = "An Int32 must be provided for the filter criteria.";
+       public const string InvalidOperation_NotSupportedOnWinRTEvent = "Adding or removing event handlers dynamically is not supported on WinRT events.";
+       public const string PlatformNotSupported_ReflectionOnly = "ReflectionOnly loading is not supported on this platform.";
+       public const string MissingMember_Name = "Member '{0}' not found.";
+       public const string MissingMethod_Name = "Method '{0}' not found.";
+       public const string MissingField_Name = "Field '{0}' not found.";
+       public const string Format_StringZeroLength = "String cannot have zero length.";
+       public const string Security_CannotReadRegistryData = "The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information.";
+       public const string Security_InvalidAssemblyPublicKey = "Invalid assembly public key.";
+       public const string Security_RegistryPermission = "Requested registry access is not allowed.";
+       public const string ClassLoad_General = "Could not load type '{0}' from assembly '{1}'.";
+       public const string ClassLoad_RankTooLarge = "'{0}' from assembly '{1}' has too many dimensions.";
+       public const string ClassLoad_ExplicitGeneric = "Could not load type '{0}' from assembly '{1}' because generic types cannot have explicit layout.";
+       public const string ClassLoad_BadFormat = "Could not load type '{0}' from assembly '{1}' because the format is invalid.";
+       public const string ClassLoad_ValueClassTooLarge = "Array of type '{0}' from assembly '{1}' cannot be created because base value type is too large.";
+       public const string ClassLoad_ExplicitLayout = "Could not load type '{0}' from assembly '{1}' because it contains an object field at offset '{2}' that is incorrectly aligned or overlapped by a non-object field.";
+       public const string EE_MissingMethod = "Method not found: '{0}'.";
+       public const string EE_MissingField = "Field not found: '{0}'.";
+       public const string UnauthorizedAccess_RegistryKeyGeneric_Key = "Access to the registry key '{0}' is denied.";
+       public const string UnknownError_Num = "Unknown error '{0}'.";
+       public const string Argument_NeedNonGenericType = "The specified Type must not be a generic type definition.";
+       public const string Argument_NeedStructWithNoRefs = "The specified Type must be a struct containing no references.";
+       public const string ArgumentNull_Buffer = "Buffer cannot be null.";
+       public const string ArgumentOutOfRange_AddressSpace = "The number of bytes cannot exceed the virtual address space on a 32 bit machine.";
+       public const string ArgumentOutOfRange_UIntPtrMaxMinusOne = "The length of the buffer must be less than the maximum UIntPtr value for your platform.";
+       public const string Arg_BufferTooSmall = "Not enough space available in the buffer.";
+       public const string InvalidOperation_MustCallInitialize = "You must call Initialize on this object instance before using it.";
+       public const string ArgumentException_BufferNotFromPool = "The buffer is not associated with this pool and may not be returned to it.";
+       public const string Argument_InvalidSafeBufferOffLen = "Offset and length were greater than the size of the SafeBuffer.";
+       public const string Argument_InvalidSeekOrigin = "Invalid seek origin.";
+       public const string Argument_NotEnoughBytesToRead = "There are not enough bytes remaining in the accessor to read at this position.";
+       public const string Argument_NotEnoughBytesToWrite = "There are not enough bytes remaining in the accessor to write at this position.";
+       public const string Argument_OffsetAndCapacityOutOfBounds = "Offset and capacity were greater than the size of the view.";
+       public const string Argument_UnmanagedMemAccessorWrapAround = "The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.";
+       public const string ArgumentOutOfRange_StreamLength = "Stream length must be non-negative and less than 2^31 - 1 - origin.";
+       public const string ArgumentOutOfRange_UnmanagedMemStreamWrapAround = "The UnmanagedMemoryStream capacity would wrap around the high end of the address space.";
+       public const string InvalidOperation_CalledTwice = "The method cannot be called twice on the same instance.";
+       public const string IO_FixedCapacity = "Unable to expand length of this stream beyond its capacity.";
+       public const string IO_SeekBeforeBegin = "An attempt was made to move the position before the beginning of the stream.";
+       public const string IO_StreamTooLong = "Stream was too long.";
+       public const string Arg_BadDecimal = "Read an invalid decimal value from the buffer.";
+       public const string NotSupported_Reading = "Accessor does not support reading.";
+       public const string NotSupported_UmsSafeBuffer = "This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer.";
+       public const string NotSupported_Writing = "Accessor does not support writing.";
+       public const string NotSupported_UnseekableStream = "Stream does not support seeking.";
+       public const string IndexOutOfRange_UMSPosition = "Unmanaged memory stream position was beyond the capacity of the stream.";
+       public const string ObjectDisposed_StreamIsClosed = "Cannot access a closed Stream.";
+       public const string ObjectDisposed_ViewAccessorClosed = "Cannot access a closed accessor.";
+       public const string ArgumentOutOfRange_PositionLessThanCapacityRequired = "The position may not be greater or equal to the capacity of the accessor.";
+       public const string IO_EOF_ReadBeyondEOF = "Unable to read beyond the end of the stream.";
+       public const string Arg_EndOfStreamException = "Attempted to read past the end of the stream.";
+       public const string ObjectDisposed_FileClosed = "Cannot access a closed file.";
+       public const string Arg_InvalidSearchPattern = "Search pattern cannot contain \\\"..\\\" to move up directories and can be contained only internally in file/directory names, as in \\\"a..b\\\".";
+       public const string ArgumentOutOfRange_FileLengthTooBig = "Specified file length was too large for the file system.";
+       public const string Argument_InvalidHandle = "'handle' has been disposed or is an invalid handle.";
+       public const string Argument_AlreadyBoundOrSyncHandle = "'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O.";
+       public const string Argument_PreAllocatedAlreadyAllocated = "'preAllocated' is already in use.";
+       public const string Argument_NativeOverlappedAlreadyFree = "'overlapped' has already been freed.";
+       public const string Argument_NativeOverlappedWrongBoundHandle = "'overlapped' was not allocated by this ThreadPoolBoundHandle instance.";
+       public const string Arg_HandleNotAsync = "Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).";
+       public const string ArgumentNull_Path = "Path cannot be null.";
+       public const string Argument_EmptyPath = "Empty path name is not legal.";
+       public const string Argument_InvalidFileModeAndAccessCombo = "Combining FileMode: {0} with FileAccess: {1} is invalid.";
+       public const string Argument_InvalidAppendMode = "Append access can be requested only in write-only mode.";
+       public const string IO_UnknownFileName = "[Unknown]";
+       public const string IO_FileStreamHandlePosition = "The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss.";
+       public const string NotSupported_FileStreamOnNonFiles = "FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.";
+       public const string IO_BindHandleFailed = "BindHandle for ThreadPool failed on this handle.";
+       public const string Arg_HandleNotSync = "Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).";
+       public const string IO_SetLengthAppendTruncate = "Unable to truncate data that previously existed in a file opened in Append mode.";
+       public const string IO_SeekAppendOverwrite = "Unable seek backward to overwrite data that previously existed in a file opened in Append mode.";
+       public const string IO_FileTooLongOrHandleNotSync = "IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations.";
+       public const string IndexOutOfRange_IORaceCondition = "Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.";
+       public const string Argument_StreamNotSeekable = "Stream was not seekable.";
+       public const string Arg_ResourceFileUnsupportedVersion = "The ResourceReader class does not know how to read this version of .resources files.";
+       public const string Resources_StreamNotValid = "Stream is not a valid resource file.";
+       public const string BadImageFormat_ResourcesHeaderCorrupted = "Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.";
+       public const string Argument_StreamNotReadable = "Stream was not readable.";
+       public const string BadImageFormat_NegativeStringLength = "Corrupt .resources file. String length must be non-negative.";
+       public const string BadImageFormat_ResourcesNameInvalidOffset = "Corrupt .resources file. The Invalid offset into name section is .";
+       public const string BadImageFormat_TypeMismatch = "Corrupt .resources file.  The specified type doesn't match the available data in the stream.";
+       public const string BadImageFormat_ResourceNameCorrupted_NameIndex = "Corrupt .resources file. The resource name for name index that extends past the end of the stream is ";
+       public const string BadImageFormat_ResourcesDataInvalidOffset = "Corrupt .resources file. Invalid offset  into data section is ";
+       public const string Format_Bad7BitInt32 = "Too many bytes in what should have been a 7 bit encoded Int32.";
+       public const string BadImageFormat_InvalidType = "Corrupt .resources file.  The specified type doesn't exist.";
+       public const string ResourceReaderIsClosed = "ResourceReader is closed.";
+       public const string Arg_MissingManifestResourceException = "Unable to find manifest resource.";
+       public const string Serialization_MissingKeys = "The keys for this dictionary are missing.";
+       public const string Serialization_NullKey = "One of the serialized keys is null.";
+       public const string NotSupported_KeyCollectionSet = "Mutating a key collection derived from a dictionary is not allowed.";
+       public const string NotSupported_ValueCollectionSet = "Mutating a value collection derived from a dictionary is not allowed.";
+       public const string IO_IO_StreamTooLong = "Stream was too long.";
+       public const string UnauthorizedAccess_MemStreamBuffer = "MemoryStream's internal buffer cannot be accessed.";
+       public const string NotSupported_MemStreamNotExpandable = "Memory stream is not expandable.";
+       public const string IO_IO_SeekBeforeBegin = "An attempt was made to move the position before the beginning of the stream.";
+       public const string ArgumentNull_Stream = "Stream cannot be null.";
+       public const string IO_IO_InvalidStringLen_Len = "BinaryReader encountered an invalid string length of {0} characters.";
+       public const string ArgumentOutOfRange_BinaryReaderFillBuffer = "The number of bytes requested does not fit into BinaryReader's internal buffer.";
+       public const string BlockingCollection_Add_ConcurrentCompleteAdd = "CompleteAdding may not be used concurrently with additions to the collection.";
+       public const string BlockingCollection_Add_Failed = "The underlying collection didn't accept the item.";
+       public const string BlockingCollection_CantAddAnyWhenCompleted = "At least one of the specified collections is marked as complete with regards to additions.";
+       public const string BlockingCollection_CantTakeAnyWhenAllDone = "All collections are marked as complete with regards to additions.";
+       public const string BlockingCollection_CantTakeWhenDone = "The collection argument is empty and has been marked as complete with regards to additions.";
+       public const string BlockingCollection_Completed = "The collection has been marked as complete with regards to additions.";
+       public const string BlockingCollection_CopyTo_IncorrectType = "The array argument is of the incorrect type.";
+       public const string BlockingCollection_CopyTo_MultiDim = "The array argument is multidimensional.";
+       public const string BlockingCollection_CopyTo_NonNegative = "The index argument must be greater than or equal zero.";
+       public const string Collection_CopyTo_TooManyElems = "The number of elements in the collection is greater than the available space from index to the end of the destination array.";
+       public const string BlockingCollection_ctor_BoundedCapacityRange = "The boundedCapacity argument must be positive.";
+       public const string BlockingCollection_ctor_CountMoreThanCapacity = "The collection argument contains more items than are allowed by the boundedCapacity.";
+       public const string BlockingCollection_Disposed = "The collection has been disposed.";
+       public const string BlockingCollection_Take_CollectionModified = "The underlying collection was modified from outside of the BlockingCollection<T>.";
+       public const string BlockingCollection_TimeoutInvalid = "The specified timeout must represent a value between -1 and {0}, inclusive.";
+       public const string BlockingCollection_ValidateCollectionsArray_DispElems = "The collections argument contains at least one disposed element.";
+       public const string BlockingCollection_ValidateCollectionsArray_LargeSize = "The collections length is greater than the supported range for 32 bit machine.";
+       public const string BlockingCollection_ValidateCollectionsArray_NullElems = "The collections argument contains at least one null element.";
+       public const string BlockingCollection_ValidateCollectionsArray_ZeroSize = "The collections argument is a zero-length array.";
+       public const string Common_OperationCanceled = "The operation was canceled.";
+       public const string ConcurrentBag_Ctor_ArgumentNullException = "The collection argument is null.";
+       public const string ConcurrentBag_CopyTo_ArgumentNullException = "The array argument is null.";
+       public const string Collection_CopyTo_ArgumentOutOfRangeException = "The index argument must be greater than or equal zero.";
+       public const string ConcurrentCollection_SyncRoot_NotSupported = "The SyncRoot property may not be used for the synchronization of concurrent collections.";
+       public const string ConcurrentDictionary_ArrayIncorrectType = "The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array.";
+       public const string ConcurrentDictionary_SourceContainsDuplicateKeys = "The source argument contains duplicate keys.";
+       public const string ConcurrentDictionary_ConcurrencyLevelMustBePositive = "The concurrencyLevel argument must be positive.";
+       public const string ConcurrentDictionary_CapacityMustNotBeNegative = "The capacity argument must be greater than or equal to zero.";
+       public const string ConcurrentDictionary_IndexIsNegative = "The index argument is less than zero.";
+       public const string ConcurrentDictionary_ArrayNotLargeEnough = "The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.";
+       public const string ConcurrentDictionary_KeyAlreadyExisted = "The key already existed in the dictionary.";
+       public const string ConcurrentDictionary_ItemKeyIsNull = "TKey is a reference type and item.Key is null.";
+       public const string ConcurrentDictionary_TypeOfKeyIncorrect = "The key was of an incorrect type for this dictionary.";
+       public const string ConcurrentDictionary_TypeOfValueIncorrect = "The value was of an incorrect type for this dictionary.";
+       public const string ConcurrentStack_PushPopRange_CountOutOfRange = "The count argument must be greater than or equal to zero.";
+       public const string ConcurrentStack_PushPopRange_InvalidCount = "The sum of the startIndex and count arguments must be less than or equal to the collection's Count.";
+       public const string ConcurrentStack_PushPopRange_StartOutOfRange = "The startIndex argument must be greater than or equal to zero.";
+       public const string Partitioner_DynamicPartitionsNotSupported = "Dynamic partitions are not supported by this partitioner.";
+       public const string PartitionerStatic_CanNotCallGetEnumeratorAfterSourceHasBeenDisposed = "Can not call GetEnumerator on partitions after the source enumerable is disposed";
+       public const string PartitionerStatic_CurrentCalledBeforeMoveNext = "MoveNext must be called at least once before calling Current.";
+       public const string ConcurrentBag_Enumerator_EnumerationNotStartedOrAlreadyFinished = "Enumeration has either not started or has already finished.";
+}
diff --git a/mcs/class/corlib/corert/AddrofIntrinsics.cs b/mcs/class/corlib/corert/AddrofIntrinsics.cs
new file mode 100644 (file)
index 0000000..4f892fd
--- /dev/null
@@ -0,0 +1,14 @@
+
+using System;
+
+namespace System.Runtime.InteropServices
+{
+       internal static class AddrofIntrinsics
+       {
+               // This method is implemented elsewhere in the toolchain
+               internal static IntPtr AddrOf<T>(T ftn)
+               {
+                       return Marshal.GetFunctionPointerForDelegate<T>(ftn);
+               }
+       }
+}
\ No newline at end of file
index 6a88936752923e87171375cabcde77b2ab193aad..3eaf922d1345de6a66c9acf4482ae86c20396cdf 100644 (file)
@@ -1,13 +1,21 @@
+
 namespace System.Diagnostics.Private
 {
-       static class Debug
+       static partial class Debug
        {
-               public static void Assert (bool condition)
-               {
-               }
+               internal static IDebugLogger s_logger = new MonoDebugLogger();
 
-               public static void Assert (bool condition, string message)
+               internal sealed class MonoDebugLogger : IDebugLogger
                {
+                       public void ShowAssertDialog(string stackTrace, string message, string detailMessage)
+                       {
+                               // FIXME should we g_error in this case?
+                       }
+
+                       public void WriteCore(string message)
+                       {
+                               // FIXME should we g_debug in this case?
+                       }
                }
        }
 }
diff --git a/mcs/class/corlib/corert/Interop.MemAllocFree.cs b/mcs/class/corlib/corert/Interop.MemAllocFree.cs
new file mode 100644 (file)
index 0000000..a41282d
--- /dev/null
@@ -0,0 +1,21 @@
+
+using System;
+
+internal static partial class Interop
+{
+    internal static IntPtr MemAlloc(UIntPtr sizeInBytes)
+    {
+        if (Environment.IsRunningOnWindows)
+            return Windows_MemAlloc(sizeInBytes);
+        else
+            return Unix_MemAlloc(sizeInBytes);
+    }
+
+    internal static void MemFree(IntPtr allocatedMemory)
+    {
+        if (Environment.IsRunningOnWindows)
+            Windows_MemFree(allocatedMemory);
+        else
+            Unix_MemFree(allocatedMemory);
+    }
+}
diff --git a/mcs/class/corlib/corert/Interop.cs b/mcs/class/corlib/corert/Interop.cs
new file mode 100644 (file)
index 0000000..0944b5b
--- /dev/null
@@ -0,0 +1,14 @@
+
+using System;
+
+internal partial class Interop
+{
+       internal partial class mincore
+       {
+               static mincore()
+               {
+                       if (!Environment.IsRunningOnWindows)
+                               throw new PlatformNotSupportedException();
+               }
+       }
+}
diff --git a/mcs/class/corlib/corert/SR.cs b/mcs/class/corlib/corert/SR.cs
deleted file mode 100644 (file)
index 09ed641..0000000
+++ /dev/null
@@ -1,652 +0,0 @@
-//
-// This file was generated by resx2sr tool
-//
-
-partial class SR
-{
-       public const string Arg_AccessException = "Cannot access member.";
-       public const string Arg_AccessViolationException = "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.";
-       public const string Arg_ApplicationException = "Error in the application.";
-       public const string Arg_ArgumentException = "Value does not fall within the expected range.";
-       public const string Arg_ArgumentOutOfRangeException = "Specified argument was out of the range of valid values.";
-       public const string Arg_ArithmeticException = "Overflow or underflow in the arithmetic operation.";
-       public const string Arg_ArrayPlusOffTooSmall = "Destination array is not long enough to copy all the items in the collection. Check array index and length.";
-       public const string Arg_ArrayTypeMismatchException = "Attempted to access an element as a type incompatible with the array.";
-       public const string Arg_ArrayZeroError = "Array must not be of length zero.";
-       public const string Arg_BadImageFormatException = "Format of the executable (.exe) or library (.dll) is invalid.";
-       public const string Arg_BogusIComparer = "Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.";
-       public const string Arg_CannotBeNaN = "TimeSpan does not accept floating point Not-a-Number values.";
-       public const string Arg_CannotHaveNegativeValue = "String cannot contain a minus sign if the base is not 10.";
-       public const string Arg_CopyNonBlittableArray = "Arrays must contain only blittable data in order to be copied to unmanaged memory.";
-       public const string Arg_CopyOutOfRange = "Requested range extends past the end of the array.";
-       public const string Arg_CryptographyException = "Error occurred during a cryptographic operation.";
-       public const string Arg_DataMisalignedException = "A datatype misalignment was detected in a load or store instruction.";
-       public const string Arg_DateTimeRange = "Combination of arguments to the DateTime constructor is out of the legal range.";
-       public const string Arg_DirectoryNotFoundException = "Attempted to access a path that is not on the disk.";
-       public const string Arg_DecBitCtor = "Decimal byte array constructor requires an array of length four containing valid decimal bytes.";
-       public const string Arg_DivideByZero = "Attempted to divide by zero.";
-       public const string Arg_DriveNotFoundException = "Attempted to access a drive that is not available.";
-       public const string Arg_DlgtNullInst = "Delegate to an instance method cannot have null 'this'.";
-       public const string Arg_DuplicateWaitObjectException = "Duplicate objects in argument.";
-       public const string Arg_EnumAndObjectMustBeSameType = "Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.";
-       public const string Arg_EntryPointNotFoundException = "Entry point was not found.";
-       public const string Arg_EnumIllegalVal = "Illegal enum value: {0}.";
-       public const string Arg_ExecutionEngineException = "Internal error in the runtime.";
-       public const string Arg_ExternalException = "External component has thrown an exception.";
-       public const string Arg_FieldAccessException = "Attempted to access a field that is not accessible by the caller.";
-       public const string Arg_FormatException = "One of the identified items was in an invalid format.";
-       public const string Arg_GuidArrayCtor = "Byte array for GUID must be exactly {0} bytes long.";
-       public const string Arg_HexStyleNotSupported = "The number style AllowHexSpecifier is not supported on floating point data types.";
-       public const string Arg_HTCapacityOverflow = "Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.";
-       public const string Arg_IndexOutOfRangeException = "Index was outside the bounds of the array.";
-       public const string Arg_InsufficientExecutionStackException = "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.";
-       public const string Arg_InvalidBase = "Invalid Base.";
-       public const string Arg_InvalidCastException = "Specified cast is not valid.";
-       public const string Arg_InvalidHexStyle = "With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.";
-       public const string Arg_InvalidOperationException = "Operation is not valid due to the current state of the object.";
-       public const string Arg_OleAutDateInvalid = " Not a legal OleAut date.";
-       public const string Arg_OleAutDateScale = "OleAut date did not convert to a DateTime correctly.";
-       public const string Arg_InvalidRuntimeTypeHandle = "Invalid RuntimeTypeHandle.";
-       public const string Arg_IOException = "I/O error occurred.";
-       public const string Arg_KeyNotFound = "The given key was not present in the dictionary.";
-       public const string Arg_LongerThanSrcString = "Source string was not long enough. Check sourceIndex and count.";
-       public const string Arg_LowerBoundsMustMatch = "The arrays' lower bounds must be identical.";
-       public const string Arg_MissingFieldException = "Attempted to access a non-existing field.";
-       public const string Arg_MethodAccessException = "Attempt to access the method failed.";
-       public const string Arg_MissingMemberException = "Attempted to access a missing member.";
-       public const string Arg_MissingMethodException = "Attempted to access a missing method.";
-       public const string Arg_MulticastNotSupportedException = "Attempted to add multiple callbacks to a delegate that does not support multicast.";
-       public const string Arg_MustBeBoolean = "Object must be of type Boolean.";
-       public const string Arg_MustBeByte = "Object must be of type Byte.";
-       public const string Arg_MustBeChar = "Object must be of type Char.";
-       public const string Arg_MustBeDateTime = "Object must be of type DateTime.";
-       public const string Arg_MustBeDateTimeOffset = "Object must be of type DateTimeOffset.";
-       public const string Arg_MustBeDecimal = "Object must be of type Decimal.";
-       public const string Arg_MustBeDouble = "Object must be of type Double.";
-       public const string Arg_MustBeEnum = "Type provided must be an Enum.";
-       public const string Arg_MustBeGuid = "Object must be of type GUID.";
-       public const string Arg_MustBeInt16 = "Object must be of type Int16.";
-       public const string Arg_MustBeInt32 = "Object must be of type Int32.";
-       public const string Arg_MustBeInt64 = "Object must be of type Int64.";
-       public const string Arg_MustBePrimArray = "Object must be an array of primitives.";
-       public const string Arg_MustBeSByte = "Object must be of type SByte.";
-       public const string Arg_MustBeSingle = "Object must be of type Single.";
-       public const string Arg_MustBeString = "Object must be of type String.";
-       public const string Arg_MustBeStringPtrNotAtom = "The pointer passed in as a String must not be in the bottom 64K of the process's address space.";
-       public const string Arg_MustBeTimeSpan = "Object must be of type TimeSpan.";
-       public const string Arg_MustBeUInt16 = "Object must be of type UInt16.";
-       public const string Arg_MustBeUInt32 = "Object must be of type UInt32.";
-       public const string Arg_MustBeUInt64 = "Object must be of type UInt64.";
-       public const string Arg_MustBeVersion = "Object must be of type Version.";
-       public const string Arg_NeedAtLeast1Rank = "Must provide at least one rank.";
-       public const string Arg_Need2DArray = "Array was not a two-dimensional array.";
-       public const string Arg_Need3DArray = "Array was not a three-dimensional array.";
-       public const string Arg_NegativeArgCount = "Argument count must not be negative.";
-       public const string Arg_NotFiniteNumberException = "Arg_NotFiniteNumberException = Number encountered was not a finite quantity.";
-       public const string Arg_NonZeroLowerBound = "The lower bound of target array must be zero.";
-       public const string Arg_NotGenericParameter = "Method may only be called on a Type for which Type.IsGenericParameter is true.";
-       public const string Arg_NotImplementedException = "The method or operation is not implemented.";
-       public const string Arg_NotSupportedException = "Specified method is not supported.";
-       public const string Arg_NotSupportedMultidim = "Multi-dimensional arrays are not supported.";
-       public const string Arg_NotSupportedNonZeroLowerBound = "Arrays with non-zero lower bounds are not supported.";
-       public const string Arg_NullReferenceException = "Object reference not set to an instance of an object.";
-       public const string Arg_ObjObjEx = "Object of type '{0}' cannot be converted to type '{1}'.";
-       public const string Arg_OverflowException = "Arithmetic operation resulted in an overflow.";
-       public const string Arg_OutOfMemoryException = "Insufficient memory to continue the execution of the program.";
-       public const string Arg_PlatformNotSupported = "Operation is not supported on this platform.";
-       public const string Arg_ParamName_Name = "Parameter name: {0}";
-       public const string Arg_Path2IsRooted = "Second path fragment must not be a drive or UNC name.";
-       public const string Arg_PathIllegal = "The path is not of a legal form.";
-       public const string Arg_PathIllegalUNC = "The UNC path should be of the form \\\\\\\\server\\\\share.";
-       public const string Arg_RankException = "Attempted to operate on an array with the incorrect number of dimensions.";
-       public const string Arg_RankIndices = "Indices length does not match the array rank.";
-       public const string Arg_RankMultiDimNotSupported = "Only single dimensional arrays are supported for the requested action.";
-       public const string Arg_RanksAndBounds = "Number of lengths and lowerBounds must match.";
-       public const string Arg_RegGetOverflowBug = "RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.";
-       public const string Arg_RegKeyNotFound = "The specified registry key does not exist.";
-       public const string Arg_SecurityException = "Security error.";
-       public const string Arg_StackOverflowException = "Operation caused a stack overflow.";
-       public const string Arg_SynchronizationLockException = "Object synchronization method was called from an unsynchronized block of code.";
-       public const string Arg_SystemException = "System error.";
-       public const string Arg_TargetInvocationException = "Exception has been thrown by the target of an invocation.";
-       public const string Arg_TargetParameterCountException = "Number of parameters specified does not match the expected number.";
-       public const string Arg_DefaultValueMissingException = "Missing parameter does not have a default value.";
-       public const string Arg_TimeoutException = "The operation has timed out.";
-       public const string Arg_TypeAccessException = "Attempt to access the type failed.";
-       public const string Arg_TypeLoadException = "Failure has occurred while loading a type.";
-       public const string Arg_UnauthorizedAccessException = "Attempted to perform an unauthorized operation.";
-       public const string Arg_VersionString = "Version string portion was too short or too long.";
-       public const string Arg_WrongType = "The value '{0}' is not of type '{1}' and cannot be used in this generic collection.";
-       public const string Argument_AddingDuplicate = "An item with the same key has already been added. Key: {0}";
-       public const string Argument_AddingDuplicate__ = "Item has already been added. Key in dictionary: '{0}'  Key being added: '{1}'";
-       public const string Argument_AdjustmentRulesNoNulls = "The AdjustmentRule array cannot contain null elements.";
-       public const string Argument_AdjustmentRulesOutOfOrder = "The elements of the AdjustmentRule array must be in chronological order and must not overlap.";
-       public const string Argument_BadFormatSpecifier = "Format specifier was invalid.";
-       public const string Argument_CodepageNotSupported = "{0} is not a supported code page.";
-       public const string Argument_CompareOptionOrdinal = "CompareOption.Ordinal cannot be used with other options.";
-       public const string Argument_ConflictingDateTimeRoundtripStyles = "The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.";
-       public const string Argument_ConflictingDateTimeStyles = "The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.";
-       public const string Argument_ConversionOverflow = "Conversion buffer overflow.";
-       public const string Argument_ConvertMismatch = "The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly.  For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.";
-       public const string Argument_CultureInvalidIdentifier = "{0} is an invalid culture identifier.";
-       public const string Argument_CultureIetfNotSupported = "Culture IETF Name {0} is not a recognized IETF name.";
-       public const string Argument_CultureIsNeutral = "Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.";
-       public const string Argument_CultureNotSupported = "Culture is not supported.";
-       public const string Argument_CustomCultureCannotBePassedByNumber = "Customized cultures cannot be passed by LCID, only by name.";
-       public const string Argument_DateTimeBadBinaryData = "The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
-       public const string Argument_DateTimeHasTicks = "The supplied DateTime must have the Year, Month, and Day properties set to 1.  The time cannot be specified more precisely than whole milliseconds.";
-       public const string Argument_DateTimeHasTimeOfDay = "The supplied DateTime includes a TimeOfDay setting.   This is not supported.";
-       public const string Argument_DateTimeIsInvalid = "The supplied DateTime represents an invalid time.  For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.";
-       public const string Argument_DateTimeIsNotAmbiguous = "The supplied DateTime is not in an ambiguous time range.";
-       public const string Argument_DateTimeKindMustBeUnspecified = "The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified.";
-       public const string Argument_DateTimeOffsetInvalidDateTimeStyles = "The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.";
-       public const string Argument_DateTimeOffsetIsNotAmbiguous = "The supplied DateTimeOffset is not in an ambiguous time range.";
-       public const string Argument_EmptyDecString = "Decimal separator cannot be the empty string.";
-       public const string Argument_EmptyName = "Empty name is not legal.";
-       public const string Argument_EmptyWaithandleArray = "Waithandle array may not be empty.";
-       public const string Argument_EncoderFallbackNotEmpty = "Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.";
-       public const string Argument_EncodingConversionOverflowBytes = "The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.";
-       public const string Argument_EncodingConversionOverflowChars = "The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.";
-       public const string Argument_EncodingNotSupported = "'{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
-       public const string Argument_EnumTypeDoesNotMatch = "The argument type, '{0}', is not the same as the enum type '{1}'.";
-       public const string Argument_FallbackBufferNotEmpty = "Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.";
-       public const string Argument_IdnBadLabelSize = "IDN labels must be between 1 and 63 characters long.";
-       public const string Argument_IdnBadPunycode = "Invalid IDN encoded string.";
-       public const string Argument_IdnIllegalName = "Decoded string is not a valid IDN name.";
-       public const string Argument_ImplementIComparable = "At least one object must implement IComparable.";
-       public const string Argument_InvalidArgumentForComparison = "Type of argument is not compatible with the generic comparer.";
-       public const string Argument_InvalidArrayLength = "Length of the array must be {0}.";
-       public const string Argument_InvalidArrayType = "Target array type is not compatible with the type of items in the collection.";
-       public const string Argument_InvalidCalendar = "Not a valid calendar for the given culture.";
-       public const string Argument_InvalidCharSequence = "Invalid Unicode code point found at index {0}.";
-       public const string Argument_InvalidCharSequenceNoIndex = "String contains invalid Unicode code points.";
-       public const string Argument_InvalidCodePageBytesIndex = "Unable to translate bytes {0} at index {1} from specified code page to Unicode.";
-       public const string Argument_InvalidCodePageConversionIndex = "Unable to translate Unicode character \\\\u{0:X4} at index {1} to specified code page.";
-       public const string Argument_InvalidCultureName = "Culture name '{0}' is not supported.";
-       public const string Argument_InvalidDateTimeKind = "Invalid DateTimeKind value.";
-       public const string Argument_InvalidDateTimeStyles = "An undefined DateTimeStyles value is being used.";
-       public const string Argument_InvalidDigitSubstitution = "The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.";
-       public const string Argument_InvalidEnumValue = "The value '{0}' is not valid for this usage of the type {1}.";
-       public const string Argument_InvalidFlag = "Value of flags is invalid.";
-       public const string Argument_InvalidGroupSize = "Every element in the value array should be between one and nine, except for the last element, which can be zero.";
-       public const string Argument_InvalidHighSurrogate = "Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
-       public const string Argument_InvalidId = "The specified ID parameter '{0}' is not supported.";
-       public const string Argument_InvalidLowSurrogate = "Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.";
-       public const string Argument_InvalidNativeDigitCount = "The NativeDigits array must contain exactly ten members.";
-       public const string Argument_InvalidNativeDigitValue = "Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.";
-       public const string Argument_InvalidNeutralRegionName = "The region name {0} should not correspond to neutral culture; a specific culture name is required.";
-       public const string Argument_InvalidNormalizationForm = "Invalid normalization form.";
-       public const string Argument_InvalidNumberStyles = "An undefined NumberStyles value is being used.";
-       public const string Argument_InvalidOffLen = "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.";
-       public const string Argument_InvalidPathChars = "Illegal characters in path.";
-       public const string Argument_InvalidREG_TZI_FORMAT = "The REG_TZI_FORMAT structure is corrupt.";
-       public const string Argument_InvalidResourceCultureName = "The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.";
-       public const string Argument_InvalidSerializedString = "The specified serialized string '{0}' is not supported.";
-       public const string Argument_InvalidTimeSpanStyles = "An undefined TimeSpanStyles value is being used.";
-       public const string Argument_MustBeFalse = "Argument must be initialized to false";
-       public const string Argument_NoEra = "No Era was supplied.";
-       public const string Argument_NoRegionInvariantCulture = "There is no region associated with the Invariant Culture (Culture ID: 0x7F).";
-       public const string Argument_NotIsomorphic = "Object contains non-primitive or non-blittable data.";
-       public const string Argument_OffsetLocalMismatch = "The UTC Offset of the local dateTime parameter does not match the offset argument.";
-       public const string Argument_OffsetPrecision = "Offset must be specified in whole minutes.";
-       public const string Argument_OffsetOutOfRange = "Offset must be within plus or minus 14 hours.";
-       public const string Argument_OffsetUtcMismatch = "The UTC Offset for Utc DateTime instances must be 0.";
-       public const string Argument_OneOfCulturesNotSupported = "Culture name {0} or {1} is not supported.";
-       public const string Argument_OnlyMscorlib = "Only mscorlib's assembly is valid.";
-       public const string Argument_OutOfOrderDateTimes = "The DateStart property must come before the DateEnd property.";
-       public const string ArgumentOutOfRange_Index = "Index was out of range. Must be non-negative and less than the size of the collection.";
-       public const string ArgumentOutOfRange_NeedNonNegNum = "Non-negative number required.";
-       public const string ArgumentOutOfRange_NeedNonNegNumRequired = "Non-negative number required.";
-       public const string Argument_PathEmpty = "Path cannot be the empty string or all whitespace.";
-       public const string Argument_PathFormatNotSupported = "The given path's format is not supported.";
-       public const string Argument_RecursiveFallback = "Recursive fallback not allowed for character \\\\u{0:X4}.";
-       public const string Argument_RecursiveFallbackBytes = "Recursive fallback not allowed for bytes {0}.";
-       public const string Argument_ResultCalendarRange = "The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
-       public const string Argument_SemaphoreInitialMaximum = "The initial count for the semaphore must be greater than or equal to zero and less than the maximum count.";
-       public const string Argument_TimeSpanHasSeconds = "The TimeSpan parameter cannot be specified more precisely than whole minutes.";
-       public const string Argument_TimeZoneNotFound = "The time zone ID '{0}' was not found on the local computer.";
-       public const string Argument_TimeZoneInfoBadTZif = "The tzfile does not begin with the magic characters 'TZif'.  Please verify that the file is not corrupt.";
-       public const string Argument_TimeZoneInfoInvalidTZif = "The TZif data structure is corrupt.";
-       public const string Argument_TransitionTimesAreIdentical = "The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.";
-       public const string Argument_UTCOutOfRange = "The UTC time represented when the offset is applied must be between year 0 and 10,000.";
-       public const string Argument_WaitHandleNameTooLong = "The name can be no more than 260 characters in length.";
-       public const string ArgumentException_OtherNotArrayOfCorrectLength = "Object is not a array with the same number of elements as the array to compare it to.";
-       public const string ArgumentException_TupleIncorrectType = "Argument must be of type {0}.";
-       public const string ArgumentException_TupleLastArgumentNotATuple = "The last element of an eight element tuple must be a Tuple.";
-       public const string ArgumentException_ValueTupleIncorrectType = "Argument must be of type {0}.";
-       public const string ArgumentException_ValueTupleLastArgumentNotATuple = "The TRest type argument of ValueTuple`8 must be a ValueTuple.";
-       public const string ArgumentNull_Array = "Array cannot be null.";
-       public const string ArgumentNull_ArrayElement = "At least one element in the specified array was null.";
-       public const string ArgumentNull_ArrayValue = "Found a null value within an array.";
-       public const string ArgumentNull_Generic = "Value cannot be null.";
-       public const string ArgumentNull_Key = "Key cannot be null.";
-       public const string ArgumentNull_Obj = "Object cannot be null.";
-       public const string ArgumentNull_String = "String reference not set to an instance of a String.";
-       public const string ArgumentNull_Waithandles = "The waitHandles parameter cannot be null.";
-       public const string ArgumentNull_WithParamName = "Parameter '{0}' cannot be null.";
-       public const string ArgumentOutOfRange_AddValue = "Value to add was out of range.";
-       public const string ArgumentOutOfRange_ActualValue = "Actual value was {0}.";
-       public const string ArgumentOutOfRange_BadYearMonthDay = "Year, Month, and Day parameters describe an un-representable DateTime.";
-       public const string ArgumentOutOfRange_BadHourMinuteSecond = "Hour, Minute, and Second parameters describe an un-representable DateTime.";
-       public const string ArgumentOutOfRange_BiggerThanCollection = "Must be less than or equal to the size of the collection.";
-       public const string ArgumentOutOfRange_Bounds_Lower_Upper = "Argument must be between {0} and {1}.";
-       public const string ArgumentOutOfRange_CalendarRange = "Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.";
-       public const string ArgumentOutOfRange_Capacity = "Capacity exceeds maximum capacity.";
-       public const string ArgumentOutOfRange_Count = "Count must be positive and count must refer to a location within the string/array/collection.";
-       public const string ArgumentOutOfRange_DateArithmetic = "The added or subtracted value results in an un-representable DateTime.";
-       public const string ArgumentOutOfRange_DateTimeBadMonths = "Months value must be between +/-120000.";
-       public const string ArgumentOutOfRange_DateTimeBadTicks = "Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.";
-       public const string ArgumentOutOfRange_DateTimeBadYears = "Years value must be between +/-10000.";
-       public const string ArgumentOutOfRange_Day = "Day must be between 1 and {0} for month {1}.";
-       public const string ArgumentOutOfRange_DayOfWeek = "The DayOfWeek enumeration must be in the range 0 through 6.";
-       public const string ArgumentOutOfRange_DayParam = "The Day parameter must be in the range 1 through 31.";
-       public const string ArgumentOutOfRange_DecimalRound = "Decimal can only round to between 0 and 28 digits of precision.";
-       public const string ArgumentOutOfRange_DecimalScale = "Decimal's scale value must be between 0 and 28, inclusive.";
-       public const string ArgumentOutOfRange_EndIndexStartIndex = "endIndex cannot be greater than startIndex.";
-       public const string ArgumentOutOfRange_Enum = "Enum value was out of legal range.";
-       public const string ArgumentOutOfRange_Era = "Time value was out of era range.";
-       public const string ArgumentOutOfRange_FileTimeInvalid = "Not a valid Win32 FileTime.";
-       public const string ArgumentOutOfRange_GenericPositive = "Value must be positive.";
-       public const string ArgumentOutOfRange_GetByteCountOverflow = "Too many characters. The resulting number of bytes is larger than what can be returned as an int.";
-       public const string ArgumentOutOfRange_GetCharCountOverflow = "Too many bytes. The resulting number of chars is larger than what can be returned as an int.";
-       public const string ArgumentOutOfRange_IndexCount = "Index and count must refer to a location within the string.";
-       public const string ArgumentOutOfRange_IndexCountBuffer = "Index and count must refer to a location within the buffer.";
-       public const string ArgumentOutOfRange_IndexLength = "Index and length must refer to a location within the string.";
-       public const string ArgumentOutOfRange_InvalidEraValue = "Era value was not valid.";
-       public const string ArgumentOutOfRange_InvalidHighSurrogate = "A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.";
-       public const string ArgumentOutOfRange_InvalidLowSurrogate = "A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.";
-       public const string ArgumentOutOfRange_InvalidUTF32 = "A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).";
-       public const string ArgumentOutOfRange_LengthTooLarge = "The specified length exceeds the maximum value of {0}.";
-       public const string ArgumentOutOfRange_LengthGreaterThanCapacity = "The length cannot be greater than the capacity.";
-       public const string ArgumentOutOfRange_ListInsert = "Index must be within the bounds of the List.";
-       public const string ArgumentOutOfRange_ListItem = "Index was out of range. Must be non-negative and less than the size of the list.";
-       public const string ArgumentOutOfRange_ListRemoveAt = "Index was out of range. Must be non-negative and less than the size of the list.";
-       public const string ArgumentOutOfRange_Month = "Month must be between one and twelve.";
-       public const string ArgumentOutOfRange_MonthParam = "The Month parameter must be in the range 1 through 12.";
-       public const string ArgumentOutOfRange_MustBeNonNegInt32 = "Value must be non-negative and less than or equal to Int32.MaxValue.";
-       public const string ArgumentOutOfRange_MustBeNonNegNum = "'{0}' must be non-negative.";
-       public const string ArgumentOutOfRange_MustBePositive = "'{0}' must be greater than zero.";
-       public const string ArgumentOutOfRange_NeedNonNegOrNegative1 = "Number must be either non-negative and less than or equal to Int32.MaxValue or -1.";
-       public const string ArgumentOutOfRange_NeedPosNum = "Positive number required.";
-       public const string ArgumentOutOfRange_NegativeCapacity = "Capacity must be positive.";
-       public const string ArgumentOutOfRange_NegativeCount = "Count cannot be less than zero.";
-       public const string ArgumentOutOfRange_NegativeLength = "Length cannot be less than zero.";
-       public const string ArgumentOutOfRange_OffsetLength = "Offset and length must refer to a position in the string.";
-       public const string ArgumentOutOfRange_OffsetOut = "Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.";
-       public const string ArgumentOutOfRange_PartialWCHAR = "Pointer startIndex and length do not refer to a valid string.";
-       public const string ArgumentOutOfRange_Range = "Valid values are between {0} and {1}, inclusive.";
-       public const string ArgumentOutOfRange_RoundingDigits = "Rounding digits must be between 0 and 15, inclusive.";
-       public const string ArgumentOutOfRange_SmallCapacity = "capacity was less than the current size.";
-       public const string ArgumentOutOfRange_SmallMaxCapacity = "MaxCapacity must be one or greater.";
-       public const string ArgumentOutOfRange_StartIndex = "StartIndex cannot be less than zero.";
-       public const string ArgumentOutOfRange_StartIndexLargerThanLength = "startIndex cannot be larger than length of string.";
-       public const string ArgumentOutOfRange_StartIndexLessThanLength = "startIndex must be less than length of string.";
-       public const string ArgumentOutOfRange_UtcOffset = "The TimeSpan parameter must be within plus or minus 14.0 hours.";
-       public const string ArgumentOutOfRange_UtcOffsetAndDaylightDelta = "The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours.";
-       public const string ArgumentOutOfRange_Version = "Version's parameters must be greater than or equal to zero.";
-       public const string ArgumentOutOfRange_Week = "The Week parameter must be in the range 1 through 5.";
-       public const string ArgumentOutOfRange_Year = "Year must be between 1 and 9999.";
-       public const string Arithmetic_NaN = "Function does not accept floating point Not-a-Number values.";
-       public const string ArrayTypeMismatch_CantAssignType = "Source array type cannot be assigned to destination array type.";
-       public const string BadImageFormatException_CouldNotLoadFileOrAssembly = "Could not load file or assembly '{0}'. An attempt was made to load a program with an incorrect format.";
-       public const string CollectionCorrupted = "A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted.";
-       public const string Exception_EndOfInnerExceptionStack = "--- End of inner exception stack trace ---";
-       public const string Exception_WasThrown = "Exception of type '{0}' was thrown.";
-       public const string Format_BadBase64Char = "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.";
-       public const string Format_BadBase64CharArrayLength = "Invalid length for a Base-64 char array or string.";
-       public const string Format_BadBoolean = "String was not recognized as a valid Boolean.";
-       public const string Format_BadFormatSpecifier = "Format specifier was invalid.";
-       public const string Format_BadQuote = "Cannot find a matching quote character for the character '{0}'.";
-       public const string Format_EmptyInputString = "Input string was either empty or contained only whitespace.";
-       public const string Format_GuidHexPrefix = "Expected hex 0x in '{0}'.";
-       public const string Format_GuidInvLen = "Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).";
-       public const string Format_GuidInvalidChar = "Guid string should only contain hexadecimal characters.";
-       public const string Format_GuidBrace = "Expected {0xdddddddd, etc}.";
-       public const string Format_GuidComma = "Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.).";
-       public const string Format_GuidBraceAfterLastNumber = "Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.).";
-       public const string Format_GuidDashes = "Dashes are in the wrong position for GUID parsing.";
-       public const string Format_GuidEndBrace = "Could not find the ending brace.";
-       public const string Format_ExtraJunkAtEnd = "Additional non-parsable characters are at the end of the string.";
-       public const string Format_GuidUnrecognized = "Unrecognized Guid format.";
-       public const string Format_IndexOutOfRange = "Index (zero based) must be greater than or equal to zero and less than the size of the argument list.";
-       public const string Format_InvalidGuidFormatSpecification = "Format String can be only 'D', 'd', 'N', 'n', 'P', 'p', 'B', 'b', 'X' or 'x'.";
-       public const string Format_InvalidString = "Input string was not in a correct format.";
-       public const string Format_NeedSingleChar = "String must be exactly one character long.";
-       public const string Format_NoParsibleDigits = "Could not find any recognizable digits.";
-       public const string Format_BadTimeSpan = "String was not recognized as a valid TimeSpan.";
-       public const string InvalidCast_CannotCastNullToValueType = "Null object cannot be converted to a value type.";
-       public const string InvalidCast_DownCastArrayElement = "At least one element in the source array could not be cast down to the destination array type.";
-       public const string InvalidCast_FromTo = "Invalid cast from '{0}' to '{1}'.";
-       public const string InvalidCast_IConvertible = "Object must implement IConvertible.";
-       public const string InvalidCast_StoreArrayElement = "Object cannot be stored in an array of this type.";
-       public const string InvalidNullEmptyArgument = "Argument {0} cannot be null or zero-length.";
-       public const string InvalidOperation_Calling = "WinRT Interop has already been initialized and cannot be initialized again.";
-       public const string InvalidOperation_DateTimeParsing = "Internal Error in DateTime and Calendar operations.";
-       public const string InvalidOperation_GetCodepageInfo = "Internal Error in getting codepage data.";
-       public const string InvalidOperation_EnumEnded = "Enumeration already finished.";
-       public const string InvalidOperation_EnumFailedVersion = "Collection was modified; enumeration operation may not execute.";
-       public const string InvalidOperation_EnumNotStarted = "Enumeration has not started. Call MoveNext.";
-       public const string InvalidOperation_EnumOpCantHappen = "Enumeration has either not started or has already finished.";
-       public const string InvalidOperation_HandleIsNotInitialized = "Handle is not initialized.";
-       public const string InvalidOperation_IComparerFailed = "Failed to compare two elements in the array.";
-       public const string InvalidOperation_Monitor_UseConditionDirectly = "TBD";
-       public const string InvalidOperation_NoValue = "Nullable object must have a value.";
-       public const string InvalidOperation_NullArray = "The underlying array is null.";
-       public const string InvalidOperation_ReadOnly = "Instance is read-only.";
-       public const string InvalidOperation_UnknownEnumType = "Unknown enum type.";
-       public const string InvalidOperation_ArrayCreateInstance_NotARuntimeType = "Array.CreateInstance() can only accept Type objects created by the runtime.";
-       public const string InvalidOperation_ExpectedEEType = "Internal Error: Did not expect an uninstantiated generic type here.";
-       public const string InvalidOperation_ExpectedSpecialLdTokenResult = "Internal Error: Expected an uninstantiated generic type here.";
-       public const string InvalidOperation_TooEarly = "Internal Error: This operation cannot be invoked in an eager class constructor.";
-       public const string InvalidProgram_Default = "Common Language Runtime detected an invalid program.";
-       public const string InvalidProgram_Specific = "Common Language Runtime detected an invalid program. The body of method '{0}' is invalid.";
-       public const string InvalidProgram_Vararg = "Method '{0}' has a variable argument list. Variable argument lists are not supported in .NET Core.";
-       public const string InvalidTimeZone_InvalidRegistryData = "The time zone ID '{0}' was found on the local computer, but the registry information was corrupt.";
-       public const string IO_DriveNotFound_Drive = "Could not find the drive '{0}'. The drive might not be ready or might not be mapped.";
-       public const string IO_FileExists_Name = "The file '{0}' already exists.";
-       public const string IO_FileName_Name = "File name: '{0}'";
-       public const string IO_FileNotFound = "Unable to find the specified file.";
-       public const string IO_FileNotFound_FileName = "Could not load file or assembly '{0}'. The system cannot find the file specified.";
-       public const string IO_FileLoad = "Could not load the specified file.";
-       public const string IO_NoPermissionToDirectoryName = "<Path discovery permission to the specified directory was denied.%gt;";
-       public const string IO_PathNotFound_NoPathName = "Could not find a part of the path.";
-       public const string IO_PathNotFound_Path = "Could not find a part of the path '{0}'.";
-       public const string IO_PathTooLong = "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.";
-       public const string IO_SharingViolation_File = "The process cannot access the file '{0}' because it is being used by another process.";
-       public const string IO_SharingViolation_NoFileName = "The process cannot access the file because it is being used by another process.";
-       public const string IO_AlreadyExists_Name = "Cannot create '{0}' because a file or directory with the same name already exists.";
-       public const string UnauthorizedAccess_IODenied_NoPathName = "Access to the path is denied.";
-       public const string UnauthorizedAccess_IODenied_Path = "Access to the path '{0}' is denied.";
-       public const string Lazy_CreateValue_NoParameterlessCtorForT = "The lazily-initialized type does not have a public, parameterless constructor.";
-       public const string Lazy_ctor_ModeInvalid = "The mode argument specifies an invalid value.";
-       public const string Lazy_StaticInit_InvalidOperation = "ValueFactory returned null.";
-       public const string Lazy_ToString_ValueNotCreated = "Value is not created.";
-       public const string Lazy_Value_RecursiveCallsToValue = "ValueFactory attempted to access the Value property of this instance.";
-       public const string MissingConstructor_Name = "Constructor on type '{0}' not found.";
-       public const string MustUseCCRewrite = "An assembly (probably '{1}') must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined.  Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild.  CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \\r\\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane.  Ensure that 'Perform Runtime Contract Checking' is enabled, which will define CONTRACTS_FULL.";
-       public const string net_uri_AlreadyRegistered = "A URI scheme name '{0}' already has a registered custom parser.";
-       public const string net_uri_BadAuthority = "Invalid URI: The Authority/Host could not be parsed.";
-       public const string net_uri_BadAuthorityTerminator = "Invalid URI: The Authority/Host cannot end with a backslash character ('\\\\').";
-       public const string net_uri_BadFormat = "Invalid URI: The format of the URI could not be determined.";
-       public const string net_uri_BadHostName = "Invalid URI: The hostname could not be parsed.";
-       public const string net_uri_BadPort = "Invalid URI: Invalid port specified.";
-       public const string net_uri_BadScheme = "Invalid URI: The URI scheme is not valid.";
-       public const string net_uri_BadString = "Invalid URI: There is an invalid sequence in the string.";
-       public const string net_uri_BadUserPassword = "Invalid URI: The username:password construct is badly formed.";
-       public const string net_uri_CannotCreateRelative = "A relative URI cannot be created because the 'uriString' parameter represents an absolute URI.";
-       public const string net_uri_SchemeLimit = "Invalid URI: The Uri scheme is too long.";
-       public const string net_uri_EmptyUri = "Invalid URI: The URI is empty.";
-       public const string net_uri_InvalidUriKind = "The value '{0}' passed for the UriKind parameter is invalid.";
-       public const string net_uri_MustRootedPath = "Invalid URI: A Dos path must be rooted, for example, 'c:\\\\'.";
-       public const string net_uri_NeedFreshParser = "The URI parser instance passed into 'uriParser' parameter is already registered with the scheme name '{0}'.";
-       public const string net_uri_NotAbsolute = "This operation is not supported for a relative URI.";
-       public const string net_uri_PortOutOfRange = "A derived type '{0}' has reported an invalid value for the Uri port '{1}'.";
-       public const string net_uri_SizeLimit = "Invalid URI: The Uri string is too long.";
-       public const string net_uri_UserDrivenParsing = "A derived type '{0}' is responsible for parsing this Uri instance. The base implementation must not be used.";
-       public const string net_uri_NotJustSerialization = "UriComponents.SerializationInfoString must not be combined with other UriComponents.";
-       public const string net_uri_BadUnicodeHostForIdn = "An invalid Unicode character by IDN standards was specified in the host.";
-       public const string NotSupported_FixedSizeCollection = "Collection was of a fixed size.";
-       public const string NotSupported_MaxWaitHandles = "The number of WaitHandles must be less than or equal to 64.";
-       public const string NotSupported_OpenType = "Cannot create arrays of open type.";
-       public const string NotSupported_NoCodepageData = "No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.";
-       public const string NotSupported_ReadOnlyCollection = "Collection is read-only.";
-       public const string NotSupported_StringComparison = "The string comparison type passed in is currently not supported.";
-       public const string NotSupported_VoidArray = "Arrays of System.Void are not supported.";
-       public const string NotSupported_WaitAllSTAThread = "WaitAll for multiple handles on a STA thread is not supported.";
-       public const string ObjectDisposed_Generic = "Cannot access a disposed object.";
-       public const string ObjectDisposed_ObjectName_Name = "Object name: '{0}'.";
-       public const string ObjectDisposed_WriterClosed = "Cannot write to a closed TextWriter.";
-       public const string Overflow_Byte = "Value was either too large or too small for an unsigned byte.";
-       public const string Overflow_Char = "Value was either too large or too small for a character.";
-       public const string Overflow_Decimal = "Value was either too large or too small for a Decimal.";
-       public const string Overflow_Double = "Value was either too large or too small for a Double.";
-       public const string Overflow_TimeSpanElementTooLarge = "The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.";
-       public const string Overflow_Duration = "The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue.";
-       public const string Overflow_Int16 = "Value was either too large or too small for an Int16.";
-       public const string Overflow_Int32 = "Value was either too large or too small for an Int32.";
-       public const string Overflow_Int64 = "Value was either too large or too small for an Int64.";
-       public const string Overflow_NegateTwosCompNum = "Negating the minimum value of a twos complement number is invalid.";
-       public const string Overflow_NegativeUnsigned = "The string was being parsed as an unsigned number and could not have a negative sign.";
-       public const string Overflow_SByte = "Value was either too large or too small for a signed byte.";
-       public const string Overflow_Single = "Value was either too large or too small for a Single.";
-       public const string Overflow_TimeSpanTooLong = "TimeSpan overflowed because the duration is too long.";
-       public const string Overflow_UInt16 = "Value was either too large or too small for a UInt16.";
-       public const string Overflow_UInt32 = "Value was either too large or too small for a UInt32.";
-       public const string Overflow_UInt64 = "Value was either too large or too small for a UInt64.";
-       public const string PlatformNotSupported_MakePointerType = "MakePointerType() is not supported on this platform.";
-       public const string Rank_MultiDimNotSupported = "Only single dimension arrays are supported here.";
-       public const string RuntimeWrappedException = "An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.";
-       public const string SpinWait_SpinUntil_ArgumentNull = "The condition argument is null.";
-       public const string Serialization_CorruptField = "The value of the field '{0}' is invalid.  The serialized data is corrupt.";
-       public const string Serialization_InvalidData = "An error occurred while deserializing the object.  The serialized data is corrupt.";
-       public const string Serialization_InvalidEscapeSequence = "The serialized data contained an invalid escape sequence '\\\\{0}'.";
-       public const string SpinWait_SpinUntil_TimeoutWrong = "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
-       public const string Threading_AbandonedMutexException = "The wait completed due to an abandoned mutex.";
-       public const string Threading_SemaphoreFullException = "Adding the specified count to the semaphore would cause it to exceed its maximum count.";
-       public const string Threading_WaitHandleCannotBeOpenedException = "No handle of the given name exists.";
-       public const string Threading_WaitHandleCannotBeOpenedException_InvalidHandle = "A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.";
-       public const string TimeZoneNotFound_MissingRegistryData = "The time zone ID '{0}' was not found on the local computer.";
-       public const string TypeInitialization_Default = "Type constructor threw an exception.";
-       public const string TypeInitialization_Type = "The type initializer for '{0}' threw an exception.";
-       public const string TypeInitialization_Type_NoTypeAvailable = "A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property.";
-       public const string Verification_Exception = "Operation could destabilize the runtime.";
-       public const string Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType = "Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.";
-       public const string Format_InvalidEnumFormatSpecification = "Format String can be only 'G', 'g', 'X', 'x', 'F', 'f', 'D' or 'd'.";
-       public const string Arg_MustBeEnumBaseTypeOrEnum = "The value passed in must be an enum base or an underlying type for an enum, such as an Int32.";
-       public const string Arg_EnumUnderlyingTypeAndObjectMustBeSameType = "Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.";
-       public const string Arg_MustBeType = "Type must be a type provided by the runtime.";
-       public const string Arg_MustContainEnumInfo = "Must specify valid information for parsing in the string.";
-       public const string Arg_EnumValueNotFound = "Requested value '{0}' was not found.";
-       public const string Argument_StringZeroLength = "String cannot be of zero length.";
-       public const string Argument_StringFirstCharIsZero = "The first char in the string is the null character.";
-       public const string Argument_LongEnvVarValue = "Environment variable name or value is too long.";
-       public const string Argument_IllegalEnvVarName = "Environment variable name cannot contain equal character.";
-       public const string AssumptionFailed = "Assumption failed.";
-       public const string AssumptionFailed_Cnd = "Assumption failed: {0}";
-       public const string AssertionFailed = "Assertion failed.";
-       public const string AssertionFailed_Cnd = "Assertion failed: {0}";
-       public const string Debug_Fail = "Fail: {0}";
-       public const string PreconditionFailed = "Precondition failed.";
-       public const string PreconditionFailed_Cnd = "Precondition failed: {0}";
-       public const string PostconditionFailed = "Postcondition failed.";
-       public const string PostconditionFailed_Cnd = "Postcondition failed: {0}";
-       public const string PostconditionOnExceptionFailed = "Postcondition failed after throwing an exception.";
-       public const string PostconditionOnExceptionFailed_Cnd = "Postcondition failed after throwing an exception: {0}";
-       public const string InvariantFailed = "Invariant failed.";
-       public const string InvariantFailed_Cnd = "Invariant failed: {0}";
-       public const string MissingEncodingNameResource = "Could not find a resource entry for the encoding codepage '{0} - {1}'";
-       public const string Globalization_cp_1200 = "Unicode";
-       public const string Globalization_cp_1201 = "Unicode (Big-Endian)";
-       public const string Globalization_cp_12000 = "Unicode (UTF-32)";
-       public const string Globalization_cp_12001 = "Unicode (UTF-32 Big-Endian)";
-       public const string Globalization_cp_20127 = "US-ASCII";
-       public const string Globalization_cp_28591 = "Western European (ISO)";
-       public const string Globalization_cp_65000 = "Unicode (UTF-7)";
-       public const string Globalization_cp_65001 = "Unicode (UTF-8)";
-       public const string DebugAssertBanner = "---- DEBUG ASSERTION FAILED ----";
-       public const string DebugAssertLongMessage = "---- Assert Long Message ----";
-       public const string DebugAssertShortMessage = "---- Assert Short Message ----";
-       public const string InvalidCast_Empty = "Object cannot be cast to Empty.";
-       public const string Arg_UnknownTypeCode = "Unknown TypeCode value.";
-       public const string Format_BadDatePattern = "Could not determine the order of year, month, and date from '{0}'.";
-       public const string Format_BadDateTime = "String was not recognized as a valid DateTime.";
-       public const string Format_BadDateTimeCalendar = "The DateTime represented by the string is not supported in calendar {0}.";
-       public const string Format_BadDayOfWeek = "String was not recognized as a valid DateTime because the day of week was incorrect.";
-       public const string Format_DateOutOfRange = "The DateTime represented by the string is out of range.";
-       public const string Format_MissingIncompleteDate = "There must be at least a partial date with a year present in the input.";
-       public const string Format_OffsetOutOfRange = "The time zone offset must be within plus or minus 14 hours.";
-       public const string Format_RepeatDateTimePattern = "DateTime pattern '{0}' appears more than once with different values.";
-       public const string Format_UnknowDateTimeWord = "The string was not recognized as a valid DateTime. There is an unknown word starting at index {0}.";
-       public const string Format_UTCOutOfRange = "The UTC representation of the date falls outside the year range 1-9999.";
-       public const string InvalidOperation_ComputerName = "Computer name could not be obtained.";
-       public const string RFLCT_Ambiguous = "Ambiguous match found.";
-       public const string AggregateException_ctor_DefaultMessage = "One or more errors occurred.";
-       public const string AggregateException_ctor_InnerExceptionNull = "An element of innerExceptions was null.";
-       public const string AggregateException_DeserializationFailure = "The serialization stream contains no inner exceptions.";
-       public const string AggregateException_InnerException = "(Inner Exception #{0}) "; // {entry.Item3}
-       public const string ArgumentOutOfRange_TimeoutTooLarge = "Time-out interval must be less than 2^32-2.";
-       public const string ArgumentOutOfRange_PeriodTooLarge = "Period must be less than 2^32-2.";
-       public const string TaskScheduler_FromCurrentSynchronizationContext_NoCurrent = "The current SynchronizationContext may not be used as a TaskScheduler.";
-       public const string TaskScheduler_ExecuteTask_WrongTaskScheduler = "ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler.";
-       public const string TaskScheduler_InconsistentStateAfterTryExecuteTaskInline = "The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked.";
-       public const string TaskSchedulerException_ctor_DefaultMessage = "An exception was thrown by a TaskScheduler.";
-       public const string Task_MultiTaskContinuation_FireOptions = "It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.";
-       public const string Task_ContinueWith_ESandLR = "The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously.  Synchronous continuations should not be long running.";
-       public const string Task_MultiTaskContinuation_EmptyTaskList = "The tasks argument contains no tasks.";
-       public const string Task_MultiTaskContinuation_NullTask = "The tasks argument included a null value.";
-       public const string Task_FromAsync_PreferFairness = "It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync.";
-       public const string Task_FromAsync_LongRunning = "It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync.";
-       public const string AsyncMethodBuilder_InstanceNotInitialized = "The builder was not properly initialized.";
-       public const string TaskT_TransitionToFinal_AlreadyCompleted = "An attempt was made to transition a task to a final state when it had already completed.";
-       public const string TaskT_DebuggerNoResult = "{Not yet computed}";
-       public const string OperationCanceled = "The operation was canceled.";
-       public const string CancellationToken_CreateLinkedToken_TokensIsEmpty = "No tokens were supplied.";
-       public const string CancellationTokenSource_Disposed = "The CancellationTokenSource has been disposed.";
-       public const string CancellationToken_SourceDisposed = "The CancellationTokenSource associated with this CancellationToken has been disposed.";
-       public const string TaskExceptionHolder_UnknownExceptionType = "(Internal)Expected an Exception or an IEnumerable<Exception>";
-       public const string TaskExceptionHolder_UnhandledException = "A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.";
-       public const string Task_Delay_InvalidMillisecondsDelay = "The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer.";
-       public const string Task_Delay_InvalidDelay = "The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue.";
-       public const string Task_WaitMulti_NullTask = "The tasks array included at least one null element.";
-       public const string Task_ContinueWith_NotOnAnything = "The specified TaskContinuationOptions excluded all continuation kinds.";
-       public const string Task_RunSynchronously_AlreadyStarted = "RunSynchronously may not be called on a task that was already started.";
-       public const string Task_ThrowIfDisposed = "The task has been disposed.";
-       public const string Task_RunSynchronously_TaskCompleted = "RunSynchronously may not be called on a task that has already completed.";
-       public const string Task_RunSynchronously_Promise = "RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.";
-       public const string Task_RunSynchronously_Continuation = "RunSynchronously may not be called on a continuation task.";
-       public const string Task_Start_AlreadyStarted = "Start may not be called on a task that was already started.";
-       public const string Task_Start_ContinuationTask = "Start may not be called on a continuation task.";
-       public const string Task_Start_Promise = "Start may not be called on a promise-style task.";
-       public const string Task_Start_TaskCompleted = "Start may not be called on a task that has completed.";
-       public const string TaskCanceledException_ctor_DefaultMessage = "A task was canceled.";
-       public const string TaskCompletionSourceT_TrySetException_NoExceptions = "The exceptions collection was empty.";
-       public const string TaskCompletionSourceT_TrySetException_NullException = "The exceptions collection included at least one null element.";
-       public const string Argument_MinMaxValue = "'{0}' cannot be greater than {1}.";
-       public const string InvalidOperation_NullContext = "Cannot call Set on a null context";
-       public const string ExecutionContext_ExceptionInAsyncLocalNotification = "An exception was not handled in an AsyncLocal<T> notification callback.";
-       public const string InvalidOperation_WrongAsyncResultOrEndCalledMultiple = "Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult.";
-       public const string SpinLock_IsHeldByCurrentThread = "Thread tracking is disabled.";
-       public const string SpinLock_TryEnter_LockRecursionException = "The calling thread already holds the lock.";
-       public const string SpinLock_Exit_SynchronizationLockException = "The calling thread does not hold the lock.";
-       public const string SpinLock_TryReliableEnter_ArgumentException = "The tookLock argument must be set to false before calling this method.";
-       public const string SpinLock_TryEnter_ArgumentOutOfRange = "The timeout must be a value between -1 and Int32.MaxValue, inclusive.";
-       public const string ManualResetEventSlim_Disposed = "The event has been disposed.";
-       public const string ManualResetEventSlim_ctor_SpinCountOutOfRange = "The spinCount argument must be in the range 0 to {0}, inclusive.";
-       public const string ManualResetEventSlim_ctor_TooManyWaiters = "There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported.";
-       public const string InvalidOperation_SendNotSupportedOnWindowsRTSynchronizationContext = "Send is not supported in the Windows Runtime SynchronizationContext";
-       public const string SemaphoreSlim_Disposed = "The semaphore has been disposed.";
-       public const string SemaphoreSlim_Release_CountWrong = "The releaseCount argument must be greater than zero.";
-       public const string SemaphoreSlim_Wait_TimeoutWrong = "The timeout must represent a value between -1 and Int32.MaxValue, inclusive.";
-       public const string SemaphoreSlim_ctor_MaxCountWrong = "The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter.";
-       public const string SemaphoreSlim_ctor_InitialCountWrong = "The initialCount argument must be non-negative and less than or equal to the maximumCount.";
-       public const string ThreadLocal_ValuesNotAvailable = "The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true.";
-       public const string ThreadLocal_Value_RecursiveCallsToValue = "ValueFactory attempted to access the Value property of this instance.";
-       public const string ThreadLocal_Disposed = "The ThreadLocal object has been disposed.";
-       public const string LockRecursionException_WriteAfterReadNotAllowed = "Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.";
-       public const string LockRecursionException_RecursiveWriteNotAllowed = "Recursive write lock acquisitions not allowed in this mode.";
-       public const string LockRecursionException_ReadAfterWriteNotAllowed = "A read lock may not be acquired with the write lock held in this mode.";
-       public const string LockRecursionException_RecursiveUpgradeNotAllowed = "Recursive upgradeable lock acquisitions not allowed in this mode.";
-       public const string LockRecursionException_RecursiveReadNotAllowed = "Recursive read lock acquisitions not allowed in this mode.";
-       public const string SynchronizationLockException_IncorrectDispose = "The lock is being disposed while still being used. It either is being held by a thread and/or has active waiters waiting to acquire the lock.";
-       public const string SynchronizationLockException_MisMatchedWrite = "The write lock is being released without being held.";
-       public const string LockRecursionException_UpgradeAfterReadNotAllowed = "Upgradeable lock may not be acquired with read lock held.";
-       public const string LockRecursionException_UpgradeAfterWriteNotAllowed = "Upgradeable lock may not be acquired with write lock held in this mode. Acquiring Upgradeable lock gives the ability to read along with an option to upgrade to a writer.";
-       public const string SynchronizationLockException_MisMatchedUpgrade = "The upgradeable lock is being released without being held.";
-       public const string SynchronizationLockException_MisMatchedRead = "The read lock is being released without being held.";
-       public const string InvalidOperation_TimeoutsNotSupported = "Timeouts are not supported on this stream.";
-       public const string NotSupported_UnreadableStream = "Stream does not support reading.";
-       public const string NotSupported_UnwritableStream = "Stream does not support writing.";
-       public const string ObjectDisposed_StreamClosed = "Cannot access a closed Stream.";
-       public const string NotSupported_SubclassOverride = "Derived classes must provide an implementation.";
-       public const string InvalidOperation_NoPublicRemoveMethod = "Cannot remove the event handler since no public remove method exists for the event.";
-       public const string InvalidOperation_NoPublicAddMethod = "Cannot add the event handler since no public add method exists for the event.";
-       public const string SerializationException = "Serialization error.";
-       public const string Serialization_NotFound = "Member '{0}' was not found.";
-       public const string Serialization_OptionalFieldVersionValue = "Version value must be positive.";
-       public const string Serialization_SameNameTwice = "Cannot add the same member twice to a SerializationInfo object.";
-       public const string NotSupported_AbstractNonCLS = "This non-CLS method is not implemented.";
-       public const string NotSupported_NoTypeInfo = "Cannot resolve {0} to a TypeInfo object.";
-       public const string ReflectionTypeLoad_LoadFailed = "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.";
-       public const string Arg_CustomAttributeFormatException = "Binary format of the specified custom attribute was invalid.";
-       public const string Argument_InvalidMemberForNamedArgument = "The member must be either a field or a property.";
-       public const string Arg_InvalidFilterCriteriaException = "Specified filter criteria was invalid.";
-       public const string Arg_ParmArraySize = "Must specify one or more parameters.";
-       public const string Arg_MustBePointer = "Type must be a Pointer.";
-       public const string Arg_InvalidHandle = "Invalid handle.";
-       public const string Argument_InvalidEnum = "The Enum type should contain one and only one instance field.";
-       public const string Argument_MustHaveAttributeBaseClass = "Type passed in must be derived from System.Attribute or System.Attribute itself.";
-       public const string InvalidFilterCriteriaException_CritString = "A String must be provided for the filter criteria.";
-       public const string InvalidFilterCriteriaException_CritInt = "An Int32 must be provided for the filter criteria.";
-       public const string InvalidOperation_NotSupportedOnWinRTEvent = "Adding or removing event handlers dynamically is not supported on WinRT events.";
-       public const string PlatformNotSupported_ReflectionOnly = "ReflectionOnly loading is not supported on this platform.";
-       public const string MissingMember_Name = "Member '{0}' not found.";
-       public const string MissingMethod_Name = "Method '{0}' not found.";
-       public const string MissingField_Name = "Field '{0}' not found.";
-       public const string Format_StringZeroLength = "String cannot have zero length.";
-       public const string Security_CannotReadRegistryData = "The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information.";
-       public const string Security_InvalidAssemblyPublicKey = "Invalid assembly public key.";
-       public const string Security_RegistryPermission = "Requested registry access is not allowed.";
-       public const string ClassLoad_General = "Could not load type '{0}' from assembly '{1}'.";
-       public const string ClassLoad_RankTooLarge = "'{0}' from assembly '{1}' has too many dimensions.";
-       public const string ClassLoad_ExplicitGeneric = "Could not load type '{0}' from assembly '{1}' because generic types cannot have explicit layout.";
-       public const string ClassLoad_BadFormat = "Could not load type '{0}' from assembly '{1}' because the format is invalid.";
-       public const string ClassLoad_ValueClassTooLarge = "Array of type '{0}' from assembly '{1}' cannot be created because base value type is too large.";
-       public const string ClassLoad_ExplicitLayout = "Could not load type '{0}' from assembly '{1}' because it contains an object field at offset '{2}' that is incorrectly aligned or overlapped by a non-object field.";
-       public const string EE_MissingMethod = "Method not found: '{0}'.";
-       public const string EE_MissingField = "Field not found: '{0}'.";
-       public const string UnauthorizedAccess_RegistryKeyGeneric_Key = "Access to the registry key '{0}' is denied.";
-       public const string UnknownError_Num = "Unknown error '{0}'.";
-       public const string Argument_NeedNonGenericType = "The specified Type must not be a generic type definition.";
-       public const string Argument_NeedStructWithNoRefs = "The specified Type must be a struct containing no references.";
-       public const string ArgumentNull_Buffer = "Buffer cannot be null.";
-       public const string ArgumentOutOfRange_AddressSpace = "The number of bytes cannot exceed the virtual address space on a 32 bit machine.";
-       public const string ArgumentOutOfRange_UIntPtrMaxMinusOne = "The length of the buffer must be less than the maximum UIntPtr value for your platform.";
-       public const string Arg_BufferTooSmall = "Not enough space available in the buffer.";
-       public const string InvalidOperation_MustCallInitialize = "You must call Initialize on this object instance before using it.";
-       public const string ArgumentException_BufferNotFromPool = "The buffer is not associated with this pool and may not be returned to it.";
-       public const string Argument_InvalidSafeBufferOffLen = "Offset and length were greater than the size of the SafeBuffer.";
-       public const string Argument_InvalidSeekOrigin = "Invalid seek origin.";
-       public const string Argument_NotEnoughBytesToRead = "There are not enough bytes remaining in the accessor to read at this position.";
-       public const string Argument_NotEnoughBytesToWrite = "There are not enough bytes remaining in the accessor to write at this position.";
-       public const string Argument_OffsetAndCapacityOutOfBounds = "Offset and capacity were greater than the size of the view.";
-       public const string Argument_UnmanagedMemAccessorWrapAround = "The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.";
-       public const string ArgumentOutOfRange_StreamLength = "Stream length must be non-negative and less than 2^31 - 1 - origin.";
-       public const string ArgumentOutOfRange_UnmanagedMemStreamWrapAround = "The UnmanagedMemoryStream capacity would wrap around the high end of the address space.";
-       public const string InvalidOperation_CalledTwice = "The method cannot be called twice on the same instance.";
-       public const string IO_FixedCapacity = "Unable to expand length of this stream beyond its capacity.";
-       public const string IO_SeekBeforeBegin = "An attempt was made to move the position before the beginning of the stream.";
-       public const string IO_StreamTooLong = "Stream was too long.";
-       public const string Arg_BadDecimal = "Read an invalid decimal value from the buffer.";
-       public const string NotSupported_Reading = "Accessor does not support reading.";
-       public const string NotSupported_UmsSafeBuffer = "This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer.";
-       public const string NotSupported_Writing = "Accessor does not support writing.";
-       public const string NotSupported_UnseekableStream = "Stream does not support seeking.";
-       public const string IndexOutOfRange_UMSPosition = "Unmanaged memory stream position was beyond the capacity of the stream.";
-       public const string ObjectDisposed_StreamIsClosed = "Cannot access a closed Stream.";
-       public const string ObjectDisposed_ViewAccessorClosed = "Cannot access a closed accessor.";
-       public const string ArgumentOutOfRange_PositionLessThanCapacityRequired = "The position may not be greater or equal to the capacity of the accessor.";
-       public const string IO_EOF_ReadBeyondEOF = "Unable to read beyond the end of the stream.";
-       public const string Arg_EndOfStreamException = "Attempted to read past the end of the stream.";
-       public const string ObjectDisposed_FileClosed = "Cannot access a closed file.";
-       public const string Arg_InvalidSearchPattern = "Search pattern cannot contain \\\"..\\\" to move up directories and can be contained only internally in file/directory names, as in \\\"a..b\\\".";
-       public const string ArgumentOutOfRange_FileLengthTooBig = "Specified file length was too large for the file system.";
-       public const string Argument_InvalidHandle = "'handle' has been disposed or is an invalid handle.";
-       public const string Argument_AlreadyBoundOrSyncHandle = "'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O.";
-       public const string Argument_PreAllocatedAlreadyAllocated = "'preAllocated' is already in use.";
-       public const string Argument_NativeOverlappedAlreadyFree = "'overlapped' has already been freed.";
-       public const string Argument_NativeOverlappedWrongBoundHandle = "'overlapped' was not allocated by this ThreadPoolBoundHandle instance.";
-       public const string Arg_HandleNotAsync = "Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).";
-       public const string ArgumentNull_Path = "Path cannot be null.";
-       public const string Argument_EmptyPath = "Empty path name is not legal.";
-       public const string Argument_InvalidFileModeAndAccessCombo = "Combining FileMode: {0} with FileAccess: {1} is invalid.";
-       public const string Argument_InvalidAppendMode = "Append access can be requested only in write-only mode.";
-       public const string IO_UnknownFileName = "[Unknown]";
-       public const string IO_FileStreamHandlePosition = "The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss.";
-       public const string NotSupported_FileStreamOnNonFiles = "FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.";
-       public const string IO_BindHandleFailed = "BindHandle for ThreadPool failed on this handle.";
-       public const string Arg_HandleNotSync = "Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).";
-       public const string IO_SetLengthAppendTruncate = "Unable to truncate data that previously existed in a file opened in Append mode.";
-       public const string IO_SeekAppendOverwrite = "Unable seek backward to overwrite data that previously existed in a file opened in Append mode.";
-       public const string IO_FileTooLongOrHandleNotSync = "IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations.";
-       public const string IndexOutOfRange_IORaceCondition = "Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.";
-}
index 1742d4ec6249be67feeaebf6de8d4662bc8f1393..8a80a2b0cc70e2ffffdd7bc72eacd420e9cabbf9 100644 (file)
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentDictionary.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentQueue.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentStack.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\IProducerConsumerCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\OrderablePartitioner.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\Partitioner.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\PartitionerStatic.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\Interop.Libraries.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Unix\System.Private.CoreLib.Native\Interop.MemAllocFree.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\Interop.Libraries.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.Errors.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.FormatMessage.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.MemAllocFree.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\Interop\Windows\mincore\Interop.ThreadPoolIO.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Common\src\System\Diagnostics\Debug.cs" />\r
     <Compile Include="..\..\..\external\corert\src\Common\src\System\Numerics\Hashing\HashHelpers.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\Runtime.Base\src\System\Runtime\InteropServices\NativeCallableAttribute.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeThreadPoolIOHandle.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Collections\LowLevelComparer.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Collections\ObjectEqualityComparer.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\IO\Win32Marshal.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Runtime\CompilerServices\ITuple.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Runtime\CompilerServices\TupleElementNamesAttribute.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\DeferredDisposableLifetime.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolBoundHandle.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.ExecutionContextCallbackArgs.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolNativeOverlapped.OverlappedData.cs" />\r
+    <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Threading\Win32ThreadPoolPreAllocatedOverlapped.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\Tuple.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\TupleExtensions.cs" />\r
     <Compile Include="..\..\..\external\corert\src\System.Private.CoreLib\src\System\ValueTuple.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\collectionbase.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\comparer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\compatiblecomparer.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\ConcurrentDictionary.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\ConcurrentQueue.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\ConcurrentStack.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\IProducerConsumerCollection.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\OrderablePartitioner.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\Partitioner.cs" />\r
-    <Compile Include="..\referencesource\mscorlib\system\collections\Concurrent\PartitionerStatic.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\dictionarybase.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\dictionaryentry.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\collections\emptyreadonlydictionaryinternal.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\unsafecharbuffer.cs" />\r
     <Compile Include="..\referencesource\mscorlib\system\version.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
+    <Compile Include="corefx\SR.cs" />\r
+    <Compile Include="corert\AddrofIntrinsics.cs" />\r
     <Compile Include="corert\Debug.cs" />\r
-    <Compile Include="corert\SR.cs" />\r
+    <Compile Include="corert\Interop.cs" />\r
+    <Compile Include="corert\Interop.MemAllocFree.cs" />\r
     <Compile Include="Microsoft.Win32\IRegistryApi.cs" />\r
     <Compile Include="Microsoft.Win32\Registry.cs" />\r
     <Compile Include="Microsoft.Win32\RegistryHive.cs" />\r
index d6faf256138acae5d82f61e2c00af59494b0f65f..59f60a88fb5cc55eac4c71194041ecdc3b9baa8b 100644 (file)
@@ -1107,14 +1107,6 @@ ReferenceSources/Type.cs
 ../referencesource/mscorlib/system/collections/generic/keyvaluepair.cs
 ../referencesource/mscorlib/system/collections/generic/list.cs
 
-../referencesource/mscorlib/system/collections/Concurrent/ConcurrentDictionary.cs
-../referencesource/mscorlib/system/collections/Concurrent/ConcurrentQueue.cs
-../referencesource/mscorlib/system/collections/Concurrent/ConcurrentStack.cs
-../referencesource/mscorlib/system/collections/Concurrent/IProducerConsumerCollection.cs
-../referencesource/mscorlib/system/collections/Concurrent/OrderablePartitioner.cs
-../referencesource/mscorlib/system/collections/Concurrent/Partitioner.cs
-../referencesource/mscorlib/system/collections/Concurrent/PartitionerStatic.cs
-
 ../referencesource/mscorlib/system/diagnostics/assert.cs
 ../referencesource/mscorlib/system/diagnostics/assertfilter.cs
 ../referencesource/mscorlib/system/diagnostics/assertfilters.cs
@@ -1645,18 +1637,56 @@ ReferenceSources/Type.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/safewaithandle.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/win32safehandles.cs
 
+corert/AddrofIntrinsics.cs
 corert/Debug.cs
-corert/SR.cs
+corert/Interop.cs
+corert/Interop.MemAllocFree.cs
+
+../../../external/corert/src/Common/src/Interop/Unix/Interop.Libraries.cs
+
+../../../external/corert/src/Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.MemAllocFree.cs
+
+../../../external/corert/src/Common/src/Interop/Windows/Interop.Libraries.cs
+
+../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.Errors.cs
+../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.FormatMessage.cs
+../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.MemAllocFree.cs
+../../../external/corert/src/Common/src/Interop/Windows/mincore/Interop.ThreadPoolIO.cs
+
+../../../external/corert/src/Common/src/System/Diagnostics/Debug.cs
 
 ../../../external/corert/src/Common/src/System/Numerics/Hashing/HashHelpers.cs
 
-../../../external/corert/src/System.Private.CoreLib/src/System/Collections/LowLevelComparer.cs
-../../../external/corert/src/System.Private.CoreLib/src/System/Collections/ObjectEqualityComparer.cs
+../../../external/corert/src/Runtime.Base/src/System/Runtime/InteropServices/NativeCallableAttribute.cs
+
+../../../external/corert/src/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs
 
 ../../../external/corert/src/System.Private.CoreLib/src/System/Tuple.cs
 ../../../external/corert/src/System.Private.CoreLib/src/System/TupleExtensions.cs
 ../../../external/corert/src/System.Private.CoreLib/src/System/ValueTuple.cs
 
+../../../external/corert/src/System.Private.CoreLib/src/System/Collections/LowLevelComparer.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Collections/ObjectEqualityComparer.cs
+
+../../../external/corert/src/System.Private.CoreLib/src/System/IO/Win32Marshal.cs
+
 ../../../external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/ITuple.cs
 ../../../external/corert/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
 
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/DeferredDisposableLifetime.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolBoundHandle.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.ExecutionContextCallbackArgs.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolNativeOverlapped.OverlappedData.cs
+../../../external/corert/src/System.Private.CoreLib/src/System/Threading/Win32ThreadPoolPreAllocatedOverlapped.cs
+
+corefx/SR.cs
+
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentStack.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/IProducerConsumerCollection.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/OrderablePartitioner.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/Partitioner.cs
+../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/PartitionerStatic.cs
index 5dff5e73d79361861f97b7d05bbd45432db84ac4..d2a1b7e95dad11d133df17ce8bafb86896bc3567 100644 (file)
@@ -7005,7 +7005,7 @@ namespace Mono.CSharp {
                public override void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool isCompound)
                {
                        if (backing_field != null) {
-                               backing_field.EmitAssign (ec, source, false, false);
+                               backing_field.EmitAssign (ec, source, leave_copy, false);
                                return;
                        }
 
diff --git a/mcs/tests/gtest-autoproperty-22.cs b/mcs/tests/gtest-autoproperty-22.cs
new file mode 100644 (file)
index 0000000..7be1a8a
--- /dev/null
@@ -0,0 +1,30 @@
+using System;
+
+class MainClass
+{
+       public static void Main()
+       {
+               Child test = new Child();
+       }
+}
+
+class Parent 
+{
+       protected virtual string Property { get; }
+}
+
+class Child : Parent
+{
+       protected override string Property { get; }
+
+       public Child () 
+       {
+               new AnotherClass{ field = Property = "success" };
+               Console.WriteLine(Property);
+       }
+}
+
+class AnotherClass 
+{
+       public string field;
+}
\ No newline at end of file
index 661f426ec6adcfa6daa8dc88c1f6c96edbb2f634..9ff491a9ee8f90f6e6bae49eff8c580d70c5741e 100644 (file)
       </method>
     </type>
   </test>
+  <test name="gtest-autoproperty-22.cs">
+    <type name="MainClass">
+      <method name="Void Main()" attrs="150">
+        <size>8</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Parent">
+      <method name="System.String get_Property()" attrs="2500">
+        <size>14</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Child">
+      <method name="System.String get_Property()" attrs="2244">
+        <size>14</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>47</size>
+      </method>
+    </type>
+    <type name="AnotherClass">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-collectioninit-01.cs">
     <type name="Test">
       <method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">
index 64a1b9cbf928bc1824705bdebd3d95049321cb23..886fc465336bd7d8519c3c2ad1d55c6f2a35cbce 100644 (file)
@@ -24,10 +24,11 @@ test-simple: simple.exe
        mono --debug $(the_lib) --cross default simple.exe -o foo && ./foo
        mono --debug $(the_lib) --sdk `dirname \`which mono\``/.. simple.exe -o foo && ./foo
        -rm DEMO.zip
-       mono-package-runtime `dirname \`which mono\``/.. DEMO
+       $(topdir)/../scripts/mono-package-runtime `dirname \`which mono\``/.. DEMO
        mkdir -p ~/.mono/targets/DEMO
        unzip -d ~/.mono/targets/DEMO DEMO.zip
-       mono --debug $(the_lib) --cross DEMO simple.exe -o foo && ./foo
+       mono --debug $(the_lib) --cross DEMO simple.exe -o foo | grep "Assembly.*mscorlib.dll"
+       ./foo
 
 simple.exe: Makefile
        echo 'class X { static void Main () { System.Console.WriteLine ("OK");}}' > simple.cs && mcs simple.cs
index 603af9458a8bc76785fcf06f18d2dbbe533c3eda..8be07f281f4171f13abb56785c77755f11caeb96 100755 (executable)
@@ -1082,14 +1082,14 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        static void LoadLocalizedAssemblies (List<string> assemblies)
        {
                var other = i18n.Select (x => "I18N." + x + (x.Length > 0 ? "." : "") + "dll");
-               bool error = false;
+               string error = null;
 
                foreach (string name in other) {
                        try {
                                Assembly a = LoadAssembly (name);
 
                                if (a == null) {
-                                       error = true;
+                                       error = "Failed to load " + name;
                                        continue;
                                }
 
@@ -1105,8 +1105,8 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        }
                }
 
-               if (error) {
-                       Error ("Couldn't load one or more of the i18n assemblies.");
+               if (error != null) {
+                       Error ("Couldn't load one or more of the i18n assemblies: " + error);
                        Environment.Exit (1);
                }
        }
@@ -1114,6 +1114,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        
        static readonly Universe universe = new Universe ();
        static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
+       static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}";
 
        public static string GetAssemblyName (string path)
        {
@@ -1126,7 +1127,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        string dir = Path.GetDirectoryName (path);
                        int idx = dir.LastIndexOf (Path.DirectorySeparatorChar);
                        if (idx >= 0) {
-                               name = dir.Substring (idx + 1) + Path.DirectorySeparatorChar + name;
+                               name = dir.Substring (idx + 1) + resourcePathSeparator + name;
                                Console.WriteLine ($"Storing satellite assembly '{path}' with name '{name}'");
                        } else if (!quiet)
                                Console.WriteLine ($"Warning: satellite assembly {path} doesn't have locale path prefix, name conflicts possible");
@@ -1158,7 +1159,7 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        Assembly a = universe.LoadFile (path);
 
                        foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
-                               LoadAssembly (an.FullName);
+                               a = universe.Load (an.FullName);
                                if (!QueueAssembly (files, a.CodeBase))
                                        return false;
                        }
@@ -1220,7 +1221,6 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        static void Error (string msg, params object [] args)
        {
                Console.Error.WriteLine ("ERROR: {0}", string.Format (msg, args));
-               throw new Exception ();
                Environment.Exit (1);
        }
 
index e27838e42d01f450876e4579adbc2ce3a9c0c6ba..935a31ecc323b492256337f89b269b6d5b5a3cee 100644 (file)
@@ -101,14 +101,28 @@ public class Program
 
                        str.WriteLine ("partial class SR");
                        str.WriteLine ("{");
+
+                       var dict = new Dictionary<string, string> ();
+
                        foreach (var entry in txtStrings) {
-                               str.Write ($"\tpublic const string {entry.Item1} = \"{ToCSharpString (entry.Item2)}\";");
+
+                               var value = ToCSharpString (entry.Item2);
+                               string found;
+                               if (dict.TryGetValue (entry.Item1, out found)) {
+                                       if (found == value)
+                                               continue;
+
+                                       str.WriteLine ($"\t// Constant value mismatch");
+                               } else {
+                                       dict.Add (entry.Item1, value);
+                               }
+
+                               str.Write ($"\tpublic const string {entry.Item1} = \"{value}\";");
 
                                if (!string.IsNullOrEmpty (entry.Item3))
                                        str.Write (" // {entry.Item3}");
 
                                str.WriteLine ();
-
                        }
                        str.WriteLine ("}");
                }
index b7b77f8f7660c78044a0fce67e6a2255a356946e..cc4355e4193212fd2ece61f4e1c66287431bba62 100644 (file)
@@ -119,15 +119,19 @@ namespace Mono.Tools
                        if (userStore) {
                                WriteLine ("Importing into legacy user store:");
                                ImportToStore (roots, X509StoreManager.CurrentUser.TrustedRoot);
-                               WriteLine ("");
-                               WriteLine ("Importing into BTLS user store:");
-                               ImportToStore (roots, X509StoreManager.NewCurrentUser.TrustedRoot);
+                               if (Mono.Security.Interface.MonoTlsProviderFactory.IsProviderSupported ("btls")) {
+                                       WriteLine ("");
+                                       WriteLine ("Importing into BTLS user store:");
+                                       ImportToStore (roots, X509StoreManager.NewCurrentUser.TrustedRoot);
+                               }
                        } else {
                                WriteLine ("Importing into legacy system store:");
                                ImportToStore (roots, X509StoreManager.LocalMachine.TrustedRoot);
-                               WriteLine ("");
-                               WriteLine ("Importing into BTLS system store:");
-                               ImportToStore (roots, X509StoreManager.NewLocalMachine.TrustedRoot);
+                               if (Mono.Security.Interface.MonoTlsProviderFactory.IsProviderSupported ("btls")) {
+                                       WriteLine ("");
+                                       WriteLine ("Importing into BTLS system store:");
+                                       ImportToStore (roots, X509StoreManager.NewLocalMachine.TrustedRoot);
+                               }
                        }
 
                        return 0;
index 751eabbb1b613b8020795eb57541ebf53b2aee99..246eec3b68c4605605751b6ac8490decd568b380 100644 (file)
@@ -189,7 +189,7 @@ common_sources = \
        mono-config.c           \
        mono-debug.h            \
        mono-debug.c            \
-       mono-debug-debugger.h   \
+       debug-internals.h       \
        mono-endian.c           \
        mono-endian.h           \
        mono-hash.h             \
index 312c66a115669aaeee76b7b2e89e36a648c2b07b..151f40bbaf852f9506efcda5d4e8c70027dd63aa 100644 (file)
@@ -39,6 +39,7 @@
 #include <mono/metadata/domain-internals.h>
 #include "mono/metadata/metadata-internals.h"
 #include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/exception-internals.h>
 #include <mono/metadata/threads.h>
@@ -49,7 +50,6 @@
 #include <mono/metadata/marshal-internals.h>
 #include <mono/metadata/monitor.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/attach.h>
 #include <mono/metadata/w32file.h>
 #include <mono/metadata/lock-tracer.h>
@@ -2054,7 +2054,7 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoole
        if (!is_ok (error))
                goto leave;
        
-       MonoAssembly *ass = mono_assembly_open_full (filename, &status, refOnly);
+       MonoAssembly *ass = mono_assembly_open_a_lot (filename, &status, refOnly, TRUE);
        
        if (!ass) {
                if (status == MONO_IMAGE_IMAGE_INVALID)
@@ -2479,14 +2479,12 @@ unload_thread_main (void *arg)
        MonoError error;
        unload_data *data = (unload_data*)arg;
        MonoDomain *domain = data->domain;
-       MonoThread *thread;
+       MonoInternalThread *internal;
        int i;
 
-       /* Have to attach to the runtime so shutdown can wait for this thread */
-       /* Force it to be attached to avoid racing during shutdown. */
-       thread = mono_thread_attach_full (mono_get_root_domain (), TRUE);
+       internal = mono_thread_internal_current ();
 
-       mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Domain unloader"), TRUE, FALSE, &error);
+       mono_thread_set_name_internal (internal, mono_string_new (mono_domain_get (), "Domain unloader"), TRUE, FALSE, &error);
        if (!is_ok (&error)) {
                data->failure_reason = g_strdup (mono_error_get_message (&error));
                mono_error_cleanup (&error);
@@ -2543,8 +2541,6 @@ unload_thread_main (void *arg)
        mono_domain_unlock (domain);
        mono_loader_unlock ();
 
-       mono_threads_clear_cached_culture (domain);
-
        domain->state = MONO_APPDOMAIN_UNLOADED;
 
        /* printf ("UNLOADED %s.\n", domain->friendly_name); */
@@ -2558,13 +2554,11 @@ unload_thread_main (void *arg)
 
        mono_atomic_store_release (&data->done, TRUE);
        unload_data_unref (data);
-       mono_thread_detach (thread);
        return 0;
 
 failure:
        mono_atomic_store_release (&data->done, TRUE);
        unload_data_unref (data);
-       mono_thread_detach (thread);
        return 1;
 }
 
@@ -2621,7 +2615,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        MonoAppDomainState prev_state;
        MonoMethod *method;
        unload_data *thread_data;
-       MonoNativeThreadId tid;
+       MonoInternalThread *internal;
        MonoDomain *caller_domain = mono_domain_get ();
 
        /* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, mono_native_thread_id_get ()); */
@@ -2678,10 +2672,15 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        /* 
         * First we create a separate thread for unloading, since
         * we might have to abort some threads, including the current one.
+        *
+        * Have to attach to the runtime so shutdown can wait for this thread.
+        *
+        * Force it to be attached to avoid racing during shutdown.
         */
-       thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, NULL, &tid);
-       if (thread_handle == NULL)
-               return;
+       internal = mono_thread_create_internal (mono_get_root_domain (), unload_thread_main, thread_data, MONO_THREAD_CREATE_FLAGS_FORCE_CREATE, &error);
+       mono_error_assert_ok (&error);
+
+       thread_handle = mono_threads_open_thread_handle (internal->handle);
 
        /* Wait for the thread */       
        while (!thread_data->done && guarded_wait (thread_handle, MONO_INFINITE_WAIT, TRUE) == MONO_THREAD_INFO_WAIT_RET_ALERTED) {
index 5af7bd6b9a3d02e569a70a7a42106b1135239562..c24e328f33083ff1c3beb8da8736aefe9be59bf7 100644 (file)
@@ -9,4 +9,6 @@
 
 MONO_API MonoImage*    mono_assembly_load_module_checked (MonoAssembly *assembly, uint32_t idx, MonoError *error);
 
+MonoAssembly * mono_assembly_open_a_lot (const char *filename, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context);
+
 #endif /* __MONO_METADATA_ASSEMBLY_INTERNALS_H__ */
index 18ce6c4510a75f21a4762411ff7f387c823c2b03..43cc6b44385899e3a842482446831c69c0d687d9 100644 (file)
@@ -76,8 +76,13 @@ static char **assemblies_path = NULL;
 static char **extra_gac_paths = NULL;
 
 #ifndef DISABLE_ASSEMBLY_REMAPPING
+
+static GHashTable* assembly_remapping_table;
 /* The list of system assemblies what will be remapped to the running
- * runtime version. WARNING: this list must be sorted.
+ * runtime version.
+ * This list is stored in @assembly_remapping_table during initialization.
+ * Keep it sorted just to make maintenance easier.
+ *
  * The integer number is an index in the MonoRuntimeInfo structure, whose
  * values can be found in domain.c - supported_runtimes. Look there
  * to understand what remapping will be made.
@@ -133,13 +138,13 @@ static const AssemblyVersionMap framework_assemblies [] = {
        {"System.Drawing", 0},
        {"System.Drawing.Design", 0},
        {"System.EnterpriseServices", 0},
+       {"System.IO.Compression", 2},
        {"System.IdentityModel", 3},
        {"System.IdentityModel.Selectors", 3},
-       {"System.IO.Compression", 2},
        {"System.Management", 0},
        {"System.Messaging", 0},
        {"System.Net", 2},
-       {"System.Net.Http", 3},
+       {"System.Net.Http", 4},
        {"System.Numerics.Vectors", 3},
        {"System.Runtime.InteropServices.RuntimeInformation", 2},
        {"System.Runtime.Remoting", 0},
@@ -796,6 +801,15 @@ mono_assemblies_init (void)
 
        mono_os_mutex_init_recursive (&assemblies_mutex);
        mono_os_mutex_init (&assembly_binding_mutex);
+
+#ifndef DISABLE_ASSEMBLY_REMAPPING
+       assembly_remapping_table = g_hash_table_new (g_str_hash, g_str_equal);
+
+       int i;
+       for (i = 0; i < G_N_ELEMENTS (framework_assemblies) - 1; ++i)
+               g_hash_table_insert (assembly_remapping_table, (void*)framework_assemblies [i].assembly_name, (void*)&framework_assemblies [i]);
+
+#endif
 }
 
 static void
@@ -1037,7 +1051,6 @@ static MonoAssemblyName *
 mono_assembly_remap_version (MonoAssemblyName *aname, MonoAssemblyName *dest_aname)
 {
        const MonoRuntimeInfo *current_runtime;
-       int pos, first, last;
 
        if (aname->name == NULL) return aname;
 
@@ -1074,52 +1087,52 @@ mono_assembly_remap_version (MonoAssemblyName *aname, MonoAssemblyName *dest_ana
        }
        
 #ifndef DISABLE_ASSEMBLY_REMAPPING
-       first = 0;
-       last = G_N_ELEMENTS (framework_assemblies) - 1;
-       
-       while (first <= last) {
-               int res;
-               pos = first + (last - first) / 2;
-               res = strcmp (aname->name, framework_assemblies[pos].assembly_name);
-               if (res == 0) {
-                       const AssemblyVersionSet* vset;
-                       int index = framework_assemblies[pos].version_set_index;
-                       g_assert (index < G_N_ELEMENTS (current_runtime->version_sets));
-                       vset = &current_runtime->version_sets [index];
-
-                       if (aname->major == vset->major && aname->minor == vset->minor &&
-                               aname->build == vset->build && aname->revision == vset->revision)
-                               return aname;
-               
-                       if (framework_assemblies[pos].only_lower_versions && compare_versions ((AssemblyVersionSet*)vset, aname) < 0)
-                               return aname;
-
-                       if ((aname->major | aname->minor | aname->build | aname->revision) != 0)
-                               mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY,
-                                       "The request to load the assembly %s v%d.%d.%d.%d was remapped to v%d.%d.%d.%d",
-                                                       aname->name,
-                                                       aname->major, aname->minor, aname->build, aname->revision,
-                                                       vset->major, vset->minor, vset->build, vset->revision
-                                                       );
-                       
-                       memcpy (dest_aname, aname, sizeof(MonoAssemblyName));
-                       dest_aname->major = vset->major;
-                       dest_aname->minor = vset->minor;
-                       dest_aname->build = vset->build;
-                       dest_aname->revision = vset->revision;
-                       if (framework_assemblies[pos].new_assembly_name != NULL) {
-                               dest_aname->name = framework_assemblies[pos].new_assembly_name;
-                               mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY,
-                                                       "The assembly name %s was remapped to %s",
-                                                       aname->name,
-                                                       dest_aname->name);
-                       }
-                       return dest_aname;
-               } else if (res < 0) {
-                       last = pos - 1;
-               } else {
-                       first = pos + 1;
+       const AssemblyVersionMap *vmap = (AssemblyVersionMap *)g_hash_table_lookup (assembly_remapping_table, aname->name);
+       if (vmap) {
+               const AssemblyVersionSet* vset;
+               int index = vmap->version_set_index;
+               g_assert (index < G_N_ELEMENTS (current_runtime->version_sets));
+               vset = &current_runtime->version_sets [index];
+
+               if (aname->major == vset->major && aname->minor == vset->minor &&
+                       aname->build == vset->build && aname->revision == vset->revision) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY, "Found assembly remapping for %s and was for the same version %d.%d.%d.%d",
+                               aname->name,
+                               aname->major, aname->minor, aname->build, aname->revision);
+                       return aname;
                }
+
+               if (vmap->only_lower_versions && compare_versions ((AssemblyVersionSet*)vset, aname) < 0) {
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_ASSEMBLY,
+                               "Found lower-versions-only assembly remaping to load %s %d.%d.%d.%d but mapping has %d.%d.%d.%d",
+                                               aname->name,
+                                               aname->major, aname->minor, aname->build, aname->revision,
+                                               vset->major, vset->minor, vset->build, vset->revision
+                                               );
+                       return aname;
+               }
+
+               if ((aname->major | aname->minor | aname->build | aname->revision) != 0)
+                       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY,
+                               "The request to load the assembly %s v%d.%d.%d.%d was remapped to v%d.%d.%d.%d",
+                                               aname->name,
+                                               aname->major, aname->minor, aname->build, aname->revision,
+                                               vset->major, vset->minor, vset->build, vset->revision
+                                               );
+
+               memcpy (dest_aname, aname, sizeof(MonoAssemblyName));
+               dest_aname->major = vset->major;
+               dest_aname->minor = vset->minor;
+               dest_aname->build = vset->build;
+               dest_aname->revision = vset->revision;
+               if (vmap->new_assembly_name != NULL) {
+                       dest_aname->name = vmap->new_assembly_name;
+                       mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY,
+                                               "The assembly name %s was remapped to %s",
+                                               aname->name,
+                                               dest_aname->name);
+               }
+               return dest_aname;
        }
 #endif
 
@@ -1658,6 +1671,13 @@ mono_assembly_open_from_bundle (const char *filename, MonoImageOpenStatus *statu
 MonoAssembly *
 mono_assembly_open_full (const char *filename, MonoImageOpenStatus *status, gboolean refonly)
 {
+       return mono_assembly_open_a_lot (filename, status, refonly, FALSE);
+}
+
+MonoAssembly *
+mono_assembly_open_a_lot (const char *filename, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context)
+{
+
        MonoImage *image;
        MonoAssembly *ass;
        MonoImageOpenStatus def_status;
@@ -1733,7 +1753,7 @@ mono_assembly_open_full (const char *filename, MonoImageOpenStatus *status, gboo
        }
 
        if (!image)
-               image = mono_image_open_full (fname, status, refonly);
+               image = mono_image_open_a_lot (fname, status, refonly, load_from_context);
 
        if (!image){
                if (*status == MONO_IMAGE_OK)
index 1f2e0fd103d93fc73768878b4f0c3181f40de996..72330bbc4fbac5b967452135f960a34d304fab52 100644 (file)
@@ -475,12 +475,18 @@ transport_send (int fd, guint8 *data, int len)
 static void
 transport_start_receive (void)
 {
+       MonoError error;
+       MonoInternalThread *internal;
+
        transport_connect ();
 
        if (!listen_fd)
                return;
 
-       receiver_thread_handle = mono_threads_create_thread (receiver_thread, NULL, NULL, NULL);
+       internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, &error);
+       mono_error_assert_ok (&error);
+
+       receiver_thread_handle = mono_threads_open_thread_handle (internal->handle);
        g_assert (receiver_thread_handle);
 }
 
@@ -492,8 +498,15 @@ receiver_thread (void *arg)
        guint8 buffer [256];
        guint8 *p, *p_end;
        MonoObject *exc;
+       MonoInternalThread *internal;
 
-       mono_native_thread_set_name (mono_native_thread_id_get (), "Attach receiver");
+       internal = mono_thread_internal_current ();
+       mono_thread_set_name_internal (internal, mono_string_new (mono_domain_get (), "Attach receiver"), TRUE, FALSE, &error);
+       mono_error_assert_ok (&error);
+       /* Ask the runtime to not abort this thread */
+       //internal->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
+       /* Ask the runtime to not wait for this thread */
+       internal->state |= ThreadState_Background;
 
        printf ("attach: Listening on '%s'...\n", server_uri);
 
@@ -505,14 +518,6 @@ receiver_thread (void *arg)
 
                printf ("attach: Connected.\n");
 
-               MonoThread *thread = mono_thread_attach (mono_get_root_domain ());
-               mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Attach receiver"), TRUE, FALSE, &error);
-               mono_error_assert_ok (&error);
-               /* Ask the runtime to not abort this thread */
-               //mono_thread_current ()->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
-               /* Ask the runtime to not wait for this thread */
-               thread->internal_thread->state |= ThreadState_Background;
-
                while (TRUE) {
                        char *cmd, *agent_name, *agent_args;
                        guint8 *body;
index 973bfc4ce6431d74176165c4c3e5d0d2a27594ae..0d0952b0c9ff467bb054e8eec296a6571915db12 100644 (file)
@@ -5418,6 +5418,12 @@ mono_class_setup_supertypes (MonoClass *klass)
        mono_loader_unlock ();
 }
 
+static gboolean
+discard_gclass_due_to_failure (MonoClass *gclass, void *user_data)
+{
+       return mono_class_get_generic_class (gclass)->container_class == user_data;
+}
+
 static gboolean
 fix_gclass_incomplete_instantiation (MonoClass *gclass, void *user_data)
 {
@@ -5711,6 +5717,9 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        return klass;
 
 parent_failure:
+       if (mono_class_is_gtd (klass))
+               disable_gclass_recording (discard_gclass_due_to_failure, klass);
+
        mono_class_setup_mono_type (klass);
        mono_loader_unlock ();
        mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED);
diff --git a/mono/metadata/debug-internals.h b/mono/metadata/debug-internals.h
new file mode 100644 (file)
index 0000000..1d5e33c
--- /dev/null
@@ -0,0 +1,87 @@
+#ifndef __DEBUG_INTERNALS_H__
+#define __DEBUG_INTERNALS_H__
+
+#include <glib.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/mono-debug.h>
+#include <mono/utils/mono-compiler.h>
+
+struct _MonoDebugMethodInfo {
+       MonoMethod *method;
+       MonoDebugHandle *handle;
+       uint32_t index;
+       uint32_t data_offset;
+       uint32_t lnt_offset;
+};
+
+typedef struct {
+       int parent;
+       int type;
+       /* IL offsets */
+       int start_offset, end_offset;
+} MonoDebugCodeBlock;
+
+typedef struct {
+       char *name;
+       int index;
+       /* Might be null for the main scope */
+       MonoDebugCodeBlock *block;
+} MonoDebugLocalVar;
+
+/*
+ * Information about local variables retrieved from a symbol file.
+ */
+struct _MonoDebugLocalsInfo {
+       int num_locals;
+       MonoDebugLocalVar *locals;
+       int num_blocks;
+       MonoDebugCodeBlock *code_blocks;
+};
+
+/*
+* Information about method await yield and resume offsets retrieved from a symbol file.
+*/
+struct _MonoDebugMethodAsyncInfo {
+       uint32_t catch_handler_offset;
+       int num_awaits;
+       uint32_t *yield_offsets;
+       uint32_t *resume_offsets;
+       uint32_t *move_next_method_token;
+};
+
+struct _MonoDebugLineNumberEntry {
+       uint32_t il_offset;
+       uint32_t native_offset;
+};
+
+/*
+ * Information about a source file retrieved from a symbol file.
+ */
+typedef struct {
+       char *source_file;
+       /* 16 byte long */
+       guint8 *guid, *hash;
+} MonoDebugSourceInfo;
+
+typedef struct {
+       int il_offset;
+       int line, column;
+       int end_line, end_column;
+} MonoSymSeqPoint;
+
+void            mono_debugger_lock                          (void);
+void            mono_debugger_unlock                        (void);
+
+void
+mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points);
+
+MONO_API void
+mono_debug_free_locals (MonoDebugLocalsInfo *info);
+
+void
+mono_debug_free_method_async_debug_info (MonoDebugMethodAsyncInfo *info);
+
+gboolean
+mono_debug_image_has_debug_info (MonoImage *image);
+
+#endif /* __DEBUG_INTERNALS_H__ */
index b96edfdf697335faa77ecaaffe39041cd02f315e..ba39e5224c4a31f89e9a86fe5fdb0b6906075a03 100644 (file)
@@ -20,8 +20,7 @@
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/debug-mono-symfile.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/class-internals.h>
index d9b5de92e8a998b61dcf6d0caaa047bf1d70a713..709c8f278d41352dddd98cd89c08d7b542e0e099 100644 (file)
@@ -28,7 +28,6 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/debug-mono-symfile.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/class-internals.h>
index bd8252843e5dda15f1221e99a6f2b0ab3e3308b3..2f6020189104161a7f121f64d323fb433c0d23fc 100644 (file)
@@ -12,6 +12,7 @@
 #include <mono/metadata/class.h>
 #include <mono/metadata/reflection.h>
 #include <mono/metadata/mono-debug.h>
+#include <mono/metadata/debug-internals.h>
 
 typedef struct MonoSymbolFileOffsetTable       MonoSymbolFileOffsetTable;
 typedef struct MonoSymbolFileLineNumberEntry   MonoSymbolFileLineNumberEntry;
@@ -71,69 +72,6 @@ struct MonoSymbolFileMethodAddress {
        uint8_t data [MONO_ZERO_LEN_ARRAY];
 };
 
-struct _MonoDebugMethodInfo {
-       MonoMethod *method;
-       MonoDebugHandle *handle;
-       uint32_t index;
-       uint32_t data_offset;
-       uint32_t lnt_offset;
-};
-
-typedef struct {
-       int parent;
-       int type;
-       /* IL offsets */
-       int start_offset, end_offset;
-} MonoDebugCodeBlock;
-
-typedef struct {
-       char *name;
-       int index;
-       /* Might be null for the main scope */
-       MonoDebugCodeBlock *block;
-} MonoDebugLocalVar;
-
-/*
- * Information about local variables retrieved from a symbol file.
- */
-struct _MonoDebugLocalsInfo {
-       int num_locals;
-       MonoDebugLocalVar *locals;
-       int num_blocks;
-       MonoDebugCodeBlock *code_blocks;
-};
-
-/*
-* Information about method await yield and resume offsets retrieved from a symbol file.
-*/
-struct _MonoDebugMethodAsyncInfo {
-       uint32_t catch_handler_offset;
-       int num_awaits;
-       uint32_t *yield_offsets;
-       uint32_t *resume_offsets;
-       uint32_t *move_next_method_token;
-};
-
-struct _MonoDebugLineNumberEntry {
-       uint32_t il_offset;
-       uint32_t native_offset;
-};
-
-/*
- * Information about a source file retrieved from a symbol file.
- */
-typedef struct {
-       char *source_file;
-       /* 16 byte long */
-       guint8 *guid, *hash;
-} MonoDebugSourceInfo;
-
-typedef struct {
-       int il_offset;
-       int line, column;
-       int end_line, end_column;
-} MonoSymSeqPoint;
-
 #define MONO_SYMBOL_FILE_MAJOR_VERSION         50
 #define MONO_SYMBOL_FILE_MINOR_VERSION         0
 #define MONO_SYMBOL_FILE_MAGIC                 0x45e82623fd7fa614ULL
@@ -169,9 +107,6 @@ mono_debug_symfile_lookup_locals (MonoDebugMethodInfo *minfo);
 void
 mono_debug_symfile_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points);
 
-gboolean
-mono_debug_image_has_debug_info (MonoImage *image);
-
 MONO_END_DECLS
 
 #endif /* __MONO_SYMFILE_H__ */
index 5e8282ccdf6e5311e019ed78779511bffcf3ed06..10347f109004e75c4eab58ae6bcb5cb7be6a7aeb 100644 (file)
@@ -427,7 +427,7 @@ typedef struct  {
 typedef struct  {
        const char runtime_version [12];
        const char framework_version [4];
-       const AssemblyVersionSet version_sets [4];
+       const AssemblyVersionSet version_sets [5];
 } MonoRuntimeInfo;
 
 #define mono_domain_assemblies_lock(domain) mono_locks_os_acquire(&(domain)->assemblies_lock, DomainAssembliesLock)
index 0785369e0c65662c1e35da8696d3ab2ecf47789c..b3fc90a4be5737989eaf6716982e7a4dbd19bc9f 100644 (file)
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/domain-internals.h>
 #include <mono/metadata/class-internals.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/appdomain.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/runtime.h>
@@ -93,14 +93,18 @@ typedef struct {
 
 static const MonoRuntimeInfo *current_runtime = NULL;
 
+#define NOT_AVAIL {0xffffU,0xffffU,0xffffU,0xffffU}
+
 /* This is the list of runtime versions supported by this JIT.
  */
 static const MonoRuntimeInfo supported_runtimes[] = {
-       {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
-       {"mobile",    "2.1", { {2,0,5,0}, {10,0,0,0}, {2,0,5,0}, {2,0,5,0} } },
-       {"moonlight", "2.1", { {2,0,5,0}, { 9,0,0,0}, {3,5,0,0}, {3,0,0,0} } },
+       {"v4.0.30319","4.5", { {4,0,0,0}, {10,0,0,0}, {4,0,0,0}, {4,0,0,0}, {4,0,0,0} } },
+       {"mobile",    "2.1", { {2,0,5,0}, {10,0,0,0}, {2,0,5,0}, {2,0,5,0}, {4,0,0,0} } },
+       {"moonlight", "2.1", { {2,0,5,0}, { 9,0,0,0}, {3,5,0,0}, {3,0,0,0}, NOT_AVAIL } },
 };
 
+#undef NOT_AVAIL
+
 
 /* The stable runtime version */
 #define DEFAULT_RUNTIME_VERSION "v4.0.30319"
index 7402096d704dfd5bf71ba5d1ac5d7b8801152365..f3bc6aba7c5cefa793da20e97c590ed9c0103356 100644 (file)
@@ -478,7 +478,7 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                if (res == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        break;
                } else if (res == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
-                       if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0) {
+                       if ((thread->state & (ThreadState_AbortRequested | ThreadState_SuspendRequested)) != 0) {
                                ret = FALSE;
                                break;
                        }
@@ -921,7 +921,7 @@ void
 mono_gc_init_finalizer_thread (void)
 {
        MonoError error;
-       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0, &error);
+       gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, &error);
        mono_error_assert_ok (&error);
 }
 
index d49e2456d41620b5bb914caea0ccdb2b68f1c490..2317cb549a3b6dfaae44f087cf06ede9119625de 100644 (file)
@@ -72,24 +72,122 @@ const MonoObjectHandle mono_null_value_handle = NULL;
 
 #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100
 
-static MonoObject**
-chunk_element_objslot (HandleChunk *chunk, int idx)
+enum {
+       HANDLE_CHUNK_PTR_OBJ = 0x0, /* chunk element points to beginning of a managed object */
+       HANDLE_CHUNK_PTR_INTERIOR = 0x1, /* chunk element points into the middle of a managed object */
+       HANDLE_CHUNK_PTR_MASK = 0x1
+};
+
+/* number of bits in each word of the interior pointer bitmap */
+#define INTERIOR_HANDLE_BITMAP_BITS_PER_WORD (sizeof(guint32) << 3)
+
+static gboolean
+bitset_bits_test (guint32 *bitmaps, int idx)
+{
+       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       guint32 bitmap = bitmaps [w];
+       guint32 mask = 1u << b;
+       return ((bitmap & mask) != 0);
+}
+
+static void
+bitset_bits_set (guint32 *bitmaps, int idx)
+{
+       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       guint32 *bitmap = &bitmaps [w];
+       guint32 mask = 1u << b;
+       *bitmap |= mask;
+}
+static void
+bitset_bits_clear (guint32 *bitmaps, int idx)
+{
+       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+       guint32 *bitmap = &bitmaps [w];
+       guint32 mask = ~(1u << b);
+       *bitmap &= mask;
+}
+
+static gpointer*
+chunk_element_objslot_init (HandleChunk *chunk, int idx, gboolean interior)
+{
+       if (interior)
+               bitset_bits_set (chunk->interior_bitmap, idx);
+       else
+               bitset_bits_clear (chunk->interior_bitmap, idx);
+       return &chunk->elems [idx].o;
+}
+
+static HandleChunkElem*
+chunk_element (HandleChunk *chunk, int idx)
+{
+       return &chunk->elems[idx];
+}
+
+static guint
+chunk_element_kind (HandleChunk *chunk, int idx)
 {
-       return &chunk->objects[idx].o;
+       return bitset_bits_test (chunk->interior_bitmap, idx) ? HANDLE_CHUNK_PTR_INTERIOR : HANDLE_CHUNK_PTR_OBJ;
+}
+
+static HandleChunkElem*
+handle_to_chunk_element (MonoObjectHandle o)
+{
+       return (HandleChunkElem*)o;
+}
+
+/* Given a HandleChunkElem* search through the current handle stack to find its chunk and offset. */
+static HandleChunk*
+chunk_element_to_chunk_idx (HandleStack *stack, HandleChunkElem *elem, int *out_idx)
+{
+       HandleChunk *top = stack->top;
+       HandleChunk *cur = stack->bottom;
+
+       *out_idx = 0;
+
+       while (cur != NULL) {
+               HandleChunkElem *front = &cur->elems [0];
+               HandleChunkElem *back = &cur->elems [cur->size];
+
+               if (front <= elem && elem < back) {
+                       *out_idx = (int)(elem - front);
+                       return cur;
+               }
+
+               if (cur == top)
+                       break; /* didn't find it. */
+               cur = cur->next;
+       }
+       return NULL;
 }
 
 #ifdef MONO_HANDLE_TRACK_OWNER
-#define SET_OWNER(chunk,idx) do { (chunk)->objects[(idx)].owner = owner; } while (0)
+#define SET_OWNER(chunk,idx) do { (chunk)->elems[(idx)].owner = owner; } while (0)
 #else
 #define SET_OWNER(chunk,idx) do { } while (0)
 #endif
 
-/* Actual handles implementation */
 MonoRawHandle
 #ifndef MONO_HANDLE_TRACK_OWNER
 mono_handle_new (MonoObject *object)
 #else
-mono_handle_new (MonoObject *object, const char *owner)
+mono_handle_new (MonoObject *object const char *owner)
+#endif
+{
+#ifndef MONO_HANDLE_TRACK_OWNER
+       return mono_handle_new_full (object, FALSE);
+#else
+       return mono_handle_new_full (object, FALSE, owner);
+#endif
+}
+/* Actual handles implementation */
+MonoRawHandle
+#ifndef MONO_HANDLE_TRACK_OWNER
+mono_handle_new_full (gpointer rawptr, gboolean interior)
+#else
+mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner)
 #endif
 {
        MonoThreadInfo *info = mono_thread_info_current ();
@@ -99,7 +197,7 @@ mono_handle_new (MonoObject *object, const char *owner)
 retry:
        if (G_LIKELY (top->size < OBJECTS_PER_HANDLES_CHUNK)) {
                int idx = top->size;
-               MonoObject** objslot = chunk_element_objslot (top, idx);
+               gpointer* objslot = chunk_element_objslot_init (top, idx, interior);
                /* can be interrupted anywhere here, so:
                 * 1. make sure the new slot is null
                 * 2. make the new slot scannable (increment size)
@@ -112,7 +210,7 @@ retry:
                mono_memory_write_barrier ();
                top->size++;
                mono_memory_write_barrier ();
-               *objslot = object;
+               *objslot = rawptr;
                SET_OWNER (top,idx);
                return objslot;
        }
@@ -126,6 +224,7 @@ retry:
        }
        HandleChunk *new_chunk = g_new (HandleChunk, 1);
        new_chunk->size = 0;
+       memset (new_chunk->interior_bitmap, 0, INTERIOR_HANDLE_BITMAP_WORDS);
        new_chunk->prev = top;
        new_chunk->next = NULL;
        /* make sure size == 0 before new chunk is visible */
@@ -144,6 +243,7 @@ mono_handle_stack_alloc (void)
        HandleChunk *chunk = g_new (HandleChunk, 1);
 
        chunk->size = 0;
+       memset (chunk->interior_bitmap, 0, INTERIOR_HANDLE_BITMAP_WORDS);
        chunk->prev = chunk->next = NULL;
        mono_memory_write_barrier ();
        stack->top = stack->bottom = chunk;
@@ -168,10 +268,16 @@ mono_handle_stack_free (HandleStack *stack)
 }
 
 void
-mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data)
+mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise)
 {
-       /* if we're running, we know the world is stopped.
-        */
+       /*
+         We're called twice - on the imprecise pass we call func to pin the
+         objects where the handle points to its interior.  On the precise
+         pass, we scan all the objects where the handles point to the start of
+         the object.
+
+         Note that if we're running, we know the world is stopped.
+       */
        HandleChunk *cur = stack->bottom;
        HandleChunk *last = stack->top;
 
@@ -179,11 +285,35 @@ mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data)
                return;
 
        while (cur) {
-               int i;
-               for (i = 0; i < cur->size; ++i) {
-                       MonoObject **obj_slot = chunk_element_objslot (cur, i);
-                       if (*obj_slot != NULL)
-                               func ((gpointer*)obj_slot, gc_data);
+               /* assume that object pointers will be much more common than interior pointers.
+                * scan the object pointers by iterating over the chunk elements.
+                * scan the interior pointers by iterating over the bitmap bits.
+                */
+               if (precise) {
+                       for (int i = 0; i < cur->size; ++i) {
+                               HandleChunkElem* elem = chunk_element (cur, i);
+                               int kind = chunk_element_kind (cur, i);
+                               gpointer* obj_slot = &elem->o;
+                               if (kind == HANDLE_CHUNK_PTR_OBJ && *obj_slot != NULL)
+                                       func (obj_slot, gc_data);
+                       }
+               } else {
+                       int elem_idx = 0;
+                       for (int i = 0; i < INTERIOR_HANDLE_BITMAP_WORDS; ++i) {
+                               elem_idx = i * INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
+                               if (elem_idx >= cur->size)
+                                       break;
+                               /* no interior pointers in the range */ 
+                               if (cur->interior_bitmap [i] == 0)
+                                       continue;
+                               for (int j = 0; j < INTERIOR_HANDLE_BITMAP_BITS_PER_WORD && elem_idx < cur->size; ++j,++elem_idx) {
+                                       HandleChunkElem *elem = chunk_element (cur, elem_idx);
+                                       int kind = chunk_element_kind (cur, elem_idx);
+                                       gpointer *ptr_slot = &elem->o;
+                                       if (kind == HANDLE_CHUNK_PTR_INTERIOR && *ptr_slot != NULL)
+                                               func (ptr_slot, gc_data);
+                               }
+                       }            
                }
                if (cur == last)
                        break;
@@ -265,7 +395,17 @@ mono_array_handle_length (MonoArrayHandle arr)
 uint32_t
 mono_gchandle_from_handle (MonoObjectHandle handle, mono_bool pinned)
 {
-       return mono_gchandle_new (MONO_HANDLE_RAW(handle), pinned);
+       /* FIXME: chunk_element_to_chunk_idx does a linear search through the
+        * chunks and we only need it for the assert */
+       MonoThreadInfo *info = mono_thread_info_current ();
+       HandleStack *stack = (HandleStack*) info->handle_stack;
+       HandleChunkElem* elem = handle_to_chunk_element (handle);
+       int elem_idx = 0;
+       HandleChunk *chunk = chunk_element_to_chunk_idx (stack, elem, &elem_idx);
+       /* gchandles cannot deal with interior pointers */
+       g_assert (chunk != NULL);
+       g_assert (chunk_element_kind (chunk, elem_idx) != HANDLE_CHUNK_PTR_INTERIOR);
+       return mono_gchandle_new (MONO_HANDLE_RAW (handle), pinned);
 }
 
 MonoObjectHandle
index 01ded7c4fe8df75b00893666d518f5838323841c..76ce61c8e4c5556f11bee1b5d10fd637c0c5eaf1 100644 (file)
@@ -56,16 +56,21 @@ typedef struct _HandleChunk HandleChunk;
 /* #define MONO_HANDLE_TRACK_OWNER */
 
 typedef struct {
-       MonoObject *o;
+       gpointer o; /* MonoObject ptr or interior ptr */
 #ifdef MONO_HANDLE_TRACK_OWNER
        const char *owner;
 #endif
 } HandleChunkElem;
 
+/* number of guint32's needed to store the interior pointers bitmap */
+#define INTERIOR_HANDLE_BITMAP_WORDS ((OBJECTS_PER_HANDLES_CHUNK + 31) / 32)
+
 struct _HandleChunk {
-       int size; //number of bytes
+       int size; //number of handles
+       /* bits in the range 0..size-1 of interior_bitmap are valid; rest are ignored. */
+       guint32 interior_bitmap [INTERIOR_HANDLE_BITMAP_WORDS];
        HandleChunk *prev, *next;
-       HandleChunkElem objects [OBJECTS_PER_HANDLES_CHUNK];
+       HandleChunkElem elems [OBJECTS_PER_HANDLES_CHUNK];
 };
 
 typedef struct {
@@ -85,11 +90,14 @@ typedef void (*GcScanFunc) (gpointer*, gpointer);
 
 #ifndef MONO_HANDLE_TRACK_OWNER
 MonoRawHandle mono_handle_new (MonoObject *object);
+MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior);
 #else
 MonoRawHandle mono_handle_new (MonoObject *object, const char* owner);
+MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner);
 #endif
 
-void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data);
+
+void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise);
 gboolean mono_handle_stack_is_empty (HandleStack *stack);
 HandleStack* mono_handle_stack_alloc (void);
 void mono_handle_stack_free (HandleStack *handlestack);
@@ -254,25 +262,37 @@ void mono_handle_verify (MonoRawHandle handle);
  * For example, TYPED_HANDLE_DECL(MonoObject) (see below) expands to:
  *
  * typedef struct {
- *   MonoObject *__obj;
+ *   MonoObject *__raw;
  * } MonoObjectHandlePayload;
  *
  * typedef MonoObjectHandlePayload* MonoObjectHandle;
  * typedef MonoObjectHandlePayload* MonoObjectHandleOut;
  */
 #define TYPED_HANDLE_DECL(TYPE)                                                \
-       typedef struct { TYPE *__obj; } TYPED_HANDLE_PAYLOAD_NAME (TYPE) ; \
+       typedef struct { TYPE *__raw; } TYPED_HANDLE_PAYLOAD_NAME (TYPE) ; \
        typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_HANDLE_NAME (TYPE); \
        typedef TYPED_HANDLE_PAYLOAD_NAME (TYPE) * TYPED_OUT_HANDLE_NAME (TYPE)
+/*
+ * TYPED_VALUE_HANDLE_DECL(SomeType):
+ *   Expands to a decl for handles to SomeType (which is a managed valuetype (likely a struct) of some sort) and to an internal payload struct.
+ * For example TYPED_HANDLE_DECL(MonoMethodInfo) expands to:
+ *
+ * typedef struct {
+ *   MonoMethodInfo *__raw;
+ * } MonoMethodInfoHandlePayload;
+ * typedef MonoMethodInfoHandlePayload* MonoMethodInfoHandle;
+ */
+#define TYPED_VALUE_HANDLE_DECL(TYPE) TYPED_HANDLE_DECL(TYPE)
+
 /* Have to double expand because MONO_STRUCT_OFFSET is doing token pasting on cross-compilers. */
-#define MONO_HANDLE_PAYLOAD_OFFSET_(PayloadType) MONO_STRUCT_OFFSET(PayloadType, __obj)
+#define MONO_HANDLE_PAYLOAD_OFFSET_(PayloadType) MONO_STRUCT_OFFSET(PayloadType, __raw)
 #define MONO_HANDLE_PAYLOAD_OFFSET(TYPE) MONO_HANDLE_PAYLOAD_OFFSET_(TYPED_HANDLE_PAYLOAD_NAME (TYPE))
 
 #define MONO_HANDLE_INIT ((void*) mono_null_value_handle)
 #define NULL_HANDLE mono_null_value_handle
 
 //XXX add functions to get/set raw, set field, set field to null, set array, set array to null
-#define MONO_HANDLE_RAW(HANDLE) (HANDLE_INVARIANTS (HANDLE), ((HANDLE)->__obj))
+#define MONO_HANDLE_RAW(HANDLE) (HANDLE_INVARIANTS (HANDLE), ((HANDLE)->__raw))
 #define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = MONO_HANDLE_NEW (TYPE, (NAME ## _raw))
 
 #ifndef MONO_HANDLE_TRACK_OWNER
@@ -308,7 +328,7 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
 /* N.B. RESULT is evaluated before HANDLE */
 #define MONO_HANDLE_GET(RESULT, HANDLE, FIELD) do {                    \
                MonoObjectHandle __dest = MONO_HANDLE_CAST(MonoObject, RESULT); \
-               mono_gc_wbarrier_generic_store (&__dest->__obj,  (MonoObject*)(MONO_HANDLE_RAW(HANDLE)->FIELD)); \
+               mono_gc_wbarrier_generic_store (&__dest->__raw,  (MonoObject*)(MONO_HANDLE_RAW(HANDLE)->FIELD)); \
        } while (0)
 
 #define MONO_HANDLE_NEW_GET(TYPE,HANDLE,FIELD) (MONO_HANDLE_NEW(TYPE,MONO_HANDLE_RAW(HANDLE)->FIELD))
@@ -351,11 +371,26 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
                mono_handle_array_getref (MONO_HANDLE_CAST(MonoObject, (DEST)), (HANDLE), (IDX)); \
        } while (0)
 
+/* Handles into the interior of objects.
+ *
+ * Typically when working with value types, we pass them by reference.  In the case where the value type
+ * is a field in a managed class, the reference will be a pointer into the middle of a managed object.
+ * We need to identify such pointers in order for SGen to scan them correctly.
+ */
+
+#ifndef MONO_HANDLE_TRACK_OWNER
+#define MONO_HANDLE_NEW_GET_VALPTR(HANDLE,TYPE,FIELD) (TYPE_VALUE_HANDLE_NAME(TYPE))(mono_handle_new_full (&(HANDLE)->__raw->FIELD), TRUE))
+#else
+#define MONO_HANDLE_NEW_GET_VALPTR(HANDLE,TYPE,FIELD) (TYPE_VALUE_HANDLE_NAME(TYPE))(mono_handle_new_full (&(HANDLE)->__raw->FIELD), TRUE, HANDLE_OWNER_STRINGIFY(__FILE__, __LINE__))
+#endif
+
+
 #define MONO_HANDLE_ASSIGN(DESTH, SRCH)                                \
        mono_handle_assign (MONO_HANDLE_CAST (MonoObject, (DESTH)), MONO_HANDLE_CAST(MonoObject, (SRCH)))
 
 #define MONO_HANDLE_DOMAIN(HANDLE) (mono_object_domain (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, HANDLE))))
 
+
 /* Baked typed handles we all want */
 TYPED_HANDLE_DECL (MonoString);
 TYPED_HANDLE_DECL (MonoArray);
@@ -373,7 +408,7 @@ extern const MonoObjectHandle mono_null_value_handle;
 static inline void
 mono_handle_assign (MonoObjectHandleOut dest, MonoObjectHandle src)
 {
-       mono_gc_wbarrier_generic_store (&dest->__obj, src ? MONO_HANDLE_RAW(src) : NULL);
+       mono_gc_wbarrier_generic_store (&dest->__raw, src ? MONO_HANDLE_RAW(src) : NULL);
 }
 
 //FIXME this should go somewhere else
@@ -388,7 +423,7 @@ uintptr_t mono_array_handle_length (MonoArrayHandle arr);
 static inline void
 mono_handle_array_getref (MonoObjectHandleOut dest, MonoArrayHandle array, uintptr_t index)
 {
-       mono_gc_wbarrier_generic_store (&dest->__obj, mono_array_get (MONO_HANDLE_RAW (array),gpointer, index));
+       mono_gc_wbarrier_generic_store (&dest->__raw, mono_array_get (MONO_HANDLE_RAW (array),gpointer, index));
 }
 
 #define mono_handle_class(o) mono_object_class (MONO_HANDLE_RAW (o))
index ebf717d1fdd11a17458660d62d1f971385f43f65..eebdcd23094699e3d1e7e36e5ce5b697715dfa3f 100644 (file)
@@ -629,14 +629,14 @@ HANDLES(ICALL(MMETH_9, "get_name", ves_icall_MonoMethod_get_name))
 
 ICALL_TYPE(MMETHI, "System.Reflection.MonoMethodInfo", MMETHI_4)
 ICALL(MMETHI_4, "get_method_attributes", vell_icall_get_method_attributes)
-ICALL(MMETHI_1, "get_method_info", ves_icall_get_method_info)
+HANDLES(ICALL(MMETHI_1, "get_method_info", ves_icall_get_method_info))
 HANDLES(ICALL(MMETHI_2, "get_parameter_info", ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info))
 HANDLES(ICALL(MMETHI_3, "get_retval_marshal", ves_icall_System_MonoMethodInfo_get_retval_marshal))
 
 ICALL_TYPE(MPROPI, "System.Reflection.MonoPropertyInfo", MPROPI_1)
 HANDLES(ICALL(MPROPI_1, "GetTypeModifiers", ves_icall_MonoPropertyInfo_GetTypeModifiers))
 ICALL(MPROPI_3, "get_default_value", property_info_get_default_value)
-ICALL(MPROPI_2, "get_property_info", ves_icall_MonoPropertyInfo_get_property_info)
+HANDLES(ICALL(MPROPI_2, "get_property_info", ves_icall_MonoPropertyInfo_get_property_info))
 
 ICALL_TYPE(PARAMI, "System.Reflection.ParameterInfo", PARAMI_1)
 HANDLES(ICALL(PARAMI_1, "GetMetadataToken", ves_icall_reflection_get_token))
index 6f76a3250a9e96b5cd2bb5664d5885cf0e4aa80b..9849eb11a020dda7fbfa167608f79114e94b6028 100644 (file)
@@ -1793,46 +1793,36 @@ vell_icall_get_method_attributes (MonoMethod *method)
 }
 
 ICALL_EXPORT void
-ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
+ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info, MonoError *error)
 {
-       MonoError error;
-       MonoReflectionType *rt;
        MonoDomain *domain = mono_domain_get ();
-       MonoMethodSignature* sig;
 
-       sig = mono_method_signature_checked (method, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
+       MonoMethodSignature* sig = mono_method_signature_checked (method, error);
+       return_if_nok (error);
 
-       rt = mono_type_get_object_checked (domain, &method->klass->byval_arg, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
+       MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &method->klass->byval_arg, error);
+       return_if_nok (error);
 
-       MONO_STRUCT_SETREF (info, parent, rt);
+       MONO_STRUCT_SETREF (info, parent, MONO_HANDLE_RAW (rt));
 
-       rt = mono_type_get_object_checked (domain, sig->ret, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
+       MONO_HANDLE_ASSIGN (rt, mono_type_get_object_handle (domain, sig->ret, error));
+       return_if_nok (error);
 
-       MONO_STRUCT_SETREF (info, ret, rt);
+       MONO_STRUCT_SETREF (info, ret, MONO_HANDLE_RAW (rt));
 
        info->attrs = method->flags;
        info->implattrs = method->iflags;
+       guint32 callconv;
        if (sig->call_convention == MONO_CALL_DEFAULT)
-               info->callconv = sig->sentinelpos >= 0 ? 2 : 1;
+               callconv = sig->sentinelpos >= 0 ? 2 : 1;
        else {
                if (sig->call_convention == MONO_CALL_VARARG || sig->sentinelpos >= 0)
-                       info->callconv = 2;
+                       callconv = 2;
                else
-                       info->callconv = 1;
+                       callconv = 1;
        }
-       info->callconv |= (sig->hasthis << 5) | (sig->explicit_this << 6); 
+       callconv |= (sig->hasthis << 5) | (sig->explicit_this << 6);
+       info->callconv = callconv;
 }
 
 ICALL_EXPORT MonoArrayHandle
@@ -2173,60 +2163,63 @@ typedef enum {
 } PInfo;
 
 ICALL_EXPORT void
-ves_icall_MonoPropertyInfo_get_property_info (const MonoReflectionProperty *property, MonoPropertyInfo *info, PInfo req_info)
+ves_icall_MonoPropertyInfo_get_property_info (MonoReflectionPropertyHandle property, MonoPropertyInfo *info, PInfo req_info, MonoError *error)
 {
-       MonoError error;
-       MonoReflectionType *rt;
-       MonoReflectionMethod *rm;
-       MonoDomain *domain = mono_object_domain (property); 
-       const MonoProperty *pproperty = property->property;
+       error_init (error);
+       MonoDomain *domain = MONO_HANDLE_DOMAIN (property); 
+       const MonoProperty *pproperty = MONO_HANDLE_GETVAL (property, property);
 
        if ((req_info & PInfo_ReflectedType) != 0) {
-               rt = mono_type_get_object_checked (domain, &property->klass->byval_arg, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return;
+               MonoClass *klass = MONO_HANDLE_GETVAL (property, klass);
+               MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &klass->byval_arg, error);
+               return_if_nok (error);
 
-               MONO_STRUCT_SETREF (info, parent, rt);
+               MONO_STRUCT_SETREF (info, parent, MONO_HANDLE_RAW (rt));
        }
        if ((req_info & PInfo_DeclaringType) != 0) {
-               rt = mono_type_get_object_checked (domain, &pproperty->parent->byval_arg, &error);
-               if (mono_error_set_pending_exception (&error))
-                       return;
+               MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &pproperty->parent->byval_arg, error);
+               return_if_nok (error);
 
-               MONO_STRUCT_SETREF (info, declaring_type, rt);
+               MONO_STRUCT_SETREF (info, declaring_type, MONO_HANDLE_RAW (rt));
        }
 
-       if ((req_info & PInfo_Name) != 0)
-               MONO_STRUCT_SETREF (info, name, mono_string_new (domain, pproperty->name));
+       if ((req_info & PInfo_Name) != 0) {
+               MonoStringHandle name = mono_string_new_handle (domain, pproperty->name, error);
+               return_if_nok (error);
+
+               MONO_STRUCT_SETREF (info, name, MONO_HANDLE_RAW (name));
+       }
 
        if ((req_info & PInfo_Attributes) != 0)
                info->attrs = pproperty->attrs;
 
        if ((req_info & PInfo_GetMethod) != 0) {
+               MonoClass *property_klass = MONO_HANDLE_GETVAL (property, klass);
+               MonoReflectionMethodHandle rm;
                if (pproperty->get &&
                    (((pproperty->get->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) != METHOD_ATTRIBUTE_PRIVATE) ||
-                    pproperty->get->klass == property->klass)) {
-                       rm = mono_method_get_object_checked (domain, pproperty->get, property->klass, &error);
-                       if (mono_error_set_pending_exception (&error))
-                               return;
+                    pproperty->get->klass == property_klass)) {
+                       rm = mono_method_get_object_handle (domain, pproperty->get, property_klass, error);
+                       return_if_nok (error);
                } else {
-                       rm = NULL;
+                       rm = MONO_HANDLE_NEW (MonoReflectionMethod, NULL);
                }
 
-               MONO_STRUCT_SETREF (info, get, rm);
+               MONO_STRUCT_SETREF (info, get, MONO_HANDLE_RAW (rm));
        }
        if ((req_info & PInfo_SetMethod) != 0) {
+               MonoClass *property_klass = MONO_HANDLE_GETVAL (property, klass);
+               MonoReflectionMethodHandle rm;
                if (pproperty->set &&
                    (((pproperty->set->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) != METHOD_ATTRIBUTE_PRIVATE) ||
-                    pproperty->set->klass == property->klass)) {
-                       rm =  mono_method_get_object_checked (domain, pproperty->set, property->klass, &error);
-                       if (mono_error_set_pending_exception (&error))
-                               return;
+                    pproperty->set->klass == property_klass)) {
+                       rm =  mono_method_get_object_handle (domain, pproperty->set, property_klass, error);
+                       return_if_nok (error);
                } else {
-                       rm = NULL;
+                       rm = MONO_HANDLE_NEW (MonoReflectionMethod, NULL);
                }
 
-               MONO_STRUCT_SETREF (info, set, rm);
+               MONO_STRUCT_SETREF (info, set, MONO_HANDLE_RAW (rm));
        }
        /* 
         * There may be other methods defined for properties, though, it seems they are not exposed 
index 6281e3b241c35eb37cbb5d1ead242c7ab41ccb16..e6868daee9c2887f672d7e3d2f374ee8ae0a72cd 100644 (file)
@@ -16,4 +16,7 @@ mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError
 MonoImage*
 mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error);
 
+MonoImage *
+mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context);
+
 #endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */
index f494a57f1471849533476a95b434211e00746ea7..0c507f5c1da1301a5ba886ac032240700bb0b143 100644 (file)
@@ -1253,9 +1253,13 @@ do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status,
                goto invalid_image;
 
        if (!image->ref_only && is_problematic_image (image)) {
-               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name);
-               *status = MONO_IMAGE_IMAGE_INVALID;
-               goto invalid_image;
+               if (image->load_from_context) {
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Loading problematic image %s", image->name);
+               } else {
+                       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name);
+                       *status = MONO_IMAGE_IMAGE_INVALID;
+                       goto invalid_image;
+               }
        }
 
        if (image->loader == &pe_loader && !image->metadata_only && !mono_verifier_verify_table_data (image, &errors))
@@ -1285,7 +1289,7 @@ invalid_image:
 
 static MonoImage *
 do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
-                                       gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only)
+                                       gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only, gboolean load_from_context)
 {
        MonoCLIImageInfo *iinfo;
        MonoImage *image;
@@ -1329,6 +1333,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
        image->name = mono_path_resolve_symlinks (fname);
        image->ref_only = refonly;
        image->metadata_only = metadata_only;
+       image->load_from_context = load_from_context;
        image->ref_count = 1;
        /* if MONO_SECURITY_MODE_CORE_CLR is set then determine if this image is platform code */
        image->core_clr_platform_code = mono_security_core_clr_determine_platform_image (image);
@@ -1525,6 +1530,12 @@ mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean
 
 MonoImage *
 mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean refonly)
+{
+       return mono_image_open_a_lot (fname, status, refonly, FALSE);
+}
+
+MonoImage *
+mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context)
 {
        MonoImage *image;
        GHashTable *loaded_images = get_loaded_images_hash (refonly);
@@ -1624,7 +1635,7 @@ mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean r
        mono_images_unlock ();
 
        // Image not loaded, load it now
-       image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE);
+       image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE, load_from_context);
        if (image == NULL)
                return NULL;
 
@@ -1663,7 +1674,7 @@ mono_pe_file_open (const char *fname, MonoImageOpenStatus *status)
 {
        g_return_val_if_fail (fname != NULL, NULL);
        
-       return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE);
+       return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE, FALSE);
 }
 
 /**
@@ -1680,7 +1691,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status)
 {
        g_return_val_if_fail (fname != NULL, NULL);
        
-       return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE);
+       return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE, FALSE);
 }
 
 /*
@@ -1691,7 +1702,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status)
 MonoImage *
 mono_image_open_metadata_only (const char *fname, MonoImageOpenStatus *status)
 {
-       return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE);
+       return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE, FALSE);
 }
 
 void
index efbb373197f0db84c8b91517ced171c10f621bbf..5761a8a00e35875b2174e07923a1fe7c96f4a3f3 100644 (file)
@@ -35,7 +35,7 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/appdomain.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/runtime.h>
index a2d671c6839bb359f7af9aafc8c98b9a8bfea4db..e0b18174a12eb66c15214112fdc165db20dab4e5 100644 (file)
@@ -1166,6 +1166,7 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
        int i,j;
        MonoDl *module = NULL;
        gboolean cached = FALSE;
+       gpointer addr = NULL;
 
        g_assert (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL);
 
@@ -1474,7 +1475,7 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
                                "Searching for '%s'.", import);
 
        if (piinfo->piflags & PINVOKE_ATTRIBUTE_NO_MANGLE) {
-               error_msg = mono_dl_symbol (module, import, &piinfo->addr); 
+               error_msg = mono_dl_symbol (module, import, &addr); 
        } else {
                char *mangled_name = NULL, *mangled_name2 = NULL;
                int mangle_charset;
@@ -1496,7 +1497,7 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
 #endif
                                for (mangle_param_count = 0; mangle_param_count <= (need_param_count ? 256 : 0); mangle_param_count += 4) {
 
-                                       if (piinfo->addr)
+                                       if (addr)
                                                continue;
 
                                        mangled_name = (char*)import;
@@ -1547,9 +1548,9 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
                                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
                                                                "Probing '%s'.", mangled_name2);
 
-                                       error_msg = mono_dl_symbol (module, mangled_name2, &piinfo->addr);
+                                       error_msg = mono_dl_symbol (module, mangled_name2, &addr);
 
-                                       if (piinfo->addr)
+                                       if (addr)
                                                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
                                                                        "Found as '%s'.", mangled_name2);
                                        else
@@ -1568,7 +1569,7 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
                }
        }
 
-       if (!piinfo->addr) {
+       if (!addr) {
                g_free (error_msg);
                if (exc_class) {
                        *exc_class = "EntryPointNotFoundException";
@@ -1576,7 +1577,8 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
                }
                return NULL;
        }
-       return piinfo->addr;
+       piinfo->addr = addr;
+       return addr;
 }
 
 /*
index 328cb5ac7583312904112bbfb933f779f8a9c402..f906e5172655d5cc41257d1907d92e35701db810 100644 (file)
@@ -51,9 +51,6 @@ mono_method_get_flags      (MonoMethod *method, uint32_t *iflags);
 MONO_API uint32_t
 mono_method_get_index      (MonoMethod *method);
 
-MONO_API MonoImage *
-mono_load_image            (const char *fname, MonoImageOpenStatus *status);
-
 MONO_API void
 mono_add_internal_call     (const char *name, const void* method);
 
index 1545e1e19ba69a31d6f7055a8f65920a7766b950..af4cabd655fcf0665f9b4443ef9e363a6212ed2c 100644 (file)
@@ -360,7 +360,7 @@ mono_marshal_init (void)
                register_icall (mono_threads_detach_coop, "mono_threads_detach_coop", "void ptr ptr", TRUE);
                register_icall (mono_icall_start, "mono_icall_start", "ptr ptr ptr", TRUE);
                register_icall (mono_icall_end, "mono_icall_end", "void ptr ptr ptr", TRUE);
-               register_icall (mono_handle_new, "mono_handle_new", "ptr ptr", TRUE);
+               register_icall (mono_handle_new_full, "mono_handle_new_full", "ptr ptr bool", TRUE);
 
                mono_cominterop_init ();
                mono_remoting_init ();
@@ -7500,6 +7500,44 @@ emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t,
        }
 }
 
+/* How the arguments of an icall should be wrapped */
+typedef enum {
+       /* Don't wrap at all, pass the argument as is */
+       ICALL_HANDLES_WRAP_NONE,
+       /* Wrap the argument in an object handle, pass the handle to the icall */
+       ICALL_HANDLES_WRAP_OBJ,
+       /* Wrap the argument in an object handle, pass the handle to the icall,
+          write the value out from the handle when the icall returns */
+       ICALL_HANDLES_WRAP_OBJ_INOUT,
+       /* Wrap the argument (a valuetype reference) in a handle to pin its enclosing object,
+          but pass the raw reference to the icall */
+       ICALL_HANDLES_WRAP_VALUETYPE_REF,
+} IcallHandlesWrap;
+
+typedef struct {
+       IcallHandlesWrap wrap;
+       /* if wrap is NONE or OBJ or VALUETYPE_REF, this is not meaningful.
+          if wrap is OBJ_INOUT it's the local var that holds the MonoObjectHandle.
+       */
+       int handle;
+}  IcallHandlesLocal;
+
+/*
+ * Describes how to wrap the given parameter.
+ *
+ */
+static IcallHandlesWrap
+signature_param_uses_handles (MonoMethodSignature *sig, int param)
+{
+       if (MONO_TYPE_IS_REFERENCE (sig->params [param])) {
+               return mono_signature_param_is_out (sig, param) ? ICALL_HANDLES_WRAP_OBJ_INOUT : ICALL_HANDLES_WRAP_OBJ;
+       } else if (mono_type_is_byref (sig->params [param]))
+               return ICALL_HANDLES_WRAP_VALUETYPE_REF;
+       else
+               return ICALL_HANDLES_WRAP_NONE;
+}
+
+
 #ifndef DISABLE_JIT
 /**
  * mono_marshal_emit_native_wrapper:
@@ -7952,8 +7990,8 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                int thread_info_var = -1, stack_mark_var = -1, error_var = -1;
                MonoMethodSignature *call_sig = csig;
                gboolean uses_handles = FALSE;
-               gboolean has_outarg_handles = FALSE;
-               int *outarg_handle = NULL;
+               gboolean save_handles_to_locals = FALSE;
+               IcallHandlesLocal *handles_locals = NULL;
                (void) mono_lookup_internal_call_full (method, &uses_handles);
 
 
@@ -7963,21 +8001,33 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                if (uses_handles) {
                        MonoMethodSignature *ret;
 
-                       /* Add a MonoError argument */
+                       /* Add a MonoError argument and figure out which args need to be wrapped in handles */
                        // FIXME: The stuff from mono_metadata_signature_dup_internal_with_padding ()
                        ret = mono_metadata_signature_alloc (method->klass->image, csig->param_count + 1);
 
                        ret->param_count = csig->param_count + 1;
                        ret->ret = csig->ret;
+
+                       handles_locals = g_new0 (IcallHandlesLocal, csig->param_count);
                        for (int i = 0; i < csig->param_count; ++i) {
-                               if (MONO_TYPE_IS_REFERENCE (csig->params[i])) {
+                               IcallHandlesWrap w = signature_param_uses_handles (csig, i);
+                               handles_locals [i].wrap = w;
+                               switch (w) {
+                               case ICALL_HANDLES_WRAP_OBJ:
+                               case ICALL_HANDLES_WRAP_OBJ_INOUT:
                                        ret->params [i] = mono_class_get_byref_type (mono_class_from_mono_type(csig->params[i]));
-                                       if (mono_signature_param_is_out (csig, i)) {
-                                               has_outarg_handles = TRUE;
-                                       }
-                               } else
+                                       if (w == ICALL_HANDLES_WRAP_OBJ_INOUT)
+                                               save_handles_to_locals = TRUE;
+                                       break;
+                               case ICALL_HANDLES_WRAP_NONE:
+                               case ICALL_HANDLES_WRAP_VALUETYPE_REF:
                                        ret->params [i] = csig->params [i];
+                                       break;
+                               default:
+                                       g_assert_not_reached ();
+                               }
                        }
+                       /* Add MonoError* param */
                        ret->params [csig->param_count] = &mono_get_intptr_class ()->byval_arg;
                        ret->pinvoke = csig->pinvoke;
 
@@ -7992,15 +8042,22 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                        stack_mark_var = mono_mb_add_local (mb, &handle_stack_mark_class->byval_arg);
                        error_var = mono_mb_add_local (mb, &error_class->byval_arg);
 
-                       if (has_outarg_handles) {
-                               outarg_handle = g_new0 (int, sig->param_count);
-
+                       if (save_handles_to_locals) {
                                /* add a local var to hold the handles for each out arg */
                                for (int i = 0; i < sig->param_count; ++i) {
-                                       if (mono_signature_param_is_out (sig, i) && MONO_TYPE_IS_REFERENCE (sig->params[i])) {
-                                               outarg_handle[i] = mono_mb_add_local (mb, sig->params[i]);
-                                       } else if (outarg_handle != NULL)
-                                               outarg_handle[i] = -1;
+                                       int j = i + sig->hasthis;
+                                       switch (handles_locals[j].wrap) {
+                                       case ICALL_HANDLES_WRAP_NONE:
+                                       case ICALL_HANDLES_WRAP_OBJ:
+                                       case ICALL_HANDLES_WRAP_VALUETYPE_REF:
+                                               handles_locals [j].handle = -1;
+                                               break;
+                                       case ICALL_HANDLES_WRAP_OBJ_INOUT:
+                                               handles_locals [j].handle = mono_mb_add_local (mb, sig->params [i]);
+                                               break;
+                                       default:
+                                               g_assert_not_reached ();
+                                       }
                                }
                        }
                }
@@ -8026,27 +8083,47 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
 
                        if (sig->hasthis) {
                                mono_mb_emit_byte (mb, CEE_LDARG_0);
-                               mono_mb_emit_icall (mb, mono_handle_new);
+                               /* TODO support adding wrappers to non-static struct methods */
+                               g_assert (!mono_class_is_valuetype(mono_method_get_class (method)));
+                               mono_mb_emit_byte (mb, CEE_LDC_I4_0);
+                               mono_mb_emit_icall (mb, mono_handle_new_full);
                        }
                        for (i = 0; i < sig->param_count; i++) {
-                               /* load each argument. object reference arguments get wrapped in handles */
-
-                               if (!MONO_TYPE_IS_REFERENCE (sig->params [i])) {
-                                       mono_mb_emit_ldarg (mb, i + sig->hasthis);
-                               } else {
-                                       if (outarg_handle && outarg_handle[i] != -1) {
-                                               /* handleI = argI = mono_handle_new (NULL) */
-                                               mono_mb_emit_byte (mb, CEE_LDNULL);
-                                               mono_mb_emit_icall (mb, mono_handle_new);
-                                               /* tmp = argI */
-                                               mono_mb_emit_byte (mb, CEE_DUP);
-                                               /* handleI = tmp */
-                                               mono_mb_emit_stloc (mb, outarg_handle[i]);
-                                       } else {
-                                               /* argI = mono_handle_new (argI_raw) */
-                                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
-                                               mono_mb_emit_icall (mb, mono_handle_new);
-                                       }
+                               /* load each argument. references into the managed heap get wrapped in handles */
+                               int j = i + sig->hasthis;
+                               switch (handles_locals[j].wrap) {
+                               case ICALL_HANDLES_WRAP_NONE:
+                                       mono_mb_emit_ldarg (mb, j);
+                                       break;
+                               case ICALL_HANDLES_WRAP_OBJ:
+                                       /* argI = mono_handle_new_full (argI_raw, FALSE) */
+                                       mono_mb_emit_ldarg (mb, j);
+                                       mono_mb_emit_byte (mb, CEE_LDC_I4_0);
+                                       mono_mb_emit_icall (mb, mono_handle_new_full);
+                                       break;
+                               case ICALL_HANDLES_WRAP_OBJ_INOUT:
+                                       /* handleI = argI = mono_handle_new_full (NULL, FALSE) */
+                                       mono_mb_emit_byte (mb, CEE_LDNULL);
+                                       mono_mb_emit_byte (mb, CEE_LDC_I4_0);
+                                       mono_mb_emit_icall (mb, mono_handle_new_full);
+                                       /* tmp = argI */
+                                       mono_mb_emit_byte (mb, CEE_DUP);
+                                       /* handleI = tmp */
+                                       mono_mb_emit_stloc (mb, handles_locals[j].handle);
+                                       break;
+                               case ICALL_HANDLES_WRAP_VALUETYPE_REF:
+                                       /* (void) mono_handle_new_full (argI, TRUE); argI */
+                                       mono_mb_emit_ldarg (mb, j);
+                                       mono_mb_emit_byte (mb, CEE_DUP);
+                                       mono_mb_emit_byte (mb, CEE_LDC_I4_1);
+                                       mono_mb_emit_icall (mb, mono_handle_new_full);
+                                       mono_mb_emit_byte (mb, CEE_POP);
+#if 0
+                                       fprintf (stderr, " Method %s.%s.%s has byref valuetype argument %d\n", method->klass->name_space, method->klass->name, method->name, i);
+#endif
+                                       break;
+                               default:
+                                       g_assert_not_reached ();
                                }
                        }
                        mono_mb_emit_ldloc_addr (mb, error_var);
@@ -8077,25 +8154,34 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                mono_mb_emit_byte (mb, CEE_LDIND_REF);
                                mono_mb_patch_branch (mb, pos);
                        }
-                       if (outarg_handle != NULL) {
+                       if (save_handles_to_locals) {
                                for (i = 0; i < sig->param_count; i++) {
-                                       if (outarg_handle[i] != -1) {
+                                       int j = i + sig->hasthis;
+                                       switch (handles_locals [j].wrap) {
+                                       case ICALL_HANDLES_WRAP_NONE:
+                                       case ICALL_HANDLES_WRAP_OBJ:
+                                       case ICALL_HANDLES_WRAP_VALUETYPE_REF:
+                                               break;
+                                       case ICALL_HANDLES_WRAP_OBJ_INOUT:
                                                /* *argI_raw = MONO_HANDLE_RAW (handleI) */
 
                                                /* argI_raw */
-                                               mono_mb_emit_ldarg (mb, i + sig->hasthis);
+                                               mono_mb_emit_ldarg (mb, j);
                                                /* handleI */
-                                               mono_mb_emit_ldloc (mb, outarg_handle[i]);
+                                               mono_mb_emit_ldloc (mb, handles_locals [j].handle);
                                                /* MONO_HANDLE_RAW(handleI) */
                                                mono_mb_emit_ldflda (mb, MONO_HANDLE_PAYLOAD_OFFSET (MonoObject));
                                                mono_mb_emit_byte (mb, CEE_LDIND_REF);
                                                /* *argI_raw = MONO_HANDLE_RAW(handleI) */
                                                mono_mb_emit_byte (mb, CEE_STIND_REF);
+                                               break;
+                                       default:
+                                               g_assert_not_reached ();
                                        }
                                }
-                               g_free (outarg_handle);
-                               outarg_handle = NULL;
                        }
+                       g_free (handles_locals);
+
                        mono_mb_emit_ldloc (mb, thread_info_var);
                        mono_mb_emit_ldloc_addr (mb, stack_mark_var);
                        mono_mb_emit_ldloc_addr (mb, error_var);
index ae524c9f35164b83d38898cbae52b152d5900a3c..5ff20a90e6e6b80c3d23d41ea84a2aeeb51b3ad8 100644 (file)
@@ -212,6 +212,9 @@ struct _MonoImage {
        /* Whenever this image contains metadata only without PE data */
        guint8 metadata_only : 1;
 
+       /*  Whether this image belongs to load-from context */
+       guint8 load_from_context: 1;
+
        guint8 checked_module_cctor : 1;
        guint8 has_module_cctor : 1;
 
index dd2cc0eb9a7186b6a6d77471adeb1a914570bef9..676400c152e8d414dbf72f87b4d74e86037e0fb2 100644 (file)
@@ -891,7 +891,7 @@ retry_contended:
         *
         */
        if (allow_interruption) {
-               if (!mono_thread_test_and_set_state (thread, (MonoThreadState)(ThreadState_StopRequested | ThreadState_AbortRequested), ThreadState_WaitSleepJoin)) {
+               if (!mono_thread_test_and_set_state (thread, ThreadState_AbortRequested, ThreadState_WaitSleepJoin)) {
                        wait_ret = MONO_SEM_TIMEDWAIT_RET_ALERTED;
                        goto done_waiting;
                }
@@ -918,7 +918,7 @@ done_waiting:
                 * We have to obey a stop/suspend request even if 
                 * allow_interruption is FALSE to avoid hangs at shutdown.
                 */
-               if (!mono_thread_test_state (mono_thread_internal_current (), (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested))) {
+               if (!mono_thread_test_state (mono_thread_internal_current (), ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
                        if (ms != MONO_INFINITE_WAIT) {
                                now = mono_msec_ticks ();
 
diff --git a/mono/metadata/mono-debug-debugger.h b/mono/metadata/mono-debug-debugger.h
deleted file mode 100644 (file)
index 740b2db..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __MONO_DEBUG_DEBUGGER_H__
-#define __MONO_DEBUG_DEBUGGER_H__
-
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/debug-mono-symfile.h>
-#include <mono/utils/mono-compiler.h>
-
-void            mono_debugger_lock                          (void);
-void            mono_debugger_unlock                        (void);
-
-void
-mono_debug_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrArray **source_file_list, int **source_files, MonoSymSeqPoint **seq_points, int *n_seq_points);
-
-MONO_API void
-mono_debug_free_locals (MonoDebugLocalsInfo *info);
-
-void
-mono_debug_free_method_async_debug_info (MonoDebugMethodAsyncInfo *info);
-
-#endif /* __MONO_DEBUG_DEBUGGER_H__ */
index 2eba05b36fa7d16178603afd22dfe74d678f09d0..50b10a9280abadc87b43d739e4c6ae9fb28e83a4 100644 (file)
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mempool.h>
+#include <mono/metadata/debug-mono-symfile.h>
 #include <mono/metadata/debug-mono-ppdb.h>
 #include <mono/metadata/exception-internals.h>
 #include <mono/metadata/runtime.h>
index e766126d255bb096b20daf60fdec2a23d3ebbf7e..3e6c7f3e47ba3a874700f2cbb341563f2fa0df42 100644 (file)
@@ -362,14 +362,14 @@ struct _MonoInternalThread {
        volatile int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks. Used for appdomain_ref push/pop */
        MonoThreadHandle *handle;
        gpointer native_handle;
-       MonoArray  *cached_culture_info;
+       gpointer unused3;
        gunichar2  *name;
        guint32     name_len;
        guint32     state;
        MonoException *abort_exc;
        int abort_state_handle;
        guint64 tid;    /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */
-       gpointer stack_ptr;
+       gsize debugger_thread; // FIXME switch to bool as soon as CI testing with corlib version bump works
        gpointer *static_data;
        void *thread_info; /*This is MonoThreadInfo*, but to simplify dependencies, let's make it a void* here. */
        MonoAppContext *current_appcontext;
@@ -388,7 +388,7 @@ struct _MonoInternalThread {
        gint32 managed_id;
        guint32 small_id;
        MonoThreadManageCallback manage_callback;
-       gpointer interrupt_on_stop;
+       gpointer unused4;
        gsize    flags;
        gpointer thread_pinning_ref;
        gsize __abort_protected_block_count;
index d403bd731aae6f6feec05311deb3b57cd7838a61..f304361d4bd4129d9996f6c2cd5891906e146e0d 100644 (file)
@@ -56,7 +56,7 @@ DECL_SIZE(gpointer)
 DECL_OFFSET(MonoObject, vtable)
 DECL_OFFSET(MonoObject, synchronisation)
 
-DECL_OFFSET(MonoObjectHandlePayload, __obj)
+DECL_OFFSET(MonoObjectHandlePayload, __raw)
 
 DECL_OFFSET(MonoClass, interface_bitmap)
 DECL_OFFSET(MonoClass, byval_arg)
index 96d52815caf7b41997bb284023fbebf9248a9120..bba8c17d17ec4d142458764a1d674876c54dc7ac 100644 (file)
@@ -36,7 +36,6 @@
 #include <mono/metadata/environment.h>
 #include "mono/metadata/profiler-private.h"
 #include "mono/metadata/security-manager.h"
-#include "mono/metadata/mono-debug-debugger.h"
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/reflection-internals.h>
 #include <mono/metadata/w32event.h>
@@ -441,6 +440,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                        return TRUE;
                }
                /* see if the thread doing the initialization is already blocked on this thread */
+               gboolean is_blocked = TRUE;
                blocked = GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (lock->initializing_tid));
                while ((pending_lock = (TypeInitializationLock*) g_hash_table_lookup (blocked_thread_hash, blocked))) {
                        if (mono_native_thread_id_equals (pending_lock->initializing_tid, tid)) {
@@ -451,6 +451,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                                        /* the thread doing the initialization is blocked on this thread,
                                           but on a lock that has already been freed. It just hasn't got
                                           time to awake */
+                                       is_blocked = FALSE;
                                        break;
                                }
                        }
@@ -458,7 +459,8 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                }
                ++lock->waiting_count;
                /* record the fact that we are waiting on the initializing thread */
-               g_hash_table_insert (blocked_thread_hash, GUINT_TO_POINTER (tid), lock);
+               if (is_blocked)
+                       g_hash_table_insert (blocked_thread_hash, GUINT_TO_POINTER (tid), lock);
        }
        mono_type_initialization_unlock ();
 
@@ -7923,6 +7925,9 @@ mono_delegate_ctor_with_method (MonoObject *this_obj, MonoObject *target, gpoint
        if (target && mono_object_is_transparent_proxy (target)) {
                g_assert (method);
                method = mono_marshal_get_remoting_invoke (method);
+#ifdef ENABLE_INTERPRETER
+               g_error ("need RuntimeMethod in method_ptr when using interpreter");
+#endif
                delegate->method_ptr = mono_compile_method_checked (method, error);
                return_val_if_nok (error, FALSE);
                MONO_OBJECT_SETREF (delegate, target, target);
index a880ec9330068672aeae59a614df7bf7759d6041..ec29d9d45d29033772aadeb58cb86168e5b550c1 100644 (file)
@@ -16,7 +16,7 @@
 #include "mono/metadata/assembly.h"
 #include "mono/metadata/debug-helpers.h"
 #include "mono/metadata/mono-debug.h"
-#include "mono/metadata/debug-mono-symfile.h"
+#include "mono/metadata/debug-internals.h"
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/domain-internals.h"
@@ -1147,7 +1147,7 @@ mono_profiler_coverage_get (MonoProfiler *prof, MonoMethod *method, MonoProfileC
                        if (debug_minfo) {
                                MonoDebugSourceLocation *location;
 
-                               location = mono_debug_symfile_lookup_location (debug_minfo, offset);
+                               location = mono_debug_method_lookup_location (debug_minfo, offset);
                                if (location) {
                                        entry.line = location->row;
                                        entry.col = location->column;
index 1964c55b064373fa05d69c01e5e3221f3cd6e8c3..1b5feb983bff4cd5646fd23c4994e1ebf3614bf6 100644 (file)
@@ -2331,6 +2331,22 @@ mono_gc_scan_object (void *obj, void *gc_data)
        return obj;
 }
 
+typedef struct {
+       void **start_nursery;
+       void **end_nursery;
+} PinHandleStackInteriorPtrData;
+
+/* Called when we're scanning the handle stack imprecisely and we encounter a pointer into the
+   middle of an object.
+ */
+static void
+pin_handle_stack_interior_ptrs (void **ptr_slot, void *user_data)
+{
+       PinHandleStackInteriorPtrData *ud = (PinHandleStackInteriorPtrData *)user_data;
+       sgen_conservatively_pin_objects_from (ptr_slot, ptr_slot+1, ud->start_nursery, ud->end_nursery, PIN_TYPE_STACK);
+}
+
+
 /*
  * Mark from thread stacks and registers.
  */
@@ -2420,8 +2436,21 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
                                }
                        }
                }
-               if (precise && info->client_info.info.handle_stack) {
-                       mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, (GcScanFunc)ctx.ops->copy_or_mark_object, ctx.queue);
+               if (info->client_info.info.handle_stack) {
+                       /*
+                         Make two passes over the handle stack.  On the imprecise pass, pin all
+                         objects where the handle points into the interior of the object. On the
+                         precise pass, copy or mark all the objects that have handles to the
+                         beginning of the object.
+                       */
+                       if (precise)
+                               mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, (GcScanFunc)ctx.ops->copy_or_mark_object, ctx.queue, precise);
+                       else {
+                               PinHandleStackInteriorPtrData ud = { .start_nursery = start_nursery,
+                                                                    .end_nursery = end_nursery,
+                               };
+                               mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, pin_handle_stack_interior_ptrs, &ud, precise);
+                       }
                }
        } FOREACH_THREAD_END
 }
index 2bc99e105b9cca5e57845d28d8ff21e3a68a305d..82d9b07ad14de051920b533ef9245005641a981e 100644 (file)
@@ -93,7 +93,6 @@ epoll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), g
        if (ready == -1) {
                switch (errno) {
                case EINTR:
-                       mono_thread_internal_check_for_interruption_critical (mono_thread_internal_current ());
                        ready = 0;
                        break;
                default:
index 4422b668e8f61c7c2d2a630e1b1cb702dfb5fd56..47f346a28918863dfae0fae8fcc8568f28d1874d 100644 (file)
@@ -90,7 +90,6 @@ kqueue_event_wait (void (*callback) (gint fd, gint events, gpointer user_data),
        if (ready == -1) {
                switch (errno) {
                case EINTR:
-                       mono_thread_internal_check_for_interruption_critical (mono_thread_internal_current ());
                        ready = 0;
                        break;
                default:
index 3d32130d3b530cc14ad38ce04cffaf5258ac28cf..d7eff1c210c9feee2ed71ddd206a90f13af9d5fc 100644 (file)
@@ -163,7 +163,6 @@ poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gp
                {
                case EINTR:
                {
-                       mono_thread_internal_check_for_interruption_critical (mono_thread_internal_current ());
                        ready = 0;
                        break;
                }
index 4f4fa7b1559c202ec6d0ef11435e43504759831c..4e3b30f011541330aa48beb58265f4b6d68a9d17 100644 (file)
@@ -556,7 +556,7 @@ initialize (void)
                g_error ("initialize: backend->init () failed");
 
        MonoError error;
-       if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, TRUE, SMALL_STACK, &error))
+       if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, &error))
                g_error ("initialize: mono_thread_create_internal () failed due to %s", mono_error_get_message (&error));
 }
 
index 5fc716a74e73e87999bc0e124fdb9a19b64f1c9f..3a87574aab1015efd48bcca798342fa1ac8759e8 100644 (file)
@@ -599,7 +599,7 @@ worker_try_create (void)
                counter._.starting ++;
        });
 
-       thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, TRUE, 0, &error);
+       thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL, &error);
        if (!thread) {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: could not create thread due to %s", mono_native_thread_id_get (), mono_error_get_message (&error));
                mono_error_cleanup (&error);
@@ -743,7 +743,6 @@ monitor_thread (gpointer unused)
                                break;
                        interval_left -= mono_msec_ticks () - ts;
 
-                       g_assert (!(internal->state & ThreadState_StopRequested));
                        mono_thread_interruption_checkpoint ();
                } while (interval_left > 0 && ++awake < 10);
 
@@ -819,7 +818,7 @@ monitor_ensure_running (void)
                                return;
                        if (InterlockedCompareExchange (&worker.monitor_status, MONITOR_STATUS_REQUESTED, MONITOR_STATUS_NOT_RUNNING) == MONITOR_STATUS_NOT_RUNNING) {
                                // printf ("monitor_thread: creating\n");
-                               if (!mono_thread_create_internal (mono_get_root_domain (), monitor_thread, NULL, TRUE, SMALL_STACK, &error)) {
+                               if (!mono_thread_create_internal (mono_get_root_domain (), monitor_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, &error)) {
                                        // printf ("monitor_thread: creating failed\n");
                                        worker.monitor_status = MONITOR_STATUS_NOT_RUNNING;
                                        mono_error_cleanup (&error);
index df17997b16c567521f68f2829d197817cd6cb88d..a628e3311313b293480abd8dee3523f7645ba0fc 100644 (file)
@@ -7,8 +7,6 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/object-internals.h>
 
-#define SMALL_STACK (sizeof (gpointer) * 32 * 1024)
-
 typedef struct _MonoNativeOverlapped MonoNativeOverlapped;
 
 void
index e6a1011d201d5c9c17216573840aca7760b24b17..25571e7f896f7877aed0cb90fef41920d6320ffd 100644 (file)
@@ -23,7 +23,6 @@
 /* This is a copy of System.Threading.ThreadState */
 typedef enum {
        ThreadState_Running = 0x00000000,
-       ThreadState_StopRequested = 0x00000001,
        ThreadState_SuspendRequested = 0x00000002,
        ThreadState_Background = 0x00000004,
        ThreadState_Unstarted = 0x00000008,
@@ -59,7 +58,16 @@ typedef void (*MonoThreadCleanupFunc) (MonoNativeThreadId tid);
 /* INFO has type MonoThreadInfo* */
 typedef void (*MonoThreadNotifyPendingExcFunc) (gpointer info);
 
-MonoInternalThread* mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gboolean threadpool_thread, guint32 stack_size, MonoError *error);
+typedef enum {
+       MONO_THREAD_CREATE_FLAGS_NONE         = 0x0,
+       MONO_THREAD_CREATE_FLAGS_THREADPOOL   = 0x1,
+       MONO_THREAD_CREATE_FLAGS_DEBUGGER     = 0x2,
+       MONO_THREAD_CREATE_FLAGS_FORCE_CREATE = 0x4,
+       MONO_THREAD_CREATE_FLAGS_SMALL_STACK  = 0x8,
+} MonoThreadCreateFlags;
+
+MonoInternalThread*
+mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
 
 void mono_threads_install_cleanup (MonoThreadCleanupFunc func);
 
@@ -174,9 +182,6 @@ void ves_icall_System_Runtime_Remoting_Contexts_Context_ReleaseContext (MonoAppC
 
 MonoInternalThread *mono_thread_internal_current (void);
 
-void mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread);
-
-void mono_thread_internal_stop (MonoInternalThread *thread);
 void mono_thread_internal_abort (MonoInternalThread *thread);
 void mono_thread_internal_suspend_for_shutdown (MonoInternalThread *thread);
 
@@ -212,8 +217,6 @@ void mono_thread_push_appdomain_ref (MonoDomain *domain);
 void mono_thread_pop_appdomain_ref (void);
 gboolean mono_thread_has_appdomain_ref (MonoThread *thread, MonoDomain *domain);
 
-void mono_threads_clear_cached_culture (MonoDomain *domain);
-
 MonoException* mono_thread_request_interruption (mono_bool running_managed);
 gboolean mono_thread_interruption_requested (void);
 MonoException* mono_thread_interruption_checkpoint (void);
index 3461f81e325c6dde6063bb487799a5d24b4baf02..57e1d9addf3d489102d8bab5e5219a1d1dcabd41 100644 (file)
@@ -29,7 +29,7 @@
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/object-internals.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/utils/monobitset.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-mmap.h>
@@ -114,14 +114,6 @@ typedef struct {
        StaticDataFreeList *freelist;
 } StaticDataInfo;
 
-/* Number of cached culture objects in the MonoThread->cached_culture_info array
- * (per-type): we use the first NUM entries for CultureInfo and the last for
- * UICultureInfo. So the size of the array is really NUM_CACHED_CULTURES * 2.
- */
-#define NUM_CACHED_CULTURES 4
-#define CULTURES_START_IDX 0
-#define UICULTURES_START_IDX NUM_CACHED_CULTURES
-
 /* Controls access to the 'threads' hash table */
 static void mono_threads_lock (void);
 static void mono_threads_unlock (void);
@@ -656,7 +648,7 @@ static void
 mono_alloc_static_data (gpointer **static_data_ptr, guint32 offset, gboolean threadlocal);
 
 static gboolean
-mono_thread_attach_internal (MonoThread *thread, gboolean force_attach, gboolean force_domain, gsize *stack_ptr)
+mono_thread_attach_internal (MonoThread *thread, gboolean force_attach, gboolean force_domain)
 {
        MonoThreadInfo *info;
        MonoInternalThread *internal;
@@ -674,7 +666,6 @@ mono_thread_attach_internal (MonoThread *thread, gboolean force_attach, gboolean
        internal->tid = MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ());
        internal->thread_info = info;
        internal->small_id = info->small_id;
-       internal->stack_ptr = stack_ptr;
 
        THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Setting current_object_key to %p", __func__, mono_native_thread_id_get (), internal));
 
@@ -742,6 +733,7 @@ typedef struct {
        MonoObject *start_delegate_arg;
        MonoThreadStart start_func;
        gpointer start_func_arg;
+       gboolean force_attach;
        gboolean failed;
        MonoCoopSem registered;
 } StartInfo;
@@ -768,7 +760,7 @@ static guint32 WINAPI start_wrapper_internal(StartInfo *start_info, gsize *stack
 
        THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Start wrapper", __func__, mono_native_thread_id_get ()));
 
-       if (!mono_thread_attach_internal (thread, FALSE, FALSE, stack_ptr)) {
+       if (!mono_thread_attach_internal (thread, start_info->force_attach, FALSE)) {
                start_info->failed = TRUE;
 
                mono_coop_sem_post (&start_info->registered);
@@ -881,11 +873,25 @@ static guint32 WINAPI start_wrapper_internal(StartInfo *start_info, gsize *stack
        return(0);
 }
 
-static gsize WINAPI start_wrapper(void *data)
+static gsize WINAPI
+start_wrapper (gpointer data)
 {
-       volatile gsize dummy;
+       StartInfo *start_info;
+       MonoThreadInfo *info;
+       gsize res;
+
+       start_info = (StartInfo*) data;
+       g_assert (start_info);
+
+       info = mono_thread_info_attach (&res);
+       info->runtime_thread = TRUE;
+
+       /* Run the actual main function of the thread */
+       res = start_wrapper_internal (start_info, &res);
 
-       return start_wrapper_internal ((StartInfo*) data, (gsize*) &dummy);
+       mono_thread_info_exit (res);
+
+       g_assert_not_reached ();
 }
 
 /*
@@ -896,10 +902,9 @@ static gsize WINAPI start_wrapper(void *data)
  */
 static gboolean
 create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *start_delegate, MonoThreadStart start_func, gpointer start_func_arg,
-       gboolean threadpool_thread, guint32 stack_size, MonoError *error)
+       MonoThreadCreateFlags flags, MonoError *error)
 {
        StartInfo *start_info = NULL;
-       MonoThreadHandle *thread_handle;
        MonoNativeThreadId tid;
        gboolean ret;
        gsize stack_set_size;
@@ -909,6 +914,15 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
        if (start_func)
                g_assert (!start_delegate);
 
+       if (flags & MONO_THREAD_CREATE_FLAGS_THREADPOOL) {
+               g_assert (!(flags & MONO_THREAD_CREATE_FLAGS_DEBUGGER));
+               g_assert (!(flags & MONO_THREAD_CREATE_FLAGS_FORCE_CREATE));
+       }
+       if (flags & MONO_THREAD_CREATE_FLAGS_DEBUGGER) {
+               g_assert (!(flags & MONO_THREAD_CREATE_FLAGS_THREADPOOL));
+               g_assert (!(flags & MONO_THREAD_CREATE_FLAGS_FORCE_CREATE));
+       }
+
        /*
         * Join joinable threads to prevent running out of threads since the finalizer
         * thread might be blocked/backlogged.
@@ -918,7 +932,7 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
        error_init (error);
 
        mono_threads_lock ();
-       if (shutting_down) {
+       if (shutting_down && !(flags & MONO_THREAD_CREATE_FLAGS_FORCE_CREATE)) {
                mono_threads_unlock ();
                return FALSE;
        }
@@ -928,10 +942,12 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
        mono_g_hash_table_insert (threads_starting_up, thread, thread);
        mono_threads_unlock ();
 
-       internal->threadpool_thread = threadpool_thread;
-       if (threadpool_thread)
+       internal->threadpool_thread = flags & MONO_THREAD_CREATE_FLAGS_THREADPOOL;
+       if (internal->threadpool_thread)
                mono_thread_set_state (internal, ThreadState_Background);
 
+       internal->debugger_thread = flags & MONO_THREAD_CREATE_FLAGS_DEBUGGER;
+
        start_info = g_new0 (StartInfo, 1);
        start_info->ref = 2;
        start_info->thread = thread;
@@ -939,17 +955,16 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
        start_info->start_delegate_arg = thread->start_obj;
        start_info->start_func = start_func;
        start_info->start_func_arg = start_func_arg;
+       start_info->force_attach = flags & MONO_THREAD_CREATE_FLAGS_FORCE_CREATE;
        start_info->failed = FALSE;
        mono_coop_sem_init (&start_info->registered, 0);
 
-       if (stack_size == 0)
+       if (flags != MONO_THREAD_CREATE_FLAGS_SMALL_STACK)
                stack_set_size = default_stacksize_for_thread (internal);
        else
                stack_set_size = 0;
 
-       thread_handle = mono_threads_create_thread (start_wrapper, start_info, &stack_set_size, &tid);
-
-       if (thread_handle == NULL) {
+       if (!mono_thread_platform_create_thread (start_wrapper, start_info, &stack_set_size, &tid)) {
                /* The thread couldn't be created, so set an exception */
                mono_threads_lock ();
                mono_g_hash_table_remove (threads_starting_up, thread);
@@ -974,8 +989,6 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
 
        mono_coop_sem_wait (&start_info->registered, MONO_SEM_FLAGS_NONE);
 
-       mono_threads_close_thread_handle (thread_handle);
-
        THREAD_DEBUG (g_message ("%s: (%"G_GSIZE_FORMAT") Done launching thread %p (%"G_GSIZE_FORMAT")", __func__, mono_native_thread_id_get (), internal, (gsize)internal->tid));
 
        ret = !start_info->failed;
@@ -1012,7 +1025,7 @@ guint32 mono_threads_get_default_stacksize (void)
  *   ARG should not be a GC reference.
  */
 MonoInternalThread*
-mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gboolean threadpool_thread, guint32 stack_size, MonoError *error)
+mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error)
 {
        MonoThread *thread;
        MonoInternalThread *internal;
@@ -1026,11 +1039,11 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb
 
        LOCK_THREAD (internal);
 
-       res = create_thread (thread, internal, NULL, (MonoThreadStart) func, arg, threadpool_thread, stack_size, error);
-       return_val_if_nok (error, NULL);
+       res = create_thread (thread, internal, NULL, (MonoThreadStart) func, arg, flags, error);
 
        UNLOCK_THREAD (internal);
 
+       return_val_if_nok (error, NULL);
        return internal;
 }
 
@@ -1045,7 +1058,7 @@ mono_thread_create (MonoDomain *domain, gpointer func, gpointer arg)
 gboolean
 mono_thread_create_checked (MonoDomain *domain, gpointer func, gpointer arg, MonoError *error)
 {
-       return (NULL != mono_thread_create_internal (domain, func, arg, FALSE, 0, error));
+       return (NULL != mono_thread_create_internal (domain, func, arg, MONO_THREAD_CREATE_FLAGS_NONE, error));
 }
 
 MonoThread *
@@ -1061,6 +1074,7 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
 {
        MonoInternalThread *internal;
        MonoThread *thread;
+       MonoThreadInfo *info;
        MonoNativeThreadId tid;
        gsize stack_ptr;
 
@@ -1071,9 +1085,8 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
                return mono_thread_current ();
        }
 
-       if (!mono_gc_register_thread (&domain)) {
-               g_error ("Thread %"G_GSIZE_FORMAT" calling into managed code is not registered with the GC. On UNIX, this can be fixed by #include-ing <gc.h> before <pthread.h> in the file containing the thread creation code.", mono_native_thread_id_get ());
-       }
+       info = mono_thread_info_attach (&stack_ptr);
+       g_assert (info);
 
        tid=mono_native_thread_id_get ();
 
@@ -1081,7 +1094,7 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
 
        thread = create_thread_object (domain, internal);
 
-       if (!mono_thread_attach_internal (thread, force_attach, TRUE, &stack_ptr)) {
+       if (!mono_thread_attach_internal (thread, force_attach, TRUE)) {
                /* Mono is shutting down, so just wait for the end */
                for (;;)
                        mono_thread_info_sleep (10000, NULL);
@@ -1130,17 +1143,6 @@ mono_thread_detach_internal (MonoInternalThread *thread)
        thread->abort_exc = NULL;
        thread->current_appcontext = NULL;
 
-       /*
-        * This is necessary because otherwise we might have
-        * cross-domain references which will not get cleaned up when
-        * the target domain is unloaded.
-        */
-       if (thread->cached_culture_info) {
-               int i;
-               for (i = 0; i < NUM_CACHED_CULTURES * 2; ++i)
-                       mono_array_set (thread->cached_culture_info, MonoObject*, i, NULL);
-       }
-
        /*
         * thread->synch_cs can be NULL if this was called after
         * ves_icall_System_Threading_InternalThread_Thread_free_internal.
@@ -1231,8 +1233,6 @@ mono_thread_detach_internal (MonoInternalThread *thread)
        if (thread == mono_thread_internal_current ())
                mono_thread_pop_appdomain_ref ();
 
-       thread->cached_culture_info = NULL;
-
        mono_free_static_data (thread->static_data);
        thread->static_data = NULL;
        ref_stack_destroy (thread->appdomain_refs);
@@ -1366,7 +1366,7 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj,
                return this_obj;
        }
 
-       res = create_thread (this_obj, internal, start, NULL, NULL, FALSE, 0, &error);
+       res = create_thread (this_obj, internal, start, NULL, NULL, MONO_THREAD_CREATE_FLAGS_NONE, &error);
        if (!res) {
                mono_error_cleanup (&error);
                UNLOCK_THREAD (internal);
@@ -2352,9 +2352,7 @@ request_thread_abort (MonoInternalThread *thread, MonoObject *state)
 {
        LOCK_THREAD (thread);
        
-       if ((thread->state & ThreadState_AbortRequested) != 0 || 
-               (thread->state & ThreadState_StopRequested) != 0 ||
-               (thread->state & ThreadState_Stopped) != 0)
+       if (thread->state & (ThreadState_AbortRequested | ThreadState_Stopped))
        {
                UNLOCK_THREAD (thread);
                return FALSE;
@@ -2506,17 +2504,13 @@ mono_thread_suspend (MonoInternalThread *thread)
 {
        LOCK_THREAD (thread);
 
-       if ((thread->state & ThreadState_Unstarted) != 0 || 
-               (thread->state & ThreadState_Aborted) != 0 || 
-               (thread->state & ThreadState_Stopped) != 0)
+       if (thread->state & (ThreadState_Unstarted | ThreadState_Aborted | ThreadState_Stopped))
        {
                UNLOCK_THREAD (thread);
                return FALSE;
        }
 
-       if ((thread->state & ThreadState_Suspended) != 0 || 
-               (thread->state & ThreadState_SuspendRequested) != 0 ||
-               (thread->state & ThreadState_StopRequested) != 0) 
+       if (thread->state & (ThreadState_Suspended | ThreadState_SuspendRequested | ThreadState_AbortRequested))
        {
                UNLOCK_THREAD (thread);
                return TRUE;
@@ -2630,53 +2624,14 @@ is_running_protected_wrapper (void)
        return found;
 }
 
-static gboolean
-request_thread_stop (MonoInternalThread *thread)
-{
-       LOCK_THREAD (thread);
-
-       if ((thread->state & ThreadState_StopRequested) != 0 ||
-               (thread->state & ThreadState_Stopped) != 0)
-       {
-               UNLOCK_THREAD (thread);
-               return FALSE;
-       }
-       
-       /* Make sure the thread is awake */
-       mono_thread_resume (thread);
-
-       thread->state |= ThreadState_StopRequested;
-       thread->state &= ~ThreadState_AbortRequested;
-       
-       UNLOCK_THREAD (thread);
-       return TRUE;
-}
-
-/**
- * mono_thread_internal_stop:
- *
- * Request thread @thread to stop.
- *
- * @thread MUST NOT be the current thread.
- */
 void
-mono_thread_internal_stop (MonoInternalThread *thread)
-{
-       g_assert (thread != mono_thread_internal_current ());
-
-       if (!request_thread_stop (thread))
-               return;
-       
-       async_abort_internal (thread, TRUE);
-}
-
-void mono_thread_stop (MonoThread *thread)
+mono_thread_stop (MonoThread *thread)
 {
        MonoInternalThread *internal = thread->internal_thread;
 
-       if (!request_thread_stop (internal))
+       if (!request_thread_abort (internal, NULL))
                return;
-       
+
        if (internal == mono_thread_internal_current ()) {
                MonoError error;
                self_abort_internal (&error);
@@ -3247,13 +3202,10 @@ mono_threads_set_shutting_down (void)
 
                LOCK_THREAD (current_thread);
 
-               if ((current_thread->state & ThreadState_SuspendRequested) ||
-                   (current_thread->state & ThreadState_AbortRequested) ||
-                   (current_thread->state & ThreadState_StopRequested)) {
+               if (current_thread->state & (ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
                        UNLOCK_THREAD (current_thread);
                        mono_thread_execute_interruption ();
                } else {
-                       current_thread->state |= ThreadState_Stopped;
                        UNLOCK_THREAD (current_thread);
                }
 
@@ -3436,9 +3388,7 @@ void mono_thread_suspend_all_other_threads (void)
 
                        LOCK_THREAD (thread);
 
-                       if ((thread->state & ThreadState_Suspended) != 0 || 
-                               (thread->state & ThreadState_StopRequested) != 0 ||
-                               (thread->state & ThreadState_Stopped) != 0) {
+                       if (thread->state & (ThreadState_Suspended | ThreadState_Stopped)) {
                                UNLOCK_THREAD (thread);
                                mono_threads_close_thread_handle (wait->handles [i]);
                                wait->threads [i] = NULL;
@@ -3960,39 +3910,6 @@ mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout)
        return TRUE;
 }
 
-static void
-clear_cached_culture (gpointer key, gpointer value, gpointer user_data)
-{
-       MonoInternalThread *thread = (MonoInternalThread*)value;
-       MonoDomain *domain = (MonoDomain*)user_data;
-       int i;
-
-       /* No locking needed here */
-       /* FIXME: why no locking? writes to the cache are protected with synch_cs above */
-
-       if (thread->cached_culture_info) {
-               for (i = 0; i < NUM_CACHED_CULTURES * 2; ++i) {
-                       MonoObject *obj = mono_array_get (thread->cached_culture_info, MonoObject*, i);
-                       if (obj && obj->vtable->domain == domain)
-                               mono_array_set (thread->cached_culture_info, MonoObject*, i, NULL);
-               }
-       }
-}
-       
-/*
- * mono_threads_clear_cached_culture:
- *
- *   Clear the cached_current_culture from all threads if it is in the
- * given appdomain.
- */
-void
-mono_threads_clear_cached_culture (MonoDomain *domain)
-{
-       mono_threads_lock ();
-       mono_g_hash_table_foreach (threads, clear_cached_culture, domain);
-       mono_threads_unlock ();
-}
-
 /*
  * mono_thread_get_undeniable_exception:
  *
@@ -4485,7 +4402,7 @@ mono_thread_execute_interruption (void)
 
                UNLOCK_THREAD (thread);
                return exc;
-       } else if ((thread->state & ThreadState_AbortRequested) != 0) {
+       } else if (thread->state & (ThreadState_AbortRequested)) {
                UNLOCK_THREAD (thread);
                g_assert (sys_thread->pending_exception == NULL);
                if (thread->abort_exc == NULL) {
@@ -4496,19 +4413,10 @@ mono_thread_execute_interruption (void)
                        MONO_OBJECT_SETREF (thread, abort_exc, mono_get_exception_thread_abort ());
                }
                return thread->abort_exc;
-       }
-       else if ((thread->state & ThreadState_SuspendRequested) != 0) {
+       } else if (thread->state & (ThreadState_SuspendRequested)) {
                /* calls UNLOCK_THREAD (thread) */
                self_suspend_internal ();
                return NULL;
-       }
-       else if ((thread->state & ThreadState_StopRequested) != 0) {
-               /* FIXME: do this through the JIT? */
-
-               UNLOCK_THREAD (thread);
-               
-               mono_thread_exit ();
-               return NULL;
        } else if (thread->thread_interrupt_requested) {
 
                thread->thread_interrupt_requested = FALSE;
@@ -4539,12 +4447,6 @@ mono_thread_request_interruption (gboolean running_managed)
        if (thread == NULL) 
                return NULL;
 
-#ifdef HOST_WIN32
-       if (thread->interrupt_on_stop && 
-               thread->state & ThreadState_StopRequested && 
-               thread->state & ThreadState_Background)
-               ExitThread (1);
-#endif
        if (!mono_thread_set_interruption_requested (thread))
                return NULL;
        InterlockedIncrement (&thread_interruption_requested);
@@ -4582,7 +4484,7 @@ mono_thread_resume_interruption (void)
                return NULL;
 
        LOCK_THREAD (thread);
-       still_aborting = (thread->state & (ThreadState_AbortRequested|ThreadState_StopRequested)) != 0;
+       still_aborting = (thread->state & (ThreadState_AbortRequested)) != 0;
        UNLOCK_THREAD (thread);
 
        /*This can happen if the protected block called Thread::ResetAbort*/
@@ -5142,13 +5044,6 @@ mono_thread_join (gpointer tid)
 #endif
 }
 
-void
-mono_thread_internal_check_for_interruption_critical (MonoInternalThread *thread)
-{
-       if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0)
-               mono_thread_interruption_checkpoint ();
-}
-
 void
 mono_thread_internal_unhandled_exception (MonoObject* exc)
 {
@@ -5295,7 +5190,7 @@ mono_threads_is_ready_to_be_interrupted (void)
 
        thread = mono_thread_internal_current ();
        LOCK_THREAD (thread);
-       if (thread->state & (MonoThreadState)(ThreadState_StopRequested | ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
+       if (thread->state & (ThreadState_SuspendRequested | ThreadState_AbortRequested)) {
                UNLOCK_THREAD (thread);
                return FALSE;
        }
index 9666cb67d9d0cbda59c938c69f4c77e864c375ea..cda335d25a69471d6ef9d5a5114f3cda884f9f27 100644 (file)
@@ -4928,7 +4928,7 @@ mono_w32file_get_drive_type(const gunichar2 *root_path_name)
        return (drive_type);
 }
 
-#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__native_client__) || defined(__FreeBSD_kernel__)
+#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__native_client__) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
 static gchar*
 get_fstypename (gchar *utfpath)
 {
index 4311993bb10554af25b9b1c34e1d548c690d7642..3dfee3c60789255ccebfbcb68ceb3d71e66d2982 100644 (file)
@@ -4,7 +4,8 @@
 
 #ifdef USE_HAIKU_BACKEND
 
-#include <KernelKit.h>
+/* KernelKit.h doesn't include the right headers? */
+#include <os/kernel/image.h>
 
 gchar*
 mono_w32process_get_name (pid_t pid)
index 71226c3109ddba1460f154d79741cc57558ebc5a..72fd6088860040f2855e360ae86f9faa6c2b323d 100644 (file)
@@ -15,6 +15,8 @@
 #define USE_BSD_BACKEND
 #elif defined(__HAIKU__)
 #define USE_HAIKU_BACKEND
+/* Define header for team_info */
+#include <os/kernel/OS.h>
 #else
 #define USE_DEFAULT_BACKEND
 #endif
index c10b210036825595d708b2b77a814abe1b855c84..f0139c318186b75d4755dc7b113c2bc0fa793bdc 100644 (file)
@@ -1134,6 +1134,7 @@ mono_w32socket_close (SOCKET sock)
 gint
 mono_w32socket_set_blocking (SOCKET socket, gboolean blocking)
 {
+#ifdef O_NONBLOCK
        gint ret;
        gpointer handle;
 
@@ -1143,14 +1144,12 @@ mono_w32socket_set_blocking (SOCKET socket, gboolean blocking)
                return SOCKET_ERROR;
        }
 
-#ifdef O_NONBLOCK
        /* This works better than ioctl(...FIONBIO...)
         * on Linux (it causes connect to return
         * EINPROGRESS, but the ioctl doesn't seem to) */
        ret = fcntl (socket, F_GETFL, 0);
        if (ret != -1)
                ret = fcntl (socket, F_SETFL, blocking ? (ret & (~O_NONBLOCK)) : (ret | (O_NONBLOCK)));
-#endif /* O_NONBLOCK */
 
        if (ret == -1) {
                gint errnum = errno;
@@ -1160,6 +1159,10 @@ mono_w32socket_set_blocking (SOCKET socket, gboolean blocking)
        }
 
        return 0;
+#else
+       mono_w32socket_set_last_error (ERROR_NOT_SUPPORTED);
+       return SOCKET_ERROR;
+#endif /* O_NONBLOCK */
 }
 
 gint
index 4d71777f06d350bef9a6f218d92cf3574441c129..1c6f8fd8307a8203a200e041380a1dff4048d4f2 100644 (file)
@@ -136,9 +136,7 @@ SOCKET mono_w32socket_accept (SOCKET s, struct sockaddr *addr, socklen_t *addrle
 {
        MonoInternalThread *curthread = mono_thread_internal_current ();
        SOCKET newsock = INVALID_SOCKET;
-       curthread->interrupt_on_stop = (gpointer)TRUE;
        ALERTABLE_SOCKET_CALL (FD_ACCEPT_BIT, blocking, TRUE, newsock, accept, s, addr, addrlen);
-       curthread->interrupt_on_stop = (gpointer)FALSE;
        return newsock;
 }
 
@@ -154,9 +152,7 @@ int mono_w32socket_recv (SOCKET s, char *buf, int len, int flags, gboolean block
 {
        MonoInternalThread *curthread = mono_thread_internal_current ();
        int ret = SOCKET_ERROR;
-       curthread->interrupt_on_stop = (gpointer)TRUE;
        ALERTABLE_SOCKET_CALL (FD_READ_BIT, blocking, TRUE, ret, recv, s, buf, len, flags);
-       curthread->interrupt_on_stop = (gpointer)FALSE;
        return ret;
 }
 
index 5312790ad644b21b43d518ab238c73ab15ea2458..8bc8b49a8c5b70bb2043829c7bb12797141bf069 100644 (file)
@@ -1270,7 +1270,7 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode,
                }
 
                if (ret == -1 && errno == EINTR) {
-                       if (mono_thread_test_state (thread, (MonoThreadState)(ThreadState_AbortRequested | ThreadState_StopRequested))) {
+                       if (mono_thread_test_state (thread, ThreadState_AbortRequested)) {
                                g_free (pfds);
                                return FALSE;
                        }
@@ -1777,7 +1777,7 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32
                }
 
                if (ret == -1 && errno == EINTR) {
-                       if (mono_thread_test_state (thread, (MonoThreadState)(ThreadState_AbortRequested | ThreadState_StopRequested))) {
+                       if (mono_thread_test_state (thread, ThreadState_AbortRequested)) {
                                g_free (pfds);
                                *sockets = NULL;
                                return;
index f53010594c79435c74b13c06bd545ee30d87ddff..af434f4218a008e40471928ff17ea2d51dbd11c7 100644 (file)
@@ -8,7 +8,7 @@
 /*.dll
 /*.mdb
 /*.lo
-/interpreter/*.lo
+/interp/*.lo
 /*.loT
 /*.la
 /.libs
index 3c7822f0fe018e837da805fe5ae40a27b7158e4c..4592dec23c164804b8b72003e49d64372c4aa311 100755 (executable)
@@ -37,13 +37,22 @@ sgen_static_libs = \
        $(monodir)/mono/utils/libmonoutils.la \
        $(GLIB_LIBS) $(LIBICONV)
 
+if FULL_AOT_TESTS
+# if the tests are going to run with framework assemblies compiled with
+# -d:MOBILE, tell the runtime to remap framework assemblies using the mobile
+# runtime info
+MOBILE_RUNTIME_ARG=--runtime=mobile
+else
+MOBILE_RUNTIME_ARG=
+endif
+
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
 
-MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
+MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE) $(MOBILE_RUNTIME_ARG)
 TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper
-INTERPRETER_RUNTIME = $(MINI_RUNTIME) --interpreter
+INTERP_RUNTIME = $(MINI_RUNTIME) --interpreter
 RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE)
 
 MCS = CSC_SDK_PATH_DISABLED= $(TOOLS_RUNTIME) $(CSC) -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll -r:$(CLASS)/System.Core.dll
@@ -389,15 +398,15 @@ endif
 endif
 
 if ENABLE_INTERPRETER
-interpreter_sources =  \
-       interpreter/hacks.h             \
-       interpreter/interp.h    \
-       interpreter/interp-internals.h  \
-       interpreter/interp.c    \
-       interpreter/mintops.h   \
-       interpreter/mintops.def \
-       interpreter/mintops.c   \
-       interpreter/transform.c
+interp_sources =       \
+       interp/hacks.h          \
+       interp/interp.h \
+       interp/interp-internals.h       \
+       interp/interp.c \
+       interp/mintops.h        \
+       interp/mintops.def      \
+       interp/mintops.c        \
+       interp/transform.c
 endif
 
 if ENABLE_LLVM
@@ -530,14 +539,6 @@ endif
 
 regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
 
-iregtests = \
-       basic.exe \
-       basic-float.exe \
-       basic-long.exe \
-       basic-calls.exe \
-       generics.exe \
-       objects.exe
-
 if X86
 arch_sources = $(x86_sources)
 arch_built=cpu-x86.h
@@ -623,7 +624,7 @@ os_sources = $(darwin_sources) $(posix_sources)
 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
 endif
 
-libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interpreter_sources) $(arch_sources) $(os_sources)
+libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interp_sources) $(arch_sources) $(os_sources)
 libmini_la_CFLAGS = $(mono_CFLAGS)
 
 libmonoboehm_2_0_la_SOURCES =
@@ -747,8 +748,8 @@ rcheck-nunit: mono $(regtests)
 rcheck: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
 
-richeck: mono $(iregtests)
-       $(INTERPRETER_RUNTIME) --regression $(iregtests)
+richeck: mono $(regtests)
+       $(INTERP_RUNTIME) --regression $(regtests)
 
 if ARM
 check-seq-points:
@@ -814,9 +815,9 @@ fullaotcheck: $(mono) $(fullaot_regtests)
        mkdir $(FULLAOT_TMP_DIR)
        $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" GSHAREDVT=$(GSHAREDVT)
        cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll $(FULLAOT_TMP_DIR)/
-       MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" $(FULLAOT_TMP_DIR)/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
+       MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)" $(FULLAOT_TMP_DIR)/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
        ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
-       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper --full-aot $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
+       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) --full-aot $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
 
 # This can run in parallel
 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
@@ -824,7 +825,7 @@ fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
 fullaot-tmp/%.dylib: $(CLASS)/%
        cp $(CLASS)/$* fullaot-tmp/
        mkdir fullaot-tmp/$*-tmp
-       MONO_PATH="fullaot-tmp/$(PLATFORM_PATH_SEPARATOR)$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(if $(GSHAREDVT),-O=gsharedvt) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
+       MONO_PATH="fullaot-tmp/$(PLATFORM_PATH_SEPARATOR)$(CLASS)" $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) $(if $(GSHAREDVT),-O=gsharedvt) --aot=$(AOT_FLAGS),temp-path=fullaot-tmp/$*-tmp fullaot-tmp/$*
        rm -rf fullaot-tmp/$*-tmp
 
 llvmfullaotcheck:
@@ -837,9 +838,9 @@ llvmonlycheck: mono $(llvmonly_regtests)
        mkdir fullaot-tmp
        $(MAKE) fullaot-libs AOT_FLAGS="llvmonly,$(MONO_FULLAOT_ADDITIONAL_ARGS)$(INVARIANT_AOT_OPTIONS)"
        cp $(llvmonly_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
-       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
+       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper  $(MOBILE_RUNTIME_ARG) --aot=llvmonly fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
        ln -s $$PWD/mono fullaot-tmp/
-       for i in $(llvmonly_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --llvmonly fullaot-tmp/$$i --exclude '!BITCODE' || exit 1; done
+       for i in $(llvmonly_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(MOBILE_RUNTIME_ARG) --llvmonly fullaot-tmp/$$i --exclude '!BITCODE' || exit 1; done
 
 gccheck: gc-test.exe
        MONO_GC_PARAMS=stack-mark=precise MONO_GC_DEBUG=clear-at-gc ./mono-sgen gc-test.exe     
index 864d0b247c2bbebacaa2927b5c55ae19929711bd..22dc64f95197ac60691c4a89eac17f793438fc2f 100644 (file)
@@ -5246,11 +5246,11 @@ compute_line_numbers (MonoMethod *method, int code_size, MonoDebugMethodJitInfo
                if (il_offset == -1 || il_offset == prev_il_offset)
                        continue;
                prev_il_offset = il_offset;
-               loc = mono_debug_symfile_lookup_location (minfo, il_offset);
+               loc = mono_debug_method_lookup_location (minfo, il_offset);
                if (!(loc && loc->source_file))
                        continue;
                if (loc->row == prev_line) {
-                       mono_debug_symfile_free_location (loc);
+                       mono_debug_free_source_location (loc);
                        continue;
                }
                prev_line = loc->row;
@@ -5349,7 +5349,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                                options = "";
                        prologue_end = TRUE;
                        fprintf (acfg->fp, ".loc %d %d 0%s\n", findex, loc->row, options);
-                       mono_debug_symfile_free_location (loc);
+                       mono_debug_free_source_location (loc);
                }
 
                skip = FALSE;
@@ -7892,14 +7892,13 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
 static mono_thread_start_return_t WINAPI
 compile_thread_main (gpointer user_data)
 {
-       MonoDomain *domain = ((MonoDomain **)user_data) [0];
-       MonoAotCompile *acfg = ((MonoAotCompile **)user_data) [1];
-       GPtrArray *methods = ((GPtrArray **)user_data) [2];
+       MonoAotCompile *acfg = ((MonoAotCompile **)user_data) [0];
+       GPtrArray *methods = ((GPtrArray **)user_data) [1];
        int i;
 
        MonoError error;
-       MonoThread *thread = mono_thread_attach (domain);
-       mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "AOT compiler"), TRUE, FALSE, &error);
+       MonoInternalThread *internal = mono_thread_internal_current ();
+       mono_thread_set_name_internal (internal, mono_string_new (mono_domain_get (), "AOT compiler"), TRUE, FALSE, &error);
        mono_error_assert_ok (&error);
 
        for (i = 0; i < methods->len; ++i)
@@ -9869,6 +9868,9 @@ compile_methods (MonoAotCompile *acfg)
                        methods [i] = (MonoMethod *)g_ptr_array_index (acfg->methods, i);
                i = 0;
                while (i < methods_len) {
+                       MonoError error;
+                       MonoInternalThread *thread;
+
                        frag = g_ptr_array_new ();
                        for (j = 0; j < len; ++j) {
                                if (i < methods_len) {
@@ -9878,11 +9880,13 @@ compile_methods (MonoAotCompile *acfg)
                        }
 
                        user_data = g_new0 (gpointer, 3);
-                       user_data [0] = mono_domain_get ();
-                       user_data [1] = acfg;
-                       user_data [2] = frag;
+                       user_data [0] = acfg;
+                       user_data [1] = frag;
                        
-                       thread_handle = mono_threads_create_thread (compile_thread_main, (gpointer) user_data, NULL, NULL);
+                       thread = mono_thread_create_internal (mono_domain_get (), compile_thread_main, (gpointer) user_data, MONO_THREAD_CREATE_FLAGS_NONE, &error);
+                       mono_error_assert_ok (&error);
+
+                       thread_handle = mono_threads_open_thread_handle (thread->handle);
                        g_ptr_array_add (threads, thread_handle);
                }
                g_free (methods);
index 9a1fcb9406cd97e0c3887220e7f1df61fdef5600..a5aeb9cc8a9eac5d8e28873b5f53601acff087bd 100644 (file)
@@ -257,6 +257,14 @@ class Tests
                return 0;
        }
 
+       public static int test_0_float_abs () {
+               float f = -1.0f;
+
+               if (Math.Abs (f) != 1.0f)
+                       return 1;
+               return 0;
+       }
+
        public static int test_0_round () {
                if (Math.Round (5.0) != 5.0)
                        return 1;
index 41e241a33a8bf1a14ee1b64f4f07f5773fac4a0e..4dc68f255c0deaa30497fd0b808996d5dad126f2 100644 (file)
@@ -16,7 +16,7 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/threads-types.h>
 
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 
 #include <mono/utils/valgrind.h>
 
@@ -152,7 +152,7 @@ mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit)
                for (i = 0; i < header->code_size; ++i) {
                        MonoDebugSourceLocation *location;
 
-                       location = mono_debug_symfile_lookup_location (minfo, i);
+                       location = mono_debug_method_lookup_location (minfo, i);
                        if (!location)
                                continue;
 
index ed1b7a14a7f3f502ef5708be026901355408022f..e18cb98d643bd015f474be8bec56aa36e03706b6 100644 (file)
@@ -53,8 +53,7 @@
 #endif
 
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/threads-types.h>
@@ -819,7 +818,13 @@ register_socket_transport (void);
 static inline gboolean
 is_debugger_thread (void)
 {
-       return mono_native_thread_id_equals (mono_native_thread_id_get (), debugger_thread_id);
+       MonoInternalThread *internal;
+
+       internal = mono_thread_internal_current ();
+       if (!internal)
+               return FALSE;
+
+       return internal->debugger_thread;
 }
 
 static int
@@ -1635,7 +1640,13 @@ stop_debugger_thread (void)
 static void
 start_debugger_thread (void)
 {
-       debugger_thread_handle = mono_threads_create_thread (debugger_thread, NULL, NULL, NULL);
+       MonoError error;
+       MonoInternalThread *thread;
+
+       thread = mono_thread_create_internal (mono_get_root_domain (), debugger_thread, NULL, MONO_THREAD_CREATE_FLAGS_DEBUGGER, &error);
+       mono_error_assert_ok (&error);
+
+       debugger_thread_handle = mono_threads_open_thread_handle (thread->handle);
        g_assert (debugger_thread_handle);
 }
 
@@ -2683,7 +2694,7 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
        DebuggerTlsData *tls = (DebuggerTlsData *)value;
        MonoNativeThreadId tid = MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid);
 
-       if (mono_native_thread_id_equals (mono_native_thread_id_get (), tid) || tls->terminated)
+       if (mono_thread_internal_is_current (thread) || tls->terminated)
                return;
 
        DEBUG_PRINTF (1, "[%p] Interrupting %p...\n", (gpointer) (gsize) mono_native_thread_id_get (), (gpointer)tid);
@@ -2955,7 +2966,7 @@ count_thread (gpointer key, gpointer value, gpointer user_data)
 {
        DebuggerTlsData *tls = (DebuggerTlsData *)value;
 
-       if (!tls->suspended && !tls->terminated)
+       if (!tls->suspended && !tls->terminated && !mono_thread_internal_is_current (tls->thread))
                *(int*)user_data = *(int*)user_data + 1;
 }
 
@@ -3249,8 +3260,8 @@ emit_appdomain_load (gpointer key, gpointer value, gpointer user_data)
 static void
 emit_thread_start (gpointer key, gpointer value, gpointer user_data)
 {
-       if (!mono_native_thread_id_equals (MONO_UINT_TO_NATIVE_THREAD_ID (GPOINTER_TO_UINT (key)), debugger_thread_id))
-               process_profiler_event (EVENT_KIND_THREAD_START, value);
+       g_assert (!mono_native_thread_id_equals (MONO_UINT_TO_NATIVE_THREAD_ID (GPOINTER_TO_UINT (key)), debugger_thread_id));
+       process_profiler_event (EVENT_KIND_THREAD_START, value);
 }
 
 /*
@@ -3811,7 +3822,7 @@ thread_startup (MonoProfiler *prof, uintptr_t tid)
        MonoInternalThread *old_thread;
        DebuggerTlsData *tls;
 
-       if (mono_native_thread_id_equals (MONO_UINT_TO_NATIVE_THREAD_ID (tid), debugger_thread_id))
+       if (is_debugger_thread ())
                return;
 
        g_assert (mono_native_thread_id_equals (MONO_UINT_TO_NATIVE_THREAD_ID (tid), MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid)));
@@ -3890,8 +3901,7 @@ thread_end (MonoProfiler *prof, uintptr_t tid)
        if (thread) {
                DEBUG_PRINTF (1, "[%p] Thread terminated, obj=%p, tls=%p.\n", (gpointer)tid, thread, tls);
 
-               if (mono_native_thread_id_equals (mono_native_thread_id_get (), MONO_UINT_TO_NATIVE_THREAD_ID (tid))
-                    && !mono_native_tls_get_value (debugger_tls_id)
+               if (mono_thread_internal_is_current (thread) && !mono_native_tls_get_value (debugger_tls_id)
                ) {
                        /*
                         * This can happen on darwin since we deregister threads using pthread dtors.
@@ -10132,12 +10142,12 @@ debugger_thread (void *arg)
 
        debugger_thread_id = mono_native_thread_id_get ();
 
-       MonoThread *thread = mono_thread_attach (mono_get_root_domain ());
-       mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Debugger agent"), TRUE, FALSE, &error);
+       MonoInternalThread *internal = mono_thread_internal_current ();
+       mono_thread_set_name_internal (internal, mono_string_new (mono_domain_get (), "Debugger agent"), TRUE, FALSE, &error);
        mono_error_assert_ok (&error);
 
-       thread->internal_thread->state |= ThreadState_Background;
-       thread->internal_thread->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
+       internal->state |= ThreadState_Background;
+       internal->flags |= MONO_THREAD_FLAG_DONT_MANAGE;
 
        if (agent_config.defer) {
                if (!wait_for_attach ()) {
index aaa34a3bc34fba472c49726be3bd70936bc4426a..af3ff832ecbf01b98cdd7c50f693bdbf9f63590d 100644 (file)
 
 #ifndef DISABLE_JIT
 
-/* FIXME: This conflicts with the definition in mini.c, so it cannot be moved to mini.h */
-MONO_API MonoInst* mono_emit_native_call (MonoCompile *cfg, gconstpointer func, MonoMethodSignature *sig, MonoInst **args);
-void mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native);
-void mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass);
-
 /*
  * Decompose complex long opcodes on 64 bit machines.
  * This is also used on 32 bit machines when using LLVM, so it needs to handle I/U correctly.
index 860e1ca626fd48ee19f6ff11b4f3dd65e8b461d2..9674a350f904aa1434741540ab3db5f58c94ab10 100644 (file)
@@ -56,7 +56,7 @@
 #include "mini.h"
 #include "jit.h"
 #include "aot-compiler.h"
-#include "interpreter/interp.h"
+#include "interp/interp.h"
 
 #include <string.h>
 #include <ctype.h>
index 40960cc4b847a6b3d78780ffab99c33ef8b448dc..773ea4924b3af98d143e59f141dd958cd2b0affd 100644 (file)
@@ -21,8 +21,7 @@
 #endif
 
 #include <mono/metadata/mono-endian.h>
-#include <mono/metadata/debug-mono-symfile.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 
 #ifndef HOST_WIN32
 #include <mono/utils/freebsd-elf32.h>
@@ -1581,11 +1580,11 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
 
                prev_il_offset = il_offset;
 
-               loc = mono_debug_symfile_lookup_location (minfo, il_offset);
+               loc = mono_debug_method_lookup_location (minfo, il_offset);
                if (!loc)
                        continue;
                if (!loc->source_file) {
-                       mono_debug_symfile_free_location (loc);
+                       mono_debug_free_source_location (loc);
                        continue;
                }
 
@@ -1633,7 +1632,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method,
                        prev_native_offset = i;
                }
 
-               mono_debug_symfile_free_location (loc);
+               mono_debug_free_source_location (loc);
                first = FALSE;
        }
 
@@ -1797,7 +1796,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod
 
        minfo = mono_debug_lookup_method (method);
        if (minfo)
-               loc = mono_debug_symfile_lookup_location (minfo, 0);
+               loc = mono_debug_method_lookup_location (minfo, 0);
 
        /* Subprogram */
        names = g_new0 (char *, sig->param_count);
@@ -1818,7 +1817,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod
                emit_uleb128 (w, file_index + 1);
                emit_uleb128 (w, loc->row);
 
-               mono_debug_symfile_free_location (loc);
+               mono_debug_free_source_location (loc);
                loc = NULL;
        } else {
                emit_uleb128 (w, 0);
index 83d6a1c16d5391e673984b8fdf4a3e5514edf5b9..f157e16d69503eed80fbd7ab9859da1e600effa0 100644 (file)
@@ -14,7 +14,7 @@
 #include "image-writer.h"
 #include "mini.h"
 
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 
 #include <glib.h>
 
index 211c2eee77cfb10cba1eca3d5d1a4638c1b5dae2..9bc79372897c88ad250ea57c5c863bc255a07228 100644 (file)
@@ -123,7 +123,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot)
        labels [0] = code;
        arm_cbzx (code, ARMREG_IP0, 0);
        for (i = 0; i < num_fregs; ++i)
-               arm_ldrfpx (code, ARMREG_D8 + i, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, fregs) + (i * 8));
+               arm_ldrfpx (code, ARMREG_D8 + i, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, fregs) + ((i + 8) * 8));
        mono_arm_patch (labels [0], code, MONO_R_ARM64_CBZ);
        /* Load fp */
        arm_ldrx (code, ARMREG_FP, ARMREG_R0, MONO_STRUCT_OFFSET (MonoContext, regs) + (ARMREG_FP * 8));
index 98c6046e61a5cdea5dab273ee1b289d63c26a7b5..4755adbaab1f01f086f98a416846348c5356ca8a 100644 (file)
@@ -2318,6 +2318,7 @@ class Tests
                Console.WriteLine ();
        }
 
+       [Category ("!INTERPRETER")]
        [Category ("!BITCODE")]
        public static int test_0_rethrow_stacktrace () {
                // Check that rethrowing an exception preserves the original stack trace
index 9defe79f3cc9ff701d1c4bd16da6c91db5f49653..929d4718bcd33cc24117560fd066ca0b3f87a10f 100644 (file)
@@ -233,7 +233,42 @@ class Tests
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
+       interface NonGenericInterface {
+               int return_field ();
+       }
+
+       interface GenericInterface<T> : NonGenericInterface {
+               T not_used ();
+       }
+
+       struct ImplementGenericInterface<T> : GenericInterface<T> {
+               public Object padding1;
+               public Object padding2;
+               public Object padding3;
+               public T[] arr_t;
+
+               public ImplementGenericInterface (T[] arr_t) {
+                       this.padding1 = null;
+                       this.padding2 = null;
+                       this.padding3 = null;
+                       this.arr_t = arr_t;
+               }
+
+               public T not_used () {
+                       return arr_t [0];
+               }
+
+               public int return_field () {
+                       return arr_t.Length;
+               }
+       }
+
+       public static int test_8_struct_implements_generic_interface () {
+               int[] arr = {1, 2, 3, 4};
+               NonGenericInterface s = new ImplementGenericInterface<int> (arr);
+               return s.return_field () + s.return_field ();
+       }
+
        public static int test_0_generic_get_value_optimization_vtype () {
                TestStruct[] arr = new TestStruct[] { new TestStruct (100, 200), new TestStruct (300, 400) };
                IEnumerator<TestStruct> enumerator = GenericClass<TestStruct>.Y (arr);
@@ -427,7 +462,6 @@ class Tests
        }
 #endif
 
-       [Category ("!INTERPRETER")]
        public static int test_0_ldvirtftn_generic_method () {
                new GenericsTests ().ldvirtftn<string> ();
 
@@ -454,7 +488,6 @@ class Tests
        // This cannot be made to work with full-aot, since there it is impossible to
        // statically determine that Foo<string>.Bar <int> is needed, the code only
        // references IFoo.Bar<int>
-       [Category ("!INTERPRETER")]
        [Category ("!FULLAOT")]
        public static int test_0_generic_virtual_on_interfaces () {
                Foo<string>.count1 = 0;
@@ -480,7 +513,6 @@ class Tests
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_generic_virtual_on_interfaces_ref () {
                Foo<string>.count1 = 0;
                Foo<string>.count2 = 0;
@@ -520,7 +552,6 @@ class Tests
                Value_2 = 2
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_regress_550964_constrained_enum_long () {
         MyEnumUlong a = MyEnumUlong.Value_2;
         MyEnumUlong b = MyEnumUlong.Value_2;
@@ -539,7 +570,6 @@ class Tests
                }
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_fullaot_linq () {
                var allWords = new XElement [] { new XElement { Value = "one" } };
                var filteredWords = allWords.Where(kw => kw.Value.StartsWith("T"));
@@ -562,7 +592,6 @@ class Tests
                int c = ((ICollection<T>)arr).Count;
        }
 
-       [Category ("!INTERPRETER")]
        /* Test that treating arrays as generic collections works with full-aot */
        public static int test_0_fullaot_array_wrappers () {
                GenericsTests[] arr = new GenericsTests [10];
@@ -622,7 +651,6 @@ class Tests
                return typeof (T);
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_gshared_delegate_rgctx () {
                Func<Type> t = new Func<Type> (get_type<string>);
 
@@ -632,7 +660,6 @@ class Tests
                        return 1;
        }
 
-       [Category ("!INTERPRETER")]
        // Creating a delegate from a generic method from gshared code
        public static int test_0_gshared_delegate_from_gshared () {
                if (gshared_delegate_from_gshared <object> () != 0)
@@ -664,7 +691,6 @@ class Tests
                public delegate TRet Transform<TRet> (TKey key, TValue value);
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_bug_620864 () {
                var d = new Pair<string, Type>.Transform<KeyValuePair<string, Type>> (Pair<string, Type>.make_pair);
 
@@ -721,7 +747,6 @@ class Tests
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
        [Category ("GSHAREDVT")]
        public static int test_6_partial_sharing_linq () {
                var messages = new List<Message> ();
@@ -732,7 +757,6 @@ class Tests
                return messages.Max(i => i.MessageID);
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_partial_shared_method_in_nonshared_class () {
                var c = new Class1<double> ();
                return (c.Foo<string> (5).GetType () == typeof (Class1<string>)) ? 0 : 1;
@@ -909,7 +933,6 @@ class Tests
                }
        }
 
-       [Category ("!INTERPRETER")]
        [Category ("!FULLAOT")]
        [Category ("!BITCODE")]
        public static int test_0_regress_668095_synchronized_gshared () {
@@ -928,7 +951,6 @@ class Tests
                }
        }
 
-       [Category ("!INTERPRETER")]
        [Category ("GSHAREDVT")]
        static int test_0_synchronized_gshared () {
                var c = new SyncClass<string> ();
@@ -965,7 +987,6 @@ class Tests
        }
 
        // #2155
-       [Category ("!INTERPRETER")]
        [Category ("GSHAREDVT")]
        public static int test_0_fullaot_sflda_cctor () {
                List<Doc> documents = new List<Doc>();
@@ -991,7 +1012,6 @@ class Tests
     static List<A> sources = new List<A>();
 
        // #6112
-       [Category ("!INTERPRETER")]
     public static int test_0_fullaot_imt () {
         sources.Add(null);
         sources.Add(null);
@@ -1013,7 +1033,6 @@ class Tests
        class BClass : AClass {
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_fullaot_variant_iface () {
                var arr = new BClass [10];
                var enumerable = (IEnumerable<AClass>)arr;
@@ -1045,7 +1064,6 @@ class Tests
                }
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_1_regress_constrained_iface_call_7571 () {
         var r = new Record [10];
         Foo2<Record>.Extract (r);
@@ -1056,7 +1074,6 @@ class Tests
                Val = 1
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_regress_constrained_iface_call_enum () {
                var r = new ConstrainedEnum [10];
                return Foo3<ConstrainedEnum>.CompareTo (r);
@@ -1116,7 +1133,6 @@ class Tests
        }
 #endif
 
-       [Category ("!INTERPRETER")]
        public static int test_0_delegate_callvirt_fullaot () {
                Func<string> f = delegate () { return "A"; };
         var f2 = (Func<Func<string>, string>)Delegate.CreateDelegate (typeof
@@ -1199,7 +1215,6 @@ class Tests
                return t.GetHashCode ();
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_constrained_partial_sharing () {
                string s;
 
@@ -1256,7 +1271,6 @@ class Tests
 
        static object delegate_8_args_res;
 
-       [Category ("!INTERPRETER")]
        public static int test_0_delegate_8_args () {
                delegate_8_args_res = null;
                Action<string, string, string, string, string, string, string,
index e4323480388d18ed54d50e046ddc014aedb50217..29943694c72fa7ccbf6bbc98256a040792325fd8 100644 (file)
@@ -1677,6 +1677,8 @@ public class Tests
                                   uint i1, uint i2, uint i3, uint i4);
                int Structs (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
                                         BStruct s);
+               void Generic<T2> (T t, T2[] arr, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+                                                 T2 i1, T2 i2, T2 i3, T2 i4);
        }
 
        class Foo3<T> : IFoo3<T> {
@@ -1708,6 +1710,13 @@ public class Tests
                                                        BStruct s) {
                        return s.a + s.b + s.c + s.d;
                }
+
+               public void Generic<T2> (T t, T2[] arr, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, T2 i1, T2 i2, T2 i3, T2 i4) {
+                       arr [0] = i1;
+                       arr [1] = i2;
+                       arr [2] = i3;
+                       arr [3] = i4;
+               }
        }
 
        // Passing small normal arguments on the stack
@@ -1731,6 +1740,10 @@ public class Tests
                int res6 = o.UInts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
                if (res6 != 10)
                        return 6;
+               int[] arr = new int [4];
+               o.Generic<int> (new EmptyStruct (), arr, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
+               if (arr [0] != 1 || arr [1] != 2 || arr [2] != 3 || arr [3] != 4)
+                       return 7;
                return 0;
        }
 
index 203584e14338da1edef3dae599052cdafc11454b..d1b03b3931b21e42e60353b4c0dbab3051983496 100644 (file)
@@ -1247,6 +1247,7 @@ COND:   ldloc.0
        }
 
        .method public static int32 test_1_filters () {
+               .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
                .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 08 21 42 49 54 43 4F 44 45 00 00 )          // ...!BITCODE..
                .maxstack 16
                .locals init (
@@ -2599,6 +2600,7 @@ END:
 
        .method public static default int32 test_0_wrap_non_exception_throws () cil managed
        {
+         .custom instance void [TestDriver]CategoryAttribute::.ctor(string) = ( 01 00 0C 21 49 4E 54 45 52 50 52 45 54 45 52 00 00 )   // ...!INTERPRETER.
          .try {
                    newobj instance void class [mscorlib]System.Object::'.ctor'()
                        throw
diff --git a/mono/mini/interp/hacks.h b/mono/mini/interp/hacks.h
new file mode 100644 (file)
index 0000000..9697ccb
--- /dev/null
@@ -0,0 +1,153 @@
+/* we need some special math function */
+#ifndef _ISOC99_SOURCE
+#define _ISOC99_SOURCE
+#endif
+#include <math.h>
+
+/* which are not defined on FreeBSD */
+#ifdef __GNUC__
+
+#ifndef isunordered
+#   define isunordered(u, v)                              \
+    (__extension__                                        \
+     ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \
+        isnan(__u) || isnan(__v); }))
+#endif
+
+#ifndef islessgreater
+#   define islessgreater(x, u)                                    \
+    (__extension__                                                \
+     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);         \
+        !isunordered (__x, __y) && (__x < __y) || (__y < __x); }))
+#endif
+
+#ifndef islessequal
+#   define islessequal(x, y)                              \
+    (__extension__                                        \
+     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+        !isunordered(__x, __y) && __x <= __y; })) 
+#endif
+
+#ifndef isless
+#   define isless(x, y)                                   \
+    (__extension__                                        \
+     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+        !isunordered(__x, __y) && __x < __y; })) 
+#endif
+
+#ifndef isgreater
+#   define isgreater(x, y)                                \
+    (__extension__                                        \
+     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+        !isunordered(__x, __y) && __x > __y; }))
+#endif
+
+#else
+
+/*  isunordered seems to crash on HPUX when built 64 bits
+    so use generic implementation.
+*/
+#if defined(__hpux) && SIZEOF_VOID_P == 8
+#undef isunordered
+#undef islessgreater
+#undef islessequal
+#undef isless
+#undef isgreater
+#endif
+
+#ifndef isunordered
+#   define isunordered(u, v) (isnan(u) || isnan(v))
+#endif
+
+#ifndef islessgreater
+#   define islessgreater(x, u) (!isunordered (x, y) && (x < y) || (y < x))
+#endif
+
+#ifndef islessequal
+#   define islessequal(x, y) (!isunordered(x, y) && x <= y)
+#endif
+
+#ifndef isless
+#   define isless(x, y) (!isunordered(x, y) && x < y) 
+#endif
+
+#ifndef isgreater
+#   define isgreater(x, y) (!isunordered(x, y) && x > y)
+#endif
+
+#endif
+
+/*
+ * Attempt at using the goto label construct of GNU GCC:
+ * it turns out this does give some benefit: 5-15% speedup.
+ * Don't look at these macros, it hurts...
+ */
+#define GOTO_LABEL
+#undef GOTO_LABEL
+#ifdef GOTO_LABEL
+
+#define SWITCH(a) goto *goto_map [(a)];
+#define BREAK SWITCH(*ip)
+#define CASE(l)        l ## _LABEL:
+#define DEFAULT        \
+       CEE_ILLEGAL_LABEL:      \
+       CEE_ENDMAC_LABEL:
+#define SUB_SWITCH \
+       CEE_PREFIX1_LABEL: \
+       CEE_ARGLIST_LABEL: \
+       CEE_CEQ_LABEL: \
+       CEE_CGT_LABEL: \
+       CEE_CGT_UN_LABEL: \
+       CEE_CLT_LABEL: \
+       CEE_CLT_UN_LABEL: \
+       CEE_LDFTN_LABEL: \
+       CEE_LDVIRTFTN_LABEL: \
+       CEE_UNUSED56_LABEL: \
+       CEE_LDARG_LABEL: \
+       CEE_LDARGA_LABEL: \
+       CEE_STARG_LABEL: \
+       CEE_LDLOC_LABEL: \
+       CEE_LDLOCA_LABEL: \
+       CEE_STLOC_LABEL: \
+       CEE_LOCALLOC_LABEL: \
+       CEE_UNUSED57_LABEL: \
+       CEE_ENDFILTER_LABEL: \
+       CEE_UNALIGNED__LABEL: \
+       CEE_VOLATILE__LABEL: \
+       CEE_TAIL__LABEL: \
+       CEE_INITOBJ_LABEL: \
+       CEE_UNUSED68_LABEL: \
+       CEE_CPBLK_LABEL: \
+       CEE_INITBLK_LABEL: \
+       CEE_UNUSED69_LABEL: \
+       CEE_RETHROW_LABEL: \
+       CEE_UNUSED_LABEL: \
+       CEE_SIZEOF_LABEL: \
+       CEE_REFANYTYPE_LABEL: \
+       CEE_UNUSED52_LABEL: \
+       CEE_UNUSED53_LABEL: \
+       CEE_UNUSED54_LABEL: \
+       CEE_UNUSED55_LABEL: \
+       CEE_UNUSED70_LABEL:
+#define GOTO_LABEL_VARS \
+       const static void * const goto_map [] = {\
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \   \
+       && a ## _LABEL, \
+#include "mono/cil/opcode.def" \
+#undef OPDEF   \
+       &&DUMMY_LABEL   \
+       };      \
+       DUMMY_LABEL:
+
+#else
+       
+#define SWITCH(a) switch(a)
+#define BREAK  break
+#define CASE(l)        case l:
+#define DEFAULT        \
+               default:        \
+                       g_error ("Unimplemented opcode: %x at 0x%x\n", *ip, ip-header->code);
+#define SUB_SWITCH case 0xFE:
+#define GOTO_LABEL_VARS
+
+#endif
diff --git a/mono/mini/interp/interp-internals.h b/mono/mini/interp/interp-internals.h
new file mode 100644 (file)
index 0000000..f26e4ff
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef __MONO_MINI_INTERPRETER_INTERNALS_H__
+#define __MONO_MINI_INTERPRETER_INTERNALS_H__
+
+#include <setjmp.h>
+#include <glib.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/domain-internals.h>
+#include <mono/metadata/class-internals.h>
+#include "config.h"
+
+enum {
+       VAL_I32     = 0,
+       VAL_DOUBLE  = 1,
+       VAL_I64     = 2,
+       VAL_VALUET  = 3,
+       VAL_POINTER = 4,
+       VAL_NATI    = 0 + VAL_POINTER,
+       VAL_MP      = 1 + VAL_POINTER,
+       VAL_TP      = 2 + VAL_POINTER,
+       VAL_OBJ     = 3 + VAL_POINTER
+};
+
+#if SIZEOF_VOID_P == 4
+typedef guint32 mono_u;
+typedef gint32  mono_i;
+#elif SIZEOF_VOID_P == 8
+typedef guint64 mono_u;
+typedef gint64  mono_i;
+#endif
+
+/*
+ * Value types are represented on the eval stack as pointers to the
+ * actual storage. The size field tells how much storage is allocated.
+ * A value type can't be larger than 16 MB.
+ */
+typedef struct {
+       union {
+               gint32 i;
+               gint64 l;
+               double f;
+               /* native size integer and pointer types */
+               gpointer p;
+               mono_u nati;
+               gpointer vt;
+       } data;
+#if defined(__ppc__) || defined(__powerpc__)
+       int pad;
+#endif
+} stackval;
+
+typedef struct _MonoInvocation MonoInvocation;
+
+typedef void (*MonoFuncV) (void);
+typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
+
+/* 
+ * Structure representing a method transformed for the interpreter 
+ * This is domain specific
+ */
+typedef struct _RuntimeMethod
+{
+       /* NOTE: These first two elements (method and
+          next_jit_code_hash) must be in the same order and at the
+          same offset as in MonoJitInfo, because of the jit_code_hash
+          internal hash table in MonoDomain. */
+       MonoMethod *method;
+       struct _RuntimeMethod *next_jit_code_hash;
+       guint32 locals_size;
+       guint32 args_size;
+       guint32 stack_size;
+       guint32 vt_stack_size;
+       guint32 alloca_size;
+       unsigned short *code;
+       unsigned short *new_body_start; /* after all STINARG instrs */
+       MonoPIFunc func;
+       int num_clauses;
+       MonoExceptionClause *clauses;
+       void **data_items;
+       int transformed;
+       guint32 *arg_offsets;
+       guint32 *local_offsets;
+       unsigned int param_count;
+       unsigned int hasthis;
+} RuntimeMethod;
+
+struct _MonoInvocation {
+       MonoInvocation *parent; /* parent */
+       RuntimeMethod  *runtime_method; /* parent */
+       MonoMethod     *method; /* parent */
+       stackval       *retval; /* parent */
+       char           *args;
+       stackval       *stack_args; /* parent */
+       stackval       *stack;
+       stackval       *sp; /* For GC stack marking */
+       /* exception info */
+       unsigned char  invoke_trap;
+       const unsigned short  *ip;
+       MonoException     *ex;
+       MonoExceptionClause *ex_handler;
+};
+
+typedef struct {
+       MonoDomain *domain;
+       MonoInvocation *base_frame;
+       MonoInvocation *current_frame;
+       MonoInvocation *env_frame;
+       jmp_buf *current_env;
+       unsigned char search_for_handler;
+       unsigned char managed_code;
+} ThreadContext;
+
+extern int mono_interp_traceopt;
+
+MonoException *
+mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
+
+void
+mono_interp_transform_init (void);
+
+RuntimeMethod *
+mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error);
+
+#endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */
diff --git a/mono/mini/interp/interp.c b/mono/mini/interp/interp.c
new file mode 100644 (file)
index 0000000..395850a
--- /dev/null
@@ -0,0 +1,4559 @@
+/*
+ * PLEASE NOTE: This is a research prototype.
+ *
+ *
+ * interp.c: Interpreter for CIL byte codes
+ *
+ * Authors:
+ *   Paolo Molaro (lupus@ximian.com)
+ *   Miguel de Icaza (miguel@ximian.com)
+ *   Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001, 2002 Ximian, Inc.
+ */
+#ifndef __USE_ISOC99
+#define __USE_ISOC99
+#endif
+#include "config.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <math.h>
+#include <locale.h>
+
+#include <mono/utils/gc_wrapper.h>
+
+#ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#else
+#   ifdef __CYGWIN__
+#      define alloca __builtin_alloca
+#   endif
+#endif
+
+/* trim excessive headers */
+#include <mono/metadata/image.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/threadpool.h>
+#include <mono/metadata/profiler-private.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/reflection.h>
+#include <mono/metadata/reflection-internals.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/verify.h>
+#include <mono/metadata/opcodes.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/marshal.h>
+#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-debug.h>
+
+#include "interp.h"
+#include "interp-internals.h"
+#include "mintops.h"
+#include "hacks.h"
+
+#include <mono/mini/mini.h>
+#include <mono/mini/jit-icalls.h>
+
+
+/* Mingw 2.1 doesnt need this any more, but leave it in for now for older versions */
+#ifdef _WIN32
+#define isnan _isnan
+#define finite _finite
+#endif
+#ifndef HAVE_FINITE
+#ifdef HAVE_ISFINITE
+#define finite isfinite
+#endif
+#endif
+
+#define INIT_FRAME(frame,parent_frame,method_args,method_retval,domain,mono_method,error)      \
+       do {    \
+               (frame)->parent = (parent_frame);       \
+               (frame)->stack_args = (method_args);    \
+               (frame)->retval = (method_retval);      \
+               (frame)->runtime_method = mono_interp_get_runtime_method ((domain), (mono_method), (error));    \
+               (frame)->ex = NULL;     \
+               (frame)->ip = NULL;     \
+               (frame)->invoke_trap = 0;       \
+       } while (0)
+
+void ves_exec_method (MonoInvocation *frame);
+
+static char* dump_stack (stackval *stack, stackval *sp);
+static char* dump_frame (MonoInvocation *inv);
+static MonoArray *get_trace_ips (MonoDomain *domain, MonoInvocation *top);
+static void ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context);
+
+typedef void (*ICallMethod) (MonoInvocation *frame);
+
+static guint32 die_on_exception = 0;
+static MonoNativeTlsKey thread_context_id;
+
+static char* dump_args (MonoInvocation *inv);
+
+#define DEBUG_INTERP 0
+#define COUNT_OPS 0
+#if DEBUG_INTERP
+int mono_interp_traceopt = 2;
+/* If true, then we output the opcodes as we interpret them */
+static int global_tracing = 2;
+
+static int debug_indent_level = 0;
+
+static int break_on_method = 0;
+static int nested_trace = 0;
+static GList *db_methods = NULL;
+
+static void
+output_indent (void)
+{
+       int h;
+
+       for (h = 0; h < debug_indent_level; h++)
+               g_print ("  ");
+}
+
+static void
+db_match_method (gpointer data, gpointer user_data)
+{
+       MonoMethod *m = (MonoMethod*)user_data;
+       MonoMethodDesc *desc = data;
+
+       if (mono_method_desc_full_match (desc, m))
+               break_on_method = 1;
+}
+
+static void debug_enter (MonoInvocation *frame, int *tracing)
+{
+       if (db_methods) {
+               g_list_foreach (db_methods, db_match_method, (gpointer)frame->runtime_method->method);
+               if (break_on_method)
+                       *tracing = nested_trace ? (global_tracing = 2, 3) : 2;
+               break_on_method = 0;
+       }
+       if (*tracing) {
+               MonoMethod *method = frame->runtime_method->method;
+               char *mn, *args = dump_args (frame);
+               debug_indent_level++;
+               output_indent ();
+               mn = mono_method_full_name (method, FALSE);
+               g_print ("(%p) Entering %s (", mono_thread_internal_current (), mn);
+               g_free (mn);
+               g_print  ("%s)\n", args);
+               g_free (args);
+       }
+       if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE)
+               mono_profiler_method_enter (frame->runtime_method->method);
+}
+
+
+#define DEBUG_LEAVE()  \
+       if (tracing) {  \
+               char *mn, *args;        \
+               args = dump_retval (frame);     \
+               output_indent ();       \
+               mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+               g_print  ("(%p) Leaving %s", mono_thread_internal_current (),  mn);     \
+               g_free (mn); \
+               g_print  (" => %s\n", args);    \
+               g_free (args);  \
+               debug_indent_level--;   \
+               if (tracing == 3) global_tracing = 0; \
+       }       \
+       if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE)    \
+               mono_profiler_method_leave (frame->runtime_method->method);
+
+#else
+
+int mono_interp_traceopt = 0;
+static void debug_enter (MonoInvocation *frame, int *tracing)
+{
+}
+#define DEBUG_LEAVE()
+
+#endif
+
+static void
+interp_ex_handler (MonoException *ex) {
+       MonoError error;
+       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
+       char *stack_trace;
+       if (context == NULL)
+               return;
+       stack_trace = dump_frame (context->current_frame);
+       ex->stack_trace = mono_string_new (mono_domain_get(), stack_trace);
+       g_free (stack_trace);
+       if (context->current_env == NULL || strcmp(ex->object.vtable->klass->name, "ExecutionEngineException") == 0) {
+               char *strace = mono_string_to_utf8_checked (ex->stack_trace, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               fprintf(stderr, "Nothing can catch this exception: ");
+               fprintf(stderr, "%s", ex->object.vtable->klass->name);
+               if (ex->message != NULL) {
+                       char *m = mono_string_to_utf8_checked (ex->message, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       fprintf(stderr, ": %s", m);
+                       g_free(m);
+               }
+               fprintf(stderr, "\n%s\n", strace);
+               g_free (strace);
+               if (ex->inner_ex != NULL) {
+                       ex = (MonoException *)ex->inner_ex;
+                       fprintf(stderr, "Inner exception: %s", ex->object.vtable->klass->name);
+                       if (ex->message != NULL) {
+                               char *m = mono_string_to_utf8_checked (ex->message, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               fprintf(stderr, ": %s", m);
+                               g_free(m);
+                       }
+                       strace = mono_string_to_utf8_checked (ex->stack_trace, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       fprintf(stderr, "\n");
+                       fprintf(stderr, "%s\n", strace);
+                       g_free (strace);
+               }
+               /* wait for other threads to also collapse */
+               // Sleep(1000); // TODO: proper sleep
+               exit(1);
+       }
+       context->env_frame->ex = ex;
+       context->search_for_handler = 1;
+       longjmp (*context->current_env, 1);
+}
+
+static void
+ves_real_abort (int line, MonoMethod *mh,
+               const unsigned short *ip, stackval *stack, stackval *sp)
+{
+       MonoError error;
+       fprintf (stderr, "Execution aborted in method: %s::%s\n", mh->klass->name, mh->name);
+       fprintf (stderr, "Line=%d IP=0x%04lx, Aborted execution\n", line,
+                ip-(const unsigned short *)mono_method_get_header_checked (mh, &error)->code);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       g_print ("0x%04x %02x\n",
+                ip-(const unsigned short *)mono_method_get_header_checked (mh, &error)->code, *ip);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       if (sp > stack)
+               printf ("\t[%ld] 0x%08x %0.5f\n", sp-stack, sp[-1].data.i, sp[-1].data.f);
+}
+
+#define ves_abort() \
+       do {\
+               ves_real_abort(__LINE__, frame->runtime_method->method, ip, frame->stack, sp); \
+               THROW_EX (mono_get_exception_execution_engine (NULL), ip); \
+       } while (0);
+
+static mono_mutex_t runtime_method_lookup_section;
+
+RuntimeMethod*
+mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error)
+{
+       RuntimeMethod *rtm;
+       error_init (error);
+
+       mono_os_mutex_lock (&runtime_method_lookup_section);
+       if ((rtm = mono_internal_hash_table_lookup (&domain->jit_code_hash, method))) {
+               mono_os_mutex_unlock (&runtime_method_lookup_section);
+               return rtm;
+       }
+       rtm = mono_mempool_alloc (domain->mp, sizeof (RuntimeMethod));
+       memset (rtm, 0, sizeof (*rtm));
+       rtm->method = method;
+       rtm->param_count = mono_method_signature (method)->param_count;
+       rtm->hasthis = mono_method_signature (method)->hasthis;
+       mono_internal_hash_table_insert (&domain->jit_code_hash, method, rtm);
+       mono_os_mutex_unlock (&runtime_method_lookup_section);
+
+       return rtm;
+}
+
+gpointer
+mono_interp_create_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *error)
+{
+       if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+               method = mono_marshal_get_synchronized_wrapper (method);
+       return mono_interp_get_runtime_method (domain, method, error);
+}
+
+static inline RuntimeMethod*
+get_virtual_method (MonoDomain *domain, RuntimeMethod *runtime_method, MonoObject *obj)
+{
+       MonoMethod *m = runtime_method->method;
+       MonoError error;
+
+       if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
+               RuntimeMethod *ret = NULL;
+               if (mono_object_is_transparent_proxy (obj)) {
+                       ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               } else if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
+                       ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               } else {
+                       ret = runtime_method;
+               }
+               return ret;
+       }
+
+       mono_class_setup_vtable (obj->vtable->klass);
+
+       int slot = mono_method_get_vtable_slot (m);
+       if (mono_class_is_interface (m->klass)) {
+               g_assert (obj->vtable->klass != m->klass);
+               /* TODO: interface offset lookup is slow, go through IMT instead */
+               gboolean non_exact_match;
+               slot += mono_class_interface_offset_with_variance (obj->vtable->klass, m->klass, &non_exact_match);
+       }
+
+       MonoMethod *virtual_method = obj->vtable->klass->vtable [slot];
+       if (m->is_inflated && mono_method_get_context (m)->method_inst) {
+               MonoGenericContext context = { NULL, NULL };
+
+               if (mono_class_is_ginst (virtual_method->klass))
+                       context.class_inst = mono_class_get_generic_class (virtual_method->klass)->context.class_inst;
+               else if (mono_class_is_gtd (virtual_method->klass))
+                       context.class_inst = mono_class_get_generic_container (virtual_method->klass)->context.class_inst;
+               context.method_inst = mono_method_get_context (m)->method_inst;
+
+               virtual_method = mono_class_inflate_generic_method_checked (virtual_method, &context, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       }
+       RuntimeMethod *virtual_runtime_method = mono_interp_get_runtime_method (domain, virtual_method, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       return virtual_runtime_method;
+}
+
+static void inline
+stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke)
+{
+       if (type->byref) {
+               switch (type->type) {
+               case MONO_TYPE_OBJECT:
+               case MONO_TYPE_CLASS:
+               case MONO_TYPE_STRING:
+               case MONO_TYPE_ARRAY:
+               case MONO_TYPE_SZARRAY:
+                       break;
+               default:
+                       break;
+               }
+               result->data.p = *(gpointer*)data;
+               return;
+       }
+       switch (type->type) {
+       case MONO_TYPE_VOID:
+               return;
+       case MONO_TYPE_I1:
+               result->data.i = *(gint8*)data;
+               return;
+       case MONO_TYPE_U1:
+       case MONO_TYPE_BOOLEAN:
+               result->data.i = *(guint8*)data;
+               return;
+       case MONO_TYPE_I2:
+               result->data.i = *(gint16*)data;
+               return;
+       case MONO_TYPE_U2:
+       case MONO_TYPE_CHAR:
+               result->data.i = *(guint16*)data;
+               return;
+       case MONO_TYPE_I4:
+               result->data.i = *(gint32*)data;
+               return;
+       case MONO_TYPE_U:
+       case MONO_TYPE_I:
+               result->data.nati = *(mono_i*)data;
+               return;
+       case MONO_TYPE_PTR:
+               result->data.p = *(gpointer*)data;
+               return;
+       case MONO_TYPE_U4:
+               result->data.i = *(guint32*)data;
+               return;
+       case MONO_TYPE_R4:
+               result->data.f = *(float*)data;
+               return;
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+               result->data.l = *(gint64*)data;
+               return;
+       case MONO_TYPE_R8:
+               result->data.f = *(double*)data;
+               return;
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_ARRAY:
+               result->data.p = *(gpointer*)data;
+               return;
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype) {
+                       stackval_from_data (mono_class_enum_basetype (type->data.klass), result, data, pinvoke);
+                       return;
+               } else
+                       mono_value_copy (result->data.vt, data, type->data.klass);
+               return;
+       case MONO_TYPE_GENERICINST:
+               stackval_from_data (&type->data.generic_class->container_class->byval_arg, result, data, pinvoke);
+               return;
+       default:
+               g_warning ("got type 0x%02x", type->type);
+               g_assert_not_reached ();
+       }
+}
+
+static void inline
+stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke)
+{
+       if (type->byref) {
+               gpointer *p = (gpointer*)data;
+               *p = val->data.p;
+               return;
+       }
+       /* printf ("TODAT0 %p\n", data); */
+       switch (type->type) {
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1: {
+               guint8 *p = (guint8*)data;
+               *p = val->data.i;
+               return;
+       }
+       case MONO_TYPE_BOOLEAN: {
+               guint8 *p = (guint8*)data;
+               *p = (val->data.i != 0);
+               return;
+       }
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_CHAR: {
+               guint16 *p = (guint16*)data;
+               *p = val->data.i;
+               return;
+       }
+       case MONO_TYPE_I: {
+               mono_i *p = (mono_i*)data;
+               /* In theory the value used by stloc should match the local var type
+                  but in practice it sometimes doesn't (a int32 gets dup'd and stloc'd into
+                  a native int - both by csc and mcs). Not sure what to do about sign extension
+                  as it is outside the spec... doing the obvious */
+               *p = (mono_i)val->data.nati;
+               return;
+       }
+       case MONO_TYPE_U: {
+               mono_u *p = (mono_u*)data;
+               /* see above. */
+               *p = (mono_u)val->data.nati;
+               return;
+       }
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4: {
+               gint32 *p = (gint32*)data;
+               *p = val->data.i;
+               return;
+       }
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8: {
+               gint64 *p = (gint64*)data;
+               *p = val->data.l;
+               return;
+       }
+       case MONO_TYPE_R4: {
+               float *p = (float*)data;
+               *p = val->data.f;
+               return;
+       }
+       case MONO_TYPE_R8: {
+               double *p = (double*)data;
+               *p = val->data.f;
+               return;
+       }
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_PTR: {
+               gpointer *p = (gpointer*)data;
+               *p = val->data.p;
+               return;
+       }
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype) {
+                       stackval_to_data (mono_class_enum_basetype (type->data.klass), val, data, pinvoke);
+                       return;
+               } else
+                       mono_value_copy (data, val->data.vt, type->data.klass);
+               return;
+       case MONO_TYPE_GENERICINST:
+               stackval_to_data (&type->data.generic_class->container_class->byval_arg, val, data, pinvoke);
+               return;
+       default:
+               g_warning ("got type %x", type->type);
+               g_assert_not_reached ();
+       }
+}
+
+static void
+fill_in_trace (MonoException *exception, MonoInvocation *frame)
+{
+       char *stack_trace = dump_frame (frame);
+       MonoDomain *domain = mono_domain_get();
+       (exception)->stack_trace = mono_string_new (domain, stack_trace);
+       (exception)->trace_ips = get_trace_ips (domain, frame);
+       g_free (stack_trace);
+}
+
+#define FILL_IN_TRACE(exception, frame) fill_in_trace(exception, frame)
+
+#define THROW_EX(exception,ex_ip)      \
+       do {\
+               frame->ip = (ex_ip);            \
+               frame->ex = (MonoException*)(exception);        \
+               FILL_IN_TRACE(frame->ex, frame); \
+               goto handle_exception;  \
+       } while (0)
+
+static MonoObject*
+ves_array_create (MonoInvocation *frame, MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
+{
+       uintptr_t *lengths;
+       intptr_t *lower_bounds;
+       MonoObject *obj;
+       MonoError error;
+       int i;
+
+       lengths = alloca (sizeof (uintptr_t) * klass->rank * 2);
+       for (i = 0; i < sig->param_count; ++i) {
+               lengths [i] = values->data.i;
+               values ++;
+       }
+       if (klass->rank == sig->param_count) {
+               /* Only lengths provided. */
+               lower_bounds = NULL;
+       } else {
+               /* lower bounds are first. */
+               lower_bounds = (intptr_t *) lengths;
+               lengths += klass->rank;
+       }
+       obj = (MonoObject*) mono_array_new_full_checked (domain, klass, lengths, lower_bounds, &error);
+       if (!mono_error_ok (&error)) {
+               frame->ex = mono_error_convert_to_exception (&error);
+               FILL_IN_TRACE (frame->ex, frame);
+       }
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       return obj;
+}
+
+static gint32
+ves_array_calculate_index (MonoArray *ao, stackval *sp, MonoInvocation *frame)
+{
+       g_assert (!frame->ex);
+       MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
+
+       guint32 pos = 0;
+       if (ao->bounds) {
+               for (gint32 i = 0; i < ac->rank; i++) {
+                       guint32 idx = sp [i].data.i;
+                       guint32 lower = ao->bounds [i].lower_bound;
+                       guint32 len = ao->bounds [i].length;
+                       if (idx < lower || (idx - lower) >= len) {
+                               frame->ex = mono_get_exception_index_out_of_range ();
+                               FILL_IN_TRACE (frame->ex, frame);
+                               return -1;
+                       }
+                       pos = (pos * len) + idx - lower;
+               }
+       } else {
+               pos = sp [0].data.i;
+               if (pos >= ao->max_length) {
+                       frame->ex = mono_get_exception_index_out_of_range ();
+                       FILL_IN_TRACE (frame->ex, frame);
+                       return -1;
+               }
+       }
+       return pos;
+}
+
+static void
+ves_array_set (MonoInvocation *frame)
+{
+       stackval *sp = frame->stack_args + 1;
+
+       MonoObject *o = frame->stack_args->data.p;
+       MonoArray *ao = (MonoArray *) o;
+       MonoClass *ac = o->vtable->klass;
+
+       g_assert (ac->rank >= 1);
+
+       gint32 pos = ves_array_calculate_index (ao, sp, frame);
+       if (frame->ex)
+               return;
+
+       if (sp [ac->rank].data.p && !mono_object_class (o)->element_class->valuetype) {
+               MonoError error;
+               MonoObject *isinst = mono_object_isinst_checked (sp [ac->rank].data.p, mono_object_class (o)->element_class, &error);
+               mono_error_cleanup (&error);
+               if (!isinst) {
+                       frame->ex = mono_get_exception_array_type_mismatch ();
+                       FILL_IN_TRACE (frame->ex, frame);
+                       return;
+               }
+       }
+
+       gint32 esize = mono_array_element_size (ac);
+       gpointer ea = mono_array_addr_with_size (ao, esize, pos);
+
+       MonoType *mt = mono_method_signature (frame->runtime_method->method)->params [ac->rank];
+       stackval_to_data (mt, &sp [ac->rank], ea, FALSE);
+}
+
+static void
+ves_array_get (MonoInvocation *frame)
+{
+       stackval *sp = frame->stack_args + 1;
+
+       MonoObject *o = frame->stack_args->data.p;
+       MonoArray *ao = (MonoArray *) o;
+       MonoClass *ac = o->vtable->klass;
+
+       g_assert (ac->rank >= 1);
+
+       gint32 pos = ves_array_calculate_index (ao, sp, frame);
+       if (frame->ex)
+               return;
+
+       gint32 esize = mono_array_element_size (ac);
+       gpointer ea = mono_array_addr_with_size (ao, esize, pos);
+
+       MonoType *mt = mono_method_signature (frame->runtime_method->method)->ret;
+       stackval_from_data (mt, frame->retval, ea, FALSE);
+}
+
+static gpointer
+ves_array_element_address (MonoInvocation *frame, MonoClass *required_type, MonoArray *ao, stackval *sp, gboolean needs_typecheck)
+{
+       MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
+
+       g_assert (ac->rank >= 1);
+
+       gint32 pos = ves_array_calculate_index (ao, sp, frame);
+       if (frame->ex)
+               return NULL;
+
+       if (needs_typecheck && !mono_class_is_assignable_from (mono_object_class ((MonoObject *) ao)->element_class, required_type->element_class)) {
+               frame->ex = mono_get_exception_array_type_mismatch ();
+               FILL_IN_TRACE (frame->ex, frame);
+               return NULL;
+       }
+       gint32 esize = mono_array_element_size (ac);
+       return mono_array_addr_with_size (ao, esize, pos);
+}
+
+void
+interp_walk_stack_with_ctx (MonoInternalStackWalk func, MonoContext *ctx, MonoUnwindOptions options, void *user_data)
+{
+       MonoError error;
+       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
+
+       MonoInvocation *frame = context->current_frame;
+
+       while (frame) {
+               MonoStackFrameInfo fi;
+               memset (&fi, 0, sizeof (MonoStackFrameInfo));
+
+               /* TODO: hack to make some asserts happy. */
+               fi.ji = (MonoJitInfo *) frame->runtime_method;
+
+               if (frame->runtime_method)
+                       fi.method = fi.actual_method = frame->runtime_method->method;
+
+               if (!fi.method || (fi.method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (fi.method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))) {
+                       fi.il_offset = -1;
+                       fi.type = FRAME_TYPE_MANAGED_TO_NATIVE;
+               } else {
+                       MonoMethodHeader *hd = mono_method_get_header_checked (fi.method, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       fi.type = FRAME_TYPE_MANAGED;
+                       fi.il_offset = frame->ip - (const unsigned short *) hd->code;
+                       if (!fi.method->wrapper_type)
+                               fi.managed = TRUE;
+               }
+
+               if (func (&fi, ctx, user_data))
+                       return;
+               frame = frame->parent;
+       }
+
+       g_assert (0);
+}
+
+static MonoPIFunc mono_interp_enter_icall_trampoline = NULL;
+
+struct _MethodArguments {
+       size_t ilen;
+       gpointer *iargs;
+       size_t flen;
+       double *fargs;
+       gpointer *retval;
+       size_t is_float_ret;
+};
+
+typedef struct _MethodArguments MethodArguments;
+
+// TODO: this function is also arch dependent (register width).
+static MethodArguments* build_args_from_sig (MonoMethodSignature *sig, MonoInvocation *frame)
+{
+       // TODO: don't malloc this data structure.
+       MethodArguments *margs = g_malloc0 (sizeof (MethodArguments));
+
+       if (sig->hasthis)
+               margs->ilen++;
+
+       for (int i = 0; i < sig->param_count; i++) {
+               guint32 ptype = sig->params [i]->byref ? MONO_TYPE_PTR : sig->params [i]->type;
+               switch (ptype) {
+               case MONO_TYPE_BOOLEAN:
+               case MONO_TYPE_CHAR:
+               case MONO_TYPE_I1:
+               case MONO_TYPE_U1:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_U2:
+               case MONO_TYPE_I4:
+               case MONO_TYPE_U4:
+               case MONO_TYPE_I:
+               case MONO_TYPE_U:
+               case MONO_TYPE_PTR:
+               case MONO_TYPE_SZARRAY:
+               case MONO_TYPE_CLASS:
+               case MONO_TYPE_OBJECT:
+               case MONO_TYPE_STRING:
+               case MONO_TYPE_I8:
+               case MONO_TYPE_VALUETYPE:
+               case MONO_TYPE_GENERICINST:
+                       margs->ilen++;
+                       break;
+               case MONO_TYPE_R4:
+               case MONO_TYPE_R8:
+                       margs->flen++;
+                       break;
+               default:
+                       g_error ("build_args_from_sig: not implemented yet (1): 0x%x\n", ptype);
+               }
+       }
+
+       if (margs->ilen > 0)
+               margs->iargs = g_malloc0 (sizeof (gpointer) * margs->ilen);
+
+       if (margs->flen > 0)
+               margs->fargs = g_malloc0 (sizeof (double) * margs->flen);
+
+       if (margs->ilen > 8)
+               g_error ("build_args_from_sig: TODO, allocate gregs: %d\n", margs->ilen);
+
+       if (margs->flen > 3)
+               g_error ("build_args_from_sig: TODO, allocate fregs: %d\n", margs->flen);
+
+
+       size_t int_i = 0;
+       size_t int_f = 0;
+
+       if (sig->hasthis) {
+               margs->iargs [0] = frame->stack_args->data.p;
+               int_i++;
+       }
+
+       for (int i = 0; i < sig->param_count; i++) {
+               guint32 ptype = sig->params [i]->byref ? MONO_TYPE_PTR : sig->params [i]->type;
+               switch (ptype) {
+               case MONO_TYPE_BOOLEAN:
+               case MONO_TYPE_CHAR:
+               case MONO_TYPE_I1:
+               case MONO_TYPE_U1:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_U2:
+               case MONO_TYPE_I4:
+               case MONO_TYPE_U4:
+               case MONO_TYPE_I:
+               case MONO_TYPE_U:
+               case MONO_TYPE_PTR:
+               case MONO_TYPE_SZARRAY:
+               case MONO_TYPE_CLASS:
+               case MONO_TYPE_OBJECT:
+               case MONO_TYPE_STRING:
+               case MONO_TYPE_I8:
+               case MONO_TYPE_VALUETYPE:
+               case MONO_TYPE_GENERICINST:
+                       margs->iargs [int_i] = frame->stack_args [i].data.p;
+#if DEBUG_INTERP
+                       g_print ("build_args_from_sig: margs->iargs [%d]: %p (frame @ %d)\n", int_i, margs->iargs [int_i], i);
+#endif
+                       int_i++;
+                       break;
+               case MONO_TYPE_R4:
+               case MONO_TYPE_R8:
+                       if (ptype == MONO_TYPE_R4)
+                               * (float *) &(margs->fargs [int_f]) = (float) frame->stack_args [i].data.f;
+                       else
+                               margs->fargs [int_f] = frame->stack_args [i].data.f;
+#if DEBUG_INTERP
+                       g_print ("build_args_from_sig: margs->fargs [%d]: %p (%f) (frame @ %d)\n", int_f, margs->fargs [int_f], margs->fargs [int_f], i);
+#endif
+                       int_f++;
+                       break;
+               default:
+                       g_error ("build_args_from_sig: not implemented yet (2): 0x%x\n", ptype);
+               }
+       }
+
+       switch (sig->ret->type) {
+               case MONO_TYPE_BOOLEAN:
+               case MONO_TYPE_CHAR:
+               case MONO_TYPE_I1:
+               case MONO_TYPE_U1:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_U2:
+               case MONO_TYPE_I4:
+               case MONO_TYPE_U4:
+               case MONO_TYPE_I:
+               case MONO_TYPE_U:
+               case MONO_TYPE_PTR:
+               case MONO_TYPE_SZARRAY:
+               case MONO_TYPE_CLASS:
+               case MONO_TYPE_OBJECT:
+               case MONO_TYPE_STRING:
+               case MONO_TYPE_I8:
+               case MONO_TYPE_VALUETYPE:
+               case MONO_TYPE_GENERICINST:
+                       margs->retval = &(frame->retval->data.p);
+                       break;
+               case MONO_TYPE_R4:
+               case MONO_TYPE_R8:
+                       margs->retval = &(frame->retval->data.p);
+                       margs->is_float_ret = 1;
+                       break;
+               case MONO_TYPE_VOID:
+                       margs->retval = NULL;
+                       break;
+               default:
+                       g_error ("build_args_from_sig: ret type not implemented yet: 0x%x\n", sig->ret->type);
+       }
+
+       return margs;
+}
+
+static void 
+ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
+{
+       jmp_buf env;
+       MonoInvocation *old_frame = context->current_frame;
+       MonoInvocation *old_env_frame = context->env_frame;
+       jmp_buf *old_env = context->current_env;
+
+       if (setjmp (env)) {
+               context->current_frame = old_frame;
+               context->env_frame = old_env_frame;
+               context->current_env = old_env;
+               context->managed_code = 1;
+               return;
+       }
+
+       frame->ex = NULL;
+       context->env_frame = frame;
+       context->current_env = &env;
+
+       g_assert (!frame->runtime_method);
+       if (!mono_interp_enter_icall_trampoline) {
+               MonoTrampInfo *info;
+               mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
+               // TODO:
+               // mono_tramp_info_register (info, NULL);
+       }
+
+       MethodArguments *margs = build_args_from_sig (sig, frame);
+#if DEBUG_INTERP
+       g_print ("ICALL: mono_interp_enter_icall_trampoline = %p, addr = %p\n", mono_interp_enter_icall_trampoline, addr);
+       g_print ("margs(out): ilen=%d, flen=%d\n", margs->ilen, margs->flen);
+#endif
+
+       context->current_frame = frame;
+       context->managed_code = 0;
+
+       mono_interp_enter_icall_trampoline (addr, margs);
+
+       context->managed_code = 1;
+       /* domain can only be changed by native code */
+       context->domain = mono_domain_get ();
+
+       if (*mono_thread_interruption_request_flag ()) {
+               MonoException *exc = mono_thread_interruption_checkpoint ();
+               if (exc) {
+                       frame->ex = exc;
+                       context->search_for_handler = 1;
+               }
+       }
+       
+       if (!frame->ex && !MONO_TYPE_ISSTRUCT (sig->ret))
+               stackval_from_data (sig->ret, frame->retval, (char*)&frame->retval->data.p, sig->pinvoke);
+
+       context->current_frame = old_frame;
+       context->env_frame = old_env_frame;
+       context->current_env = old_env;
+
+       g_free (margs->iargs);
+       g_free (margs->fargs);
+       g_free (margs);
+}
+
+void
+mono_interp_init_delegate (MonoDelegate *del)
+{
+       if (!del->method)
+               del->method = ((RuntimeMethod *) del->method_ptr)->method;
+}
+
+/*
+ * From the spec:
+ * runtime specifies that the implementation of the method is automatically
+ * provided by the runtime and is primarily used for the methods of delegates.
+ */
+static void
+ves_runtime_method (MonoInvocation *frame, ThreadContext *context)
+{
+       MonoMethod *method = frame->runtime_method->method;
+       const char *name = method->name;
+       MonoObject *obj = (MonoObject*) frame->stack_args->data.p;
+       MonoObject *isinst_obj;
+       MonoError error;
+
+       mono_class_init (method->klass);
+
+       isinst_obj = mono_object_isinst_checked (obj, mono_defaults.array_class, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       if (obj && isinst_obj) {
+               if (*name == 'S' && (strcmp (name, "Set") == 0)) {
+                       ves_array_set (frame);
+                       return;
+               }
+               if (*name == 'G' && (strcmp (name, "Get") == 0)) {
+                       ves_array_get (frame);
+                       return;
+               }
+       }
+       
+       g_error ("Don't know how to exec runtime method %s.%s::%s", 
+                       method->klass->name_space, method->klass->name,
+                       method->name);
+}
+
+static char*
+dump_stack (stackval *stack, stackval *sp)
+{
+       stackval *s = stack;
+       GString *str = g_string_new ("");
+       
+       if (sp == stack)
+               return g_string_free (str, FALSE);
+       
+       while (s < sp) {
+               g_string_append_printf (str, "[%p (%lld)] ", s->data.l, s->data.l);
+               ++s;
+       }
+       return g_string_free (str, FALSE);
+}
+
+static void
+dump_stackval (GString *str, stackval *s, MonoType *type)
+{
+       switch (type->type) {
+       case MONO_TYPE_I1:
+       case MONO_TYPE_U1:
+       case MONO_TYPE_I2:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_CHAR:
+       case MONO_TYPE_BOOLEAN:
+               g_string_append_printf (str, "[%d] ", s->data.i);
+               break;
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_PTR:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+               g_string_append_printf (str, "[%p] ", s->data.p);
+               break;
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype)
+                       g_string_append_printf (str, "[%d] ", s->data.i);
+               else
+                       g_string_append_printf (str, "[vt:%p] ", s->data.p);
+               break;
+       case MONO_TYPE_R4:
+       case MONO_TYPE_R8:
+               g_string_append_printf (str, "[%g] ", s->data.f);
+               break;
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+       default: {
+               GString *res = g_string_new ("");
+               mono_type_get_desc (res, type, TRUE);
+               g_string_append_printf (str, "[{%s} %lld/0x%0llx] ", res->str, s->data.l, s->data.l);
+               g_string_free (res, TRUE);
+               break;
+       }
+       }
+}
+
+static char*
+dump_args (MonoInvocation *inv)
+{
+       GString *str = g_string_new ("");
+       int i;
+       MonoMethodSignature *signature = mono_method_signature (inv->runtime_method->method);
+       
+       if (signature->param_count == 0 && !signature->hasthis)
+               return g_string_free (str, FALSE);
+
+       if (signature->hasthis) {
+               MonoMethod *method = inv->runtime_method->method;
+               dump_stackval (str, inv->stack_args, &method->klass->byval_arg);
+       }
+
+       for (i = 0; i < signature->param_count; ++i)
+               dump_stackval (str, inv->stack_args + (!!signature->hasthis) + i, signature->params [i]);
+
+       return g_string_free (str, FALSE);
+}
+
+static char*
+dump_retval (MonoInvocation *inv)
+{
+       GString *str = g_string_new ("");
+       MonoType *ret = mono_method_signature (inv->runtime_method->method)->ret;
+
+       if (ret->type != MONO_TYPE_VOID)
+               dump_stackval (str, inv->retval, ret);
+
+       return g_string_free (str, FALSE);
+}
+static char*
+dump_frame (MonoInvocation *inv)
+{
+       GString *str = g_string_new ("");
+       int i;
+       char *args;
+       MonoError error;
+
+       for (i = 0; inv; inv = inv->parent) {
+               if (inv->runtime_method != NULL) {
+                       MonoMethod *method = inv->runtime_method->method;
+                       MonoClass *k;
+
+                       int codep = 0;
+                       const char * opname = "";
+                       char *name;
+                       gchar *source = NULL;
+
+                       k = method->klass;
+
+                       if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) == 0 &&
+                               (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) == 0) {
+                               MonoMethodHeader *hd = mono_method_get_header_checked (method, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+                               if (hd != NULL) {
+                                       if (inv->ip) {
+                                               opname = mono_interp_opname [*inv->ip];
+                                               codep = inv->ip - inv->runtime_method->code;
+                                               source = g_strdup_printf ("%s:%d // (TODO: proper stacktrace)", method->name, codep);
+                                       } else 
+                                               opname = "";
+
+#if 0
+                                       MonoDebugSourceLocation *minfo = mono_debug_lookup_method (method);
+                                       source = mono_debug_method_lookup_location (minfo, codep);
+#endif
+                               }
+                       }
+                       args = dump_args (inv);
+                       name = mono_method_full_name (method, TRUE);
+                       if (source)
+                               g_string_append_printf (str, "#%d: 0x%05x %-10s in %s (%s) at %s\n", i, codep, opname, name, args, source);
+                       else
+                               g_string_append_printf (str, "#%d: 0x%05x %-10s in %s (%s)\n", i, codep, opname, name, args);
+                       g_free (name);
+                       g_free (args);
+                       g_free (source);
+                       ++i;
+               }
+       }
+       return g_string_free (str, FALSE);
+}
+
+static MonoArray *
+get_trace_ips (MonoDomain *domain, MonoInvocation *top)
+{
+       int i;
+       MonoArray *res;
+       MonoInvocation *inv;
+       MonoError error;
+
+       for (i = 0, inv = top; inv; inv = inv->parent)
+               if (inv->runtime_method != NULL)
+                       ++i;
+
+       res = mono_array_new_checked (domain, mono_defaults.int_class, 2 * i, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+       for (i = 0, inv = top; inv; inv = inv->parent)
+               if (inv->runtime_method != NULL) {
+                       mono_array_set (res, gpointer, i, inv->runtime_method);
+                       ++i;
+                       mono_array_set (res, gpointer, i, (gpointer)inv->ip);
+                       ++i;
+               }
+
+       return res;
+}
+
+
+#define MYGUINT64_MAX 18446744073709551615ULL
+#define MYGINT64_MAX 9223372036854775807LL
+#define MYGINT64_MIN (-MYGINT64_MAX -1LL)
+
+#define MYGUINT32_MAX 4294967295U
+#define MYGINT32_MAX 2147483647
+#define MYGINT32_MIN (-MYGINT32_MAX -1)
+       
+#define CHECK_ADD_OVERFLOW(a,b) \
+       (gint32)(b) >= 0 ? (gint32)(MYGINT32_MAX) - (gint32)(b) < (gint32)(a) ? -1 : 0  \
+       : (gint32)(MYGINT32_MIN) - (gint32)(b) > (gint32)(a) ? +1 : 0
+
+#define CHECK_SUB_OVERFLOW(a,b) \
+       (gint32)(b) < 0 ? (gint32)(MYGINT32_MAX) + (gint32)(b) < (gint32)(a) ? -1 : 0   \
+       : (gint32)(MYGINT32_MIN) + (gint32)(b) > (gint32)(a) ? +1 : 0
+
+#define CHECK_ADD_OVERFLOW_UN(a,b) \
+       (guint32)(MYGUINT32_MAX) - (guint32)(b) < (guint32)(a) ? -1 : 0
+
+#define CHECK_SUB_OVERFLOW_UN(a,b) \
+       (guint32)(a) < (guint32)(b) ? -1 : 0
+
+#define CHECK_ADD_OVERFLOW64(a,b) \
+       (gint64)(b) >= 0 ? (gint64)(MYGINT64_MAX) - (gint64)(b) < (gint64)(a) ? -1 : 0  \
+       : (gint64)(MYGINT64_MIN) - (gint64)(b) > (gint64)(a) ? +1 : 0
+
+#define CHECK_SUB_OVERFLOW64(a,b) \
+       (gint64)(b) < 0 ? (gint64)(MYGINT64_MAX) + (gint64)(b) < (gint64)(a) ? -1 : 0   \
+       : (gint64)(MYGINT64_MIN) + (gint64)(b) > (gint64)(a) ? +1 : 0
+
+#define CHECK_ADD_OVERFLOW64_UN(a,b) \
+       (guint64)(MYGUINT64_MAX) - (guint64)(b) < (guint64)(a) ? -1 : 0
+
+#define CHECK_SUB_OVERFLOW64_UN(a,b) \
+       (guint64)(a) < (guint64)(b) ? -1 : 0
+
+#if SIZEOF_VOID_P == 4
+#define CHECK_ADD_OVERFLOW_NAT(a,b) CHECK_ADD_OVERFLOW(a,b)
+#define CHECK_ADD_OVERFLOW_NAT_UN(a,b) CHECK_ADD_OVERFLOW_UN(a,b)
+#else
+#define CHECK_ADD_OVERFLOW_NAT(a,b) CHECK_ADD_OVERFLOW64(a,b)
+#define CHECK_ADD_OVERFLOW_NAT_UN(a,b) CHECK_ADD_OVERFLOW64_UN(a,b)
+#endif
+
+/* Resolves to TRUE if the operands would overflow */
+#define CHECK_MUL_OVERFLOW(a,b) \
+       ((gint32)(a) == 0) || ((gint32)(b) == 0) ? 0 : \
+       (((gint32)(a) > 0) && ((gint32)(b) == -1)) ? FALSE : \
+       (((gint32)(a) < 0) && ((gint32)(b) == -1)) ? (a == - MYGINT32_MAX) : \
+       (((gint32)(a) > 0) && ((gint32)(b) > 0)) ? (gint32)(a) > ((MYGINT32_MAX) / (gint32)(b)) : \
+       (((gint32)(a) > 0) && ((gint32)(b) < 0)) ? (gint32)(a) > ((MYGINT32_MIN) / (gint32)(b)) : \
+       (((gint32)(a) < 0) && ((gint32)(b) > 0)) ? (gint32)(a) < ((MYGINT32_MIN) / (gint32)(b)) : \
+       (gint32)(a) < ((MYGINT32_MAX) / (gint32)(b))
+
+#define CHECK_MUL_OVERFLOW_UN(a,b) \
+       ((guint32)(a) == 0) || ((guint32)(b) == 0) ? 0 : \
+       (guint32)(b) > ((MYGUINT32_MAX) / (guint32)(a))
+
+#define CHECK_MUL_OVERFLOW64(a,b) \
+       ((gint64)(a) == 0) || ((gint64)(b) == 0) ? 0 : \
+       (((gint64)(a) > 0) && ((gint64)(b) == -1)) ? FALSE : \
+       (((gint64)(a) < 0) && ((gint64)(b) == -1)) ? (a == - MYGINT64_MAX) : \
+       (((gint64)(a) > 0) && ((gint64)(b) > 0)) ? (gint64)(a) > ((MYGINT64_MAX) / (gint64)(b)) : \
+       (((gint64)(a) > 0) && ((gint64)(b) < 0)) ? (gint64)(a) > ((MYGINT64_MIN) / (gint64)(b)) : \
+       (((gint64)(a) < 0) && ((gint64)(b) > 0)) ? (gint64)(a) < ((MYGINT64_MIN) / (gint64)(b)) : \
+       (gint64)(a) < ((MYGINT64_MAX) / (gint64)(b))
+
+#define CHECK_MUL_OVERFLOW64_UN(a,b) \
+       ((guint64)(a) == 0) || ((guint64)(b) == 0) ? 0 : \
+       (guint64)(b) > ((MYGUINT64_MAX) / (guint64)(a))
+
+#if SIZEOF_VOID_P == 4
+#define CHECK_MUL_OVERFLOW_NAT(a,b) CHECK_MUL_OVERFLOW(a,b)
+#define CHECK_MUL_OVERFLOW_NAT_UN(a,b) CHECK_MUL_OVERFLOW_UN(a,b)
+#else
+#define CHECK_MUL_OVERFLOW_NAT(a,b) CHECK_MUL_OVERFLOW64(a,b)
+#define CHECK_MUL_OVERFLOW_NAT_UN(a,b) CHECK_MUL_OVERFLOW64_UN(a,b)
+#endif
+
+MonoObject*
+mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error)
+{
+       MonoInvocation frame;
+       ThreadContext * volatile context = mono_native_tls_get_value (thread_context_id);
+       MonoObject *retval = NULL;
+       MonoMethodSignature *sig = mono_method_signature (method);
+       MonoClass *klass = mono_class_from_mono_type (sig->ret);
+       int i, type, isobject = 0;
+       void *ret = NULL;
+       stackval result;
+       stackval *args = alloca (sizeof (stackval) * (sig->param_count + !!sig->hasthis));
+       ThreadContext context_struct;
+       MonoInvocation *old_frame = NULL;
+       jmp_buf env;
+
+       error_init (error);
+
+       frame.ex = NULL;
+
+       if (setjmp(env)) {
+               if (context != &context_struct) {
+                       context->domain = mono_domain_get ();
+                       context->current_frame = old_frame;
+                       context->managed_code = 0;
+               } else 
+                       mono_native_tls_set_value (thread_context_id, NULL);
+               if (exc != NULL)
+                       *exc = (MonoObject *)frame.ex;
+               return retval;
+       }
+
+       if (context == NULL) {
+               context = &context_struct;
+               context_struct.base_frame = &frame;
+               context_struct.current_frame = NULL;
+               context_struct.env_frame = &frame;
+               context_struct.current_env = &env;
+               context_struct.search_for_handler = 0;
+               context_struct.managed_code = 0;
+               mono_native_tls_set_value (thread_context_id, context);
+       }
+       else
+               old_frame = context->current_frame;
+
+       context->domain = mono_domain_get ();
+
+       switch (sig->ret->type) {
+       case MONO_TYPE_VOID:
+               break;
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_SZARRAY:
+               isobject = 1;
+               break;
+       case MONO_TYPE_VALUETYPE:
+               retval = mono_object_new_checked (context->domain, klass, error);
+               ret = ((char*)retval) + sizeof (MonoObject);
+               if (!sig->ret->data.klass->enumtype)
+                       result.data.vt = ret;
+               break;
+       default:
+               retval = mono_object_new_checked (context->domain, klass, error);
+               ret = ((char*)retval) + sizeof (MonoObject);
+               break;
+       }
+
+       if (sig->hasthis)
+               args [0].data.p = obj;
+
+       for (i = 0; i < sig->param_count; ++i) {
+               int a_index = i + !!sig->hasthis;
+               if (sig->params [i]->byref) {
+                       args [a_index].data.p = params [i];
+                       continue;
+               }
+               type = sig->params [i]->type;
+handle_enum:
+               switch (type) {
+               case MONO_TYPE_U1:
+               case MONO_TYPE_I1:
+               case MONO_TYPE_BOOLEAN:
+                       args [a_index].data.i = *(MonoBoolean*)params [i];
+                       break;
+               case MONO_TYPE_U2:
+               case MONO_TYPE_I2:
+               case MONO_TYPE_CHAR:
+                       args [a_index].data.i = *(gint16*)params [i];
+                       break;
+#if SIZEOF_VOID_P == 4
+               case MONO_TYPE_U: /* use VAL_POINTER? */
+               case MONO_TYPE_I:
+#endif
+               case MONO_TYPE_U4:
+               case MONO_TYPE_I4:
+                       args [a_index].data.i = *(gint32*)params [i];
+                       break;
+#if SIZEOF_VOID_P == 8
+               case MONO_TYPE_U:
+               case MONO_TYPE_I:
+#endif
+               case MONO_TYPE_U8:
+               case MONO_TYPE_I8:
+                       args [a_index].data.l = *(gint64*)params [i];
+                       break;
+               case MONO_TYPE_VALUETYPE:
+                       if (sig->params [i]->data.klass->enumtype) {
+                               type = mono_class_enum_basetype (sig->params [i]->data.klass)->type;
+                               goto handle_enum;
+                       } else {
+                               args [a_index].data.p = params [i];
+                       }
+                       break;
+               case MONO_TYPE_STRING:
+               case MONO_TYPE_CLASS:
+               case MONO_TYPE_ARRAY:
+               case MONO_TYPE_SZARRAY:
+               case MONO_TYPE_OBJECT:
+                       args [a_index].data.p = params [i];
+                       break;
+               default:
+                       g_error ("type 0x%x not handled in  runtime invoke", sig->params [i]->type);
+               }
+       }
+
+       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+               method = mono_marshal_get_native_wrapper (method, FALSE, FALSE);
+       INIT_FRAME (&frame,context->current_frame,args,&result,mono_get_root_domain (),method,error);
+       if (exc)
+               frame.invoke_trap = 1;
+       context->managed_code = 1;
+       ves_exec_method_with_context (&frame, context);
+       context->managed_code = 0;
+       if (context == &context_struct)
+               mono_native_tls_set_value (thread_context_id, NULL);
+       else
+               context->current_frame = old_frame;
+       if (frame.ex != NULL) {
+               if (exc != NULL) {
+                       *exc = (MonoObject*) frame.ex;
+                       return NULL;
+               }
+               if (context->current_env != NULL) {
+                       context->env_frame->ex = frame.ex;
+                       longjmp(*context->current_env, 1);
+               }
+               else
+                       printf("dropped exception...\n");
+       }
+       if (sig->ret->type == MONO_TYPE_VOID && !method->string_ctor)
+               return NULL;
+       if (isobject || method->string_ctor)
+               return result.data.p;
+       stackval_to_data (sig->ret, &result, ret, sig->pinvoke);
+       return retval;
+}
+
+static stackval * 
+do_icall (ThreadContext *context, int op, stackval *sp, gpointer ptr)
+{
+       MonoInvocation *old_frame = context->current_frame;
+       MonoInvocation *old_env_frame = context->env_frame;
+       jmp_buf *old_env = context->current_env;
+       jmp_buf env;
+
+       if (setjmp (env)) {
+               context->current_frame = old_frame;
+               context->env_frame = old_env_frame;
+               context->current_env = old_env;
+               context->managed_code = 1;
+               return sp;
+       }
+
+       context->env_frame = context->current_frame;
+       context->current_env = &env;
+       context->managed_code = 0;
+
+       switch (op) {
+       case MINT_ICALL_V_V: {
+               void (*func)() = ptr;
+               func ();
+               break;
+       }
+       case MINT_ICALL_V_P: {
+               gpointer (*func)() = ptr;
+               sp++;
+               sp [-1].data.p = func ();
+               break;
+       }
+       case MINT_ICALL_P_V: {
+               void (*func)(gpointer) = ptr;
+               func (sp [-1].data.p);
+               sp --;
+               break;
+       }
+       case MINT_ICALL_P_P: {
+               gpointer (*func)(gpointer) = ptr;
+               sp [-1].data.p = func (sp [-1].data.p);
+               break;
+       }
+       case MINT_ICALL_PP_V: {
+               void (*func)(gpointer,gpointer) = ptr;
+               sp -= 2;
+               func (sp [0].data.p, sp [1].data.p);
+               break;
+       }
+       case MINT_ICALL_PI_V: {
+               void (*func)(gpointer,int) = ptr;
+               sp -= 2;
+               func (sp [0].data.p, sp [1].data.i);
+               break;
+       }
+       case MINT_ICALL_PP_P: {
+               gpointer (*func)(gpointer,gpointer) = ptr;
+               --sp;
+               sp [-1].data.p = func (sp [-1].data.p, sp [0].data.p);
+               break;
+       }
+       case MINT_ICALL_PI_P: {
+               gpointer (*func)(gpointer,int) = ptr;
+               --sp;
+               sp [-1].data.p = func (sp [-1].data.p, sp [0].data.i);
+               break;
+       }
+       case MINT_ICALL_PPP_V: {
+               void (*func)(gpointer,gpointer,gpointer) = ptr;
+               sp -= 3;
+               func (sp [0].data.p, sp [1].data.p, sp [2].data.p);
+               break;
+       }
+       case MINT_ICALL_PPI_V: {
+               void (*func)(gpointer,gpointer,int) = ptr;
+               sp -= 3;
+               func (sp [0].data.p, sp [1].data.p, sp [2].data.i);
+               break;
+       }
+       default:
+               g_assert_not_reached ();
+       }
+
+       context->env_frame = old_env_frame;
+       context->current_env = old_env;
+
+       return sp;
+}
+
+static mono_mutex_t create_method_pointer_mutex;
+
+static GHashTable *method_pointer_hash = NULL;
+
+static MonoMethod *method_pointers [2] = {0};
+
+static MonoObject *
+mp_tramp_0 (MonoObject *this_obj, void **params, MonoObject **exc, void *compiled_method) {
+       MonoError error;
+       void *params_real[] = {this_obj, &params, &exc, &compiled_method};
+       MonoObject *ret = mono_interp_runtime_invoke (method_pointers [0], NULL, params_real, NULL, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       return ret;
+}
+
+static MonoObject *
+mp_tramp_1 (MonoObject *this_obj, void **params, MonoObject **exc, void *compiled_method) {
+       MonoError error;
+       void *params_real[] = {this_obj, &params, &exc, &compiled_method};
+       MonoObject *ret = mono_interp_runtime_invoke (method_pointers [1], NULL, params_real, NULL, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       return ret;
+}
+
+gpointer *mp_tramps[] = {(gpointer) mp_tramp_0, (gpointer) mp_tramp_1};
+
+static int tramps_used = 0;
+
+gpointer
+mono_interp_create_method_pointer (MonoMethod *method, MonoError *error)
+{
+       gpointer addr;
+       MonoJitInfo *ji;
+
+       mono_os_mutex_lock (&create_method_pointer_mutex);
+       if (!method_pointer_hash) {
+               // FIXME: is registering method table as GC root really necessary?
+               // MONO_GC_REGISTER_ROOT_FIXED (method_pointer_hash);
+               method_pointer_hash = g_hash_table_new (NULL, NULL);
+       }
+       addr = g_hash_table_lookup (method_pointer_hash, method);
+       if (addr) {
+               mono_os_mutex_unlock (&create_method_pointer_mutex);
+               return addr;
+       }
+
+       /*
+        * If it is a static P/Invoke method, we can just return the pointer
+        * to the method implementation.
+        */
+       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL && ((MonoMethodPInvoke*) method)->addr) {
+               ji = g_new0 (MonoJitInfo, 1);
+               ji->d.method = method;
+               ji->code_size = 1;
+               ji->code_start = addr = ((MonoMethodPInvoke*) method)->addr;
+
+               mono_jit_info_table_add (mono_get_root_domain (), ji);
+       }               
+       else {
+               g_assert (method->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE);
+               g_assert (tramps_used < 2);
+
+               /* FIXME: needs locking */
+               method_pointers [tramps_used] = method;
+               addr = mp_tramps [tramps_used];
+               tramps_used++;
+       }
+
+       g_hash_table_insert (method_pointer_hash, method, addr);
+       mono_os_mutex_unlock (&create_method_pointer_mutex);
+
+       return addr;
+}
+
+#if COUNT_OPS
+static int opcode_counts[512];
+
+#define COUNT_OP(op) opcode_counts[op]++
+#else
+#define COUNT_OP(op) 
+#endif
+
+#if DEBUG_INTERP
+#define DUMP_INSTR() \
+       if (tracing > 1) { \
+               char *ins; \
+               if (sp > frame->stack) { \
+                       ins = dump_stack (frame->stack, sp); \
+               } else { \
+                       ins = g_strdup (""); \
+               } \
+               sp->data.l = 0; \
+               output_indent (); \
+               char *mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+               g_print ("(%p) %s -> ", mono_thread_internal_current (), mn); \
+               g_free (mn); \
+               mono_interp_dis_mintop(rtm->code, ip); \
+               g_print ("\t%d:%s\n", vt_sp - vtalloc, ins); \
+               g_free (ins); \
+       }
+#else
+#define DUMP_INSTR()
+#endif
+
+#ifdef __GNUC__
+#define USE_COMPUTED_GOTO 1
+#endif
+#if USE_COMPUTED_GOTO
+#define MINT_IN_SWITCH(op) COUNT_OP(op); goto *in_labels[op];
+#define MINT_IN_CASE(x) LAB_ ## x:
+#if DEBUG_INTERP
+#define MINT_IN_BREAK if (tracing > 1) goto main_loop; else { COUNT_OP(*ip); goto *in_labels[*ip]; }
+#else
+#define MINT_IN_BREAK { COUNT_OP(*ip); goto *in_labels[*ip]; }
+#endif
+#define MINT_IN_DEFAULT mint_default: if (0) goto mint_default; /* make gcc shut up */
+#else
+#define MINT_IN_SWITCH(op) switch (op)
+#define MINT_IN_CASE(x) case x:
+#define MINT_IN_BREAK break
+#define MINT_IN_DEFAULT default:
+#endif
+
+/* 
+ * Defining this causes register allocation errors in some versions of gcc:
+ * error: unable to find a register to spill in class `SIREG'
+ */
+/* #define MINT_USE_DEDICATED_IP_REG */
+
+static void 
+ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context)
+{
+       MonoInvocation child_frame;
+       GSList *finally_ips = NULL;
+       const unsigned short *endfinally_ip = NULL;
+#if defined(__GNUC__) && defined (i386) && defined (MINT_USE_DEDICATED_IP_REG)
+       register const unsigned short *ip asm ("%esi");
+#else
+       register const unsigned short *ip;
+#endif
+       register stackval *sp;
+       RuntimeMethod *rtm;
+#if DEBUG_INTERP
+       gint tracing = global_tracing;
+       unsigned char *vtalloc;
+#endif
+       int i32;
+       unsigned char *vt_sp;
+       unsigned char *locals;
+       MonoError error;
+       MonoObject *o = NULL;
+       MonoClass *c;
+#if USE_COMPUTED_GOTO
+       static void *in_labels[] = {
+#define OPDEF(a,b,c,d) \
+       &&LAB_ ## a,
+#include "mintops.def"
+       0 };
+#endif
+
+       frame->ex = NULL;
+       frame->ex_handler = NULL;
+       frame->ip = NULL;
+       context->current_frame = frame;
+
+#if DEBUG_INTERP
+       debug_enter (frame, &tracing);
+#endif
+
+       if (!frame->runtime_method->transformed) {
+               context->managed_code = 0;
+#if DEBUG_INTERP
+               char *mn = mono_method_full_name (frame->runtime_method->method, TRUE);
+               g_print ("(%p) Transforming %s\n", mono_thread_internal_current (), mn);
+               g_free (mn);
+#endif
+               frame->ex = mono_interp_transform_method (frame->runtime_method, context);
+               context->managed_code = 1;
+               if (frame->ex) {
+                       rtm = NULL;
+                       ip = NULL;
+                       goto exit_frame;
+               }
+       }
+
+       rtm = frame->runtime_method;
+       frame->args = alloca (rtm->alloca_size);
+       memset (frame->args, 0, rtm->alloca_size);
+
+       sp = frame->stack = (stackval *)((char *)frame->args + rtm->args_size);
+       memset (sp, 0, rtm->stack_size);
+
+       vt_sp = (unsigned char *) sp + rtm->stack_size;
+       memset (vt_sp, 0, rtm->vt_stack_size);
+#if DEBUG_INTERP
+       vtalloc = vt_sp;
+#endif
+
+       locals = (unsigned char *) vt_sp + rtm->vt_stack_size;
+       memset (vt_sp, 0, rtm->locals_size);
+
+       child_frame.parent = frame;
+
+       /* ready to go */
+       ip = rtm->code;
+
+       /*
+        * using while (ip < end) may result in a 15% performance drop, 
+        * but it may be useful for debug
+        */
+       while (1) {
+       main_loop:
+               /* g_assert (sp >= frame->stack); */
+               /* g_assert(vt_sp - vtalloc <= rtm->vt_stack_size); */
+               DUMP_INSTR();
+               MINT_IN_SWITCH (*ip) {
+               MINT_IN_CASE(MINT_INITLOCALS)
+                       memset (locals, 0, rtm->locals_size);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NOP)
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BREAK)
+                       ++ip;
+                       G_BREAKPOINT (); /* this is not portable... */
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDNULL) 
+                       sp->data.p = NULL;
+                       ++ip;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_VTRESULT) {
+                       int ret_size = * (guint16 *)(ip + 1);
+                       unsigned char *ret_vt_sp = vt_sp;
+                       vt_sp -= READ32(ip + 2);
+                       if (ret_size > 0) {
+                               memmove (vt_sp, ret_vt_sp, ret_size);
+                               sp [-1].data.p = vt_sp;
+                               vt_sp += (ret_size + 7) & ~7;
+                       }
+                       ip += 4;
+                       MINT_IN_BREAK;
+               }
+#define LDC(n) do { sp->data.i = (n); ++ip; ++sp; } while (0)
+               MINT_IN_CASE(MINT_LDC_I4_M1)
+                       LDC(-1);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_0)
+                       LDC(0);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_1)
+                       LDC(1);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_2)
+                       LDC(2);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_3)
+                       LDC(3);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_4)
+                       LDC(4);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_5)
+                       LDC(5);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_6)
+                       LDC(6);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_7)
+                       LDC(7);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_8)
+                       LDC(8);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4_S) 
+                       sp->data.i = *(const short *)(ip + 1);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I4)
+                       ++ip;
+                       sp->data.i = READ32 (ip);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_I8)
+                       ++ip;
+                       sp->data.l = READ64 (ip);
+                       ip += 4;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDC_R4) {
+                       guint32 val;
+                       ++ip;
+                       val = READ32(ip);
+                       sp->data.f = * (float *)&val;
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDC_R8) 
+                       sp->data.l = READ64 (ip + 1); /* note union usage */
+                       ip += 5;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DUP) 
+                       sp [0] = sp[-1];
+                       ++sp;
+                       ++ip; 
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DUP_VT)
+                       i32 = READ32 (ip + 1);
+                       sp->data.p = vt_sp;
+                       memcpy(sp->data.p, sp [-1].data.p, i32);
+                       vt_sp += (i32 + 7) & ~7;
+                       ++sp;
+                       ip += 3;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_POP) {
+                       guint16 u16 = (* (guint16 *)(ip + 1)) + 1;
+                       if (u16 > 1)
+                               memmove (sp - u16, sp - 1, (u16 - 1) * sizeof (stackval));
+                       sp--;
+                       ip += 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_JMP) {
+                       RuntimeMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
+                       if (!new_method->transformed) {
+                               frame->ip = ip;
+                               frame->ex = mono_interp_transform_method (new_method, context);
+                               if (frame->ex)
+                                       goto exit_frame;
+                       }
+                       ip += 2;
+                       if (new_method->alloca_size > rtm->alloca_size)
+                               g_error ("MINT_JMP to method which needs more stack space (%d > %d)", new_method->alloca_size, rtm->alloca_size); 
+                       rtm = frame->runtime_method = new_method;
+                       vt_sp = (unsigned char *) sp + rtm->stack_size;
+#if DEBUG_INTERP
+                       vtalloc = vt_sp;
+#endif
+                       locals = vt_sp + rtm->vt_stack_size;
+                       ip = rtm->new_body_start; /* bypass storing input args from callers frame */
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CALLI) {
+                       MonoMethodSignature *csignature;
+                       stackval *endsp = sp;
+
+                       frame->ip = ip;
+                       
+                       csignature = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       --sp;
+                       --endsp;
+                       child_frame.runtime_method = sp->data.p;
+
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+                       /* decrement by the actual number of args */
+                       sp -= csignature->param_count;
+                       if (csignature->hasthis)
+                               --sp;
+                       child_frame.stack_args = sp;
+
+                       /* `this' can be NULL for string:.ctor */
+                       if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
+                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       } else if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+
+                       if (csignature->hasthis) {
+                               MonoObject *this_arg = sp->data.p;
+
+                               if (this_arg->vtable->klass->valuetype) {
+                                       gpointer *unboxed = mono_object_unbox (this_arg);
+                                       sp [0].data.p = unboxed;
+                               }
+                       }
+
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               goto handle_finally;
+                       }
+
+                       /* need to handle typedbyref ... */
+                       if (csignature->ret->type != MONO_TYPE_VOID) {
+                               *sp = *endsp;
+                               sp++;
+                       }
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CALLI_NAT) {
+                       MonoMethodSignature *csignature;
+                       stackval *endsp = sp;
+                       unsigned char *code = NULL;
+
+                       frame->ip = ip;
+                       
+                       csignature = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       --sp;
+                       --endsp;
+                       code = sp->data.p;
+                       child_frame.runtime_method = NULL;
+
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+                       /* decrement by the actual number of args */
+                       sp -= csignature->param_count;
+                       if (csignature->hasthis)
+                               --sp;
+                       child_frame.stack_args = sp;
+                       ves_pinvoke_method (&child_frame, csignature, (MonoFuncV) code, FALSE, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               if (context->search_for_handler) {
+                                       context->search_for_handler = 0;
+                                       goto handle_exception;
+                               }
+                               goto handle_finally;
+                       }
+
+                       /* need to handle typedbyref ... */
+                       if (csignature->ret->type != MONO_TYPE_VOID) {
+                               *sp = *endsp;
+                               sp++;
+                       }
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CALL) {
+                       stackval *endsp = sp;
+
+                       frame->ip = ip;
+                       
+                       child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+                       /* decrement by the actual number of args */
+                       sp -= child_frame.runtime_method->param_count;
+                       if (child_frame.runtime_method->hasthis)
+                               --sp;
+                       child_frame.stack_args = sp;
+
+                       /* `this' can be NULL for string:.ctor */
+                       if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
+                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               goto handle_exception;;
+                       }
+
+                       /* need to handle typedbyref ... */
+                       *sp = *endsp;
+                       sp++;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_VCALL) {
+                       frame->ip = ip;
+                       
+                       child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ip += 2;
+
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+                       /* decrement by the actual number of args */
+                       sp -= child_frame.runtime_method->param_count;
+                       if (child_frame.runtime_method->hasthis) {
+                               --sp;
+                               MonoObject *this_arg = sp->data.p;
+                               if (!this_arg)
+                                       THROW_EX (mono_get_exception_null_reference(), ip - 2);
+                       }
+                       child_frame.stack_args = sp;
+
+                       if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
+                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               goto handle_finally;
+                       }
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CALLVIRT) {
+                       stackval *endsp = sp;
+                       MonoObject *this_arg;
+                       guint32 token;
+
+                       frame->ip = ip;
+                       
+                       token = * (unsigned short *)(ip + 1);
+                       ip += 2;
+                       child_frame.runtime_method = rtm->data_items [token];
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+
+                       /* decrement by the actual number of args */
+                       sp -= child_frame.runtime_method->param_count + 1;
+                       child_frame.stack_args = sp;
+                       this_arg = sp->data.p;
+                       if (!this_arg)
+                               THROW_EX (mono_get_exception_null_reference(), ip - 2);
+                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+
+                       MonoClass *this_class = this_arg->vtable->klass;
+                       if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+                               /* unbox */
+                               gpointer *unboxed = mono_object_unbox (this_arg);
+                               sp [0].data.p = unboxed;
+                       }
+
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               if (context->search_for_handler) {
+                                       context->search_for_handler = 0;
+                                       goto handle_exception;
+                               }
+                               goto handle_finally;
+                       }
+
+                       /* need to handle typedbyref ... */
+                       *sp = *endsp;
+                       sp++;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_VCALLVIRT) {
+                       MonoObject *this_arg;
+                       guint32 token;
+
+                       frame->ip = ip;
+                       
+                       token = * (unsigned short *)(ip + 1);
+                       ip += 2;
+                       child_frame.runtime_method = rtm->data_items [token];
+                       sp->data.p = vt_sp;
+                       child_frame.retval = sp;
+
+                       /* decrement by the actual number of args */
+                       sp -= child_frame.runtime_method->param_count + 1;
+                       child_frame.stack_args = sp;
+                       this_arg = sp->data.p;
+                       if (!this_arg)
+                               THROW_EX (mono_get_exception_null_reference(), ip - 2);
+                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+
+                       MonoClass *this_class = this_arg->vtable->klass;
+                       if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+                               gpointer *unboxed = mono_object_unbox (this_arg);
+                               sp [0].data.p = unboxed;
+                       }
+
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               if (context->search_for_handler) {
+                                       context->search_for_handler = 0;
+                                       goto handle_exception;
+                               }
+                               goto handle_finally;
+                       }
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CALLRUN)
+                       ves_runtime_method (frame, context);
+                       if (frame->ex) {
+                               rtm = NULL;
+                               goto handle_exception;
+                       }
+                       goto exit_frame;
+               MINT_IN_CASE(MINT_RET)
+                       --sp;
+                       *frame->retval = *sp;
+                       if (sp > frame->stack)
+                               g_warning ("ret: more values on stack: %d", sp-frame->stack);
+                       goto exit_frame;
+               MINT_IN_CASE(MINT_RET_VOID)
+                       if (sp > frame->stack)
+                               g_warning ("ret.void: more values on stack: %d", sp-frame->stack);
+                       goto exit_frame;
+               MINT_IN_CASE(MINT_RET_VT)
+                       i32 = READ32(ip + 1);
+                       --sp;
+                       memcpy(frame->retval->data.p, sp->data.p, i32);
+                       if (sp > frame->stack)
+                               g_warning ("ret.vt: more values on stack: %d", sp-frame->stack);
+                       goto exit_frame;
+               MINT_IN_CASE(MINT_BR_S)
+                       ip += (short) *(ip + 1);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BR)
+                       ip += (gint32) READ32(ip + 1);
+                       MINT_IN_BREAK;
+#define ZEROP_S(datamem, op) \
+       --sp; \
+       if (sp->data.datamem op 0) \
+               ip += * (gint16 *)(ip + 1); \
+       else \
+               ip += 2;
+
+#define ZEROP(datamem, op) \
+       --sp; \
+       if (sp->data.datamem op 0) \
+               ip += READ32(ip + 1); \
+       else \
+               ip += 3;
+
+               MINT_IN_CASE(MINT_BRFALSE_I4_S)
+                       ZEROP_S(i, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRFALSE_I8_S)
+                       ZEROP_S(l, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRFALSE_R8_S)
+                       ZEROP_S(f, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRFALSE_I4)
+                       ZEROP(i, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRFALSE_I8)
+                       ZEROP(l, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRFALSE_R8)
+                       ZEROP_S(f, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_I4_S)
+                       ZEROP_S(i, !=);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_I8_S)
+                       ZEROP_S(l, !=);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_R8_S)
+                       ZEROP_S(f, !=);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_I4)
+                       ZEROP(i, !=);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_I8)
+                       ZEROP(l, !=);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BRTRUE_R8)
+                       ZEROP(f, !=);
+                       MINT_IN_BREAK;
+#define CONDBR_S(cond) \
+       sp -= 2; \
+       if (cond) \
+               ip += * (gint16 *)(ip + 1); \
+       else \
+               ip += 2;
+#define BRELOP_S(datamem, op) \
+       CONDBR_S(sp[0].data.datamem op sp[1].data.datamem)
+
+#define CONDBR(cond) \
+       sp -= 2; \
+       if (cond) \
+               ip += READ32(ip + 1); \
+       else \
+               ip += 3;
+
+#define BRELOP(datamem, op) \
+       CONDBR(sp[0].data.datamem op sp[1].data.datamem)
+
+               MINT_IN_CASE(MINT_BEQ_I4_S)
+                       BRELOP_S(i, ==)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BEQ_I8_S)
+                       BRELOP_S(l, ==)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BEQ_R8_S)
+                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f == sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BEQ_I4)
+                       BRELOP(i, ==)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BEQ_I8)
+                       BRELOP(l, ==)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BEQ_R8)
+                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f == sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_I4_S)
+                       BRELOP_S(i, >=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_I8_S)
+                       BRELOP_S(l, >=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_R8_S)
+                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f >= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_I4)
+                       BRELOP(i, >=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_I8)
+                       BRELOP(l, >=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_R8)
+                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f >= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_I4_S)
+                       BRELOP_S(i, >)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_I8_S)
+                       BRELOP_S(l, >)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_R8_S)
+                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f > sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_I4)
+                       BRELOP(i, >)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_I8)
+                       BRELOP(l, >)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_R8)
+                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f > sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_I4_S)
+                       BRELOP_S(i, <)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_I8_S)
+                       BRELOP_S(l, <)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_R8_S)
+                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f < sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_I4)
+                       BRELOP(i, <)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_I8)
+                       BRELOP(l, <)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_R8)
+                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f < sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_I4_S)
+                       BRELOP_S(i, <=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_I8_S)
+                       BRELOP_S(l, <=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_R8_S)
+                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_I4)
+                       BRELOP(i, <=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_I8)
+                       BRELOP(l, <=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_R8)
+                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_I4_S)
+                       BRELOP_S(i, !=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_I8_S)
+                       BRELOP_S(l, !=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_R8_S)
+                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f != sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_I4)
+                       BRELOP(i, !=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_I8)
+                       BRELOP(l, !=)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BNE_UN_R8)
+                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f != sp[1].data.f)
+                       MINT_IN_BREAK;
+
+#define BRELOP_S_CAST(datamem, op, type) \
+       sp -= 2; \
+       if ((type) sp[0].data.datamem op (type) sp[1].data.datamem) \
+               ip += * (gint16 *)(ip + 1); \
+       else \
+               ip += 2;
+
+#define BRELOP_CAST(datamem, op, type) \
+       sp -= 2; \
+       if ((type) sp[0].data.datamem op (type) sp[1].data.datamem) \
+               ip += READ32(ip + 1); \
+       else \
+               ip += 3;
+
+               MINT_IN_CASE(MINT_BGE_UN_I4_S)
+                       BRELOP_S_CAST(i, >=, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_UN_I8_S)
+                       BRELOP_S_CAST(l, >=, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_UN_R8_S)
+                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f >= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_UN_I4)
+                       BRELOP_CAST(i, >=, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_UN_I8)
+                       BRELOP_CAST(l, >=, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGE_UN_R8)
+                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f >= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_I4_S)
+                       BRELOP_S_CAST(i, >, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_I8_S)
+                       BRELOP_S_CAST(l, >, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_R8_S)
+                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f > sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_I4)
+                       BRELOP_CAST(i, >, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_I8)
+                       BRELOP_CAST(l, >, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BGT_UN_R8)
+                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f > sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_I4_S)
+                       BRELOP_S_CAST(i, <=, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_I8_S)
+                       BRELOP_S_CAST(l, <=, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_R8_S)
+                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f <= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_I4)
+                       BRELOP_CAST(i, <=, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_I8)
+                       BRELOP_CAST(l, <=, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLE_UN_R8)
+                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f <= sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_I4_S)
+                       BRELOP_S_CAST(i, <, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_I8_S)
+                       BRELOP_S_CAST(l, <, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_R8_S)
+                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f < sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_I4)
+                       BRELOP_CAST(i, <, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_I8)
+                       BRELOP_CAST(l, <, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BLT_UN_R8)
+                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f < sp[1].data.f)
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SWITCH) {
+                       guint32 n;
+                       const unsigned short *st;
+                       ++ip;
+                       n = READ32 (ip);
+                       ip += 2;
+                       st = ip + 2 * n;
+                       --sp;
+                       if ((guint32)sp->data.i < n) {
+                               gint offset;
+                               ip += 2 * (guint32)sp->data.i;
+                               offset = READ32 (ip);
+                               ip = st + offset;
+                       } else {
+                               ip = st;
+                       }
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDIND_I1)
+                       ++ip;
+                       sp[-1].data.i = *(gint8*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_U1)
+                       ++ip;
+                       sp[-1].data.i = *(guint8*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_I2)
+                       ++ip;
+                       sp[-1].data.i = *(gint16*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_U2)
+                       ++ip;
+                       sp[-1].data.i = *(guint16*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_I4) /* Fall through */
+               MINT_IN_CASE(MINT_LDIND_U4)
+                       ++ip;
+                       sp[-1].data.i = *(gint32*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_I8)
+                       ++ip;
+                       sp[-1].data.l = *(gint64*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_I) {
+                       guint16 offset = * (guint16 *)(ip + 1);
+                       sp[-1 - offset].data.p = *(gpointer*)sp[-1 - offset].data.p;
+                       ip += 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDIND_R4)
+                       ++ip;
+                       sp[-1].data.f = *(gfloat*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_R8)
+                       ++ip;
+                       sp[-1].data.f = *(gdouble*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDIND_REF)
+                       ++ip;
+                       sp[-1].data.p = *(gpointer*)sp[-1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_REF) 
+                       ++ip;
+                       sp -= 2;
+                       * (gpointer *) sp->data.p = sp[1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_I1)
+                       ++ip;
+                       sp -= 2;
+                       * (gint8 *) sp->data.p = (gint8)sp[1].data.i;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_I2)
+                       ++ip;
+                       sp -= 2;
+                       * (gint16 *) sp->data.p = (gint16)sp[1].data.i;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_I4)
+                       ++ip;
+                       sp -= 2;
+                       * (gint32 *) sp->data.p = sp[1].data.i;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_I)
+                       ++ip;
+                       sp -= 2;
+                       * (mono_i *) sp->data.p = (mono_i)sp[1].data.p;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_I8)
+                       ++ip;
+                       sp -= 2;
+                       * (gint64 *) sp->data.p = sp[1].data.l;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_R4)
+                       ++ip;
+                       sp -= 2;
+                       * (float *) sp->data.p = (gfloat)sp[1].data.f;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STIND_R8)
+                       ++ip;
+                       sp -= 2;
+                       * (double *) sp->data.p = sp[1].data.f;
+                       MINT_IN_BREAK;
+#define BINOP(datamem, op) \
+       --sp; \
+       sp [-1].data.datamem = sp [-1].data.datamem op sp [0].data.datamem; \
+       ++ip;
+               MINT_IN_CASE(MINT_ADD_I4)
+                       BINOP(i, +);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_I8)
+                       BINOP(l, +);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_R8)
+                       BINOP(f, +);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD1_I4)
+                       ++sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_I4)
+                       BINOP(i, -);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_I8)
+                       BINOP(l, -);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_R8)
+                       BINOP(f, -);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB1_I4)
+                       --sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_I4)
+                       BINOP(i, *);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_I8)
+                       BINOP(l, *);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_R8)
+                       BINOP(f, *);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DIV_I4)
+                       if (sp [-1].data.i == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       if (sp [-1].data.i == (-1))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(i, /);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DIV_I8)
+                       if (sp [-1].data.l == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       if (sp [-1].data.l == (-1))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(l, /);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DIV_R8)
+                       BINOP(f, /);
+                       MINT_IN_BREAK;
+
+#define BINOP_CAST(datamem, op, type) \
+       --sp; \
+       sp [-1].data.datamem = (type)sp [-1].data.datamem op (type)sp [0].data.datamem; \
+       ++ip;
+               MINT_IN_CASE(MINT_DIV_UN_I4)
+                       if (sp [-1].data.i == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       BINOP_CAST(i, /, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_DIV_UN_I8)
+                       if (sp [-1].data.l == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       BINOP_CAST(l, /, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_REM_I4)
+                       if (sp [-1].data.i == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       if (sp [-1].data.i == (-1))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(i, %);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_REM_I8)
+                       if (sp [-1].data.l == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       if (sp [-1].data.l == (-1))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(l, %);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_REM_R8)
+                       /* FIXME: what do we actually do here? */
+                       --sp;
+                       sp [-1].data.f = fmod (sp [-1].data.f, sp [0].data.f);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_REM_UN_I4)
+                       if (sp [-1].data.i == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       BINOP_CAST(i, %, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_REM_UN_I8)
+                       if (sp [-1].data.l == 0)
+                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
+                       BINOP_CAST(l, %, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_AND_I4)
+                       BINOP(i, &);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_AND_I8)
+                       BINOP(l, &);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_OR_I4)
+                       BINOP(i, |);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_OR_I8)
+                       BINOP(l, |);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_XOR_I4)
+                       BINOP(i, ^);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_XOR_I8)
+                       BINOP(l, ^);
+                       MINT_IN_BREAK;
+
+#define SHIFTOP(datamem, op) \
+       --sp; \
+       sp [-1].data.datamem = sp [-1].data.datamem op sp [0].data.i; \
+       ++ip;
+
+               MINT_IN_CASE(MINT_SHL_I4)
+                       SHIFTOP(i, <<);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SHL_I8)
+                       SHIFTOP(l, <<);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SHR_I4)
+                       SHIFTOP(i, >>);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SHR_I8)
+                       SHIFTOP(l, >>);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SHR_UN_I4)
+                       --sp;
+                       sp [-1].data.i = (guint32)sp [-1].data.i >> sp [0].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SHR_UN_I8)
+                       --sp;
+                       sp [-1].data.l = (guint64)sp [-1].data.l >> sp [0].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NEG_I4)
+                       sp [-1].data.i = - sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NEG_I8)
+                       sp [-1].data.l = - sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NEG_R8)
+                       sp [-1].data.f = - sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NOT_I4)
+                       sp [-1].data.i = ~ sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NOT_I8)
+                       sp [-1].data.l = ~ sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I1_I4)
+                       sp [-1].data.i = (gint8)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I1_I8)
+                       sp [-1].data.i = (gint8)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I1_R8)
+                       sp [-1].data.i = (gint8)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U1_I4)
+                       sp [-1].data.i = (guint8)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U1_I8)
+                       sp [-1].data.i = (guint8)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U1_R8)
+                       sp [-1].data.i = (guint8)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I2_I4)
+                       sp [-1].data.i = (gint16)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I2_I8)
+                       sp [-1].data.i = (gint16)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I2_R8)
+                       sp [-1].data.i = (gint16)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U2_I4)
+                       sp [-1].data.i = (guint16)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U2_I8)
+                       sp [-1].data.i = (guint16)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U2_R8)
+                       sp [-1].data.i = (guint16)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I4_R8)
+                       sp [-1].data.i = (gint32)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U4_I8)
+               MINT_IN_CASE(MINT_CONV_I4_I8)
+                       sp [-1].data.i = (gint32)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I4_I8_SP)
+                       sp [-2].data.i = (gint32)sp [-2].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U4_R8)
+                       sp [-1].data.i = (guint32)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I8_I4)
+                       sp [-1].data.l = sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I8_I4_SP)
+                       sp [-2].data.l = sp [-2].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I8_U4)
+                       sp [-1].data.l = (guint32)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_I8_R8)
+                       sp [-1].data.l = (gint64)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R4_I4)
+                       sp [-1].data.f = (float)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R4_I8)
+                       sp [-1].data.f = (float)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R4_R8)
+                       sp [-1].data.f = (float)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R8_I4)
+                       sp [-1].data.f = (double)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R8_I8)
+                       sp [-1].data.f = (double)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U8_I4)
+                       sp [-1].data.l = sp [-1].data.i & 0xffffffff;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_U8_R8)
+                       sp [-1].data.l = (guint64)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CPOBJ) {
+                       c = rtm->data_items[* (guint16 *)(ip + 1)];
+                       g_assert (c->byval_arg.type == MONO_TYPE_VALUETYPE);
+                       stackval_from_data (&c->byval_arg, &sp [-2], sp [-1].data.p, FALSE);
+                       ip += 2;
+                       sp -= 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDOBJ) {
+                       void *p;
+                       c = rtm->data_items[* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       p = sp [-1].data.p;
+                       if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
+                               int size = mono_class_value_size (c, NULL);
+                               sp [-1].data.p = vt_sp;
+                               vt_sp += (size + 7) & ~7;
+                       }
+                       stackval_from_data (&c->byval_arg, &sp [-1], p, FALSE);
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDSTR)
+                       sp->data.p = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ++sp;
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_NEWOBJ) {
+                       MonoClass *newobj_class;
+                       MonoMethodSignature *csig;
+                       stackval valuetype_this;
+                       guint32 token;
+                       stackval retval;
+
+                       frame->ip = ip;
+
+                       token = * (guint16 *)(ip + 1);
+                       ip += 2;
+
+                       child_frame.ip = NULL;
+                       child_frame.ex = NULL;
+
+                       child_frame.runtime_method = rtm->data_items [token];
+                       csig = mono_method_signature (child_frame.runtime_method->method);
+                       newobj_class = child_frame.runtime_method->method->klass;
+                       /*if (profiling_classes) {
+                               guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, newobj_class));
+                               count++;
+                               g_hash_table_insert (profiling_classes, newobj_class, GUINT_TO_POINTER (count));
+                       }*/
+
+                       if (newobj_class->parent == mono_defaults.array_class) {
+                               sp -= csig->param_count;
+                               child_frame.stack_args = sp;
+                               o = ves_array_create (&child_frame, context->domain, newobj_class, csig, sp);
+                               if (child_frame.ex)
+                                       THROW_EX (child_frame.ex, ip);
+                               goto array_constructed;
+                       }
+
+                       g_assert (csig->hasthis);
+                       if (csig->param_count) {
+                               sp -= csig->param_count;
+                               memmove (sp + 1, sp, csig->param_count * sizeof (stackval));
+                       }
+                       child_frame.stack_args = sp;
+
+                       /*
+                        * First arg is the object.
+                        */
+                       if (newobj_class->valuetype) {
+                               MonoType *t = &newobj_class->byval_arg;
+                               memset (&valuetype_this, 0, sizeof (stackval));
+                               if (!newobj_class->enumtype && (t->type == MONO_TYPE_VALUETYPE || (t->type == MONO_TYPE_GENERICINST && mono_type_generic_inst_is_valuetype (t)))) {
+                                       sp->data.p = vt_sp;
+                                       valuetype_this.data.p = vt_sp;
+                               } else {
+                                       sp->data.p = &valuetype_this;
+                               }
+                       } else {
+                               if (newobj_class != mono_defaults.string_class) {
+                                       context->managed_code = 0;
+                                       o = mono_object_new_checked (context->domain, newobj_class, &error);
+                                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                                       context->managed_code = 1;
+                                       if (*mono_thread_interruption_request_flag ())
+                                               mono_thread_interruption_checkpoint ();
+                                       sp->data.p = o;
+                               } else {
+                                       sp->data.p = NULL;
+                                       child_frame.retval = &retval;
+                               }
+                       }
+
+                       g_assert (csig->call_convention == MONO_CALL_DEFAULT);
+
+                       ves_exec_method_with_context (&child_frame, context);
+
+                       context->current_frame = frame;
+
+                       if (child_frame.ex) {
+                               /*
+                                * An exception occurred, need to run finally, fault and catch handlers..
+                                */
+                               frame->ex = child_frame.ex;
+                               goto handle_finally;
+                       }
+                       /*
+                        * a constructor returns void, but we need to return the object we created
+                        */
+array_constructed:
+                       if (newobj_class->valuetype && !newobj_class->enumtype) {
+                               *sp = valuetype_this;
+                       } else if (newobj_class == mono_defaults.string_class) {
+                               *sp = retval;
+                       } else {
+                               sp->data.p = o;
+                       }
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CASTCLASS)
+                       c = rtm->data_items [*(guint16 *)(ip + 1)];
+                       if ((o = sp [-1].data.p)) {
+                               MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               if (!isinst_obj)
+                                       THROW_EX (mono_get_exception_invalid_cast (), ip);
+                       }
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ISINST)
+                       c = rtm->data_items [*(guint16 *)(ip + 1)];
+                       if ((o = sp [-1].data.p)) {
+                               MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               if (!isinst_obj)
+                                       sp [-1].data.p = NULL;
+                       }
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R_UN_I4)
+                       sp [-1].data.f = (double)(guint32)sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_R_UN_I8)
+                       sp [-1].data.f = (double)(guint64)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_UNBOX)
+                       c = rtm->data_items[*(guint16 *)(ip + 1)];
+                       
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+
+                       MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       if (!(isinst_obj || ((o->vtable->klass->rank == 0) && (o->vtable->klass->element_class == c->element_class))))
+                               THROW_EX (mono_get_exception_invalid_cast (), ip);
+
+                       sp [-1].data.p = mono_object_unbox (o);
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_THROW)
+                       --sp;
+                       frame->ex_handler = NULL;
+                       if (!sp->data.p)
+                               sp->data.p = mono_get_exception_null_reference ();
+                       THROW_EX ((MonoException *)sp->data.p, ip);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLDA_UNSAFE)
+                       o = sp [-1].data.p;
+                       sp[-1].data.p = (char *)o + * (guint16 *)(ip + 1);
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLDA)
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       sp[-1].data.p = (char *)o + * (guint16 *)(ip + 1);
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CKNULL)
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+
+#define LDFLD(datamem, fieldtype) \
+       o = sp [-1].data.p; \
+       if (!o) \
+               THROW_EX (mono_get_exception_null_reference (), ip); \
+       sp[-1].data.datamem = * (fieldtype *)((char *)o + * (guint16 *)(ip + 1)) ; \
+       ip += 2;
+
+               MINT_IN_CASE(MINT_LDFLD_I1) LDFLD(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_U1) LDFLD(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_I2) LDFLD(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_U2) LDFLD(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_I4) LDFLD(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_I8) LDFLD(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_R4) LDFLD(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_R8) LDFLD(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_O) LDFLD(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFLD_P) LDFLD(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LDFLD_VT)
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       i32 = READ32(ip + 2);
+                       sp [-1].data.p = vt_sp;
+                       memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
+                       vt_sp += (i32 + 7) & ~7;
+                       ip += 4;
+                       MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LDRMFLD) {
+                       gpointer tmp;
+                       MonoClassField *field;
+                       char *addr;
+
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       field = rtm->data_items[* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       if (mono_object_is_transparent_proxy (o)) {
+                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
+
+                               addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       } else {
+                               addr = (char*)o + field->offset;
+                       }                               
+
+                       stackval_from_data (field->type, &sp [-1], addr, FALSE);
+                       MINT_IN_BREAK;
+               }
+
+               MINT_IN_CASE(MINT_LDRMFLD_VT) {
+                       MonoClassField *field;
+                       char *addr;
+                       gpointer tmp;
+
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       field = rtm->data_items[* (guint16 *)(ip + 1)];
+                       i32 = READ32(ip + 2);
+                       ip += 4;
+                       if (mono_object_is_transparent_proxy (o)) {
+                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
+                               addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       } else {
+                               addr = (char*)o + field->offset;
+                       }                               
+
+                       sp [-1].data.p = vt_sp;
+                       memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
+                       vt_sp += (i32 + 7) & ~7;
+                       memcpy(sp [-1].data.p, addr, i32);
+                       MINT_IN_BREAK;
+               }
+
+#define STFLD(datamem, fieldtype) \
+       o = sp [-2].data.p; \
+       if (!o) \
+               THROW_EX (mono_get_exception_null_reference (), ip); \
+       sp -= 2; \
+       * (fieldtype *)((char *)o + * (guint16 *)(ip + 1)) = sp[1].data.datamem; \
+       ip += 2;
+
+               MINT_IN_CASE(MINT_STFLD_I1) STFLD(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_U1) STFLD(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_I2) STFLD(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_U2) STFLD(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_I4) STFLD(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_I8) STFLD(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_R4) STFLD(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_R8) STFLD(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_O) STFLD(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STFLD_P) STFLD(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_STFLD_VT)
+                       o = sp [-2].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       i32 = READ32(ip + 2);
+                       sp -= 2;
+                       memcpy((char *)o + * (guint16 *)(ip + 1), sp [1].data.p, i32);
+                       vt_sp -= (i32 + 7) & ~7;
+                       ip += 4;
+                       MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_STRMFLD) {
+                       MonoClassField *field;
+
+                       o = sp [-2].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       
+                       field = rtm->data_items[* (guint16 *)(ip + 1)];
+                       ip += 2;
+
+                       if (mono_object_is_transparent_proxy (o)) {
+                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
+                               mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       } else
+                               stackval_to_data (field->type, &sp [-1], (char*)o + field->offset, FALSE);
+
+                       sp -= 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STRMFLD_VT) {
+                       MonoClassField *field;
+
+                       o = sp [-2].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       field = rtm->data_items[* (guint16 *)(ip + 1)];
+                       i32 = READ32(ip + 2);
+                       ip += 4;
+
+                       if (mono_object_is_transparent_proxy (o)) {
+                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
+                               mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       } else
+                               memcpy((char*)o + field->offset, sp [-1].data.p, i32);
+
+                       sp -= 2;
+                       vt_sp -= (i32 + 7) & ~7;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDSFLDA) {
+                       MonoClassField *field = rtm->data_items[*(guint16 *)(ip + 1)];
+                       sp->data.p = mono_class_static_field_address (context->domain, field);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDSFLD) {
+                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
+                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       stackval_from_data (field->type, sp, addr, FALSE);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDSFLD_VT) {
+                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
+                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       int size = READ32 (ip + 2);
+                       ip += 4;
+
+                       sp->data.p = vt_sp;
+                       vt_sp += (size + 7) & ~7;
+                       stackval_from_data (field->type, sp, addr, FALSE);
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STSFLD) {
+                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
+                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       ip += 2;
+                       --sp;
+                       stackval_to_data (field->type, sp, addr, FALSE);
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STSFLD_VT) {
+                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
+                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       int size = READ32 (ip + 2);
+                       ip += 4;
+
+                       --sp;
+                       stackval_to_data (field->type, sp, addr, FALSE);
+                       vt_sp -= (size + 7) & ~7;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STOBJ_VT) {
+                       int size;
+                       c = rtm->data_items[* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       size = mono_class_value_size (c, NULL);
+                       memcpy(sp [-2].data.p, sp [-1].data.p, size);
+                       vt_sp -= (size + 7) & ~7;
+                       sp -= 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STOBJ) {
+                       int size;
+                       c = rtm->data_items[* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       size = mono_class_value_size (c, NULL);
+                       memcpy(sp [-2].data.p, &sp [-1].data, size);
+                       sp -= 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CONV_OVF_I4_UN_R8)
+                       if (sp [-1].data.f < 0 || sp [-1].data.f > MYGUINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint32)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U8_I4)
+                       if (sp [-1].data.i < 0)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.l = sp [-1].data.i;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U8_I8)
+                       if (sp [-1].data.l < 0)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I8_U8)
+                       if ((guint64) sp [-1].data.l > MYGINT64_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U8_R8)
+               MINT_IN_CASE(MINT_CONV_OVF_I8_UN_R8)
+                       if (sp [-1].data.f < 0 || sp [-1].data.f > MYGINT64_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.l = (guint64)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I8_R8)
+                       if (sp [-1].data.f < MYGINT64_MIN || sp [-1].data.f > MYGINT64_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.l = (gint64)sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I4_UN_I8)
+                       if ((mono_u)sp [-1].data.l > MYGUINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (mono_u)sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_BOX) {
+                       c = rtm->data_items [* (guint16 *)(ip + 1)];
+                       guint16 offset = * (guint16 *)(ip + 2);
+
+                       if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
+                               int size = mono_class_value_size (c, NULL);
+                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, sp [-1 - offset].data.p, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               size = (size + 7) & ~7;
+                               vt_sp -= size;
+                       } else {
+                               stackval_to_data (&c->byval_arg, &sp [-1 - offset], (char *) &sp [-1 - offset], FALSE);
+                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, &sp [-1 - offset], &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+                       ip += 3;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_NEWARR)
+                       sp [-1].data.p = (MonoObject*) mono_array_new_checked (context->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
+                       if (!mono_error_ok (&error)) {
+                               THROW_EX (mono_error_convert_to_exception (&error), ip);
+                       }
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       ip += 2;
+                       /*if (profiling_classes) {
+                               guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, o->vtable->klass));
+                               count++;
+                               g_hash_table_insert (profiling_classes, o->vtable->klass, GUINT_TO_POINTER (count));
+                       }*/
+
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLEN)
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       sp [-1].data.nati = mono_array_length ((MonoArray *)o);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_GETCHR) {
+                       MonoString *s;
+                       s = sp [-2].data.p;
+                       if (!s)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       i32 = sp [-1].data.i;
+                       if (i32 < 0 || i32 >= mono_string_length (s))
+                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
+                       --sp;
+                       sp [-1].data.i = mono_string_chars(s)[i32];
+                       ++ip;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STRLEN)
+                       ++ip;
+                       sp [-1].data.i = mono_string_length ((MonoString*)sp [-1].data.p);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ARRAY_RANK)
+                       o = sp [-1].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+                       sp [-1].data.i = mono_object_class (sp [-1].data.p)->rank;
+                       ip++;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDELEMA)
+               MINT_IN_CASE(MINT_LDELEMA_TC) {
+                       gboolean needs_typecheck = *ip == MINT_LDELEMA_TC;
+                       
+                       MonoClass *klass = rtm->data_items [*(guint16 *) (ip + 1)];
+                       guint16 numargs = *(guint16 *) (ip + 2);
+                       ip += 3;
+                       sp -= numargs;
+
+                       o = sp [0].data.p;
+                       sp->data.p = ves_array_element_address (frame, klass, (MonoArray *) o, &sp [1], needs_typecheck);
+                       if (frame->ex)
+                               THROW_EX (frame->ex, ip);
+                       ++sp;
+
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDELEM_I1) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_U1) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_I2) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_U2) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_I4) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_U4) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_I8)  /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_I)  /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_R4) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_R8) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_REF) /* fall through */
+               MINT_IN_CASE(MINT_LDELEM_VT) {
+                       MonoArray *o;
+                       mono_u aindex;
+
+                       sp -= 2;
+
+                       o = sp [0].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+
+                       aindex = sp [1].data.i;
+                       if (aindex >= mono_array_length (o))
+                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
+
+                       /*
+                        * FIXME: throw mono_get_exception_array_type_mismatch () if needed 
+                        */
+                       switch (*ip) {
+                       case MINT_LDELEM_I1:
+                               sp [0].data.i = mono_array_get (o, gint8, aindex);
+                               break;
+                       case MINT_LDELEM_U1:
+                               sp [0].data.i = mono_array_get (o, guint8, aindex);
+                               break;
+                       case MINT_LDELEM_I2:
+                               sp [0].data.i = mono_array_get (o, gint16, aindex);
+                               break;
+                       case MINT_LDELEM_U2:
+                               sp [0].data.i = mono_array_get (o, guint16, aindex);
+                               break;
+                       case MINT_LDELEM_I:
+                               sp [0].data.nati = mono_array_get (o, mono_i, aindex);
+                               break;
+                       case MINT_LDELEM_I4:
+                               sp [0].data.i = mono_array_get (o, gint32, aindex);
+                               break;
+                       case MINT_LDELEM_U4:
+                               sp [0].data.i = mono_array_get (o, guint32, aindex);
+                               break;
+                       case MINT_LDELEM_I8:
+                               sp [0].data.l = mono_array_get (o, guint64, aindex);
+                               break;
+                       case MINT_LDELEM_R4:
+                               sp [0].data.f = mono_array_get (o, float, aindex);
+                               break;
+                       case MINT_LDELEM_R8:
+                               sp [0].data.f = mono_array_get (o, double, aindex);
+                               break;
+                       case MINT_LDELEM_REF:
+                               sp [0].data.p = mono_array_get (o, gpointer, aindex);
+                               break;
+                       case MINT_LDELEM_VT: {
+                               MonoClass *klass_vt = rtm->data_items [*(guint16 *) (ip + 1)];
+                               i32 = READ32 (ip + 2);
+                               char *src_addr = mono_array_addr_with_size ((MonoArray *) o, i32, aindex);
+                               sp [0].data.vt = vt_sp;
+                               stackval_from_data (&klass_vt->byval_arg, sp, src_addr, FALSE);
+                               vt_sp += (i32 + 7) & ~7;
+                               ip += 3;
+                               break;
+                       }
+                       default:
+                               ves_abort();
+                       }
+
+                       ++ip;
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_STELEM_I)  /* fall through */
+               MINT_IN_CASE(MINT_STELEM_I1) /* fall through */ 
+               MINT_IN_CASE(MINT_STELEM_U1) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_I2) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_I4) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_I8) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_R4) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_R8) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_REF) /* fall through */
+               MINT_IN_CASE(MINT_STELEM_VT) {
+                       mono_u aindex;
+
+                       sp -= 3;
+
+                       o = sp [0].data.p;
+                       if (!o)
+                               THROW_EX (mono_get_exception_null_reference (), ip);
+
+                       aindex = sp [1].data.i;
+                       if (aindex >= mono_array_length ((MonoArray *)o))
+                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
+
+                       switch (*ip) {
+                       case MINT_STELEM_I:
+                               mono_array_set ((MonoArray *)o, mono_i, aindex, sp [2].data.nati);
+                               break;
+                       case MINT_STELEM_I1:
+                               mono_array_set ((MonoArray *)o, gint8, aindex, sp [2].data.i);
+                               break;
+                       case MINT_STELEM_U1:
+                               mono_array_set ((MonoArray *) o, guint8, aindex, sp [2].data.i);
+                               break;
+                       case MINT_STELEM_I2:
+                               mono_array_set ((MonoArray *)o, gint16, aindex, sp [2].data.i);
+                               break;
+                       case MINT_STELEM_I4:
+                               mono_array_set ((MonoArray *)o, gint32, aindex, sp [2].data.i);
+                               break;
+                       case MINT_STELEM_I8:
+                               mono_array_set ((MonoArray *)o, gint64, aindex, sp [2].data.l);
+                               break;
+                       case MINT_STELEM_R4:
+                               mono_array_set ((MonoArray *)o, float, aindex, sp [2].data.f);
+                               break;
+                       case MINT_STELEM_R8:
+                               mono_array_set ((MonoArray *)o, double, aindex, sp [2].data.f);
+                               break;
+                       case MINT_STELEM_REF: {
+                               MonoObject *isinst_obj = mono_object_isinst_checked (sp [2].data.p, mono_object_class (o)->element_class, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               if (sp [2].data.p && !isinst_obj)
+                                       THROW_EX (mono_get_exception_array_type_mismatch (), ip);
+                               mono_array_set ((MonoArray *)o, gpointer, aindex, sp [2].data.p);
+                               break;
+                       }
+                       case MINT_STELEM_VT: {
+                               MonoClass *klass_vt = rtm->data_items [*(guint16 *) (ip + 1)];
+                               i32 = READ32 (ip + 2);
+                               char *dst_addr = mono_array_addr_with_size ((MonoArray *) o, i32, aindex);
+
+                               stackval_to_data (&klass_vt->byval_arg, &sp [2], dst_addr, FALSE);
+                               vt_sp -= (i32 + 7) & ~7;
+                               ip += 3;
+                               break;
+                       }
+                       default:
+                               ves_abort();
+                       }
+
+                       ++ip;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_CONV_OVF_I4_U4)
+                       if (sp [-1].data.i < 0)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I4_I8)
+                       if (sp [-1].data.l < MYGINT32_MIN || sp [-1].data.l > MYGINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint32) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I4_U8)
+                       if (sp [-1].data.l < 0 || sp [-1].data.l > MYGINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint32) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I4_R8)
+                       if (sp [-1].data.f < MYGINT32_MIN || sp [-1].data.f > MYGINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint32) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U4_I4)
+                       if (sp [-1].data.i < 0)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U4_I8)
+                       if (sp [-1].data.l < 0 || sp [-1].data.l > MYGUINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint32) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U4_R8)
+                       if (sp [-1].data.f < 0 || sp [-1].data.f > MYGUINT32_MAX)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint32) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I2_I4)
+                       if (sp [-1].data.i < -32768 || sp [-1].data.i > 32767)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I2_I8)
+                       if (sp [-1].data.l < -32768 || sp [-1].data.l > 32767)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint16) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I2_R8)
+                       if (sp [-1].data.f < -32768 || sp [-1].data.f > 32767)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint16) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U2_I4)
+                       if (sp [-1].data.i < 0 || sp [-1].data.i > 65535)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U2_I8)
+                       if (sp [-1].data.l < 0 || sp [-1].data.l > 65535)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint16) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U2_R8)
+                       if (sp [-1].data.f < 0 || sp [-1].data.f > 65535)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint16) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I1_I4)
+                       if (sp [-1].data.i < -128 || sp [-1].data.i > 127)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I1_I8)
+                       if (sp [-1].data.l < -128 || sp [-1].data.l > 127)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint8) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_I1_R8)
+                       if (sp [-1].data.f < -128 || sp [-1].data.f > 127)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (gint8) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U1_I4)
+                       if (sp [-1].data.i < 0 || sp [-1].data.i > 255)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U1_I8)
+                       if (sp [-1].data.l < 0 || sp [-1].data.l > 255)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint8) sp [-1].data.l;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CONV_OVF_U1_R8)
+                       if (sp [-1].data.f < 0 || sp [-1].data.f > 255)
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       sp [-1].data.i = (guint8) sp [-1].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+#if 0
+               MINT_IN_CASE(MINT_LDELEM) 
+               MINT_IN_CASE(MINT_STELEM) 
+               MINT_IN_CASE(MINT_UNBOX_ANY) 
+
+               MINT_IN_CASE(MINT_REFANYVAL) ves_abort(); MINT_IN_BREAK;
+#endif
+               MINT_IN_CASE(MINT_CKFINITE)
+                       if (!isfinite(sp [-1].data.f))
+                               THROW_EX (mono_get_exception_arithmetic (), ip);
+                       ++ip;
+                       MINT_IN_BREAK;
+#if 0
+               MINT_IN_CASE(MINT_MKREFANY) ves_abort(); MINT_IN_BREAK;
+#endif
+               MINT_IN_CASE(MINT_LDTOKEN)
+                       sp->data.p = vt_sp;
+                       vt_sp += 8;
+                       * (gpointer *)sp->data.p = rtm->data_items[*(guint16 *)(ip + 1)];
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_OVF_I4)
+                       if (CHECK_ADD_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(i, +);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_OVF_I8)
+                       if (CHECK_ADD_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(l, +);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_OVF_UN_I4)
+                       if (CHECK_ADD_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(i, +, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ADD_OVF_UN_I8)
+                       if (CHECK_ADD_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(l, +, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_OVF_I4)
+                       if (CHECK_MUL_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(i, *);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_OVF_I8)
+                       if (CHECK_MUL_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(l, *);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_OVF_UN_I4)
+                       if (CHECK_MUL_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(i, *, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MUL_OVF_UN_I8)
+                       if (CHECK_MUL_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(l, *, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_OVF_I4)
+                       if (CHECK_SUB_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(i, -);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_OVF_I8)
+                       if (CHECK_SUB_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP(l, -);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_OVF_UN_I4)
+                       if (CHECK_SUB_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(i, -, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_SUB_OVF_UN_I8)
+                       if (CHECK_SUB_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
+                               THROW_EX (mono_get_exception_overflow (), ip);
+                       BINOP_CAST(l, -, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ENDFINALLY)
+                       if (finally_ips) {
+                               ip = finally_ips->data;
+                               finally_ips = g_slist_remove (finally_ips, ip);
+                               goto main_loop;
+                       }
+                       if (frame->ex)
+                               goto handle_fault;
+                       ves_abort();
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LEAVE) /* Fall through */
+               MINT_IN_CASE(MINT_LEAVE_S)
+                       while (sp > frame->stack) {
+                               --sp;
+                       }
+                       frame->ip = ip;
+                       if (*ip == MINT_LEAVE_S) {
+                               ip += (short) *(ip + 1);
+                       } else {
+                               ip += (gint32) READ32 (ip + 1);
+                       }
+                       endfinally_ip = ip;
+                       if (frame->ex_handler != NULL && MONO_OFFSET_IN_HANDLER(frame->ex_handler, frame->ip - rtm->code)) {
+                               frame->ex_handler = NULL;
+                               frame->ex = NULL;
+                       }
+                       goto handle_finally;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_ICALL_V_V) 
+               MINT_IN_CASE(MINT_ICALL_V_P)
+               MINT_IN_CASE(MINT_ICALL_P_V) 
+               MINT_IN_CASE(MINT_ICALL_P_P)
+               MINT_IN_CASE(MINT_ICALL_PP_V)
+               MINT_IN_CASE(MINT_ICALL_PI_V)
+               MINT_IN_CASE(MINT_ICALL_PP_P)
+               MINT_IN_CASE(MINT_ICALL_PI_P)
+               MINT_IN_CASE(MINT_ICALL_PPP_V)
+               MINT_IN_CASE(MINT_ICALL_PPI_V)
+                       sp = do_icall (context, *ip, sp, rtm->data_items [*(guint16 *)(ip + 1)]);
+                       if (frame->ex != NULL)
+                               goto handle_exception;
+                       ip += 2;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MONO_LDPTR) 
+                       sp->data.p = rtm->data_items [*(guint16 *)(ip + 1)];
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MONO_NEWOBJ)
+                       sp->data.p = mono_object_new_checked (context->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       ip += 2;
+                       sp++;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MONO_FREE)
+                       ++ip;
+                       --sp;
+                       g_error ("that doesn't seem right");
+                       g_free (sp->data.p);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_MONO_RETOBJ)
+                       ++ip;
+                       sp--;
+                       stackval_from_data (mono_method_signature (frame->runtime_method->method)->ret, frame->retval, sp->data.p,
+                            mono_method_signature (frame->runtime_method->method)->pinvoke);
+                       if (sp > frame->stack)
+                               g_warning ("retobj: more values on stack: %d", sp-frame->stack);
+                       goto exit_frame;
+
+#define RELOP(datamem, op) \
+       --sp; \
+       sp [-1].data.i = sp [-1].data.datamem op sp [0].data.datamem; \
+       ++ip;
+               MINT_IN_CASE(MINT_CEQ_I4)
+                       RELOP(i, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CEQ0_I4)
+                       sp [-1].data.i = (sp [-1].data.i == 0);
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CEQ_I8)
+                       RELOP(l, ==);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CEQ_R8)
+                       --sp; 
+                       if (isunordered (sp [-1].data.f, sp [0].data.f))
+                               sp [-1].data.i = 0;
+                       else
+                               sp [-1].data.i = sp [-1].data.f == sp [0].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CGT_I4)
+                       RELOP(i, >);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CGT_I8)
+                       RELOP(l, >);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CGT_R8)
+                       --sp; 
+                       if (isunordered (sp [-1].data.f, sp [0].data.f))
+                               sp [-1].data.i = 0;
+                       else
+                               sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+
+#define RELOP_CAST(datamem, op, type) \
+       --sp; \
+       sp [-1].data.i = (type)sp [-1].data.datamem op (type)sp [0].data.datamem; \
+       ++ip;
+
+               MINT_IN_CASE(MINT_CGT_UN_I4)
+                       RELOP_CAST(i, >, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CGT_UN_I8)
+                       RELOP_CAST(l, >, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CGT_UN_R8)
+                       --sp; 
+                       if (isunordered (sp [-1].data.f, sp [0].data.f))
+                               sp [-1].data.i = 1;
+                       else
+                               sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_I4)
+                       RELOP(i, <);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_I8)
+                       RELOP(l, <);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_R8)
+                       --sp; 
+                       if (isunordered (sp [-1].data.f, sp [0].data.f))
+                               sp [-1].data.i = 0;
+                       else
+                               sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_UN_I4)
+                       RELOP_CAST(i, <, guint32);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_UN_I8)
+                       RELOP_CAST(l, <, guint64);
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CLT_UN_R8)
+                       --sp; 
+                       if (isunordered (sp [-1].data.f, sp [0].data.f))
+                               sp [-1].data.i = 1;
+                       else
+                               sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
+                       ++ip;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDFTN) {
+                       sp->data.p = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ++sp;
+                       ip += 2;
+                       MINT_IN_BREAK;
+               }
+               MINT_IN_CASE(MINT_LDVIRTFTN) {
+                       RuntimeMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
+                       ip += 2;
+                       --sp;
+                       if (!sp->data.p)
+                               THROW_EX (mono_get_exception_null_reference (), ip - 2);
+                               
+                       sp->data.p = get_virtual_method (context->domain, m, sp->data.p);
+                       ++sp;
+                       MINT_IN_BREAK;
+               }
+
+               MINT_IN_CASE(MINT_LDTHISA)
+                       g_error ("should not happen");
+                       // sp->data.p = &frame->obj;
+                       ++ip;
+                       ++sp; 
+                       MINT_IN_BREAK;
+
+#define LDARG(datamem, argtype) \
+       sp->data.datamem = * (argtype *)(frame->args + * (guint16 *)(ip + 1)); \
+       ip += 2; \
+       ++sp; 
+       
+               MINT_IN_CASE(MINT_LDARG_I1) LDARG(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_U1) LDARG(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_I2) LDARG(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_U2) LDARG(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_I4) LDARG(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_I8) LDARG(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_R4) LDARG(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_R8) LDARG(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_O) LDARG(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDARG_P) LDARG(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LDARG_VT)
+                       sp->data.p = vt_sp;
+                       i32 = READ32(ip + 2);
+                       memcpy(sp->data.p, frame->args + * (guint16 *)(ip + 1), i32);
+                       vt_sp += (i32 + 7) & ~7;
+                       ip += 4;
+                       ++sp;
+                       MINT_IN_BREAK;
+
+#define STARG(datamem, argtype) \
+       --sp; \
+       * (argtype *)(frame->args + * (guint16 *)(ip + 1)) = sp->data.datamem; \
+       ip += 2; \
+       
+               MINT_IN_CASE(MINT_STARG_I1) STARG(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_U1) STARG(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_I2) STARG(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_U2) STARG(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_I4) STARG(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_I8) STARG(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_R4) STARG(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_R8) STARG(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_O) STARG(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STARG_P) STARG(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_STARG_VT) 
+                       i32 = READ32(ip + 2);
+                       --sp;
+                       memcpy(frame->args + * (guint16 *)(ip + 1), sp->data.p, i32);
+                       vt_sp -= (i32 + 7) & ~7;
+                       ip += 4;
+                       MINT_IN_BREAK;
+
+#define STINARG(datamem, argtype) \
+       do { \
+               int n = * (guint16 *)(ip + 1); \
+               * (argtype *)(frame->args + rtm->arg_offsets [n]) = frame->stack_args [n].data.datamem; \
+               ip += 2; \
+       } while (0)
+       
+               MINT_IN_CASE(MINT_STINARG_I1) STINARG(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_U1) STINARG(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_I2) STINARG(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_U2) STINARG(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_I4) STINARG(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_I8) STINARG(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_R4) STINARG(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_R8) STINARG(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_O) STINARG(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STINARG_P) STINARG(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_STINARG_VT) {
+                       int n = * (guint16 *)(ip + 1);
+                       i32 = READ32(ip + 2);
+                       memcpy (frame->args + rtm->arg_offsets [n], frame->stack_args [n].data.p, i32);
+                       ip += 4;
+                       MINT_IN_BREAK;
+               }
+
+               MINT_IN_CASE(MINT_LDARGA)
+                       sp->data.p = frame->args + * (guint16 *)(ip + 1);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+
+#define LDLOC(datamem, argtype) \
+       sp->data.datamem = * (argtype *)(locals + * (guint16 *)(ip + 1)); \
+       ip += 2; \
+       ++sp; 
+       
+               MINT_IN_CASE(MINT_LDLOC_I1) LDLOC(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_U1) LDLOC(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_I2) LDLOC(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_U2) LDLOC(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_I4) LDLOC(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_I8) LDLOC(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_R4) LDLOC(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_R8) LDLOC(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_O) LDLOC(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_LDLOC_P) LDLOC(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LDLOC_VT)
+                       sp->data.p = vt_sp;
+                       i32 = READ32(ip + 2);
+                       memcpy(sp->data.p, locals + * (guint16 *)(ip + 1), i32);
+                       vt_sp += (i32 + 7) & ~7;
+                       ip += 4;
+                       ++sp;
+                       MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LDLOCA_S)
+                       sp->data.p = locals + * (guint16 *)(ip + 1);
+                       ip += 2;
+                       ++sp;
+                       MINT_IN_BREAK;
+
+#define STLOC(datamem, argtype) \
+       --sp; \
+       * (argtype *)(locals + * (guint16 *)(ip + 1)) = sp->data.datamem; \
+       ip += 2;
+       
+               MINT_IN_CASE(MINT_STLOC_I1) STLOC(i, gint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_U1) STLOC(i, guint8); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_I2) STLOC(i, gint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_U2) STLOC(i, guint16); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_I4) STLOC(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_I8) STLOC(l, gint64); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_R4) STLOC(f, float); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_R8) STLOC(f, double); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_O) STLOC(p, gpointer); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_P) STLOC(p, gpointer); MINT_IN_BREAK;
+
+#define STLOC_NP(datamem, argtype) \
+       * (argtype *)(locals + * (guint16 *)(ip + 1)) = sp [-1].data.datamem; \
+       ip += 2;
+
+               MINT_IN_CASE(MINT_STLOC_NP_I4) STLOC_NP(i, gint32); MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_STLOC_NP_O) STLOC_NP(p, gpointer); MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_STLOC_VT)
+                       i32 = READ32(ip + 2);
+                       --sp;
+                       memcpy(locals + * (guint16 *)(ip + 1), sp->data.p, i32);
+                       vt_sp -= (i32 + 7) & ~7;
+                       ip += 4;
+                       MINT_IN_BREAK;
+
+               MINT_IN_CASE(MINT_LOCALLOC) {
+                       if (sp != frame->stack + 1) /*FIX?*/
+                               THROW_EX (mono_get_exception_execution_engine (NULL), ip);
+
+                       int len = sp [-1].data.i;
+                       sp [-1].data.p = alloca (len);
+                       MonoMethodHeader *header = mono_method_get_header_checked (frame->runtime_method->method, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       if (header->init_locals)
+                               memset (sp [-1].data.p, 0, len);
+                       ++ip;
+                       MINT_IN_BREAK;
+               }
+#if 0
+               MINT_IN_CASE(MINT_ENDFILTER) ves_abort(); MINT_IN_BREAK;
+#endif
+               MINT_IN_CASE(MINT_INITOBJ)
+                       --sp;
+                       memset (sp->data.vt, 0, READ32(ip + 1));
+                       ip += 3;
+                       MINT_IN_BREAK;
+               MINT_IN_CASE(MINT_CPBLK)
+                       sp -= 3;
+                       if (!sp [0].data.p || !sp [1].data.p)
+                               THROW_EX (mono_get_exception_null_reference(), ip - 1);
+                       ++ip;
+                       /* FIXME: value and size may be int64... */
+                       memcpy (sp [0].data.p, sp [1].data.p, sp [2].data.i);
+                       MINT_IN_BREAK;
+#if 0
+               MINT_IN_CASE(MINT_CONSTRAINED_) {
+                       guint32 token;
+                       /* FIXME: implement */
+                       ++ip;
+                       token = READ32 (ip);
+                       ip += 2;
+                       MINT_IN_BREAK;
+               }
+#endif
+               MINT_IN_CASE(MINT_INITBLK)
+                       sp -= 3;
+                       if (!sp [0].data.p)
+                               THROW_EX (mono_get_exception_null_reference(), ip - 1);
+                       ++ip;
+                       /* FIXME: value and size may be int64... */
+                       memset (sp [0].data.p, sp [1].data.i, sp [2].data.i);
+                       MINT_IN_BREAK;
+#if 0
+               MINT_IN_CASE(MINT_NO_)
+                       /* FIXME: implement */
+                       ip += 2;
+                       MINT_IN_BREAK;
+#endif
+               MINT_IN_CASE(MINT_RETHROW)
+                       /* 
+                        * need to clarify what this should actually do:
+                        * start the search from the last found handler in
+                        * this method or continue in the caller or what.
+                        * Also, do we need to run finally/fault handlers after a retrow?
+                        * Well, this implementation will follow the usual search
+                        * for an handler, considering the current ip as throw spot.
+                        * We need to NULL frame->ex_handler for the later code to
+                        * actually run the new found handler.
+                        */
+                       frame->ex_handler = NULL;
+                       THROW_EX (frame->ex, ip - 1);
+                       MINT_IN_BREAK;
+               MINT_IN_DEFAULT
+                       g_print ("Unimplemented opcode: %04x %s at 0x%x\n", *ip, mono_interp_opname[*ip], ip-rtm->code);
+                       THROW_EX (mono_get_exception_execution_engine ("Unimplemented opcode"), ip);
+               }
+       }
+
+       g_assert_not_reached ();
+       /*
+        * Exception handling code.
+        * The exception object is stored in frame->ex.
+        */
+
+       handle_exception:
+       {
+               int i;
+               guint32 ip_offset;
+               MonoInvocation *inv;
+               MonoExceptionClause *clause;
+               /*char *message;*/
+               MonoObject *ex_obj;
+
+#if DEBUG_INTERP
+               if (tracing)
+                       g_print ("* Handling exception '%s' at IL_%04x\n", 
+                               frame->ex == NULL ? "** Unknown **" : mono_object_class (frame->ex)->name, 
+                               rtm == NULL ? 0 : frame->ip - rtm->code);
+#endif
+               if (die_on_exception)
+                       goto die_on_ex;
+
+               for (inv = frame; inv; inv = inv->parent) {
+                       MonoMethod *method;
+                       if (inv->runtime_method == NULL)
+                               continue;
+                       method = inv->runtime_method->method;
+                       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+                               continue;
+                       if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
+                               continue;
+                       if (inv->ip == NULL)
+                               continue;
+                       ip_offset = inv->ip - inv->runtime_method->code;
+                       inv->ex_handler = NULL; /* clear this in case we are trhowing an exception while handling one  - this one wins */
+                       for (i = 0; i < inv->runtime_method->num_clauses; ++i) {
+                               clause = &inv->runtime_method->clauses [i];
+                               if (clause->flags <= 1 && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
+                                       if (!clause->flags) {
+                                               MonoObject *isinst_obj = mono_object_isinst_checked ((MonoObject*)frame->ex, clause->data.catch_class, &error);
+                                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                                               if (isinst_obj) {
+                                                       /* 
+                                                        * OK, we found an handler, now we need to execute the finally
+                                                        * and fault blocks before branching to the handler code.
+                                                        */
+                                                       inv->ex_handler = clause;
+#if DEBUG_INTERP
+                                                       if (tracing)
+                                                               g_print ("* Found handler at '%s'\n", method->name);
+#endif
+                                                       goto handle_finally;
+                                               }
+                                       } else {
+                                               g_error ("FIXME: handle filter clause");
+                                       }
+                               }
+                       }
+               }
+               /*
+                * If we get here, no handler was found: print a stack trace.
+                */
+               for (inv = frame; inv; inv = inv->parent) {
+                       if (inv->invoke_trap)
+                               goto handle_finally;
+               }
+die_on_ex:
+               ex_obj = (MonoObject*)frame->ex;
+               mono_unhandled_exception (ex_obj);
+               exit (1);
+       }
+       handle_finally:
+       {
+               int i;
+               guint32 ip_offset;
+               MonoExceptionClause *clause;
+               GSList *old_list = finally_ips;
+               MonoMethod *method = frame->runtime_method->method;
+               MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               
+#if DEBUG_INTERP
+               if (tracing)
+                       g_print ("* Handle finally IL_%04x\n", endfinally_ip == NULL ? 0 : endfinally_ip - rtm->code);
+#endif
+               if (rtm == NULL || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) 
+                               || (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))) {
+                       goto exit_frame;
+               }
+               ip_offset = frame->ip - rtm->code;
+
+               if (endfinally_ip != NULL)
+                       finally_ips = g_slist_prepend(finally_ips, (void *)endfinally_ip);
+               for (i = 0; i < header->num_clauses; ++i)
+                       if (frame->ex_handler == &rtm->clauses [i])
+                               break;
+               while (i > 0) {
+                       --i;
+                       clause = &rtm->clauses [i];
+                       if (MONO_OFFSET_IN_CLAUSE (clause, ip_offset) && (endfinally_ip == NULL || !(MONO_OFFSET_IN_CLAUSE (clause, endfinally_ip - rtm->code)))) {
+                               if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
+                                       ip = rtm->code + clause->handler_offset;
+                                       finally_ips = g_slist_prepend (finally_ips, (gpointer) ip);
+#if DEBUG_INTERP
+                                       if (tracing)
+                                               g_print ("* Found finally at IL_%04x with exception: %s\n", clause->handler_offset, frame->ex? "yes": "no");
+#endif
+                               }
+                       }
+               }
+
+               endfinally_ip = NULL;
+
+               if (old_list != finally_ips && finally_ips) {
+                       ip = finally_ips->data;
+                       finally_ips = g_slist_remove (finally_ips, ip);
+                       sp = frame->stack; /* spec says stack should be empty at endfinally so it should be at the start too */
+                       goto main_loop;
+               }
+
+               /*
+                * If an exception is set, we need to execute the fault handler, too,
+                * otherwise, we continue normally.
+                */
+               if (frame->ex)
+                       goto handle_fault;
+               ves_abort();
+       }
+       handle_fault:
+       {
+               int i;
+               guint32 ip_offset;
+               MonoExceptionClause *clause;
+               MonoMethod *method = frame->runtime_method->method;
+               MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               
+#if DEBUG_INTERP
+               if (tracing)
+                       g_print ("* Handle fault\n");
+#endif
+               ip_offset = frame->ip - rtm->code;
+               for (i = 0; i < header->num_clauses; ++i) {
+                       clause = &rtm->clauses [i];
+                       if (clause->flags == MONO_EXCEPTION_CLAUSE_FAULT && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
+                               ip = rtm->code + clause->handler_offset;
+#if DEBUG_INTERP
+                               if (tracing)
+                                       g_print ("* Executing handler at IL_%04x\n", clause->handler_offset);
+#endif
+                               goto main_loop;
+                       }
+               }
+               /*
+                * If the handler for the exception was found in this method, we jump
+                * to it right away, otherwise we return and let the caller run
+                * the finally, fault and catch blocks.
+                * This same code should be present in the endfault opcode, but it
+                * is corrently not assigned in the ECMA specs: LAMESPEC.
+                */
+               if (frame->ex_handler) {
+#if DEBUG_INTERP
+                       if (tracing)
+                               g_print ("* Executing handler at IL_%04x\n", frame->ex_handler->handler_offset);
+#endif
+                       ip = rtm->code + frame->ex_handler->handler_offset;
+                       sp = frame->stack;
+                       vt_sp = (unsigned char *) sp + rtm->stack_size;
+                       sp->data.p = frame->ex;
+                       ++sp;
+                       goto main_loop;
+               }
+               goto exit_frame;
+       }
+exit_frame:
+       DEBUG_LEAVE ();
+}
+
+void
+ves_exec_method (MonoInvocation *frame)
+{
+       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
+       ThreadContext context_struct;
+       MonoError error;
+       jmp_buf env;
+
+       frame->ex = NULL;
+
+       if (setjmp(env)) {
+               mono_unhandled_exception ((MonoObject*)frame->ex);
+               return;
+       }
+       if (context == NULL) {
+               context = &context_struct;
+               context_struct.domain = mono_domain_get ();
+               context_struct.base_frame = frame;
+               context_struct.current_frame = NULL;
+               context_struct.env_frame = frame;
+               context_struct.current_env = &env;
+               context_struct.search_for_handler = 0;
+               context_struct.managed_code = 0;
+               mono_native_tls_set_value (thread_context_id, context);
+       }
+       frame->ip = NULL;
+       frame->parent = context->current_frame;
+       frame->runtime_method = mono_interp_get_runtime_method (context->domain, frame->method, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       context->managed_code = 1;
+       ves_exec_method_with_context (frame, context);
+       context->managed_code = 0;
+       if (frame->ex) {
+               if (context != &context_struct && context->current_env) {
+                       context->env_frame->ex = frame->ex;
+                       longjmp (*context->current_env, 1);
+               }
+               else
+                       mono_unhandled_exception ((MonoObject*)frame->ex);
+       }
+       if (context->base_frame == frame)
+               mono_native_tls_set_value (thread_context_id, NULL);
+       else
+               context->current_frame = frame->parent;
+}
+
+static int 
+ves_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
+{
+       MonoImage *image = mono_assembly_get_image (assembly);
+       MonoMethod *method;
+       MonoError error;
+       int rval;
+
+       method = mono_get_method_checked (image, mono_image_get_entry_point (image), NULL, NULL, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+       if (!method)
+               g_error ("No entry point method found in %s", mono_image_get_filename (image));
+
+       rval = mono_runtime_run_main_checked (method, argc, argv, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       return rval;
+}
+
+static void
+usage (void)
+{
+       fprintf (stderr,
+                "mint %s, the Mono ECMA CLI interpreter, (C) 2001, 2002 Ximian, Inc.\n\n"
+                "Usage is: mint [options] executable args...\n\n", VERSION);
+       fprintf (stderr,
+                "Runtime Debugging:\n"
+#ifdef DEBUG_INTERP
+                "   --debug\n"
+#endif
+                "   --dieonex\n"
+                "   --noptr\t\t\tdon't print pointer addresses in trace output\n"
+                "   --opcode-count\n"
+                "   --print-vtable\n"
+                "   --traceclassinit\n"
+                "\n"
+                "Development:\n"
+                "   --debug method_name\n"
+                "   --profile\n"
+                "   --trace\n"
+                "   --traceops\n"
+                "   --regression\n"
+                "\n"
+                "Runtime:\n"
+                "   --config filename  load the specified config file instead of the default\n"
+                "   --workers n        maximum number of worker threads\n"
+               );
+       exit (1);
+}
+
+static MonoBoolean
+interp_ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info, 
+                         MonoReflectionMethod **method, 
+                         gint32 *iloffset, gint32 *native_offset,
+                         MonoString **file, gint32 *line, gint32 *column)
+{
+       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
+       MonoInvocation *inv = context->current_frame;
+       MonoError error;
+       int i;
+
+       for (i = 0; inv && i < skip; inv = inv->parent)
+               if (inv->runtime_method != NULL)
+                       ++i;
+
+       if (iloffset)
+               *iloffset = 0;
+       if (native_offset)
+               *native_offset = 0;
+       if (method) {
+               if (inv == NULL) {
+                       *method = NULL;
+               } else {
+                       *method = mono_method_get_object_checked (context->domain, inv->runtime_method->method, NULL, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               }
+       }
+       if (line)
+               *line = 0;
+       if (need_file_info) {
+               if (column)
+                       *column = 0;
+               if (file)
+                       *file = mono_string_new (mono_domain_get (), "unknown");
+       }
+
+       return TRUE;
+}
+
+static MonoArray *
+interp_ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info)
+{
+       MonoDomain *domain = mono_domain_get ();
+       MonoArray *res;
+       MonoArray *ta = exc->trace_ips;
+       MonoError error;
+       int i, len;
+
+       if (ta == NULL) {
+               /* Exception is not thrown yet */
+               MonoArray *array = mono_array_new_checked (domain, mono_defaults.stack_frame_class, 0, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               return array;
+       }
+       
+       len = mono_array_length (ta);
+
+       res = mono_array_new_checked (domain, mono_defaults.stack_frame_class, len > skip ? len - skip : 0, &error);
+       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+       for (i = skip; i < len / 2; i++) {
+               MonoStackFrame *sf = (MonoStackFrame *)mono_object_new_checked (domain, mono_defaults.stack_frame_class, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               gushort *ip = mono_array_get (ta, gpointer, 2 * i + 1);
+               RuntimeMethod *rtm = mono_array_get (ta, gpointer, 2 * i);
+
+               if (rtm != NULL) {
+                       sf->method = mono_method_get_object_checked (domain, rtm->method, NULL, &error);
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       sf->native_offset = ip - rtm->code;
+               }
+
+#if 0
+               sf->il_offset = mono_debug_il_offset_from_address (ji->method, sf->native_offset, domain);
+
+               if (need_file_info) {
+                       gchar *filename;
+                       
+                       filename = mono_debug_source_location_from_address (ji->method, sf->native_offset, &sf->line, domain);
+
+                       sf->filename = filename? mono_string_new (domain, filename): NULL;
+                       sf->column = 0;
+
+                       g_free (filename);
+               }
+#endif
+
+               mono_array_set (res, gpointer, i, sf);
+       }
+
+       return res;
+}
+
+void
+mono_interp_init ()
+{
+       mono_native_tls_alloc (&thread_context_id, NULL);
+    mono_native_tls_set_value (thread_context_id, NULL);
+       mono_os_mutex_init_recursive (&runtime_method_lookup_section);
+       mono_os_mutex_init_recursive (&create_method_pointer_mutex);
+
+       mono_interp_transform_init ();
+}
+
+typedef int (*TestMethod) (void);
+
+static void
+interp_regression_step (MonoImage *image, int verbose, int *total_run, int *total, GTimer *timer, MonoDomain *domain)
+{
+       int result, expected, failed, cfailed, run;
+       double elapsed, transform_time;
+       int i;
+       MonoObject *result_obj;
+       static gboolean filter_method_init = FALSE;
+       static const char *filter_method = NULL;
+
+       g_print ("Test run: image=%s\n", mono_image_get_filename (image));
+       cfailed = failed = run = 0;
+       transform_time = elapsed = 0.0;
+
+#if 0
+       /* fixme: ugly hack - delete all previously compiled methods */
+       if (domain_jit_info (domain)) {
+               g_hash_table_destroy (domain_jit_info (domain)->jit_trampoline_hash);
+               domain_jit_info (domain)->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
+               mono_internal_hash_table_destroy (&(domain->jit_code_hash));
+               mono_jit_code_hash_init (&(domain->jit_code_hash));
+       }
+#endif
+
+       g_timer_start (timer);
+       for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
+               MonoObject *exc = NULL;
+               MonoError error;
+               MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+               if (!method) {
+                       mono_error_cleanup (&error); /* FIXME don't swallow the error */
+                       continue;
+               }
+
+               if (!filter_method_init) {
+                       filter_method = g_getenv ("INTERP_FILTER_METHOD");
+                       filter_method_init = TRUE;
+               }
+               gboolean filter = FALSE;
+               if (filter_method) {
+                       const char *name = filter_method;
+
+                       if ((strchr (name, '.') > name) || strchr (name, ':')) {
+                               MonoMethodDesc *desc = mono_method_desc_new (name, TRUE);
+                               filter = mono_method_desc_full_match (desc, method);
+                               mono_method_desc_free (desc);
+                       } else {
+                               filter = strcmp (method->name, name) == 0;
+                       }
+               } else { /* no filter, check for `Category' attribute on method */
+                       filter = TRUE;
+                       MonoCustomAttrInfo* ainfo = mono_custom_attrs_from_method_checked (method, &error);
+                       mono_error_cleanup (&error);
+
+                       if (ainfo) {
+                               int j;
+                               for (j = 0; j < ainfo->num_attrs && filter; ++j) {
+                                       MonoCustomAttrEntry *centry = &ainfo->attrs [j];
+                                       if (centry->ctor == NULL)
+                                               continue;
+
+                                       MonoClass *klass = centry->ctor->klass;
+                                       if (strcmp (klass->name, "CategoryAttribute"))
+                                               continue;
+
+                                       MonoObject *obj = mono_custom_attrs_get_attr_checked (ainfo, klass, &error);
+                                       /* FIXME: there is an ordering problem if there're multiple attributes, do this instead:
+                                        * MonoObject *obj = create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, &error); */
+                                       mono_error_cleanup (&error);
+                                       MonoMethod *getter = mono_class_get_method_from_name (klass, "get_Category", -1);
+                                       MonoObject *str = mono_interp_runtime_invoke (getter, obj, NULL, &exc, &error);
+                                       mono_error_cleanup (&error);
+                                       char *utf8_str = mono_string_to_utf8_checked ((MonoString *) str, &error);
+                                       mono_error_cleanup (&error);
+                                       if (!strcmp (utf8_str, "!INTERPRETER")) {
+                                               g_print ("skip %s...\n", method->name);
+                                               filter = FALSE;
+                                       }
+                               }
+                       }
+               }
+               if (strncmp (method->name, "test_", 5) == 0 && filter) {
+                       MonoError interp_error;
+                       MonoObject *exc = NULL;
+
+                       result_obj = mono_interp_runtime_invoke (method, NULL, NULL, &exc, &interp_error);
+                       if (!mono_error_ok (&interp_error)) {
+                               cfailed++;
+                               g_print ("Test '%s' execution failed.\n", method->name);
+                       } else if (exc != NULL) {
+                               g_print ("Exception in Test '%s' occured:\n", method->name);
+                               mono_object_describe (exc);
+                               run++;
+                               failed++;
+                       } else {
+                               result = *(gint32 *) mono_object_unbox (result_obj);
+                               expected = atoi (method->name + 5);  // FIXME: oh no.
+                               run++;
+
+                               if (result != expected) {
+                                       failed++;
+                                       g_print ("Test '%s' failed result (got %d, expected %d).\n", method->name, result, expected);
+                               }
+                       }
+               }
+       }
+       g_timer_stop (timer);
+       elapsed = g_timer_elapsed (timer, NULL);
+       if (failed > 0 || cfailed > 0){
+               g_print ("Results: total tests: %d, failed: %d, cfailed: %d (pass: %.2f%%)\n",
+                               run, failed, cfailed, 100.0*(run-failed-cfailed)/run);
+       } else {
+               g_print ("Results: total tests: %d, all pass \n",  run);
+       }
+
+       g_print ("Elapsed time: %f secs (%f, %f)\n\n", elapsed,
+                       elapsed - transform_time, transform_time);
+       *total += failed + cfailed;
+       *total_run += run;
+}
+static int
+interp_regression (MonoImage *image, int verbose, int *total_run)
+{
+       MonoMethod *method;
+       GTimer *timer = g_timer_new ();
+       MonoDomain *domain = mono_domain_get ();
+       guint32 i;
+       int total;
+
+       /* load the metadata */
+       for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
+               MonoError error;
+               method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+               if (!method) {
+                       mono_error_cleanup (&error);
+                       continue;
+               }
+               mono_class_init (method->klass);
+       }
+
+       total = 0;
+       *total_run = 0;
+       interp_regression_step (image, verbose, total_run, &total, timer, domain);
+
+       g_timer_destroy (timer);
+       return total;
+}
+
+int
+mono_interp_regression_list (int verbose, int count, char *images [])
+{
+       int i, total, total_run, run;
+       
+       total_run = total = 0;
+       for (i = 0; i < count; ++i) {
+               MonoAssembly *ass = mono_assembly_open (images [i], NULL);
+               if (!ass) {
+                       g_warning ("failed to load assembly: %s", images [i]);
+                       continue;
+               }
+               total += interp_regression (mono_assembly_get_image (ass), verbose, &run);
+               total_run += run;
+       }
+       if (total > 0) {
+               g_print ("Overall results: tests: %d, failed: %d (pass: %.2f%%)\n", total_run, total, 100.0*(total_run-total)/total_run);
+       } else {
+               g_print ("Overall results: tests: %d, 100%% pass\n", total_run);
+       }
+       
+       return total;
+}
+
diff --git a/mono/mini/interp/interp.h b/mono/mini/interp/interp.h
new file mode 100644 (file)
index 0000000..cd3514f
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef __MONO_MINI_INTERPRETER_H__
+#define __MONO_MINI_INTERPRETER_H__
+#include <mono/mini/mini.h>
+
+int
+mono_interp_regression_list (int verbose, int count, char *images []);
+
+void
+mono_interp_init (void);
+
+gpointer
+mono_interp_create_method_pointer (MonoMethod *method, MonoError *error);
+
+MonoObject*
+mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error);
+
+void
+mono_interp_init_delegate (MonoDelegate *del);
+
+gpointer
+mono_interp_create_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *error);
+
+void
+interp_walk_stack_with_ctx (MonoInternalStackWalk func, MonoContext *ctx, MonoUnwindOptions options, void *user_data);
+#endif /* __MONO_MINI_INTERPRETER_H__ */
diff --git a/mono/mini/interp/mintops.c b/mono/mini/interp/mintops.c
new file mode 100644 (file)
index 0000000..5b4d692
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Utilities for handling interpreter VM instructions
+ *
+ * Authors:
+ *   Bernie Solomon (bernard@ugsolutions.com)
+ *
+ */
+#include <glib.h>
+#include <stdio.h>
+#include "mintops.h"
+
+#define OPDEF(a,b,c,d) \
+       b,
+const char *mono_interp_opname[] = {
+#include "mintops.def"
+       ""
+};
+#undef OPDEF
+
+#define OPDEF(a,b,c,d) \
+       c,
+unsigned char mono_interp_oplen[] = {
+#include "mintops.def"
+       0
+};
+#undef OPDEF
+
+
+#define OPDEF(a,b,c,d) \
+       d,
+MintOpArgType mono_interp_opargtype[] = {
+#include "mintops.def"
+       0
+};
+#undef OPDEF
+
+const guint16 *
+mono_interp_dis_mintop(const guint16 *base, const guint16 *ip)
+{
+       int len = mono_interp_oplen [*ip];
+       guint32 token;
+       int target;
+       if (len < 0 || len > 10) {
+               g_print ("op %d len %d\n", *ip, len);
+               g_assert_not_reached ();
+       } else if (len == 0) { /* SWITCH */
+               int n = READ32 (ip + 1);
+               len = 3 + n * 2;
+       }
+
+       g_print ("IL_%04x: %-10s", ip - base, mono_interp_opname [*ip]);
+       switch (mono_interp_opargtype [*ip]) {
+       case MintOpNoArgs:
+               break;
+       case MintOpUShortInt:
+               g_print (" %u", * (guint16 *)(ip + 1));
+               break;
+       case MintOpTwoShorts:
+               g_print (" %u,%u", * (guint16 *)(ip + 1), * (guint16 *)(ip + 2));
+               break;
+       case MintOpShortAndInt:
+               g_print (" %u,%u", * (guint16 *)(ip + 1), (guint32)READ32(ip + 2));
+               break;
+       case MintOpShortInt:
+               g_print (" %d", * (short *)(ip + 1));
+               break;
+       case MintOpClassToken:
+       case MintOpMethodToken:
+       case MintOpFieldToken:
+               token = * (guint16 *)(ip + 1);
+               g_print (" %u", token);
+               break;
+       case MintOpInt:
+               g_print (" %d", (gint32)READ32 (ip + 1));
+               break;
+       case MintOpLongInt:
+               g_print (" %lld", (gint64)READ64 (ip + 1));
+               break;
+       case MintOpFloat: {
+               gint32 tmp = READ32 (ip + 1);
+               g_print (" %g", * (float *)&tmp);
+               break;
+       }
+       case MintOpDouble: {
+               gint64 tmp = READ64 (ip + 1);
+               g_print (" %g", * (double *)&tmp);
+               break;
+       }
+       case MintOpShortBranch:
+               target = ip + * (short *)(ip + 1) - base;
+               g_print (" IL_%04x", target);
+               break;
+       case MintOpBranch:
+               target = ip + (gint32)READ32 (ip + 1) - base;
+               g_print (" IL_%04x", target);
+               break;
+       case MintOpSwitch: {
+               const guint16 *p = ip + 1;
+               int sval = (gint32)READ32 (p);
+               int i;
+               p += 2;
+               g_print ("(");
+               for (i = 0; i < sval; ++i) {
+                       int offset;
+                       if (i > 0)
+                               g_print (", ");
+                       offset = (gint32)READ32 (p);
+                       g_print ("IL_%04x", ip - base + 3 + 2 * sval + offset);
+                       p += 2;
+               }
+               g_print (")");
+               break;
+       }
+       default:
+               g_print("unknown arg type\n");
+       }
+
+       return ip + len;
+}
+
diff --git a/mono/mini/interp/mintops.def b/mono/mini/interp/mintops.def
new file mode 100644 (file)
index 0000000..f80f2a5
--- /dev/null
@@ -0,0 +1,513 @@
+/*
+ * Definitions of VM instructions executed by interp.c
+ *
+ * Authors:
+ *   Bernie Solomon (bernard@ugsolutions.com)
+ *
+ */
+
+/* OPDEF (opsymbol, opstring, oplength, optype) */
+
+OPDEF(MINT_NOP, "nop", 1, MintOpNoArgs)
+OPDEF(MINT_BREAK, "break", 1, MintOpNoArgs)
+OPDEF(MINT_LDNULL, "ldnull", 1, MintOpNoArgs)
+OPDEF(MINT_DUP, "dup", 1, MintOpNoArgs)
+OPDEF(MINT_DUP_VT, "dup.vt", 3, MintOpInt)
+OPDEF(MINT_POP, "pop", 2, MintOpShortInt)
+
+OPDEF(MINT_RET, "ret", 1, MintOpNoArgs)
+OPDEF(MINT_RET_VOID, "ret.void", 1, MintOpNoArgs)
+OPDEF(MINT_RET_VT, "ret.vt", 3, MintOpInt)
+
+OPDEF(MINT_VTRESULT, "vtresult", 4, MintOpShortAndInt) /*FIX should be unsigned*/
+
+OPDEF(MINT_LDC_I4_M1, "ldc.i4.m1", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_0, "ldc.i4.0", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_1, "ldc.i4.1", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_2, "ldc.i4.2", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_3, "ldc.i4.3", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_4, "ldc.i4.4", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_5, "ldc.i4.5", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_6, "ldc.i4.6", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_7, "ldc.i4.7", 1, MintOpNoArgs)
+OPDEF(MINT_LDC_I4_8, "ldc.i4.8", 1, MintOpNoArgs)
+
+OPDEF(MINT_LDC_I4_S, "ldc.i4.s", 2, MintOpShortInt)
+OPDEF(MINT_LDC_I4, "ldc.i4", 3, MintOpInt)
+OPDEF(MINT_LDC_I8, "ldc.i8", 5, MintOpLongInt)
+
+OPDEF(MINT_LDC_R4, "ldc.r4", 3, MintOpFloat)
+OPDEF(MINT_LDC_R8, "ldc.r8", 5, MintOpDouble)
+
+OPDEF(MINT_LDARG_I1, "ldarg.i1", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_U1, "ldarg.u1", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_I2, "ldarg.i2", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_U2, "ldarg.u2", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_I4, "ldarg.i4", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_I8, "ldarg.i8", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_R4, "ldarg.r4", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_R8, "ldarg.r8", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_O, "ldarg.o", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_P, "ldarg.p", 2, MintOpUShortInt)
+OPDEF(MINT_LDARG_VT, "ldarg.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_STARG_I1, "starg.i1", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_U1, "starg.u1", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_I2, "starg.i2", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_U2, "starg.u2", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_I4, "starg.i4", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_I8, "starg.i8", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_R4, "starg.r4", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_R8, "starg.r8", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_O, "starg.o", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_P, "starg.p", 2, MintOpUShortInt)
+OPDEF(MINT_STARG_VT, "starg.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_STINARG_I1, "stinarg.i1", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_U1, "stinarg.u1", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_I2, "stinarg.i2", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_U2, "stinarg.u2", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_I4, "stinarg.i4", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_I8, "stinarg.i8", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_R4, "stinarg.r4", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_R8, "stinarg.r8", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_O, "stinarg.o", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_P, "stinarg.p", 2, MintOpUShortInt)
+OPDEF(MINT_STINARG_VT, "stinarg.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDARGA, "ldarga", 2, MintOpUShortInt)
+OPDEF(MINT_LDTHISA, "ldthisa", 1, MintOpNoArgs)
+
+OPDEF(MINT_LDFLD_I1, "ldfld.i1", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_U1, "ldfld.u1", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_I2, "ldfld.i2", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_U2, "ldfld.u2", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_I4, "ldfld.i4", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_I8, "ldfld.i8", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_R4, "ldfld.r4", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_R8, "ldfld.r8", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_O, "ldfld.o", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_P, "ldfld.p", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLD_VT, "ldfld.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDRMFLD, "ldrmfld", 2, MintOpFieldToken)
+OPDEF(MINT_LDRMFLD_VT, "ldrmfld.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDFLDA, "ldflda", 2, MintOpUShortInt)
+OPDEF(MINT_LDFLDA_UNSAFE, "ldflda.unsafe", 2, MintOpUShortInt)
+
+OPDEF(MINT_STFLD_I1, "stfld.i1", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_U1, "stfld.u1", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_I2, "stfld.i2", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_U2, "stfld.u2", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_I4, "stfld.i4", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_I8, "stfld.i8", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_R4, "stfld.r4", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_R8, "stfld.r8", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_O, "stfld.o", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_P, "stfld.p", 2, MintOpUShortInt)
+OPDEF(MINT_STFLD_VT, "stfld.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_STRMFLD, "strmfld", 2, MintOpFieldToken)
+OPDEF(MINT_STRMFLD_VT, "strmfld.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDSFLD, "ldsfld", 2, MintOpFieldToken)
+OPDEF(MINT_LDSFLD_VT, "ldsfld.vt", 4, MintOpShortAndInt)
+OPDEF(MINT_STSFLD, "stsfld", 2, MintOpUShortInt)
+OPDEF(MINT_STSFLD_VT, "stsfld.vt", 4, MintOpShortAndInt)
+OPDEF(MINT_LDSFLDA, "ldsflda", 2, MintOpUShortInt)
+
+OPDEF(MINT_LDLOC_I1, "ldloc.i1", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_U1, "ldloc.u1", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_I2, "ldloc.i2", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_U2, "ldloc.u2", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_I4, "ldloc.i4", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_I8, "ldloc.i8", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_R4, "ldloc.r4", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_R8, "ldloc.r8", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_O, "ldloc.o", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_P, "ldloc.p", 2, MintOpUShortInt)
+OPDEF(MINT_LDLOC_VT, "ldloc.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_STLOC_I1, "stloc.i1", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_U1, "stloc.u1", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_I2, "stloc.i2", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_U2, "stloc.u2", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_I4, "stloc.i4", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_I8, "stloc.i8", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_R4, "stloc.r4", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_R8, "stloc.r8", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_O, "stloc.o", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_P, "stloc.p", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_VT, "stloc.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_STLOC_NP_I4, "stloc.np.i4", 2, MintOpUShortInt)
+OPDEF(MINT_STLOC_NP_O, "stloc.np.o", 2, MintOpUShortInt)
+
+OPDEF(MINT_LDLOCA_S, "ldloca.s", 2, MintOpUShortInt)
+
+OPDEF(MINT_LDIND_I1, "ldind.i1", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_U1, "ldind.u1", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_I2, "ldind.i2", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_U2, "ldind.u2", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_I4, "ldind.i4", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_U4, "ldind.u4", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_I8, "ldind.i8", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_I, "ldind.i", 2, MintOpUShortInt)
+OPDEF(MINT_LDIND_R4, "ldind.r4", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_R8, "ldind.r8", 1, MintOpNoArgs)
+OPDEF(MINT_LDIND_REF, "ldind.ref", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_I1, "stind.i1", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_I2, "stind.i2", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_I4, "stind.i4", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_I8, "stind.i8", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_I, "stind.i", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_R4, "stind.r4", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_R8, "stind.r8", 1, MintOpNoArgs)
+OPDEF(MINT_STIND_REF, "stind.ref", 1, MintOpNoArgs)
+
+OPDEF(MINT_BR, "br", 3, MintOpBranch)
+OPDEF(MINT_LEAVE, "leave", 3, MintOpBranch)
+OPDEF(MINT_BR_S, "br.s", 2, MintOpShortBranch)
+OPDEF(MINT_LEAVE_S, "leave.s", 2, MintOpShortBranch)
+
+OPDEF(MINT_THROW, "throw", 1, MintOpNoArgs)
+OPDEF(MINT_RETHROW, "rethrow", 1, MintOpNoArgs)
+OPDEF(MINT_ENDFINALLY, "endfinally", 1, MintOpNoArgs)
+
+OPDEF(MINT_BRFALSE_I4, "brfalse.i4", 3, MintOpBranch)
+OPDEF(MINT_BRFALSE_I8, "brfalse.i8", 3, MintOpBranch)
+OPDEF(MINT_BRFALSE_R8, "brfalse.r8", 3, MintOpBranch)
+OPDEF(MINT_BRTRUE_I4, "brtrue.i4", 3, MintOpBranch)
+OPDEF(MINT_BRTRUE_I8, "brtrue.i8", 3, MintOpBranch)
+OPDEF(MINT_BRTRUE_R8, "brtrue.r8", 3, MintOpBranch)
+
+OPDEF(MINT_BRFALSE_I4_S, "brfalse.i4.s", 2, MintOpShortBranch)
+OPDEF(MINT_BRFALSE_I8_S, "brfalse.i8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BRFALSE_R8_S, "brfalse.r8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BRTRUE_I4_S, "brtrue.i4.s", 2, MintOpShortBranch)
+OPDEF(MINT_BRTRUE_I8_S, "brtrue.i8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BRTRUE_R8_S, "brtrue.r8.s", 2, MintOpShortBranch)
+
+OPDEF(MINT_BEQ_I4, "beq.i4", 3, MintOpBranch)
+OPDEF(MINT_BEQ_I8, "beq.i8", 3, MintOpBranch)
+OPDEF(MINT_BEQ_R8, "beq.r8", 3, MintOpBranch)
+OPDEF(MINT_BGE_I4, "bge.i4", 3, MintOpBranch) 
+OPDEF(MINT_BGE_I8, "bge.i8", 3, MintOpBranch) 
+OPDEF(MINT_BGE_R8, "bge.r8", 3, MintOpBranch) 
+OPDEF(MINT_BGT_I4, "bgt.i4", 3, MintOpBranch) 
+OPDEF(MINT_BGT_I8, "bgt.i8", 3, MintOpBranch) 
+OPDEF(MINT_BGT_R8, "bgt.r8", 3, MintOpBranch) 
+OPDEF(MINT_BLT_I4, "blt.i4", 3, MintOpBranch) 
+OPDEF(MINT_BLT_I8, "blt.i8", 3, MintOpBranch) 
+OPDEF(MINT_BLT_R8, "blt.r8", 3, MintOpBranch) 
+OPDEF(MINT_BLE_I4, "ble.i4", 3, MintOpBranch) 
+OPDEF(MINT_BLE_I8, "ble.i8", 3, MintOpBranch) 
+OPDEF(MINT_BLE_R8, "ble.r8", 3, MintOpBranch) 
+
+OPDEF(MINT_BNE_UN_I4, "bne.un.i4", 3, MintOpBranch)
+OPDEF(MINT_BNE_UN_I8, "bne.un.i8", 3, MintOpBranch)
+OPDEF(MINT_BNE_UN_R8, "bne.un.r8", 3, MintOpBranch)
+OPDEF(MINT_BGE_UN_I4, "bge.un.i4", 3, MintOpBranch) 
+OPDEF(MINT_BGE_UN_I8, "bge.un.i8", 3, MintOpBranch) 
+OPDEF(MINT_BGE_UN_R8, "bge.un.r8", 3, MintOpBranch) 
+OPDEF(MINT_BGT_UN_I4, "bgt.un.i4", 3, MintOpBranch) 
+OPDEF(MINT_BGT_UN_I8, "bgt.un.i8", 3, MintOpBranch) 
+OPDEF(MINT_BGT_UN_R8, "bgt.un.r8", 3, MintOpBranch) 
+OPDEF(MINT_BLE_UN_I4, "ble.un.i4", 3, MintOpBranch) 
+OPDEF(MINT_BLE_UN_I8, "ble.un.i8", 3, MintOpBranch) 
+OPDEF(MINT_BLE_UN_R8, "ble.un.r8", 3, MintOpBranch) 
+OPDEF(MINT_BLT_UN_I4, "blt.un.i4", 3, MintOpBranch) 
+OPDEF(MINT_BLT_UN_I8, "blt.un.i8", 3, MintOpBranch) 
+OPDEF(MINT_BLT_UN_R8, "blt.un.r8", 3, MintOpBranch) 
+
+OPDEF(MINT_BEQ_I4_S, "beq.i4.s", 2, MintOpShortBranch)
+OPDEF(MINT_BEQ_I8_S, "beq.i8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BEQ_R8_S, "beq.r8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BGE_I4_S, "bge.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGE_I8_S, "bge.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGE_R8_S, "bge.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_I4_S, "bgt.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_I8_S, "bgt.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_R8_S, "bgt.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_I4_S, "blt.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_I8_S, "blt.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_R8_S, "blt.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_I4_S, "ble.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_I8_S, "ble.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_R8_S, "ble.r8.s", 2, MintOpShortBranch) 
+
+OPDEF(MINT_BNE_UN_I4_S, "bne.un.i4.s", 2, MintOpShortBranch)
+OPDEF(MINT_BNE_UN_I8_S, "bne.un.i8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BNE_UN_R8_S, "bne.un.r8.s", 2, MintOpShortBranch)
+OPDEF(MINT_BGE_UN_I4_S, "bge.un.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGE_UN_I8_S, "bge.un.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGE_UN_R8_S, "bge.un.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_UN_I4_S, "bgt.un.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_UN_I8_S, "bgt.un.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BGT_UN_R8_S, "bgt.un.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_UN_I4_S, "ble.un.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_UN_I8_S, "ble.un.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLE_UN_R8_S, "ble.un.r8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_UN_I4_S, "blt.un.i4.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_UN_I8_S, "blt.un.i8.s", 2, MintOpShortBranch) 
+OPDEF(MINT_BLT_UN_R8_S, "blt.un.r8.s", 2, MintOpShortBranch) 
+
+OPDEF(MINT_SWITCH, "switch", 0, MintOpSwitch)
+
+OPDEF(MINT_LDSTR, "ldstr", 2, MintOpMethodToken) /* not really */
+
+OPDEF(MINT_CALL, "call", 2, MintOpMethodToken) 
+OPDEF(MINT_VCALL, "vcall", 2, MintOpMethodToken) 
+OPDEF(MINT_CALLVIRT, "callvirt", 2, MintOpMethodToken) 
+OPDEF(MINT_VCALLVIRT, "vcallvirt", 2, MintOpMethodToken) 
+OPDEF(MINT_CALLI, "calli", 2, MintOpMethodToken) 
+OPDEF(MINT_CALLI_NAT, "calli.nat", 2, MintOpMethodToken) 
+OPDEF(MINT_JMP, "jmp", 2, MintOpMethodToken) 
+
+OPDEF(MINT_CALLRUN, "callrun", 1, MintOpNoArgs)
+
+OPDEF(MINT_NEWOBJ, "newobj", 2, MintOpMethodToken) 
+OPDEF(MINT_INITOBJ, "initobj", 3, MintOpInt) 
+OPDEF(MINT_CASTCLASS, "castclass", 2, MintOpClassToken) 
+OPDEF(MINT_ISINST, "isinst", 2, MintOpClassToken) 
+OPDEF(MINT_NEWARR, "newarr", 2, MintOpClassToken) 
+OPDEF(MINT_BOX, "box", 3, MintOpTwoShorts)
+OPDEF(MINT_UNBOX, "unbox", 2, MintOpClassToken) 
+OPDEF(MINT_LDTOKEN, "ldtoken", 2, MintOpClassToken) /* not really */
+OPDEF(MINT_LDFTN, "ldftn", 2, MintOpMethodToken) 
+OPDEF(MINT_LDVIRTFTN, "ldvirtftn", 2, MintOpMethodToken) 
+OPDEF(MINT_CPOBJ, "cpobj", 2, MintOpClassToken)
+OPDEF(MINT_LDOBJ, "ldobj", 2, MintOpClassToken) 
+OPDEF(MINT_STOBJ, "stobj", 2, MintOpClassToken) 
+OPDEF(MINT_STOBJ_VT, "stobj.vt", 2, MintOpClassToken) 
+OPDEF(MINT_CPBLK, "cpblk", 1, MintOpNoArgs) 
+OPDEF(MINT_INITBLK, "initblk", 1, MintOpNoArgs) 
+OPDEF(MINT_LOCALLOC, "localloc", 1, MintOpNoArgs) 
+OPDEF(MINT_INITLOCALS, "initlocals", 1, MintOpNoArgs) 
+
+OPDEF(MINT_LDELEM_I, "ldelem.i", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_I1, "ldelem.i1", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_U1, "ldelem.u1", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_I2, "ldelem.i2", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_U2, "ldelem.u2", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_I4, "ldelem.i4", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_U4, "ldelem.u4", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_I8, "ldelem.i8", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_R4, "ldelem.r4", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_R8, "ldelem.r8", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_REF, "ldelem.ref", 1, MintOpNoArgs)
+OPDEF(MINT_LDELEM_VT, "ldelem.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDELEMA, "ldelema", 3, MintOpTwoShorts)
+OPDEF(MINT_LDELEMA_TC, "ldelema.tc", 3, MintOpTwoShorts)
+
+OPDEF(MINT_STELEM_I, "stelem.i", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_I1, "stelem.i1", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_U1, "stelem.u1", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_I2, "stelem.i2", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_I4, "stelem.i4", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_I8, "stelem.i8", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_R4, "stelem.r4", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_R8, "stelem.r8", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_REF, "stelem.ref", 1, MintOpNoArgs)
+OPDEF(MINT_STELEM_VT, "stelem.vt", 4, MintOpShortAndInt)
+
+OPDEF(MINT_LDLEN, "ldlen", 1, MintOpNoArgs)
+
+OPDEF(MINT_ADD_I4, "add.i4", 1, MintOpNoArgs)
+OPDEF(MINT_ADD_I8, "add.i8", 1, MintOpNoArgs)
+OPDEF(MINT_ADD_R8, "add.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_ADD1_I4, "add1.i4", 1, MintOpNoArgs)
+
+OPDEF(MINT_SUB_I4, "sub.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SUB_I8, "sub.i8", 1, MintOpNoArgs)
+OPDEF(MINT_SUB_R8, "sub.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_SUB1_I4, "sub1.i4", 1, MintOpNoArgs)
+
+OPDEF(MINT_MUL_I4, "mul.i4", 1, MintOpNoArgs)
+OPDEF(MINT_MUL_I8, "mul.i8", 1, MintOpNoArgs)
+OPDEF(MINT_MUL_R8, "mul.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_DIV_I4, "div.i4", 1, MintOpNoArgs)
+OPDEF(MINT_DIV_I8, "div.i8", 1, MintOpNoArgs)
+OPDEF(MINT_DIV_R8, "div.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_DIV_UN_I4, "div.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_DIV_UN_I8, "div.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_ADD_OVF_I4, "add.ovf.i4", 1, MintOpNoArgs)
+OPDEF(MINT_ADD_OVF_I8, "add.ovf.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_ADD_OVF_UN_I4, "add.ovf.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_ADD_OVF_UN_I8, "add.ovf.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_MUL_OVF_I4, "mul.ovf.i4", 1, MintOpNoArgs)
+OPDEF(MINT_MUL_OVF_I8, "mul.ovf.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_MUL_OVF_UN_I4, "mul.ovf.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_MUL_OVF_UN_I8, "mul.ovf.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_SUB_OVF_I4, "sub.ovf.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SUB_OVF_I8, "sub.ovf.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_SUB_OVF_UN_I4, "sub.ovf.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SUB_OVF_UN_I8, "sub.ovf.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_NEG_I4, "neg.i4", 1, MintOpNoArgs)
+OPDEF(MINT_NEG_I8, "neg.i8", 1, MintOpNoArgs)
+OPDEF(MINT_NEG_R8, "neg.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_NOT_I4, "not.i4", 1, MintOpNoArgs)
+OPDEF(MINT_NOT_I8, "not.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_AND_I4, "and.i4", 1, MintOpNoArgs)
+OPDEF(MINT_AND_I8, "and.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_OR_I4, "or.i4", 1, MintOpNoArgs)
+OPDEF(MINT_OR_I8, "or.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_XOR_I4, "xor.i4", 1, MintOpNoArgs)
+OPDEF(MINT_XOR_I8, "xor.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_REM_I4, "rem.i4", 1, MintOpNoArgs)
+OPDEF(MINT_REM_I8, "rem.i8", 1, MintOpNoArgs)
+OPDEF(MINT_REM_R8, "rem.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_REM_UN_I4, "rem.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_REM_UN_I8, "rem.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_SHR_UN_I4, "shr.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SHR_UN_I8, "shr.un.i8", 1, MintOpNoArgs)
+OPDEF(MINT_SHL_I4, "shl.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SHL_I8, "shl.i8", 1, MintOpNoArgs)
+OPDEF(MINT_SHR_I4, "shr.i4", 1, MintOpNoArgs)
+OPDEF(MINT_SHR_I8, "shr.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_R_UN_I4, "conv.r.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_R_UN_I8, "conv.r.un.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_I1_I4, "conv.i1.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I1_I8, "conv.i1.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I1_R8, "conv.i1.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_U1_I4, "conv.u1.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U1_I8, "conv.u1.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U1_R8, "conv.u1.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_I2_I4, "conv.i2.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I2_I8, "conv.i2.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I2_R8, "conv.i2.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_U2_I4, "conv.u2.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U2_I8, "conv.u2.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U2_R8, "conv.u2.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_I4_I8, "conv.i4.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I4_R8, "conv.i4.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_U4_I8, "conv.u4.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U4_R8, "conv.u4.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_I8_I4, "conv.i8.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I8_U4, "conv.i8.u4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_I8_R8, "conv.i8.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_R4_I4, "conv.r4.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_R4_I8, "conv.r4.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_R4_R8, "conv.r4.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_R8_I4, "conv.r8.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_R8_I8, "conv.r8.i8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_I4_I8_SP, "conv.i4.i8.sp", 1, MintOpNoArgs) /* special for narrowing sp[-2] on 64 bits */
+OPDEF(MINT_CONV_I8_I4_SP, "conv.i8.i4.sp", 1, MintOpNoArgs) /* special for widening sp[-2] on 64 bits */
+
+OPDEF(MINT_CONV_U8_I4, "conv.u8.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_U8_R8, "conv.u8.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I1_I4, "conv.ovf.i1.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I1_I8, "conv.ovf.i1.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I1_R8, "conv.ovf.i1.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_U1_I4, "conv.ovf.u1.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U1_I8, "conv.ovf.u1.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U1_R8, "conv.ovf.u1.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I2_I4, "conv.ovf.i2.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I2_I8, "conv.ovf.i2.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I2_R8, "conv.ovf.i2.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_U2_I4, "conv.ovf.u2.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U2_I8, "conv.ovf.u2.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U2_R8, "conv.ovf.u2.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I4_U4, "conv.ovf.i4.u4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I4_I8, "conv.ovf.i4.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I4_U8, "conv.ovf.i4.u8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I4_R8, "conv.ovf.i4.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I4_UN_I8, "conv.ovf.i4.un.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I4_UN_R8, "conv.ovf.i4.un.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_U4_I4, "conv.ovf.u4.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U4_I8, "conv.ovf.u4.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U4_R8, "conv.ovf.u4.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I8_U8, "conv.ovf.i8.u8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_I8_R8, "conv.ovf.i8.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_I8_UN_R8, "conv.ovf.i8.un.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CONV_OVF_U8_I4, "conv.ovf.u8.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U8_I8, "conv.ovf.u8.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CONV_OVF_U8_R8, "conv.ovf.u8.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CEQ_I4, "ceq.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CEQ_I8, "ceq.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CEQ_R8, "ceq.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CEQ0_I4, "ceq0.i4", 1, MintOpNoArgs)
+
+OPDEF(MINT_CGT_I4, "cgt.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CGT_I8, "cgt.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CGT_R8, "cgt.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CGT_UN_I4, "cgt.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CGT_UN_I8, "cgt.un.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CGT_UN_R8, "cgt.un.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CLT_I4, "clt.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CLT_I8, "clt.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CLT_R8, "clt.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CLT_UN_I4, "clt.un.i4", 1, MintOpNoArgs)
+OPDEF(MINT_CLT_UN_I8, "clt.un.i8", 1, MintOpNoArgs)
+OPDEF(MINT_CLT_UN_R8, "clt.un.r8", 1, MintOpNoArgs)
+
+OPDEF(MINT_CKFINITE, "ckfinite", 1, MintOpNoArgs)
+
+OPDEF(MINT_CKNULL, "cknull", 1, MintOpNoArgs)
+
+OPDEF(MINT_GETCHR, "getchr", 1, MintOpNoArgs)
+OPDEF(MINT_STRLEN, "strlen", 1, MintOpNoArgs)
+OPDEF(MINT_ARRAY_RANK, "array_rank", 1, MintOpNoArgs)
+
+OPDEF(MINT_ICALL_V_V, "mono_icall_v_v", 2, MintOpClassToken) /* not really */
+OPDEF(MINT_ICALL_V_P, "mono_icall_v_p", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_P_V, "mono_icall_p_v", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_P_P, "mono_icall_p_p", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PP_V, "mono_icall_pp_v", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PI_V, "mono_icall_pi_v", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PP_P, "mono_icall_pp_p", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PI_P, "mono_icall_pi_p", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PPP_V, "mono_icall_ppp_v", 2, MintOpClassToken)
+OPDEF(MINT_ICALL_PPI_V, "mono_icall_ppi_v", 2, MintOpClassToken)
+OPDEF(MINT_MONO_LDPTR, "mono_ldptr", 2, MintOpClassToken) 
+OPDEF(MINT_MONO_NEWOBJ, "mono_newobj", 2, MintOpClassToken)
+OPDEF(MINT_MONO_RETOBJ, "mono_retobj", 1, MintOpNoArgs)
+OPDEF(MINT_MONO_FREE, "mono_free", 1, MintOpNoArgs)
+
+
diff --git a/mono/mini/interp/mintops.h b/mono/mini/interp/mintops.h
new file mode 100644 (file)
index 0000000..e787526
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef __INTERPRETER_MINTOPS_H
+#define __INTERPRETER_MINTOPS_H
+
+#include <glib.h>
+
+typedef enum
+{
+       MintOpNoArgs,
+       MintOpShortInt,
+       MintOpUShortInt,
+       MintOpInt,
+       MintOpLongInt,
+       MintOpFloat,
+       MintOpDouble,
+       MintOpBranch,
+       MintOpShortBranch,
+       MintOpSwitch,
+       MintOpMethodToken,
+       MintOpFieldToken,
+       MintOpClassToken,
+       MintOpTwoShorts,
+       MintOpShortAndInt
+} MintOpArgType;
+
+#define OPDEF(a,b,c,d) \
+       a,
+enum {
+#include "mintops.def"
+       MINT_LASTOP
+};
+#undef OPDEF
+
+#if NO_UNALIGNED_ACCESS
+#  if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#define READ32(x) (((guint16 *)(x)) [0] | ((guint16 *)(x)) [1] << 16)
+#define READ64(x) ((guint64)((guint16 *)(x)) [0] | \
+                   (guint64)((guint16 *)(x)) [1] << 16 | \
+                   (guint64)((guint16 *)(x)) [2] << 32 | \
+                   (guint64)((guint16 *)(x)) [3] << 48)
+#  else
+#define READ32(x) (((guint16 *)(x)) [0] << 16 | ((guint16 *)(x)) [1])
+#define READ64(x) ((guint64)((guint16 *)(x)) [0] << 48 | \
+                   (guint64)((guint16 *)(x)) [1] << 32 | \
+                   (guint64)((guint16 *)(x)) [2] << 16 | \
+                   (guint64)((guint16 *)(x)) [3])
+#  endif
+#else /* unaligned access OK */
+#define READ32(x) (*(guint32 *)(x))
+#define READ64(x) (*(guint64 *)(x))
+#endif
+
+extern const char *mono_interp_opname[];
+extern unsigned char mono_interp_oplen[];
+extern MintOpArgType mono_interp_opargtype[];
+extern const guint16 *mono_interp_dis_mintop(const unsigned short *base, const guint16 *ip);
+
+#endif
+
diff --git a/mono/mini/interp/transform.c b/mono/mini/interp/transform.c
new file mode 100644 (file)
index 0000000..4b2b96b
--- /dev/null
@@ -0,0 +1,3510 @@
+/*
+ * transform CIL into different opcodes for more
+ * efficient interpretation
+ *
+ * Written by Bernie Solomon (bernard@ugsolutions.com)
+ * Copyright (c) 2004.
+ */
+
+#include <string.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/marshal.h>
+#include <mono/metadata/profiler-private.h>
+#include <mono/metadata/tabledefs.h>
+
+#include <mono/mini/mini.h>
+
+#include "mintops.h"
+#include "interp-internals.h"
+#include "interp.h"
+
+// TODO: export from marshal.c
+MonoDelegate* mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
+
+#define DEBUG 0
+
+typedef struct
+{
+       MonoClass *klass;
+       unsigned char type;
+       unsigned char flags;
+} StackInfo;
+
+typedef struct
+{
+       MonoMethod *method;
+       MonoMethodHeader *header;
+       RuntimeMethod *rtm;
+       const unsigned char *il_code;
+       const unsigned char *ip;
+       const unsigned char *last_ip;
+       const unsigned char *in_start;
+       int code_size;
+       int *in_offsets;
+       int *forward_refs;
+       StackInfo **stack_state;
+       int *stack_height;
+       int *vt_stack_size;
+       unsigned char *is_bb_start;
+       unsigned short *new_code;
+       unsigned short *new_code_end;
+       unsigned short *new_ip;
+       unsigned short *last_new_ip;
+       unsigned int max_code_size;
+       StackInfo *stack;
+       StackInfo *sp;
+       unsigned int max_stack_height;
+       unsigned int vt_sp;
+       unsigned int max_vt_sp;
+       int n_data_items;
+       int max_data_items;
+       void **data_items;
+       GHashTable *data_hash;
+} TransformData;
+
+#define MINT_TYPE_I1 0
+#define MINT_TYPE_U1 1
+#define MINT_TYPE_I2 2
+#define MINT_TYPE_U2 3
+#define MINT_TYPE_I4 4
+#define MINT_TYPE_I8 5
+#define MINT_TYPE_R4 6
+#define MINT_TYPE_R8 7
+#define MINT_TYPE_O  8
+#define MINT_TYPE_P  9
+#define MINT_TYPE_VT 10
+
+#define STACK_TYPE_I4 0
+#define STACK_TYPE_I8 1
+#define STACK_TYPE_R8 2
+#define STACK_TYPE_O  3
+#define STACK_TYPE_VT 4
+#define STACK_TYPE_MP 5
+#define STACK_TYPE_F  6
+
+static const char *stack_type_string [] = { "I4", "I8", "R8", "O ", "VT", "MP", "F " };
+
+#if SIZEOF_VOID_P == 8
+#define STACK_TYPE_I STACK_TYPE_I8
+#else
+#define STACK_TYPE_I STACK_TYPE_I4
+#endif
+
+static int stack_type [] = {
+       STACK_TYPE_I4, /*I1*/
+       STACK_TYPE_I4, /*U1*/
+       STACK_TYPE_I4, /*I2*/
+       STACK_TYPE_I4, /*U2*/
+       STACK_TYPE_I4, /*I4*/
+       STACK_TYPE_I8, /*I8*/
+       STACK_TYPE_R8, /*R4*/
+       STACK_TYPE_R8, /*R8*/
+       STACK_TYPE_O,  /*O*/
+       STACK_TYPE_MP, /*P*/
+       STACK_TYPE_VT
+};
+
+static void
+grow_code (TransformData *td)
+{
+       unsigned int old_ip_offset = td->new_ip - td->new_code;
+       unsigned int old_last_ip_offset = td->last_new_ip - td->new_code;
+       g_assert (old_ip_offset <= td->max_code_size);
+       td->new_code = g_realloc (td->new_code, (td->max_code_size *= 2) * sizeof (td->new_code [0]));
+       td->new_code_end = td->new_code + td->max_code_size;
+       td->new_ip = td->new_code + old_ip_offset;
+       td->last_new_ip = td->new_code + old_last_ip_offset;
+}
+
+#define ENSURE_CODE(td, n) \
+       do { \
+               if ((td)->new_ip + (n) > (td)->new_code_end) \
+                       grow_code (td); \
+       } while (0)
+
+#define ADD_CODE(td, n) \
+       do { \
+               if ((td)->new_ip == (td)->new_code_end) \
+                       grow_code (td); \
+               *(td)->new_ip++ = (n); \
+       } while (0)
+
+#define CHECK_STACK(td, n) \
+       do { \
+               int stack_size = (td)->sp - (td)->stack; \
+               if (stack_size < (n)) \
+                       g_warning ("%s.%s: not enough values (%d < %d) on stack at %04x", \
+                               (td)->method->klass->name, (td)->method->name, \
+                               stack_size, n, (td)->ip - (td)->il_code); \
+       } while (0)
+
+#define ENSURE_I4(td, sp_off) \
+       do { \
+               if ((td)->sp [-sp_off].type == STACK_TYPE_I8) \
+                       ADD_CODE(td, sp_off == 1 ? MINT_CONV_I4_I8 : MINT_CONV_I4_I8_SP); \
+       } while (0)
+
+static void 
+handle_branch(TransformData *td, int short_op, int long_op, int offset) 
+{
+       int shorten_branch = 0;
+       int target = td->ip + offset - td->il_code;
+       if (target < 0 || target >= td->code_size)
+               g_assert_not_reached ();
+       if (offset > 0 && td->stack_height [target] < 0) {
+               td->stack_height [target] = td->sp - td->stack;
+               if (td->stack_height [target] > 0)
+                       td->stack_state [target] = g_memdup (td->stack, td->stack_height [target] * sizeof (td->stack [0]));
+               td->vt_stack_size [target] = td->vt_sp;
+       }
+       if (offset < 0) {
+               offset = td->in_offsets [target] - (td->new_ip - td->new_code);
+               if (offset >= -32768) {
+                       shorten_branch = 1;
+               }
+       } else {
+               int prev = td->forward_refs [target];
+               td->forward_refs [td->ip - td->il_code] = prev;
+               td->forward_refs [target] = td->ip - td->il_code;
+               offset = 0;
+               if (td->header->code_size <= 25000) /* FIX to be precise somehow? */
+                       shorten_branch = 1;
+       }
+       if (shorten_branch) {
+               ADD_CODE(td, short_op);
+               ADD_CODE(td, offset);
+       } else {
+               ADD_CODE(td, long_op);
+               ADD_CODE(td, * (unsigned short *)(&offset));
+               ADD_CODE(td, * ((unsigned short *)&offset + 1));
+       }
+}
+
+static void 
+one_arg_branch(TransformData *td, int mint_op, int offset) 
+{
+       int type = td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-1].type;
+       int long_op = mint_op + type - STACK_TYPE_I4;
+       int short_op = long_op + MINT_BRFALSE_I4_S - MINT_BRFALSE_I4;
+       CHECK_STACK(td, 1);
+       --td->sp;
+       handle_branch (td, short_op, long_op, offset);
+}
+
+static void 
+two_arg_branch(TransformData *td, int mint_op, int offset) 
+{
+       int type1 = td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-1].type;
+       int type2 = td->sp [-2].type == STACK_TYPE_O || td->sp [-2].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-2].type;
+       int long_op = mint_op + type1 - STACK_TYPE_I4;
+       int short_op = long_op + MINT_BEQ_I4_S - MINT_BEQ_I4;
+       CHECK_STACK(td, 2);
+       if (type1 == STACK_TYPE_I4 && type2 == STACK_TYPE_I8) {
+               ADD_CODE(td, MINT_CONV_I8_I4);
+               td->in_offsets [td->ip - td->il_code]++;
+       } else if (type1 == STACK_TYPE_I8 && type2 == STACK_TYPE_I4) {
+               ADD_CODE(td, MINT_CONV_I8_I4_SP);
+               td->in_offsets [td->ip - td->il_code]++;
+       } else if (type1 != type2) {
+               g_warning("%s.%s: branch type mismatch %d %d", 
+                       td->method->klass->name, td->method->name, 
+                       td->sp [-1].type, td->sp [-2].type);
+       }
+       td->sp -= 2;
+       handle_branch (td, short_op, long_op, offset);
+}
+
+static void
+unary_arith_op(TransformData *td, int mint_op)
+{
+       int op = mint_op + td->sp [-1].type - STACK_TYPE_I4;
+       CHECK_STACK(td, 1);
+       ADD_CODE(td, op);
+}
+
+static void
+binary_arith_op(TransformData *td, int mint_op)
+{
+       int type1 = td->sp [-2].type;
+       int type2 = td->sp [-1].type;
+       int op;
+#if SIZEOF_VOID_P == 8
+       if ((type1 == STACK_TYPE_MP || type1 == STACK_TYPE_I8) && type2 == STACK_TYPE_I4) {
+               ADD_CODE(td, MINT_CONV_I8_I4);
+               type2 = STACK_TYPE_I8;
+       }
+       if (type1 == STACK_TYPE_I4 && (type2 == STACK_TYPE_MP || type2 == STACK_TYPE_I8)) {
+               ADD_CODE(td, MINT_CONV_I8_I4_SP);
+               type1 = STACK_TYPE_I8;
+               td->sp [-2].type = STACK_TYPE_I8;
+       }
+#endif
+       if (type1 == STACK_TYPE_MP)
+               type1 = STACK_TYPE_I;
+       if (type2 == STACK_TYPE_MP)
+               type2 = STACK_TYPE_I;
+       if (type1 != type2) {
+               g_warning("%s.%s: %04x arith type mismatch %s %d %d", 
+                       td->method->klass->name, td->method->name, 
+                       td->ip - td->il_code, mono_interp_opname[mint_op], type1, type2);
+       }
+       op = mint_op + type1 - STACK_TYPE_I4;
+       CHECK_STACK(td, 2);
+       ADD_CODE(td, op);
+       --td->sp;
+}
+
+static void
+binary_int_op(TransformData *td, int mint_op)
+{
+       int op = mint_op + td->sp [-1].type - STACK_TYPE_I4;
+       CHECK_STACK(td, 2);
+       if (td->sp [-1].type != td->sp [-2].type)
+               g_warning("%s.%s: int type mismatch", td->method->klass->name, td->method->name);
+       ADD_CODE(td, op);
+       --td->sp;
+}
+
+static void
+shift_op(TransformData *td, int mint_op)
+{
+       int op = mint_op + td->sp [-2].type - STACK_TYPE_I4;
+       CHECK_STACK(td, 2);
+       if (td->sp [-1].type != STACK_TYPE_I4) {
+               g_warning("%s.%s: shift type mismatch %d", 
+                       td->method->klass->name, td->method->name,
+                       td->sp [-2].type);
+       }
+       ADD_CODE(td, op);
+       --td->sp;
+}
+
+static int 
+mint_type(MonoType *type)
+{
+       if (type->byref)
+               return MINT_TYPE_P;
+enum_type:
+       switch (type->type) {
+       case MONO_TYPE_I1:
+               return MINT_TYPE_I1;
+       case MONO_TYPE_U1:
+       case MONO_TYPE_BOOLEAN:
+               return MINT_TYPE_U1;
+       case MONO_TYPE_I2:
+               return MINT_TYPE_I2;
+       case MONO_TYPE_U2:
+       case MONO_TYPE_CHAR:
+               return MINT_TYPE_U2;
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+               return MINT_TYPE_I4;
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+#if SIZEOF_VOID_P == 4
+               return MINT_TYPE_I4;
+#else
+               return MINT_TYPE_I8;
+#endif
+       case MONO_TYPE_PTR:
+               return MINT_TYPE_P;
+       case MONO_TYPE_R4:
+               return MINT_TYPE_R4;
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+               return MINT_TYPE_I8;
+       case MONO_TYPE_R8:
+               return MINT_TYPE_R8;
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_ARRAY:
+               return MINT_TYPE_O;
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype) {
+                       type = mono_class_enum_basetype (type->data.klass);
+                       goto enum_type;
+               } else
+                       return MINT_TYPE_VT;
+       case MONO_TYPE_GENERICINST:
+               type = &type->data.generic_class->container_class->byval_arg;
+               goto enum_type;
+       default:
+               g_warning ("got type 0x%02x", type->type);
+               g_assert_not_reached ();
+       }
+       return -1;
+}
+
+static int 
+can_store (int stack_type, int var_type)
+{
+       if (stack_type == STACK_TYPE_O || stack_type == STACK_TYPE_MP)
+               stack_type = STACK_TYPE_I;
+       if (var_type == STACK_TYPE_O || var_type == STACK_TYPE_MP)
+               var_type = STACK_TYPE_I;
+       return stack_type == var_type;
+}
+
+#define SET_SIMPLE_TYPE(s, ty) \
+       do { \
+               (s)->type = (ty); \
+               (s)->flags = 0; \
+               (s)->klass = NULL; \
+       } while (0)
+
+#define SET_TYPE(s, ty, k) \
+       do { \
+               (s)->type = (ty); \
+               (s)->flags = 0; \
+               (s)->klass = k; \
+       } while (0)
+
+#define PUSH_SIMPLE_TYPE(td, ty) \
+       do { \
+               int sp_height; \
+               (td)->sp++; \
+               sp_height = (td)->sp - (td)->stack; \
+               if (sp_height > (td)->max_stack_height) \
+                       (td)->max_stack_height = sp_height; \
+               SET_SIMPLE_TYPE((td)->sp - 1, ty); \
+       } while (0)
+
+#define PUSH_TYPE(td, ty, k) \
+       do { \
+               int sp_height; \
+               (td)->sp++; \
+               sp_height = (td)->sp - (td)->stack; \
+               if (sp_height > (td)->max_stack_height) \
+                       (td)->max_stack_height = sp_height; \
+               SET_TYPE((td)->sp - 1, ty, k); \
+       } while (0)
+
+#define PUSH_VT(td, size) \
+       do { \
+               (td)->vt_sp += ((size) + 7) & ~7; \
+               if ((td)->vt_sp > (td)->max_vt_sp) \
+                       (td)->max_vt_sp = (td)->vt_sp; \
+       } while (0)
+
+#define POP_VT(td, size) \
+       do { \
+               (td)->vt_sp -= ((size) + 7) & ~7; \
+       } while (0)
+
+#if NO_UNALIGNED_ACCESS
+#define WRITE32(td, v) \
+       do { \
+               ENSURE_CODE(td, 2); \
+               * (guint16 *)((td)->new_ip) = * (guint16 *)(v); \
+               * ((guint16 *)((td)->new_ip) + 1) = * ((guint16 *)(v) + 1); \
+               (td)->new_ip += 2; \
+       } while (0)
+
+#define WRITE64(td, v) \
+       do { \
+               ENSURE_CODE(td, 4); \
+               * (guint16 *)((td)->new_ip) = * (guint16 *)(v); \
+               * ((guint16 *)((td)->new_ip) + 1) = * ((guint16 *)(v) + 1); \
+               * ((guint16 *)((td)->new_ip) + 2) = * ((guint16 *)(v) + 2); \
+               * ((guint16 *)((td)->new_ip) + 3) = * ((guint16 *)(v) + 3); \
+               (td)->new_ip += 4; \
+       } while (0)
+#else
+#define WRITE32(td, v) \
+       do { \
+               ENSURE_CODE(td, 2); \
+               * (guint32 *)((td)->new_ip) = * (guint32 *)(v); \
+               (td)->new_ip += 2; \
+       } while (0)
+
+#define WRITE64(td, v) \
+       do { \
+               ENSURE_CODE(td, 4); \
+               * (guint64 *)((td)->new_ip) = * (guint64 *)(v); \
+               (td)->new_ip += 4; \
+       } while (0)
+
+#endif
+
+static void 
+load_arg(TransformData *td, int n)
+{
+       int mt;
+       MonoClass *klass = NULL;
+       MonoType *type;
+
+       gboolean hasthis = mono_method_signature (td->method)->hasthis;
+       if (hasthis && n == 0)
+               type = &td->method->klass->byval_arg;
+       else
+               type = mono_method_signature (td->method)->params [hasthis ? n - 1 : n];
+
+       mt = mint_type (type);
+       if (mt == MINT_TYPE_VT) {
+               gint32 size;
+               klass = mono_class_from_mono_type (type);
+               if (mono_method_signature (td->method)->pinvoke)
+                       size = mono_class_native_size (klass, NULL);
+               else
+                       size = mono_class_value_size (klass, NULL);
+
+               if (hasthis && n == 0) {
+                       mt = MINT_TYPE_P;
+                       ADD_CODE (td, MINT_LDARG_P);
+                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
+                       klass = NULL;
+               } else {
+                       PUSH_VT (td, size);
+                       ADD_CODE (td, MINT_LDARG_VT);
+                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
+                       WRITE32 (td, &size);
+               }
+       } else {
+               if (hasthis && n == 0) {
+                       mt = MINT_TYPE_P;
+                       ADD_CODE (td, MINT_LDARG_P);
+                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
+                       klass = NULL;
+               } else {
+                       ADD_CODE(td, MINT_LDARG_I1 + (mt - MINT_TYPE_I1));
+                       ADD_CODE(td, td->rtm->arg_offsets [n]); /* FIX for large offset */
+                       if (mt == MINT_TYPE_O)
+                               klass = mono_class_from_mono_type (type);
+               }
+       }
+       PUSH_TYPE(td, stack_type[mt], klass);
+}
+
+static void 
+store_arg(TransformData *td, int n)
+{
+       int mt;
+       CHECK_STACK (td, 1);
+       MonoType *type;
+
+       gboolean hasthis = mono_method_signature (td->method)->hasthis;
+       if (hasthis && n == 0)
+               type = &td->method->klass->byval_arg;
+       else
+               type = mono_method_signature (td->method)->params [n - !!hasthis];
+
+       mt = mint_type (type);
+       if (mt == MINT_TYPE_VT) {
+               gint32 size;
+               MonoClass *klass = mono_class_from_mono_type (type);
+               if (mono_method_signature (td->method)->pinvoke)
+                       size = mono_class_native_size (klass, NULL);
+               else
+                       size = mono_class_value_size (klass, NULL);
+               ADD_CODE(td, MINT_STARG_VT);
+               ADD_CODE(td, n);
+               WRITE32(td, &size);
+               if (td->sp [-1].type == STACK_TYPE_VT)
+                       POP_VT(td, size);
+       } else {
+               ADD_CODE(td, MINT_STARG_I1 + (mt - MINT_TYPE_I1));
+               ADD_CODE(td, td->rtm->arg_offsets [n]);
+       }
+       --td->sp;
+}
+
+static void 
+store_inarg(TransformData *td, int n)
+{
+       MonoType *type;
+       gboolean hasthis = mono_method_signature (td->method)->hasthis;
+       if (hasthis && n == 0)
+               type = &td->method->klass->byval_arg;
+       else
+               type = mono_method_signature (td->method)->params [n - !!hasthis];
+
+       int mt = mint_type (type);
+       if (hasthis && n == 0) {
+               ADD_CODE (td, MINT_STINARG_P);
+               ADD_CODE (td, n);
+               return;
+       }
+       if (mt == MINT_TYPE_VT) {
+               MonoClass *klass = mono_class_from_mono_type (type);
+               gint32 size;
+               if (mono_method_signature (td->method)->pinvoke)
+                       size = mono_class_native_size (klass, NULL);
+               else
+                       size = mono_class_value_size (klass, NULL);
+               ADD_CODE(td, MINT_STINARG_VT);
+               ADD_CODE(td, n);
+               WRITE32(td, &size);
+       } else {
+               ADD_CODE(td, MINT_STINARG_I1 + (mt - MINT_TYPE_I1));
+               ADD_CODE(td, n);
+       }
+}
+
+static void 
+load_local(TransformData *td, int n)
+{
+       MonoType *type = td->header->locals [n];
+       int mt = mint_type (type);
+       int offset = td->rtm->local_offsets [n];
+       MonoClass *klass = NULL;
+       if (mt == MINT_TYPE_VT) {
+               klass = mono_class_from_mono_type (type);
+               gint32 size = mono_class_value_size (klass, NULL);
+               PUSH_VT(td, size);
+               ADD_CODE(td, MINT_LDLOC_VT);
+               ADD_CODE(td, offset); /*FIX for large offset */
+               WRITE32(td, &size);
+       } else {
+               g_assert (mt < MINT_TYPE_VT);
+               if (mt == MINT_TYPE_I4 && !td->is_bb_start [td->in_start - td->il_code] && td->last_new_ip != NULL &&
+                       td->last_new_ip [0] == MINT_STLOC_I4 && td->last_new_ip [1] == offset) {
+                       td->last_new_ip [0] = MINT_STLOC_NP_I4;
+               } else if (mt == MINT_TYPE_O && !td->is_bb_start [td->in_start - td->il_code] && td->last_new_ip != NULL &&
+                       td->last_new_ip [0] == MINT_STLOC_O && td->last_new_ip [1] == offset) {
+                       td->last_new_ip [0] = MINT_STLOC_NP_O;
+               } else {
+                       ADD_CODE(td, MINT_LDLOC_I1 + (mt - MINT_TYPE_I1));
+                       ADD_CODE(td, offset); /*FIX for large offset */
+               }
+               if (mt == MINT_TYPE_O)
+                       klass = mono_class_from_mono_type (type);
+       }
+       PUSH_TYPE(td, stack_type[mt], klass);
+}
+
+static void 
+store_local(TransformData *td, int n)
+{
+       MonoType *type = td->header->locals [n];
+       int mt = mint_type (type);
+       int offset = td->rtm->local_offsets [n];
+       CHECK_STACK (td, 1);
+#if SIZEOF_VOID_P == 8
+       if (td->sp [-1].type == STACK_TYPE_I4 && stack_type [mt] == STACK_TYPE_I8) {
+               ADD_CODE(td, MINT_CONV_I8_I4);
+               td->sp [-1].type = STACK_TYPE_I8;
+       }
+#endif
+       if (!can_store(td->sp [-1].type, stack_type [mt])) {
+               g_warning("%s.%s: Store local stack type mismatch %d %d", 
+                       td->method->klass->name, td->method->name,
+                       stack_type [mt], td->sp [-1].type);
+       }
+       if (mt == MINT_TYPE_VT) {
+               MonoClass *klass = mono_class_from_mono_type (type);
+               gint32 size = mono_class_value_size (klass, NULL);
+               ADD_CODE(td, MINT_STLOC_VT);
+               ADD_CODE(td, offset); /*FIX for large offset */
+               WRITE32(td, &size);
+               if (td->sp [-1].type == STACK_TYPE_VT)
+                       POP_VT(td, size);
+       } else {
+               g_assert (mt < MINT_TYPE_VT);
+               ADD_CODE(td, MINT_STLOC_I1 + (mt - MINT_TYPE_I1));
+               ADD_CODE(td, offset); /*FIX for large offset */
+       }
+       --td->sp;
+}
+
+#define SIMPLE_OP(td, op) \
+       do { \
+               ADD_CODE(&td, op); \
+               ++td.ip; \
+       } while (0)
+
+static guint16
+get_data_item_index (TransformData *td, void *ptr)
+{
+       gpointer p = g_hash_table_lookup (td->data_hash, ptr);
+       guint index;
+       if (p != NULL)
+               return GPOINTER_TO_UINT (p) - 1;
+       if (td->max_data_items == td->n_data_items) {
+               td->max_data_items = td->n_data_items == 0 ? 16 : 2 * td->max_data_items;
+               td->data_items = g_realloc (td->data_items, td->max_data_items * sizeof(td->data_items [0]));
+       }
+       index = td->n_data_items;
+       td->data_items [index] = ptr;
+       ++td->n_data_items;
+       g_hash_table_insert (td->data_hash, ptr, GUINT_TO_POINTER (index + 1));
+       return index;
+}
+
+static void
+interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target_method, MonoDomain *domain, MonoGenericContext *generic_context, unsigned char *is_bb_start, int body_start_offset, MonoClass *constrained_class, gboolean readonly)
+{
+       MonoImage *image = method->klass->image;
+       MonoMethodSignature *csignature;
+       MonoError error;
+       int virtual = *td->ip == CEE_CALLVIRT;
+       int calli = *td->ip == CEE_CALLI || *td->ip == CEE_MONO_CALLI_EXTRA_ARG;
+       int i;
+       guint32 vt_stack_used = 0;
+       guint32 vt_res_size = 0;
+       int op = -1;
+       int native = 0;
+       int is_void = 0;
+
+       guint32 token = read32 (td->ip + 1);
+
+       if (target_method == NULL) {
+               if (calli) {
+                       CHECK_STACK(td, 1);
+                       native = (method->wrapper_type != MONO_WRAPPER_DELEGATE_INVOKE && td->sp [-1].type == STACK_TYPE_I);
+                       --td->sp;
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               csignature = (MonoMethodSignature *)mono_method_get_wrapper_data (method, token);
+                       else
+                               csignature = mono_metadata_parse_signature (image, token);
+
+                       if (generic_context) {
+                               csignature = mono_inflate_generic_signature (csignature, generic_context, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+
+                       target_method = NULL;
+               } else {
+                       if (method->wrapper_type == MONO_WRAPPER_NONE)
+                               target_method = mono_get_method_full (image, token, NULL, generic_context);
+                       else
+                               target_method = (MonoMethod *)mono_method_get_wrapper_data (method, token);
+                       csignature = mono_method_signature (target_method);
+                       if (target_method->klass == mono_defaults.string_class) {
+                               if (target_method->name [0] == 'g') {
+                                       if (strcmp (target_method->name, "get_Chars") == 0)
+                                               op = MINT_GETCHR;
+                                       else if (strcmp (target_method->name, "get_Length") == 0)
+                                               op = MINT_STRLEN;
+                               }
+                       } else if (mono_class_is_subclass_of (target_method->klass, mono_defaults.array_class, FALSE)) {
+                               if (!strcmp (target_method->name, "get_Rank")) {
+                                       op = MINT_ARRAY_RANK;
+                               } else if (!strcmp (target_method->name, "get_Length")) {
+                                       op = MINT_LDLEN;
+                               } else if (!strcmp (target_method->name, "Address")) {
+                                       op = readonly ? MINT_LDELEMA : MINT_LDELEMA_TC;
+                               }
+                       } else if (target_method && generic_context) {
+                               csignature = mono_inflate_generic_signature (csignature, generic_context, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               target_method = mono_class_inflate_generic_method_checked (target_method, generic_context, &error);
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       }
+               }
+       } else {
+               csignature = mono_method_signature (target_method);
+       }
+
+       if (constrained_class) {
+               if (constrained_class->enumtype && !strcmp (target_method->name, "GetHashCode")) {
+                       /* Use the corresponding method from the base type to avoid boxing */
+                       MonoType *base_type = mono_class_enum_basetype (constrained_class);
+                       g_assert (base_type);
+                       constrained_class = mono_class_from_mono_type (base_type);
+                       target_method = mono_class_get_method_from_name (constrained_class, target_method->name, 0);
+                       g_assert (target_method);
+               }
+       }
+
+       if (constrained_class) {
+               mono_class_setup_vtable (constrained_class);
+#if DEBUG_INTERP
+               g_print ("CONSTRAINED.CALLVIRT: %s::%s.  %s (%p) ->\n", target_method->klass->name, target_method->name, mono_signature_full_name (target_method->signature), target_method);
+#endif
+               target_method = mono_get_method_constrained_with_method (image, target_method, constrained_class, generic_context, &error);
+#if DEBUG_INTERP
+               g_print ("                    : %s::%s.  %s (%p)\n", target_method->klass->name, target_method->name, mono_signature_full_name (target_method->signature), target_method);
+#endif
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               mono_class_setup_vtable (target_method->klass);
+
+               if (constrained_class->valuetype && (target_method->klass == mono_defaults.object_class || target_method->klass == mono_defaults.enum_class->parent || target_method->klass == mono_defaults.enum_class)) {
+                       if (target_method->klass == mono_defaults.enum_class && (td->sp - csignature->param_count - 1)->type == STACK_TYPE_MP) {
+                               /* managed pointer on the stack, we need to deref that puppy */
+                               ADD_CODE (td, MINT_LDIND_I);
+                               ADD_CODE (td, csignature->param_count);
+                       }
+                       ADD_CODE (td, MINT_BOX);
+                       ADD_CODE (td, get_data_item_index (td, constrained_class));
+                       ADD_CODE (td, csignature->param_count);
+               } else if (!constrained_class->valuetype) {
+                       /* managed pointer on the stack, we need to deref that puppy */
+                       ADD_CODE (td, MINT_LDIND_I);
+                       ADD_CODE (td, csignature->param_count);
+               } else {
+                       if (target_method->klass->valuetype) {
+                               /* Own method */
+                       } else {
+                               /* Interface method */
+                               int ioffset, slot;
+
+                               mono_class_setup_vtable (constrained_class);
+                               ioffset = mono_class_interface_offset (constrained_class, target_method->klass);
+                               if (ioffset == -1)
+                                       g_error ("type load error: constrained_class");
+                               slot = mono_method_get_vtable_slot (target_method);
+                               if (slot == -1)
+                                       g_error ("type load error: target_method->klass");
+                               target_method = constrained_class->vtable [ioffset + slot];
+
+                               if (target_method->klass == mono_defaults.enum_class) {
+                                       if ((td->sp - csignature->param_count - 1)->type == STACK_TYPE_MP) {
+                                               /* managed pointer on the stack, we need to deref that puppy */
+                                               ADD_CODE (td, MINT_LDIND_I);
+                                               ADD_CODE (td, csignature->param_count);
+                                       }
+                                       ADD_CODE (td, MINT_BOX);
+                                       ADD_CODE (td, get_data_item_index (td, constrained_class));
+                                       ADD_CODE (td, csignature->param_count);
+                               }
+                       }
+                       virtual = FALSE;
+               }
+       }
+
+       if (target_method)
+               mono_class_init (target_method->klass);
+
+       CHECK_STACK (td, csignature->param_count + csignature->hasthis);
+       if (!calli && (!virtual || (target_method->flags & METHOD_ATTRIBUTE_VIRTUAL) == 0) &&
+               (target_method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) == 0 && 
+               (target_method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) == 0) {
+               int called_inited = mono_class_vtable (domain, target_method->klass)->initialized;
+               MonoMethodHeader *mheader = mono_method_get_header (target_method);
+
+               if (/*mono_metadata_signature_equal (method->signature, target_method->signature) */ method == target_method && *(td->ip + 5) == CEE_RET) {
+                       int offset;
+                       if (mono_interp_traceopt)
+                               g_print ("Optimize tail call of %s.%s\n", target_method->klass->name, target_method->name);
+                       for (i = csignature->param_count - 1; i >= 0; --i)
+                               store_arg (td, i + csignature->hasthis);
+
+                       ADD_CODE(td, MINT_BR_S);
+                       offset = body_start_offset - ((td->new_ip - 1) - td->new_code);
+                       ADD_CODE(td, offset);
+                       if (!is_bb_start [td->ip + 5 - td->il_code])
+                               ++td->ip; /* gobble the CEE_RET if it isn't branched to */                              
+                       td->ip += 5;
+                       return;
+               } else {
+                       /* mheader might not exist if this is a delegate invoc, etc */
+                       if (mheader && *mheader->code == CEE_RET && called_inited) {
+                               if (mono_interp_traceopt)
+                                       g_print ("Inline (empty) call of %s.%s\n", target_method->klass->name, target_method->name);
+                               for (i = 0; i < csignature->param_count; i++)
+                                       ADD_CODE (td, MINT_POP); /*FIX: vt */
+                                       ADD_CODE (td, 0);
+                               if (csignature->hasthis) {
+                                       if (virtual)
+                                               ADD_CODE(td, MINT_CKNULL);
+                                       ADD_CODE (td, MINT_POP);
+                                       ADD_CODE (td, 0);
+                               }
+                               td->sp -= csignature->param_count + csignature->hasthis;
+                               td->ip += 5;
+                               return;
+                       }
+               }
+       }
+       if (method->wrapper_type == MONO_WRAPPER_NONE && target_method != NULL) {
+               if (target_method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+                       target_method = mono_marshal_get_native_wrapper (target_method, FALSE, FALSE);
+               if (!virtual && target_method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+                       target_method = mono_marshal_get_synchronized_wrapper (target_method);
+       }
+       g_assert (csignature->call_convention == MONO_CALL_DEFAULT || csignature->call_convention == MONO_CALL_C);
+       td->sp -= csignature->param_count + !!csignature->hasthis;
+       for (i = 0; i < csignature->param_count; ++i) {
+               if (td->sp [i + !!csignature->hasthis].type == STACK_TYPE_VT) {
+                       gint32 size;
+                       MonoClass *klass = mono_class_from_mono_type (csignature->params [i]);
+                       if (csignature->pinvoke && method->wrapper_type != MONO_WRAPPER_NONE)
+                               size = mono_class_native_size (klass, NULL);
+                       else
+                               size = mono_class_value_size (klass, NULL);
+                       size = (size + 7) & ~7;
+                       vt_stack_used += size;
+               }
+       }
+
+       /* need to handle typedbyref ... */
+       if (csignature->ret->type != MONO_TYPE_VOID) {
+               int mt = mint_type(csignature->ret);
+               MonoClass *klass = mono_class_from_mono_type (csignature->ret);
+               if (mt == MINT_TYPE_VT) {
+                       if (csignature->pinvoke && method->wrapper_type != MONO_WRAPPER_NONE)
+                               vt_res_size = mono_class_native_size (klass, NULL);
+                       else
+                               vt_res_size = mono_class_value_size (klass, NULL);
+                       PUSH_VT(td, vt_res_size);
+               }
+               PUSH_TYPE(td, stack_type[mt], klass);
+       } else
+               is_void = TRUE;
+
+       if (op >= 0) {
+               ADD_CODE (td, op);
+#if SIZEOF_VOID_P == 8
+               if (op == MINT_LDLEN)
+                       ADD_CODE (td, MINT_CONV_I4_I8);
+#endif
+               if (op == MINT_LDELEMA || op == MINT_LDELEMA_TC) {
+                       ADD_CODE (td, get_data_item_index (td, target_method->klass));
+                       ADD_CODE (td, 1 + target_method->klass->rank);
+               }
+       } else {
+               if (calli)
+                       ADD_CODE(td, native ? MINT_CALLI_NAT : MINT_CALLI);
+               else if (virtual)
+                       ADD_CODE(td, is_void ? MINT_VCALLVIRT : MINT_CALLVIRT);
+               else
+                       ADD_CODE(td, is_void ? MINT_VCALL : MINT_CALL);
+               
+               if (calli) {
+                       ADD_CODE(td, get_data_item_index (td, (void *)csignature));
+               } else {
+                       ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+               }
+       }
+       td->ip += 5;
+       if (vt_stack_used != 0 || vt_res_size != 0) {
+               ADD_CODE(td, MINT_VTRESULT);
+               ADD_CODE(td, vt_res_size);
+               WRITE32(td, &vt_stack_used);
+               td->vt_sp -= vt_stack_used;
+       }
+}
+
+static void
+generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, MonoGenericContext *generic_context)
+{
+       MonoMethodHeader *header = mono_method_get_header (method);
+       MonoMethodSignature *signature = mono_method_signature (method);
+       MonoImage *image = method->klass->image;
+       MonoDomain *domain = mono_domain_get ();
+       MonoClass *constrained_class = NULL;
+       MonoError error;
+       int offset, mt, i, i32;
+       gboolean readonly = FALSE;
+       MonoClass *klass;
+       MonoClassField *field;
+       const unsigned char *end;
+       int new_in_start_offset;
+       int body_start_offset;
+       int target;
+       guint32 token;
+       TransformData td;
+       int generating_code = 1;
+
+       memset(&td, 0, sizeof(td));
+       td.method = method;
+       td.rtm = rtm;
+       td.is_bb_start = is_bb_start;
+       td.il_code = header->code;
+       td.code_size = header->code_size;
+       td.header = header;
+       td.max_code_size = td.code_size;
+       td.new_code = (unsigned short *)g_malloc(td.max_code_size * sizeof(gushort));
+       td.new_code_end = td.new_code + td.max_code_size;
+       td.in_offsets = g_malloc0(header->code_size * sizeof(int));
+       td.forward_refs = g_malloc(header->code_size * sizeof(int));
+       td.stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
+       td.stack_height = g_malloc(header->code_size * sizeof(int));
+       td.vt_stack_size = g_malloc(header->code_size * sizeof(int));
+       td.n_data_items = 0;
+       td.max_data_items = 0;
+       td.data_items = NULL;
+       td.data_hash = g_hash_table_new (NULL, NULL);
+       rtm->data_items = td.data_items;
+       for (i = 0; i < header->code_size; i++) {
+               td.forward_refs [i] = -1;
+               td.stack_height [i] = -1;
+       }
+       td.new_ip = td.new_code;
+       td.last_new_ip = NULL;
+
+       td.stack = g_malloc0 ((header->max_stack + 1) * sizeof (td.stack [0]));
+       td.sp = td.stack;
+       td.max_stack_height = 0;
+
+       for (i = 0; i < header->num_clauses; i++) {
+               MonoExceptionClause *c = header->clauses + i;
+               td.stack_height [c->handler_offset] = 0;
+               td.vt_stack_size [c->handler_offset] = 0;
+               td.is_bb_start [c->handler_offset] = 1;
+
+               td.stack_height [c->handler_offset] = 1;
+               td.stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
+               td.stack_state [c->handler_offset][0].type = STACK_TYPE_O;
+               td.stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
+       }
+
+       td.ip = header->code;
+       end = td.ip + header->code_size;
+
+       if (mono_interp_traceopt) {
+               char *tmp = mono_disasm_code (NULL, method, td.ip, end);
+               char *name = mono_method_full_name (method, TRUE);
+               g_print ("Method %s, original code:\n", name);
+               g_print ("%s\n", tmp);
+               g_free (tmp);
+               g_free (name);
+       }
+
+       if (signature->hasthis)
+               store_inarg (&td, 0);
+       for (i = 0; i < signature->param_count; i++)
+               store_inarg (&td, i + !!signature->hasthis);
+
+       body_start_offset = td.new_ip - td.new_code;
+
+       for (i = 0; i < header->num_locals; i++) {
+               int mt = mint_type(header->locals [i]);
+               if (mt == MINT_TYPE_VT || mt == MINT_TYPE_O || mt == MINT_TYPE_P) {
+                       ADD_CODE(&td, MINT_INITLOCALS);
+                       break;
+               }
+       }
+
+       while (td.ip < end) {
+               int in_offset;
+
+               g_assert (td.sp >= td.stack);
+               g_assert (td.vt_sp < 0x10000000);
+               in_offset = td.ip - header->code;
+               td.in_offsets [in_offset] = td.new_ip - td.new_code;
+               new_in_start_offset = td.new_ip - td.new_code;
+               td.in_start = td.ip;
+               while (td.forward_refs [in_offset] >= 0) {
+                       int j = td.forward_refs [in_offset];
+                       int slot;
+                       td.forward_refs [in_offset] = td.forward_refs [j];
+                       if (td.in_offsets [j] < 0) {                        
+                               int old_switch_offset = -td.in_offsets [j];
+                               int new_switch_offset = td.in_offsets [old_switch_offset];
+                               int switch_case = (j - old_switch_offset - 5) / 4;
+                               int n_cases = read32 (header->code + old_switch_offset + 1);
+                               offset = (td.new_ip - td.new_code) - (new_switch_offset + 2 * n_cases + 3);
+                               slot = new_switch_offset + 3 + 2 * switch_case;
+                               td.new_code [slot] = * (unsigned short *)(&offset);
+                               td.new_code [slot + 1] = * ((unsigned short *)&offset + 1);
+                       } else {
+                               int op = td.new_code [td.in_offsets [j]];
+                               if (mono_interp_opargtype [op] == MintOpShortBranch) {
+                                       offset = (td.new_ip - td.new_code) - td.in_offsets [j];
+                                       g_assert (offset <= 32767);
+                                       slot = td.in_offsets [j] + 1;
+                                       td.new_code [slot] = offset;
+                               } else {
+                                       offset = (td.new_ip - td.new_code) - td.in_offsets [j];
+                                       slot = td.in_offsets [j] + 1;
+                                       td.new_code [slot] = * (unsigned short *)(&offset);
+                                       td.new_code [slot + 1] = * ((unsigned short *)&offset + 1);
+                               }
+                       }
+               }
+               if (td.stack_height [in_offset] >= 0) {
+                       g_assert (is_bb_start [in_offset]);
+                       if (td.stack_height [in_offset] > 0)
+                               memcpy (td.stack, td.stack_state [in_offset], td.stack_height [in_offset] * sizeof(td.stack [0]));
+                       td.sp = td.stack + td.stack_height [in_offset];
+                       td.vt_sp = td.vt_stack_size [in_offset];
+               }
+               if (is_bb_start [in_offset]) {
+                       generating_code = 1;
+               }
+               if (!generating_code) {
+                       while (td.ip < end && !is_bb_start [td.ip - td.il_code])
+                               ++td.ip;
+                       continue;
+               }
+               if (mono_interp_traceopt > 1) {
+                       printf("IL_%04lx %s %-10s -> IL_%04lx, sp %ld, %s %-12s vt_sp %u (max %u)\n", 
+                               td.ip - td.il_code,
+                               td.is_bb_start [td.ip - td.il_code] == 3 ? "<>" :
+                               td.is_bb_start [td.ip - td.il_code] == 2 ? "< " :
+                               td.is_bb_start [td.ip - td.il_code] == 1 ? " >" : "  ",
+                               mono_opcode_name (*td.ip), td.new_ip - td.new_code, td.sp - td.stack, 
+                               td.sp > td.stack ? stack_type_string [td.sp [-1].type] : "  ",
+                               (td.sp > td.stack && (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_VT)) ? (td.sp [-1].klass == NULL ? "?" : td.sp [-1].klass->name) : "",
+                               td.vt_sp, td.max_vt_sp);
+               }
+               switch (*td.ip) {
+               case CEE_NOP: 
+                       /* lose it */
+                       ++td.ip;
+                       break;
+               case CEE_BREAK:
+                       SIMPLE_OP(td, MINT_BREAK);
+                       break;
+               case CEE_LDARG_0:
+               case CEE_LDARG_1:
+               case CEE_LDARG_2:
+               case CEE_LDARG_3:
+                       load_arg (&td, *td.ip - CEE_LDARG_0);
+                       ++td.ip;
+                       break;
+               case CEE_LDLOC_0:
+               case CEE_LDLOC_1:
+               case CEE_LDLOC_2:
+               case CEE_LDLOC_3:
+                       load_local (&td, *td.ip - CEE_LDLOC_0);
+                       ++td.ip;
+                       break;
+               case CEE_STLOC_0:
+               case CEE_STLOC_1:
+               case CEE_STLOC_2:
+               case CEE_STLOC_3:
+                       store_local (&td, *td.ip - CEE_STLOC_0);
+                       ++td.ip;
+                       break;
+               case CEE_LDARG_S:
+                       load_arg (&td, ((guint8 *)td.ip)[1]);
+                       td.ip += 2;
+                       break;
+               case CEE_LDARGA_S: {
+                       /* NOTE: n includes this */
+                       int n = ((guint8 *)td.ip)[1];
+                       if (n == 0 && signature->hasthis) {
+                               g_error ("LDTHISA: NOPE");
+                               ADD_CODE(&td, MINT_LDTHISA);
+                       }
+                       else {
+                               ADD_CODE(&td, MINT_LDARGA);
+                               ADD_CODE(&td, td.rtm->arg_offsets [n]);
+                       }
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+                       td.ip += 2;
+                       break;
+               }
+               case CEE_STARG_S:
+                       store_arg (&td, ((guint8 *)td.ip)[1]);
+                       td.ip += 2;
+                       break;
+               case CEE_LDLOC_S:
+                       load_local (&td, ((guint8 *)td.ip)[1]);
+                       td.ip += 2;
+                       break;
+               case CEE_LDLOCA_S:
+                       ADD_CODE(&td, MINT_LDLOCA_S);
+                       ADD_CODE(&td, td.rtm->local_offsets [((guint8 *)td.ip)[1]]);
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+                       td.ip += 2;
+                       break;
+               case CEE_STLOC_S:
+                       store_local (&td, ((guint8 *)td.ip)[1]);
+                       td.ip += 2;
+                       break;
+               case CEE_LDNULL: 
+                       SIMPLE_OP(td, MINT_LDNULL);
+                       PUSH_TYPE(&td, STACK_TYPE_O, NULL);
+                       break;
+               case CEE_LDC_I4_M1:
+                       SIMPLE_OP(td, MINT_LDC_I4_M1);
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       break;
+               case CEE_LDC_I4_0:
+                       if (!td.is_bb_start[td.ip + 1 - td.il_code] && td.ip [1] == 0xfe && td.ip [2] == CEE_CEQ && 
+                               td.sp > td.stack && td.sp [-1].type == STACK_TYPE_I4) {
+                               SIMPLE_OP(td, MINT_CEQ0_I4);
+                               td.ip += 2;
+                       } else {
+                               SIMPLE_OP(td, MINT_LDC_I4_0);
+                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       }
+                       break;
+               case CEE_LDC_I4_1:
+                       if (!td.is_bb_start[td.ip + 1 - td.il_code] && 
+                               (td.ip [1] == CEE_ADD || td.ip [1] == CEE_SUB) && td.sp [-1].type == STACK_TYPE_I4) {
+                               ADD_CODE(&td, td.ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
+                               td.ip += 2;
+                       } else {
+                               SIMPLE_OP(td, MINT_LDC_I4_1);
+                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       }
+                       break;
+               case CEE_LDC_I4_2:
+               case CEE_LDC_I4_3:
+               case CEE_LDC_I4_4:
+               case CEE_LDC_I4_5:
+               case CEE_LDC_I4_6:
+               case CEE_LDC_I4_7:
+               case CEE_LDC_I4_8:
+                       SIMPLE_OP(td, (*td.ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       break;
+               case CEE_LDC_I4_S: 
+                       ADD_CODE(&td, MINT_LDC_I4_S);
+                       ADD_CODE(&td, ((gint8 *) td.ip) [1]);
+                       td.ip += 2;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       break;
+               case CEE_LDC_I4:
+                       i32 = read32 (td.ip + 1);
+                       ADD_CODE(&td, MINT_LDC_I4);
+                       WRITE32(&td, &i32);
+                       td.ip += 5;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                       break;
+               case CEE_LDC_I8: {
+                       gint64 val = read64 (td.ip + 1);
+                       ADD_CODE(&td, MINT_LDC_I8);
+                       WRITE64(&td, &val);
+                       td.ip += 9;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I8);
+                       break;
+               }
+               case CEE_LDC_R4: {
+                       float val;
+                       readr4 (td.ip + 1, &val);
+                       ADD_CODE(&td, MINT_LDC_R4);
+                       WRITE32(&td, &val);
+                       td.ip += 5;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+                       break;
+               }
+               case CEE_LDC_R8: {
+                       double val;
+                       readr8 (td.ip + 1, &val);
+                       ADD_CODE(&td, MINT_LDC_R8);
+                       WRITE64(&td, &val);
+                       td.ip += 9;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+                       break;
+               }
+               case CEE_DUP: {
+                       int type = td.sp [-1].type;
+                       MonoClass *klass = td.sp [-1].klass;
+                       if (td.sp [-1].type == STACK_TYPE_VT) {
+                               gint32 size = mono_class_value_size (klass, NULL);
+                               PUSH_VT(&td, size);
+                               ADD_CODE(&td, MINT_DUP_VT);
+                               WRITE32(&td, &size);
+                               td.ip ++;
+                       } else 
+                               SIMPLE_OP(td, MINT_DUP);
+                       PUSH_TYPE(&td, type, klass);
+                       break;
+               }
+               case CEE_POP:
+                       CHECK_STACK(&td, 1);
+                       SIMPLE_OP(td, MINT_POP);
+                       ADD_CODE (&td, 0);
+                       if (td.sp [-1].type == STACK_TYPE_VT) {
+                               int size = mono_class_value_size (td.sp [-1].klass, NULL);
+                               size = (size + 7) & ~7;
+                               ADD_CODE(&td, MINT_VTRESULT);
+                               ADD_CODE(&td, 0);
+                               WRITE32(&td, &size);
+                               td.vt_sp -= size;
+                       }
+                       --td.sp;
+                       break;
+               case CEE_JMP: {
+                       MonoMethod *m;
+                       if (td.sp > td.stack)
+                               g_warning ("CEE_JMP: stack must be empty");
+                       token = read32 (td.ip + 1);
+                       m = mono_get_method_full (image, token, NULL, generic_context);
+                       ADD_CODE (&td, MINT_JMP);
+                       ADD_CODE (&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                       td.ip += 5;
+                       break;
+               }
+               case CEE_CALLVIRT: /* Fall through */
+               case CEE_CALLI:    /* Fall through */
+               case CEE_CALL: {
+                       interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class, readonly);
+                       constrained_class = NULL;
+                       readonly = FALSE;
+                       break;
+               }
+               case CEE_RET: {
+                       int vt_size = 0;
+                       if (signature->ret->type != MONO_TYPE_VOID) {
+                               --td.sp;
+                               MonoClass *klass = mono_class_from_mono_type (signature->ret);
+                               if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
+                                       vt_size = mono_class_value_size (klass, NULL);
+                                       vt_size = (vt_size + 7) & ~7;
+                               }
+                       }
+                       if (td.sp > td.stack)
+                               g_warning ("%s.%s: CEE_RET: more values on stack: %d", td.method->klass->name, td.method->name, td.sp - td.stack);
+                       if (td.vt_sp != vt_size)
+                               g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td.method->klass->name, td.method->name, td.vt_sp, vt_size);
+                       if (vt_size == 0)
+                               SIMPLE_OP(td, signature->ret->type == MONO_TYPE_VOID ? MINT_RET_VOID : MINT_RET);
+                       else {
+                               ADD_CODE(&td, MINT_RET_VT);
+                               WRITE32(&td, &vt_size);
+                               ++td.ip;
+                       }
+                       generating_code = 0;
+                       break;
+               }
+               case CEE_BR:
+                       handle_branch (&td, MINT_BR_S, MINT_BR, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       generating_code = 0;
+                       break;
+               case CEE_BR_S:
+                       handle_branch (&td, MINT_BR_S, MINT_BR, 2 + (gint8)td.ip [1]);
+                       td.ip += 2;
+                       generating_code = 0;
+                       break;
+               case CEE_BRFALSE:
+                       one_arg_branch (&td, MINT_BRFALSE_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BRFALSE_S:
+                       one_arg_branch (&td, MINT_BRFALSE_I4, 2 + (gint8)td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BRTRUE:
+                       one_arg_branch (&td, MINT_BRTRUE_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BRTRUE_S:
+                       one_arg_branch (&td, MINT_BRTRUE_I4, 2 + (gint8)td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BEQ:
+                       two_arg_branch (&td, MINT_BEQ_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BEQ_S:
+                       two_arg_branch (&td, MINT_BEQ_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BGE:
+                       two_arg_branch (&td, MINT_BGE_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BGE_S:
+                       two_arg_branch (&td, MINT_BGE_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BGT:
+                       two_arg_branch (&td, MINT_BGT_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BGT_S:
+                       two_arg_branch (&td, MINT_BGT_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BLT:
+                       two_arg_branch (&td, MINT_BLT_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BLT_S:
+                       two_arg_branch (&td, MINT_BLT_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BLE:
+                       two_arg_branch (&td, MINT_BLE_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BLE_S:
+                       two_arg_branch (&td, MINT_BLE_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BNE_UN:
+                       two_arg_branch (&td, MINT_BNE_UN_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BNE_UN_S:
+                       two_arg_branch (&td, MINT_BNE_UN_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BGE_UN:
+                       two_arg_branch (&td, MINT_BGE_UN_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BGE_UN_S:
+                       two_arg_branch (&td, MINT_BGE_UN_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BGT_UN:
+                       two_arg_branch (&td, MINT_BGT_UN_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BGT_UN_S:
+                       two_arg_branch (&td, MINT_BGT_UN_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BLE_UN:
+                       two_arg_branch (&td, MINT_BLE_UN_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BLE_UN_S:
+                       two_arg_branch (&td, MINT_BLE_UN_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_BLT_UN:
+                       two_arg_branch (&td, MINT_BLT_UN_I4, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       break;
+               case CEE_BLT_UN_S:
+                       two_arg_branch (&td, MINT_BLT_UN_I4, 2 + (gint8) td.ip [1]);
+                       td.ip += 2;
+                       break;
+               case CEE_SWITCH: {
+                       guint32 n;
+                       const unsigned char *next_ip;
+                       const unsigned char *base_ip = td.ip;
+                       unsigned short *next_new_ip;
+                       ++td.ip;
+                       n = read32 (td.ip);
+                       ADD_CODE (&td, MINT_SWITCH);
+                       WRITE32 (&td, &n);
+                       td.ip += 4;
+                       next_ip = td.ip + n * 4;
+                       next_new_ip = td.new_ip + n * 2;
+                       --td.sp;
+                       int stack_height = td.sp - td.stack;
+                       for (i = 0; i < n; i++) {
+                               offset = read32 (td.ip);
+                               target = next_ip - td.il_code + offset;
+                               if (offset < 0) {
+#if DEBUG_INTERP
+                                       if (stack_height > 0 && stack_height != td.stack_height [target])
+                                               g_warning ("SWITCH with back branch and non-empty stack");
+#endif
+                                       target = td.in_offsets [target] - (next_new_ip - td.new_code);
+                               } else {
+                                       td.stack_height [target] = stack_height;
+                                       td.vt_stack_size [target] = td.vt_sp;
+                                       if (stack_height > 0)
+                                               td.stack_state [target] = g_memdup (td.stack, stack_height * sizeof (td.stack [0]));
+                                       int prev = td.forward_refs [target];
+                                       td.forward_refs [td.ip - td.il_code] = prev;
+                                       td.forward_refs [target] = td.ip - td.il_code;
+                                       td.in_offsets [td.ip - td.il_code] = - (base_ip - td.il_code);
+                               }
+                               WRITE32 (&td, &target);
+                               td.ip += 4;
+                       }
+                       break;
+               }
+               case CEE_LDIND_I1:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_I1);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_U1:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_U1);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_I2:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_I2);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_U2:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_U2);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_I4:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_I4);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_U4:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_U4);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDIND_I8:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_I8);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+               case CEE_LDIND_I:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_I);
+                       ADD_CODE (&td, 0);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                       break;
+               case CEE_LDIND_R4:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_R4);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_LDIND_R8:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_R8);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_LDIND_REF:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDIND_REF);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+                       break;
+               case CEE_STIND_REF:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_REF);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_I1:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_I1);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_I2:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_I2);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_I4:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_I4);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_I:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_I);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_I8:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_I8);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_R4:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_R4);
+                       td.sp -= 2;
+                       break;
+               case CEE_STIND_R8:
+                       CHECK_STACK (&td, 2);
+                       SIMPLE_OP (td, MINT_STIND_R8);
+                       td.sp -= 2;
+                       break;
+               case CEE_ADD:
+                       binary_arith_op(&td, MINT_ADD_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SUB:
+                       binary_arith_op(&td, MINT_SUB_I4);
+                       ++td.ip;
+                       break;
+               case CEE_MUL:
+                       binary_arith_op(&td, MINT_MUL_I4);
+                       ++td.ip;
+                       break;
+               case CEE_DIV:
+                       binary_arith_op(&td, MINT_DIV_I4);
+                       ++td.ip;
+                       break;
+               case CEE_DIV_UN:
+                       binary_arith_op(&td, MINT_DIV_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_REM:
+                       binary_int_op (&td, MINT_REM_I4);
+                       ++td.ip;
+                       break;
+               case CEE_REM_UN:
+                       binary_int_op (&td, MINT_REM_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_AND:
+                       binary_int_op (&td, MINT_AND_I4);
+                       ++td.ip;
+                       break;
+               case CEE_OR:
+                       binary_int_op (&td, MINT_OR_I4);
+                       ++td.ip;
+                       break;
+               case CEE_XOR:
+                       binary_int_op (&td, MINT_XOR_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SHL:
+                       shift_op (&td, MINT_SHL_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SHR:
+                       shift_op (&td, MINT_SHR_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SHR_UN:
+                       shift_op (&td, MINT_SHR_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_NEG:
+                       unary_arith_op (&td, MINT_NEG_I4);
+                       ++td.ip;
+                       break;
+               case CEE_NOT:
+                       unary_arith_op (&td, MINT_NOT_I4);
+                       ++td.ip;
+                       break;
+               case CEE_CONV_U1:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_U1_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_U1_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_U1_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_I1:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_I1_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_I1_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_I1_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_U2:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_U2_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_U2_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_U2_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_I2:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_I2_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_I2_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_I2_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_U:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE(&td, MINT_CONV_U4_R8);
+#else
+                               ADD_CODE(&td, MINT_CONV_U8_R8);
+#endif
+                               break;
+                       case STACK_TYPE_I4:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_U8_I4);
+#endif
+                               break;
+                       case STACK_TYPE_I8:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE(&td, MINT_CONV_U4_I8);
+#endif
+                               break;
+                       case STACK_TYPE_MP:
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                       break;
+               case CEE_CONV_I: 
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_I8_R8);
+#else
+                               ADD_CODE(&td, MINT_CONV_I4_R8);
+#endif
+                               break;
+                       case STACK_TYPE_I4:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_I8_I4);
+#endif
+                               break;
+                       case STACK_TYPE_O:
+                               break;
+                       case STACK_TYPE_MP:
+                               break;
+                       case STACK_TYPE_I8:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE(&td, MINT_CONV_I4_I8);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                       break;
+               case CEE_CONV_U4:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_U4_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_U4_I8);
+                               break;
+                       case STACK_TYPE_MP:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_U4_I8);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_I4:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_I4_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_I4_I8);
+                               break;
+                       case STACK_TYPE_MP:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_I4_I8);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_I8:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_I8_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_I8_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               break;
+                       case STACK_TYPE_MP:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE(&td, MINT_CONV_I8_I4);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+               case CEE_CONV_R4:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_R4_R8);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_R4_I8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_R4_I4);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_CONV_R8:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_R8_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_R8_I8);
+                               break;
+                       case STACK_TYPE_R8:
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_CONV_U8:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_U8_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               break;
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_U8_R8);
+                               break;
+                       case STACK_TYPE_MP:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE(&td, MINT_CONV_U8_I4);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+               case CEE_CPOBJ: {
+                       CHECK_STACK (&td, 2);
+
+                       token = read32 (td.ip + 1);
+                       klass = mono_class_get_full (image, token, generic_context);
+
+                       if (klass->valuetype) {
+                               ADD_CODE (&td, MINT_CPOBJ);
+                               ADD_CODE (&td, get_data_item_index(&td, klass));
+                       } else {
+                               ADD_CODE (&td, MINT_LDIND_REF);
+                               ADD_CODE (&td, MINT_STIND_REF);
+                       }
+                       td.ip += 5;
+                       td.sp -= 2;
+                       break;
+               }
+               case CEE_LDOBJ: {
+                       int size;
+                       CHECK_STACK (&td, 1);
+
+                       token = read32 (td.ip + 1);
+
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                       else
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       ADD_CODE(&td, MINT_LDOBJ);
+                       ADD_CODE(&td, get_data_item_index(&td, klass));
+                       if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
+                               size = mono_class_value_size (klass, NULL);
+                               PUSH_VT(&td, size);
+                       }
+                       td.ip += 5;
+                       SET_TYPE(td.sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
+                       break;
+               }
+               case CEE_LDSTR: {
+                       MonoString *s;
+                       token = mono_metadata_token_index (read32 (td.ip + 1));
+                       td.ip += 5;
+                       if (method->wrapper_type != MONO_WRAPPER_NONE) {
+                               s = mono_string_new_wrapper(
+                                       mono_method_get_wrapper_data (method, token));
+                       }
+                       else
+                               s = mono_ldstr (domain, image, token);
+                       ADD_CODE(&td, MINT_LDSTR);
+                       ADD_CODE(&td, get_data_item_index (&td, s));
+                       PUSH_TYPE(&td, STACK_TYPE_O, mono_defaults.string_class);
+                       break;
+               }
+               case CEE_NEWOBJ: {
+                       MonoMethod *m;
+                       MonoMethodSignature *csignature;
+                       guint32 vt_stack_used = 0;
+                       guint32 vt_res_size = 0;
+
+                       td.ip++;
+                       token = read32 (td.ip);
+                       td.ip += 4;
+
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
+                       else 
+                               m = mono_get_method_full (image, token, NULL, generic_context);
+
+                       csignature = mono_method_signature (m);
+                       klass = m->klass;
+                       td.sp -= csignature->param_count;
+                       ADD_CODE(&td, MINT_NEWOBJ);
+                       ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+
+                       if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
+                               vt_res_size = mono_class_value_size (klass, NULL);
+                               PUSH_VT (&td, vt_res_size);
+                       }
+                       for (i = 0; i < csignature->param_count; ++i) {
+                               int mt = mint_type(csignature->params [i]);
+                               if (mt == MINT_TYPE_VT) {
+                                       MonoClass *k = mono_class_from_mono_type (csignature->params [i]);
+                                       gint32 size = mono_class_value_size (k, NULL);
+                                       size = (size + 7) & ~7;
+                                       vt_stack_used += size;
+                               }
+                       }
+                       if (vt_stack_used != 0 || vt_res_size != 0) {
+                               ADD_CODE(&td, MINT_VTRESULT);
+                               ADD_CODE(&td, vt_res_size);
+                               WRITE32(&td, &vt_stack_used);
+                               td.vt_sp -= vt_stack_used;
+                       }
+                       PUSH_TYPE (&td, stack_type [mint_type (&klass->byval_arg)], klass);
+                       break;
+               }
+               case CEE_CASTCLASS:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       klass = mono_class_get_full (image, token, generic_context);
+                       ADD_CODE(&td, MINT_CASTCLASS);
+                       ADD_CODE(&td, get_data_item_index (&td, klass));
+                       td.sp [-1].klass = klass;
+                       td.ip += 5;
+                       break;
+               case CEE_ISINST:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       klass = mono_class_get_full (image, token, generic_context);
+                       ADD_CODE(&td, MINT_ISINST);
+                       ADD_CODE(&td, get_data_item_index (&td, klass));
+                       td.ip += 5;
+                       break;
+               case CEE_CONV_R_UN:
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_R_UN_I8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_R_UN_I4);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       ++td.ip;
+                       break;
+               case CEE_UNBOX:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                       else 
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       if (mono_class_is_nullable (klass)) {
+                               g_error ("cee_unbox: implement Nullable");
+                       }
+                       
+                       ADD_CODE(&td, MINT_UNBOX);
+                       ADD_CODE(&td, get_data_item_index (&td, klass));
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                       td.ip += 5;
+                       break;
+               case CEE_UNBOX_ANY:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+
+                       g_assert (method->wrapper_type == MONO_WRAPPER_NONE);
+                       klass = mono_class_get_full (image, token, generic_context);
+
+                       if (mini_type_is_reference (&klass->byval_arg)) {
+                               ADD_CODE (&td, MINT_CASTCLASS);
+                               ADD_CODE (&td, get_data_item_index (&td, klass));
+                               SET_TYPE (td.sp - 1, stack_type [mt], klass);
+                               td.ip += 5;
+                       } else if (mono_class_is_nullable (klass)) {
+                               MonoMethod *target_method = mono_class_get_method_from_name (klass, "Unbox", 1);
+                               /* td.ip is incremented by interp_transform_call */
+                               interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+                       } else {
+                               int mt = mint_type (&klass->byval_arg);
+                               ADD_CODE (&td, MINT_UNBOX);
+                               ADD_CODE (&td, get_data_item_index (&td, klass));
+
+                               ADD_CODE (&td, MINT_LDOBJ);
+                               ADD_CODE (&td, get_data_item_index(&td, klass));
+                               SET_TYPE (td.sp - 1, stack_type [mt], klass);
+
+                               if (mt == MINT_TYPE_VT) {
+                                       int size = mono_class_value_size (klass, NULL);
+                                       PUSH_VT (&td, size);
+                               }
+                               td.ip += 5;
+                       }
+
+                       break;
+               case CEE_THROW:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_THROW);
+                       --td.sp;
+                       generating_code = 0;
+                       break;
+               case CEE_LDFLDA:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
+                       mono_class_init (klass);
+                       if (is_static) {
+                               ADD_CODE (&td, MINT_POP);
+                               ADD_CODE (&td, 0);
+                               ADD_CODE (&td, MINT_LDSFLDA);
+                               ADD_CODE (&td, get_data_item_index (&td, field));
+                       } else {
+                               if ((td.sp - 1)->type == STACK_TYPE_O) {
+                                       ADD_CODE (&td, MINT_LDFLDA);
+                               } else {
+                                       g_assert ((td.sp -1)->type == STACK_TYPE_MP);
+                                       ADD_CODE (&td, MINT_LDFLDA_UNSAFE);
+                               }
+                               ADD_CODE (&td, klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset);
+                       }
+                       td.ip += 5;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                       break;
+               case CEE_LDFLD: {
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
+                       mono_class_init (klass);
+
+                       MonoClass *field_klass = mono_class_from_mono_type (field->type);
+                       mt = mint_type (&field_klass->byval_arg);
+                       if (klass->marshalbyref) {
+                               g_assert (!is_static);
+                               ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT :  MINT_LDRMFLD);
+                               ADD_CODE(&td, get_data_item_index (&td, field));
+                       } else  {
+                               if (is_static) {
+                                       ADD_CODE (&td, MINT_POP);
+                                       ADD_CODE (&td, 0);
+                                       ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+                                       ADD_CODE (&td, get_data_item_index (&td, field));
+                               } else {
+                                       ADD_CODE (&td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
+                                       ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+                               }
+                       }
+                       if (mt == MINT_TYPE_VT) {
+                               int size = mono_class_value_size (field_klass, NULL);
+                               PUSH_VT(&td, size);
+                               WRITE32(&td, &size);
+                       }
+                       if (td.sp [-1].type == STACK_TYPE_VT) {
+                               int size = mono_class_value_size (klass, NULL);
+                               size = (size + 7) & ~7;
+                               td.vt_sp -= size;
+                               ADD_CODE (&td, MINT_VTRESULT);
+                               ADD_CODE (&td, 0);
+                               WRITE32 (&td, &size);
+                       }
+                       td.ip += 5;
+                       SET_TYPE(td.sp - 1, stack_type [mt], field_klass);
+                       break;
+               }
+               case CEE_STFLD: {
+                       CHECK_STACK (&td, 2);
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
+                       mono_class_init (klass);
+                       mt = mint_type(field->type);
+
+                       if (klass->marshalbyref) {
+                               g_assert (!is_static);
+                               ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
+                               ADD_CODE(&td, get_data_item_index (&td, field));
+                       } else  {
+                               if (is_static) {
+                                       ADD_CODE (&td, MINT_POP);
+                                       ADD_CODE (&td, 1);
+                                       ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+                                       ADD_CODE (&td, get_data_item_index (&td, field));
+                               } else {
+                                       ADD_CODE (&td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
+                                       ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+                               }
+                       }
+                       if (mt == MINT_TYPE_VT) {
+                               MonoClass *klass = mono_class_from_mono_type (field->type);
+                               int size = mono_class_value_size (klass, NULL);
+                               POP_VT(&td, size);
+                               WRITE32(&td, &size);
+                       }
+                       td.ip += 5;
+                       td.sp -= 2;
+                       break;
+               }
+               case CEE_LDSFLDA:
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       ADD_CODE(&td, MINT_LDSFLDA);
+                       ADD_CODE(&td, get_data_item_index (&td, field));
+                       td.ip += 5;
+                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+                       break;
+               case CEE_LDSFLD:
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       mt = mint_type(field->type);
+                       ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+                       ADD_CODE(&td, get_data_item_index (&td, field));
+                       klass = NULL;
+                       if (mt == MINT_TYPE_VT) {
+                               MonoClass *klass = mono_class_from_mono_type (field->type);
+                               int size = mono_class_value_size (klass, NULL);
+                               PUSH_VT(&td, size);
+                               WRITE32(&td, &size);
+                               klass = field->type->data.klass;
+                       } else {
+                               if (mt == MINT_TYPE_O) 
+                                       klass = mono_class_from_mono_type (field->type);
+                       }
+                       td.ip += 5;
+                       PUSH_TYPE(&td, stack_type [mt], klass);
+                       break;
+               case CEE_STSFLD:
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       field = mono_field_from_token (image, token, &klass, generic_context);
+                       mt = mint_type(field->type);
+                       ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+                       ADD_CODE(&td, get_data_item_index (&td, field));
+                       if (mt == MINT_TYPE_VT) {
+                               MonoClass *klass = mono_class_from_mono_type (field->type);
+                               int size = mono_class_value_size (klass, NULL);
+                               POP_VT (&td, size);
+                               WRITE32 (&td, &size);
+                       }
+                       td.ip += 5;
+                       --td.sp;
+                       break;
+               case CEE_STOBJ: {
+                       int size;
+                       token = read32 (td.ip + 1);
+
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                       else
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       ADD_CODE(&td, td.sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
+                       ADD_CODE(&td, get_data_item_index (&td, klass));
+                       if (td.sp [-1].type == STACK_TYPE_VT) {
+                               size = mono_class_value_size (klass, NULL);
+                               size = (size + 7) & ~7;
+                               td.vt_sp -= size;
+                       }
+                       td.ip += 5;
+                       td.sp -= 2;
+                       break;
+               }
+               case CEE_CONV_OVF_I_UN:
+               case CEE_CONV_OVF_U_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+#else
+                               ADD_CODE(&td, MINT_CONV_OVF_I4_UN_R8);
+#endif
+                               break;
+                       case STACK_TYPE_I8:
+#if SIZEOF_VOID_P == 4
+                               ADD_CODE (&td, MINT_CONV_OVF_I4_UN_I8);
+#endif
+                               break;
+                       case STACK_TYPE_I4:
+#if SIZEOF_VOID_P == 8
+                               ADD_CODE(&td, MINT_CONV_I8_U4);
+#endif
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                               break;
+                       }
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       ++td.ip;
+                       break;
+               case CEE_CONV_OVF_I8_UN:
+               case CEE_CONV_OVF_U8_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+                               break;
+                       case STACK_TYPE_I8:
+                               if (*td.ip == CEE_CONV_OVF_I8_UN)
+                                       ADD_CODE (&td, MINT_CONV_OVF_I8_U8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_I8_U4);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                               break;
+                       }
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       ++td.ip;
+                       break;
+               case CEE_BOX: {
+                       int size;
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                       else
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       if (mono_class_is_nullable (klass)) {
+                               MonoMethod *target_method = mono_class_get_method_from_name (klass, "Box", 1);
+                               /* td.ip is incremented by interp_transform_call */
+                               interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+                       } else if (!klass->valuetype) {
+                               /* already boxed, do nothing. */
+                               td.ip += 5;
+                       } else {
+                               if (mint_type (&klass->byval_arg) == MINT_TYPE_VT && !klass->enumtype) {
+                                       size = mono_class_value_size (klass, NULL);
+                                       size = (size + 7) & ~7;
+                                       td.vt_sp -= size;
+                               }
+                               ADD_CODE(&td, MINT_BOX);
+                               ADD_CODE(&td, get_data_item_index (&td, klass));
+                               ADD_CODE (&td, 0);
+                               SET_TYPE(td.sp - 1, STACK_TYPE_O, klass);
+                               td.ip += 5;
+                       }
+
+                       break;
+               }
+               case CEE_NEWARR: {
+                       CHECK_STACK (&td, 1);
+                       token = read32 (td.ip + 1);
+
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                       else
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       unsigned char lentype = (td.sp - 1)->type;
+                       if (lentype == STACK_TYPE_I8) {
+                               /* mimic mini behaviour */
+                               ADD_CODE (&td, MINT_CONV_OVF_U4_I8);
+                       } else {
+                               g_assert (lentype == STACK_TYPE_I4);
+                               ADD_CODE (&td, MINT_CONV_OVF_U4_I4);
+                       }
+                       SET_SIMPLE_TYPE (td.sp - 1, STACK_TYPE_I4);
+                       ADD_CODE (&td, MINT_NEWARR);
+                       ADD_CODE (&td, get_data_item_index (&td, klass));
+                       SET_TYPE (td.sp - 1, STACK_TYPE_O, klass);
+                       td.ip += 5;
+                       break;
+               }
+               case CEE_LDLEN:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_LDLEN);
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                       break;
+               case CEE_LDELEMA:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       token = read32 (td.ip + 1);
+
+                       if (method->wrapper_type != MONO_WRAPPER_NONE)
+                               klass = (MonoClass *) mono_method_get_wrapper_data (method, token);
+                       else
+                               klass = mono_class_get_full (image, token, generic_context);
+
+                       if (!klass->valuetype && method->wrapper_type == MONO_WRAPPER_NONE && !readonly) {
+                               ADD_CODE (&td, MINT_LDELEMA_TC);
+                       } else {
+                               ADD_CODE (&td, MINT_LDELEMA);
+                       }
+                       ADD_CODE (&td, get_data_item_index (&td, klass));
+                       /* according to spec, ldelema bytecode is only used for 1-dim arrays */
+                       ADD_CODE (&td, 2);
+                       readonly = FALSE;
+
+                       td.ip += 5;
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                       break;
+               case CEE_LDELEM_I1:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_I1);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_U1:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_U1);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_I2:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_I2);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_U2:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_U2);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_I4:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_I4);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_U4:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_U4);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_LDELEM_I8:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_I8);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+               case CEE_LDELEM_I:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_I);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                       break;
+               case CEE_LDELEM_R4:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_R4);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_LDELEM_R8:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_R8);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                       break;
+               case CEE_LDELEM_REF:
+                       CHECK_STACK (&td, 2);
+                       ENSURE_I4 (&td, 1);
+                       SIMPLE_OP (td, MINT_LDELEM_REF);
+                       --td.sp;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+                       break;
+               case CEE_LDELEM:
+                       CHECK_STACK (&td, 2);
+                       token = read32 (td.ip + 1);
+                       klass = mono_class_get_full (image, token, generic_context);
+                       switch (mint_type (&klass->byval_arg)) {
+                               case MINT_TYPE_I1:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_I1);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                                       break;
+                               case MINT_TYPE_U1:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_U1);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                                       break;
+                               case MINT_TYPE_U2:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_U2);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                                       break;
+                               case MINT_TYPE_I2:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_I2);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                                       break;
+                               case MINT_TYPE_I4:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_I4);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                                       break;
+                               case MINT_TYPE_I8:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_I8);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                                       break;
+                               case MINT_TYPE_R4:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_R4);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                                       break;
+                               case MINT_TYPE_R8:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_R8);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+                                       break;
+                               case MINT_TYPE_O:
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_REF);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+                                       break;
+                               case MINT_TYPE_VT: {
+                                       int size = mono_class_value_size (klass, NULL);
+                                       ENSURE_I4 (&td, 1);
+                                       SIMPLE_OP (td, MINT_LDELEM_VT);
+                                       ADD_CODE (&td, get_data_item_index (&td, klass));
+                                       WRITE32 (&td, &size);
+                                       --td.sp;
+                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_VT);
+                                       PUSH_VT (&td, size);
+                                       break;
+                               }
+                               default: {
+                                       GString *res = g_string_new ("");
+                                       mono_type_get_desc (res, &klass->byval_arg, TRUE);
+                                       g_print ("LDELEM: %s -> %d (%s)\n", klass->name, mint_type (&klass->byval_arg), res->str);
+                                       g_string_free (res, TRUE);
+                                       g_assert (0);
+                                       break;
+                               }
+                       }
+                       td.ip += 4;
+                       break;
+               case CEE_STELEM_I:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_I);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_I1:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_I1);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_I2:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_I2);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_I4:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_I4);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_I8:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_I8);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_R4:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_R4);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_R8:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_R8);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM_REF:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       SIMPLE_OP (td, MINT_STELEM_REF);
+                       td.sp -= 3;
+                       break;
+               case CEE_STELEM:
+                       CHECK_STACK (&td, 3);
+                       ENSURE_I4 (&td, 2);
+                       token = read32 (td.ip + 1);
+                       klass = mono_class_get_full (image, token, generic_context);
+                       switch (mint_type (&klass->byval_arg)) {
+                               case MINT_TYPE_U1:
+                                       SIMPLE_OP (td, MINT_STELEM_U1);
+                                       break;
+                               case MINT_TYPE_I4:
+                                       SIMPLE_OP (td, MINT_STELEM_I4);
+                                       break;
+                               case MINT_TYPE_I8:
+                                       SIMPLE_OP (td, MINT_STELEM_I8);
+                                       break;
+                               case MINT_TYPE_O:
+                                       SIMPLE_OP (td, MINT_STELEM_REF);
+                                       break;
+                               case MINT_TYPE_VT: {
+                                       int size = mono_class_value_size (klass, NULL);
+                                       SIMPLE_OP (td, MINT_STELEM_VT);
+                                       ADD_CODE (&td, get_data_item_index (&td, klass));
+                                       WRITE32 (&td, &size);
+                                       POP_VT (&td, size);
+                                       break;
+                               }
+                               default: {
+                                       GString *res = g_string_new ("");
+                                       mono_type_get_desc (res, &klass->byval_arg, TRUE);
+                                       g_print ("STELEM: %s -> %d (%s)\n", klass->name, mint_type (&klass->byval_arg), res->str);
+                                       g_string_free (res, TRUE);
+                                       g_assert (0);
+                                       break;
+                               }
+                       }
+                       td.ip += 4;
+                       td.sp -= 3;
+                       break;
+#if 0
+               case CEE_CONV_OVF_U1:
+
+               case CEE_CONV_OVF_I8:
+
+#if SIZEOF_VOID_P == 8
+               case CEE_CONV_OVF_U:
+#endif
+               case CEE_REFANYVAL: ves_abort(); break;
+#endif
+               case CEE_CKFINITE:
+                       CHECK_STACK (&td, 1);
+                       SIMPLE_OP (td, MINT_CKFINITE);
+                       break;
+               case CEE_CONV_OVF_I1:
+               case CEE_CONV_OVF_I1_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I1_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_OVF_I1_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I1_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_OVF_U1:
+               case CEE_CONV_OVF_U1_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U1_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_OVF_U1_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U1_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_OVF_I2:
+               case CEE_CONV_OVF_I2_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I2_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_OVF_I2_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I2_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+               case CEE_CONV_OVF_U2_UN:
+               case CEE_CONV_OVF_U2:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U2_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_OVF_U2_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U2_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+#if SIZEOF_VOID_P == 4
+               case CEE_CONV_OVF_I:
+#endif
+               case CEE_CONV_OVF_I4:
+               case CEE_CONV_OVF_I4_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I4_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               if (*td.ip == CEE_CONV_OVF_I4_UN)
+                                       ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
+                               break;
+                       case STACK_TYPE_I8:
+                               if (*td.ip == CEE_CONV_OVF_I4_UN)
+                                       ADD_CODE (&td, MINT_CONV_OVF_I4_U8);
+                               else
+                                       ADD_CODE (&td, MINT_CONV_OVF_I4_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+#if SIZEOF_VOID_P == 4
+               case CEE_CONV_OVF_U:
+#endif
+               case CEE_CONV_OVF_U4:
+               case CEE_CONV_OVF_U4_UN:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U4_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               if (*td.ip != CEE_CONV_OVF_U4_UN)
+                                       ADD_CODE(&td, MINT_CONV_OVF_U4_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U4_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                       break;
+#if SIZEOF_VOID_P == 8
+               case CEE_CONV_OVF_I:
+#endif
+               case CEE_CONV_OVF_I8:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_I8_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_I8_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+#if SIZEOF_VOID_P == 8
+               case CEE_CONV_OVF_U:
+#endif
+               case CEE_CONV_OVF_U8:
+                       CHECK_STACK (&td, 1);
+                       switch (td.sp [-1].type) {
+                       case STACK_TYPE_R8:
+                               ADD_CODE(&td, MINT_CONV_OVF_U8_R8);
+                               break;
+                       case STACK_TYPE_I4:
+                               ADD_CODE(&td, MINT_CONV_OVF_U8_I4);
+                               break;
+                       case STACK_TYPE_I8:
+                               ADD_CODE (&td, MINT_CONV_OVF_U8_I8);
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
+                       ++td.ip;
+                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+                       break;
+               case CEE_LDTOKEN: {
+                       int size;
+                       gpointer handle;
+                       token = read32 (td.ip + 1);
+                       if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD || method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
+                               handle = mono_method_get_wrapper_data (method, token);
+                               klass = (MonoClass *) mono_method_get_wrapper_data (method, token + 1);
+                               if (klass == mono_defaults.typehandle_class)
+                                       handle = &((MonoClass *) handle)->byval_arg;
+                       } else {
+                               handle = mono_ldtoken (image, token, &klass, generic_context);
+                       }
+                       mt = mint_type (&klass->byval_arg);
+                       g_assert (mt == MINT_TYPE_VT);
+                       size = mono_class_value_size (klass, NULL);
+                       g_assert (size == sizeof(gpointer));
+                       PUSH_VT (&td, sizeof(gpointer));
+                       ADD_CODE (&td, MINT_LDTOKEN);
+                       ADD_CODE (&td, get_data_item_index (&td, handle));
+
+                       SET_TYPE (td.sp, stack_type [mt], klass);
+                       td.sp++;
+                       td.ip += 5;
+                       break;
+               }
+               case CEE_ADD_OVF:
+                       binary_arith_op(&td, MINT_ADD_OVF_I4);
+                       ++td.ip;
+                       break;
+               case CEE_ADD_OVF_UN:
+                       binary_arith_op(&td, MINT_ADD_OVF_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_MUL_OVF:
+                       binary_arith_op(&td, MINT_MUL_OVF_I4);
+                       ++td.ip;
+                       break;
+               case CEE_MUL_OVF_UN:
+                       binary_arith_op(&td, MINT_MUL_OVF_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SUB_OVF:
+                       binary_arith_op(&td, MINT_SUB_OVF_I4);
+                       ++td.ip;
+                       break;
+               case CEE_SUB_OVF_UN:
+                       binary_arith_op(&td, MINT_SUB_OVF_UN_I4);
+                       ++td.ip;
+                       break;
+               case CEE_ENDFINALLY:
+                       SIMPLE_OP (td, MINT_ENDFINALLY);
+                       generating_code = 0;
+                       break;
+               case CEE_LEAVE:
+                       td.sp = td.stack;
+                       handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td.ip + 1));
+                       td.ip += 5;
+                       generating_code = 0;
+                       break;
+               case CEE_LEAVE_S:
+                       td.sp = td.stack;
+                       handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td.ip [1]);
+                       td.ip += 2;
+                       generating_code = 0;
+                       break;
+               case CEE_UNUSED41:
+                       ++td.ip;
+                       switch (*td.ip) {
+                               case CEE_MONO_CALLI_EXTRA_ARG:
+                                       /* Same as CEE_CALLI, except that we drop the extra arg required for llvm specific behaviour */
+                                       ADD_CODE (&td, MINT_POP);
+                                       ADD_CODE (&td, 1);
+                                       --td.sp;
+                                       interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+                                       break;
+                               case CEE_MONO_JIT_ICALL_ADDR: {
+                                       guint32 token;
+                                       gpointer func;
+                                       MonoJitICallInfo *info;
+
+                                       token = read32 (td.ip + 1);
+                                       td.ip += 5;
+                                       func = mono_method_get_wrapper_data (method, token);
+                                       info = mono_find_jit_icall_by_addr (func);
+
+                                       ADD_CODE (&td, MINT_LDFTN);
+                                       ADD_CODE (&td, get_data_item_index (&td, func));
+                                       PUSH_SIMPLE_TYPE (&td, STACK_TYPE_I);
+                                       break;
+                               }
+                               case CEE_MONO_ICALL: {
+                                       guint32 token;
+                                       gpointer func;
+                                       MonoJitICallInfo *info;
+
+                                       token = read32 (td.ip + 1);
+                                       td.ip += 5;
+                                       func = mono_method_get_wrapper_data (method, token);
+                                       info = mono_find_jit_icall_by_addr (func);
+                                       g_assert (info);
+
+                                       CHECK_STACK (&td, info->sig->param_count);
+                                       switch (info->sig->param_count) {
+                                       case 0:
+                                               if (MONO_TYPE_IS_VOID (info->sig->ret))
+                                                       ADD_CODE (&td,MINT_ICALL_V_V);
+                                               else
+                                                       ADD_CODE (&td, MINT_ICALL_V_P);
+                                               break;
+                                       case 1:
+                                               if (MONO_TYPE_IS_VOID (info->sig->ret))
+                                                       ADD_CODE (&td,MINT_ICALL_P_V);
+                                               else
+                                                       ADD_CODE (&td,MINT_ICALL_P_P);
+                                               break;
+                                       case 2:
+                                               if (MONO_TYPE_IS_VOID (info->sig->ret)) {
+                                                       if (info->sig->params [1]->type == MONO_TYPE_I4)
+                                                               ADD_CODE (&td,MINT_ICALL_PI_V);
+                                                       else
+                                                               ADD_CODE (&td,MINT_ICALL_PP_V);
+                                               } else {
+                                                       if (info->sig->params [1]->type == MONO_TYPE_I4)
+                                                               ADD_CODE (&td,MINT_ICALL_PI_P);
+                                                       else
+                                                               ADD_CODE (&td,MINT_ICALL_PP_P);
+                                               }
+                                               break;
+                                       case 3:
+                                               g_assert (MONO_TYPE_IS_VOID (info->sig->ret));
+                                               if (info->sig->params [2]->type == MONO_TYPE_I4)
+                                                       ADD_CODE (&td,MINT_ICALL_PPI_V);
+                                               else
+                                                       ADD_CODE (&td,MINT_ICALL_PPP_V);
+                                               break;
+                                       default:
+                                               g_assert_not_reached ();
+                                       }
+
+                                       if (func == mono_ftnptr_to_delegate) {
+                                               g_error ("TODO: ?");
+                                       }
+                                       ADD_CODE(&td, get_data_item_index (&td, func));
+                                       td.sp -= info->sig->param_count;
+
+                                       if (!MONO_TYPE_IS_VOID (info->sig->ret)) {
+                                               td.sp ++;
+                                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+                                       }
+                                       break;
+                               }
+                       case CEE_MONO_VTADDR: {
+                               int size;
+                               CHECK_STACK (&td, 1);
+                               if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE)
+                                       size = mono_class_native_size(td.sp [-1].klass, NULL);
+                               else
+                                       size = mono_class_value_size(td.sp [-1].klass, NULL);
+                               size = (size + 7) & ~7;
+                               ADD_CODE(&td, MINT_VTRESULT);
+                               ADD_CODE(&td, 0);
+                               WRITE32(&td, &size);
+                               td.vt_sp -= size;
+                               ++td.ip;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                               break;
+                       }
+                       case CEE_MONO_LDPTR:
+                       case CEE_MONO_CLASSCONST:
+                               token = read32 (td.ip + 1);
+                               td.ip += 5;
+                               ADD_CODE(&td, MINT_MONO_LDPTR);
+                               ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
+                               td.sp [0].type = STACK_TYPE_I;
+                               ++td.sp;
+                               break;
+                       case CEE_MONO_OBJADDR:
+                               CHECK_STACK (&td, 1);
+                               ++td.ip;
+                               td.sp[-1].type = STACK_TYPE_MP;
+                               /* do nothing? */
+                               break;
+                       case CEE_MONO_NEWOBJ:
+                               token = read32 (td.ip + 1);
+                               td.ip += 5;
+                               ADD_CODE(&td, MINT_MONO_NEWOBJ);
+                               ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
+                               td.sp [0].type = STACK_TYPE_O;
+                               ++td.sp;
+                               break;
+                       case CEE_MONO_RETOBJ:
+                               CHECK_STACK (&td, 1);
+                               token = read32 (td.ip + 1);
+                               td.ip += 5;
+                               ADD_CODE(&td, MINT_MONO_RETOBJ);
+                               td.sp--;
+
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                               
+                               /*stackval_from_data (signature->ret, frame->retval, sp->data.vt, signature->pinvoke);*/
+
+                               if (td.sp > td.stack)
+                                       g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td.sp-td.stack);
+                               break;
+                       case CEE_MONO_LDNATIVEOBJ:
+                               token = read32 (td.ip + 1);
+                               td.ip += 5;
+                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+                               g_assert(klass->valuetype);
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                               break;
+                       case CEE_MONO_SAVE_LMF:
+                       case CEE_MONO_RESTORE_LMF:
+                       case CEE_MONO_NOT_TAKEN:
+                               ++td.ip;
+                               break;
+                       case CEE_MONO_LDPTR_INT_REQ_FLAG:
+                               ADD_CODE (&td, MINT_MONO_LDPTR);
+                               ADD_CODE (&td, get_data_item_index (&td, mono_thread_interruption_request_flag ()));
+                               PUSH_TYPE (&td, STACK_TYPE_MP, NULL);
+                               ++td.ip;
+                               break;
+                       default:
+                               g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td.ip, td.ip-header->code);
+                       }
+                       break;
+#if 0
+               case CEE_PREFIX7:
+               case CEE_PREFIX6:
+               case CEE_PREFIX5:
+               case CEE_PREFIX4:
+               case CEE_PREFIX3:
+               case CEE_PREFIX2:
+               case CEE_PREFIXREF: ves_abort(); break;
+#endif
+               /*
+                * Note: Exceptions thrown when executing a prefixed opcode need
+                * to take into account the number of prefix bytes (usually the
+                * throw point is just (ip - n_prefix_bytes).
+                */
+               case CEE_PREFIX1: 
+                       ++td.ip;
+                       switch (*td.ip) {
+#if 0
+                       case CEE_ARGLIST: ves_abort(); break;
+#endif
+                       case CEE_CEQ:
+                               CHECK_STACK(&td, 2);
+                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
+                                       ADD_CODE(&td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+                               else
+                                       ADD_CODE(&td, MINT_CEQ_I4 + td.sp [-1].type - STACK_TYPE_I4);
+                               --td.sp;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                               ++td.ip;
+                               break;
+                       case CEE_CGT:
+                               CHECK_STACK(&td, 2);
+                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
+                                       ADD_CODE(&td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+                               else
+                                       ADD_CODE(&td, MINT_CGT_I4 + td.sp [-1].type - STACK_TYPE_I4);
+                               --td.sp;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                               ++td.ip;
+                               break;
+                       case CEE_CGT_UN:
+                               CHECK_STACK(&td, 2);
+                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
+                                       ADD_CODE(&td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+                               else
+                                       ADD_CODE(&td, MINT_CGT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
+                               --td.sp;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                               ++td.ip;
+                               break;
+                       case CEE_CLT:
+                               CHECK_STACK(&td, 2);
+                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
+                                       ADD_CODE(&td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+                               else
+                                       ADD_CODE(&td, MINT_CLT_I4 + td.sp [-1].type - STACK_TYPE_I4);
+                               --td.sp;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                               ++td.ip;
+                               break;
+                       case CEE_CLT_UN:
+                               CHECK_STACK(&td, 2);
+                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
+                                       ADD_CODE(&td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+                               else
+                                       ADD_CODE(&td, MINT_CLT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
+                               --td.sp;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+                               ++td.ip;
+                               break;
+                       case CEE_LDVIRTFTN: /* fallthrough */
+                       case CEE_LDFTN: {
+                               MonoMethod *m;
+                               if (*td.ip == CEE_LDVIRTFTN) {
+                                       CHECK_STACK (&td, 1);
+                                       --td.sp;
+                               }
+                               token = read32 (td.ip + 1);
+                               if (method->wrapper_type != MONO_WRAPPER_NONE)
+                                       m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
+                               else 
+                                       m = mono_get_method_full (image, token, NULL, generic_context);
+
+                               if (method->wrapper_type == MONO_WRAPPER_NONE && m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
+                                       m = mono_marshal_get_synchronized_wrapper (m);
+
+                               ADD_CODE(&td, *td.ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
+                               ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+                               td.ip += 5;
+                               PUSH_SIMPLE_TYPE (&td, STACK_TYPE_F);
+                               break;
+                       }
+                       case CEE_LDARG:
+                               load_arg (&td, read16 (td.ip + 1));
+                               td.ip += 3;
+                               break;
+                       case CEE_LDARGA: {
+                               int n = read16 (td.ip + 1);
+                               if (n == 0 && signature->hasthis) {
+                                       g_error ("LDTHISA: NOPE");
+                                       ADD_CODE(&td, MINT_LDTHISA);
+                               }
+                               else {
+                                       ADD_CODE(&td, MINT_LDARGA);
+                                       ADD_CODE(&td, td.rtm->arg_offsets [n]); /* FIX for large offsets */
+                               }
+                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+                               td.ip += 3;
+                               break;
+                       }
+                       case CEE_STARG:
+                               store_arg (&td, read16 (td.ip + 1));
+                               td.ip += 3;
+                               break;
+                       case CEE_LDLOC:
+                               load_local (&td, read16 (td.ip + 1));
+                               td.ip += 3;
+                               break;
+                       case CEE_LDLOCA:
+                               ADD_CODE(&td, MINT_LDLOCA_S);
+                               ADD_CODE(&td, td.rtm->local_offsets [read16 (td.ip + 1)]);
+                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+                               td.ip += 3;
+                               break;
+                       case CEE_STLOC:
+                               store_local (&td, read16 (td.ip + 1));
+                               td.ip += 3;
+                               break;
+                       case CEE_LOCALLOC:
+                               CHECK_STACK (&td, 1);
+#if SIZEOF_VOID_P == 8
+                               if (td.sp [-1].type == STACK_TYPE_I8)
+                                       ADD_CODE(&td, MINT_CONV_I4_I8);
+#endif                         
+                               ADD_CODE(&td, MINT_LOCALLOC);
+                               if (td.sp != td.stack + 1)
+                                       g_warning("CEE_LOCALLOC: stack not empty");
+                               ++td.ip;
+                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+                               break;
+#if 0
+                       case CEE_UNUSED57: ves_abort(); break;
+                       case CEE_ENDFILTER: ves_abort(); break;
+#endif
+                       case CEE_UNALIGNED_:
+                               ++td.ip;
+                               /* FIX: should do something? */;
+                               break;
+                       case CEE_VOLATILE_:
+                               ++td.ip;
+                               /* FIX: should do something? */;
+                               break;
+                       case CEE_TAIL_:
+                               ++td.ip;
+                               /* FIX: should do something? */;
+                               break;
+                       case CEE_INITOBJ:
+                               CHECK_STACK(&td, 1);
+                               token = read32 (td.ip + 1);
+                               klass = mono_class_get_full (image, token, generic_context);
+                               if (klass->valuetype) {
+                                       ADD_CODE (&td, MINT_INITOBJ);
+                                       i32 = mono_class_value_size (klass, NULL);
+                                       WRITE32 (&td, &i32);
+                               } else {
+                                       ADD_CODE (&td, MINT_LDNULL);
+                                       ADD_CODE (&td, MINT_STIND_REF);
+                               }
+                               td.ip += 5;
+                               --td.sp;
+                               break;
+                       case CEE_CPBLK:
+                               CHECK_STACK(&td, 3);
+                               /* FIX? convert length to I8? */
+                               ADD_CODE(&td, MINT_CPBLK);
+                               td.sp -= 3;
+                               ++td.ip;
+                               break;
+                       case CEE_READONLY_:
+                               readonly = TRUE;
+                               td.ip += 1;
+                               break;
+                       case CEE_CONSTRAINED_:
+                               token = read32 (td.ip + 1);
+                               constrained_class = mono_class_get_full (image, token, generic_context);
+                               mono_class_init (constrained_class);
+                               td.ip += 5;
+                               break;
+                       case CEE_INITBLK:
+                               CHECK_STACK(&td, 3);
+                               ADD_CODE(&td, MINT_INITBLK);
+                               td.sp -= 3;
+                               break;
+#if 0
+                       case CEE_NO_:
+                               /* FIXME: implement */
+                               ip += 2;
+                               break;
+#endif
+                       case CEE_RETHROW:
+                               SIMPLE_OP (td, MINT_RETHROW);
+                               generating_code = 0;
+                               break;
+                       case CEE_SIZEOF: {
+                               gint32 size;
+                               token = read32 (td.ip + 1);
+                               td.ip += 5;
+                               if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !image_is_dynamic (method->klass->image) && !generic_context) {
+                                       int align;
+                                       MonoType *type = mono_type_create_from_typespec (image, token);
+                                       size = mono_type_size (type, &align);
+                               } else {
+                                       int align;
+                                       MonoClass *szclass = mono_class_get_full (image, token, generic_context);
+                                       mono_class_init (szclass);
+#if 0
+                                       if (!szclass->valuetype)
+                                               THROW_EX (mono_exception_from_name (mono_defaults.corlib, "System", "InvalidProgramException"), ip - 5);
+#endif
+                                       size = mono_type_size (&szclass->byval_arg, &align);
+                               } 
+                               ADD_CODE(&td, MINT_LDC_I4);
+                               WRITE32(&td, &size);
+                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+                               break;
+                       }
+#if 0
+                       case CEE_REFANYTYPE: ves_abort(); break;
+#endif
+                       default:
+                               g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td.ip, mono_opcode_name (256 + *td.ip), td.ip-header->code);
+                       }
+                       break;
+               default:
+                       g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td.ip, td.ip-header->code);
+               }
+
+               if (td.new_ip - td.new_code != new_in_start_offset) 
+                       td.last_new_ip = td.new_code + new_in_start_offset;
+               else if (td.is_bb_start [td.in_start - td.il_code])
+                       td.is_bb_start [td.ip - td.il_code] = 1;
+                       
+               td.last_ip = td.in_start;
+       }
+
+       if (mono_interp_traceopt) {
+               const guint16 *p = td.new_code;
+               printf("Runtime method: %p, VT stack size: %d\n", rtm, td.max_vt_sp);
+               printf("Calculated stack size: %d, stated size: %d\n", td.max_stack_height, header->max_stack);
+               while (p < td.new_ip) {
+                       p = mono_interp_dis_mintop(td.new_code, p);
+                       printf("\n");
+               }
+       }
+       g_assert (td.max_stack_height <= (header->max_stack + 1));
+
+       rtm->clauses = mono_mempool_alloc (domain->mp, header->num_clauses * sizeof(MonoExceptionClause));
+       memcpy (rtm->clauses, header->clauses, header->num_clauses * sizeof(MonoExceptionClause));
+       rtm->code = mono_mempool_alloc (domain->mp, (td.new_ip - td.new_code) * sizeof(gushort));
+       memcpy (rtm->code, td.new_code, (td.new_ip - td.new_code) * sizeof(gushort));
+       g_free (td.new_code);
+       rtm->new_body_start = rtm->code + body_start_offset;
+       rtm->num_clauses = header->num_clauses;
+       for (i = 0; i < header->num_clauses; i++) {
+               MonoExceptionClause *c = rtm->clauses + i;
+               int end_off = c->try_offset + c->try_len;
+               c->try_offset = td.in_offsets [c->try_offset];
+               c->try_len = td.in_offsets [end_off] - c->try_offset;
+               end_off = c->handler_offset + c->handler_len;
+               c->handler_offset = td.in_offsets [c->handler_offset];
+               c->handler_len = td.in_offsets [end_off] - c->handler_offset;
+       }
+       rtm->vt_stack_size = td.max_vt_sp;
+       rtm->alloca_size = rtm->locals_size + rtm->args_size + rtm->vt_stack_size + rtm->stack_size;
+       rtm->data_items = mono_mempool_alloc (domain->mp, td.n_data_items * sizeof (td.data_items [0]));
+       memcpy (rtm->data_items, td.data_items, td.n_data_items * sizeof (td.data_items [0]));
+       g_free (td.in_offsets);
+       g_free (td.forward_refs);
+       for (i = 0; i < header->code_size; ++i)
+               g_free (td.stack_state [i]);
+       g_free (td.stack_state);
+       g_free (td.stack_height);
+       g_free (td.vt_stack_size);
+       g_free (td.data_items);
+       g_free (td.stack);
+       g_hash_table_destroy (td.data_hash);
+}
+
+static mono_mutex_t calc_section;
+
+void 
+mono_interp_transform_init (void)
+{
+       mono_os_mutex_init_recursive(&calc_section);
+}
+
+MonoException *
+mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context)
+{
+       int i, align, size, offset;
+       MonoMethod *method = runtime_method->method;
+       MonoImage *image = method->klass->image;
+       MonoMethodHeader *header = mono_method_get_header (method);
+       MonoMethodSignature *signature = mono_method_signature (method);
+       register const unsigned char *ip, *end;
+       const MonoOpcode *opcode;
+       MonoMethod *m;
+       MonoClass *class;
+       MonoDomain *domain = mono_domain_get ();
+       unsigned char *is_bb_start;
+       int in;
+       MonoVTable *method_class_vt;
+       int backwards;
+       MonoGenericContext *generic_context = NULL;
+
+       // g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
+       method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
+       if (!method_class_vt->initialized) {
+               MonoError error;
+               jmp_buf env;
+               MonoInvocation *last_env_frame = context->env_frame;
+               jmp_buf *old_env = context->current_env;
+               error_init (&error);
+
+               if (setjmp(env)) {
+                       MonoException *failed = context->env_frame->ex;
+                       context->env_frame->ex = NULL;
+                       context->env_frame = last_env_frame;
+                       context->current_env = old_env;
+                       return failed;
+               }
+               context->env_frame = context->current_frame;
+               context->current_env = &env;
+               mono_runtime_class_init_full (method_class_vt, &error);
+               if (!mono_error_ok (&error)) {
+                       return mono_error_convert_to_exception (&error);
+               }
+               context->env_frame = last_env_frame;
+               context->current_env = old_env;
+       }
+
+       mono_profiler_method_jit (method); /* sort of... */
+
+       if (mono_method_signature (method)->is_inflated)
+               generic_context = mono_method_get_context (method);
+       else {
+               MonoGenericContainer *generic_container = mono_method_get_generic_container (method);
+               if (generic_container)
+                       generic_context = &generic_container->context;
+       }
+
+       if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
+               MonoMethod *nm = NULL;
+               mono_os_mutex_lock(&calc_section);
+               if (runtime_method->transformed) {
+                       mono_os_mutex_unlock(&calc_section);
+                       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
+                       return NULL;
+               }
+
+               /* assumes all internal calls with an array this are built in... */
+               if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL && (! mono_method_signature (method)->hasthis || method->klass->rank == 0)) {
+                       nm = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
+                       signature = mono_method_signature (nm);
+               } else {
+                       const char *name = method->name;
+                       if (method->klass->parent == mono_defaults.multicastdelegate_class) {
+                               if (*name == '.' && (strcmp (name, ".ctor") == 0)) {
+                                       MonoJitICallInfo *mi = mono_find_jit_icall_by_name ("ves_icall_mono_delegate_ctor");
+                                       g_assert (mi);
+                                       char *wrapper_name = g_strdup_printf ("__icall_wrapper_%s", mi->name);
+                                       nm = mono_marshal_get_icall_wrapper (mi->sig, wrapper_name, mi->func, TRUE);
+                               } else if (*name == 'I' && (strcmp (name, "Invoke") == 0)) {
+                                       nm = mono_marshal_get_delegate_invoke (method, NULL);
+                               } else if (*name == 'B' && (strcmp (name, "BeginInvoke") == 0)) {
+                                       nm = mono_marshal_get_delegate_begin_invoke (method);
+                               } else if (*name == 'E' && (strcmp (name, "EndInvoke") == 0)) {
+                                       nm = mono_marshal_get_delegate_end_invoke (method);
+                               }
+                       } 
+                       if (nm == NULL) {
+                               runtime_method->code = g_malloc(sizeof(short));
+                               runtime_method->code[0] = MINT_CALLRUN;
+                       }
+               }
+               if (nm == NULL) {
+                       runtime_method->stack_size = sizeof (stackval); /* for tracing */
+                       runtime_method->alloca_size = runtime_method->stack_size;
+                       runtime_method->transformed = TRUE;
+                       mono_os_mutex_unlock(&calc_section);
+                       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
+                       return NULL;
+               }
+               method = nm;
+               header = mono_method_get_header (nm);
+               mono_os_mutex_unlock(&calc_section);
+       }
+       g_assert ((signature->param_count + signature->hasthis) < 1000);
+       g_assert (header->max_stack < 10000);
+       /* intern the strings in the method. */
+       ip = header->code;
+       end = ip + header->code_size;
+
+       is_bb_start = g_malloc0(header->code_size);
+       is_bb_start [0] = 1;
+       while (ip < end) {
+               in = *ip;
+               if (in == 0xfe) {
+                       ip++;
+                       in = *ip + 256;
+               }
+               else if (in == 0xf0) {
+                       ip++;
+                       in = *ip + MONO_CEE_MONO_ICALL;
+               }
+               opcode = &mono_opcodes [in];
+               switch (opcode->argument) {
+               case MonoInlineNone:
+                       ++ip;
+                       break;
+               case MonoInlineString:
+                       if (method->wrapper_type == MONO_WRAPPER_NONE)
+                               mono_ldstr (domain, image, mono_metadata_token_index (read32 (ip + 1)));
+                       ip += 5;
+                       break;
+               case MonoInlineType:
+                       if (method->wrapper_type == MONO_WRAPPER_NONE) {
+                               class = mono_class_get_full (image, read32 (ip + 1), generic_context);
+                               mono_class_init (class);
+                               /* quick fix to not do this for the fake ptr classes - probably should not be getting the vtable at all here */
+#if 0
+                               g_error ("FIXME: interface method lookup: %s (in method %s)", class->name, method->name);
+                               if (!(class->flags & TYPE_ATTRIBUTE_INTERFACE) && class->interface_offsets != NULL)
+                                       mono_class_vtable (domain, class);
+#endif
+                       }
+                       ip += 5;
+                       break;
+               case MonoInlineMethod:
+                       if (method->wrapper_type == MONO_WRAPPER_NONE && *ip != CEE_CALLI) {
+                               m = mono_get_method_full (image, read32 (ip + 1), NULL, generic_context);
+                               if (m == NULL) {
+                                       g_free (is_bb_start);
+                                       g_error ("FIXME: where to get method and class string?"); 
+                                       return NULL;
+                                       // return mono_get_exception_missing_method ();
+                               }
+                               mono_class_init (m->klass);
+                               if (!mono_class_is_interface (m->klass))
+                                       mono_class_vtable (domain, m->klass);
+                       }
+                       ip += 5;
+                       break;
+               case MonoInlineField:
+               case MonoInlineSig:
+               case MonoInlineI:
+               case MonoInlineTok:
+               case MonoShortInlineR:
+                       ip += 5;
+                       break;
+               case MonoInlineBrTarget:
+                       offset = read32 (ip + 1);
+                       ip += 5;
+                       backwards = offset < 0;
+                       offset += ip - header->code;
+                       g_assert (offset >= 0 && offset < header->code_size);
+                       is_bb_start [offset] |= backwards ? 2 : 1;
+                       break;
+               case MonoShortInlineBrTarget:
+                       offset = ((gint8 *)ip) [1];
+                       ip += 2;
+                       backwards = offset < 0;
+                       offset += ip - header->code;
+                       g_assert (offset >= 0 && offset < header->code_size);
+                       is_bb_start [offset] |= backwards ? 2 : 1;
+                       break;
+               case MonoInlineVar:
+                       ip += 3;
+                       break;
+               case MonoShortInlineVar:
+               case MonoShortInlineI:
+                       ip += 2;
+                       break;
+               case MonoInlineSwitch: {
+                       guint32 n;
+                       const unsigned char *next_ip;
+                       ++ip;
+                       n = read32 (ip);
+                       ip += 4;
+                       next_ip = ip + 4 * n;
+                       for (i = 0; i < n; i++) {
+                               offset = read32 (ip);
+                               backwards = offset < 0;
+                               offset += next_ip - header->code;
+                               g_assert (offset >= 0 && offset < header->code_size);
+                               is_bb_start [offset] |= backwards ? 2 : 1;
+                               ip += 4;
+                       }
+                       break;
+               }
+               case MonoInlineR:
+               case MonoInlineI8:
+                       ip += 9;
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+       }
+       // g_printerr ("TRANSFORM(0x%016lx): end %s::%s\n", mono_thread_current (), method->klass->name, method->name);
+
+       /* the rest needs to be locked so it is only done once */
+       mono_os_mutex_lock(&calc_section);
+       if (runtime_method->transformed) {
+               mono_os_mutex_unlock(&calc_section);
+               g_free (is_bb_start);
+               mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
+               return NULL;
+       }
+
+       runtime_method->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
+       runtime_method->stack_size = (sizeof (stackval) + 2) * header->max_stack; /* + 1 for returns of called functions  + 1 for 0-ing in trace*/
+       runtime_method->stack_size = (runtime_method->stack_size + 7) & ~7;
+       offset = 0;
+       for (i = 0; i < header->num_locals; ++i) {
+               size = mono_type_size (header->locals [i], &align);
+               offset += align - 1;
+               offset &= ~(align - 1);
+               runtime_method->local_offsets [i] = offset;
+               offset += size;
+       }
+       offset = (offset + 7) & ~7;
+       runtime_method->locals_size = offset;
+       g_assert (runtime_method->locals_size < 65536);
+       offset = 0;
+       runtime_method->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
+
+       if (signature->hasthis) {
+               g_assert (!signature->pinvoke);
+               size = mono_type_stack_size (&method->klass->byval_arg, &align);
+               offset += align - 1;
+               offset &= ~(align - 1);
+               runtime_method->arg_offsets [0] = offset;
+               offset += size;
+       }
+
+       for (i = 0; i < signature->param_count; ++i) {
+               if (signature->pinvoke) {
+                       guint32 dummy;
+                       size = mono_type_native_stack_size (signature->params [i], &dummy);
+                       align = 8;
+               }
+               else
+                       size = mono_type_stack_size (signature->params [i], &align);
+               offset += align - 1;
+               offset &= ~(align - 1);
+               runtime_method->arg_offsets [i + !!signature->hasthis] = offset;
+               offset += size;
+       }
+       offset = (offset + 7) & ~7;
+       runtime_method->args_size = offset;
+       g_assert (runtime_method->args_size < 10000);
+
+       generate (method, runtime_method, is_bb_start, generic_context);
+
+       g_free (is_bb_start);
+
+       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
+       runtime_method->transformed = TRUE;
+       mono_os_mutex_unlock(&calc_section);
+
+       return NULL;
+}
+
diff --git a/mono/mini/interpreter/hacks.h b/mono/mini/interpreter/hacks.h
deleted file mode 100644 (file)
index 9697ccb..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/* we need some special math function */
-#ifndef _ISOC99_SOURCE
-#define _ISOC99_SOURCE
-#endif
-#include <math.h>
-
-/* which are not defined on FreeBSD */
-#ifdef __GNUC__
-
-#ifndef isunordered
-#   define isunordered(u, v)                              \
-    (__extension__                                        \
-     ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \
-        isnan(__u) || isnan(__v); }))
-#endif
-
-#ifndef islessgreater
-#   define islessgreater(x, u)                                    \
-    (__extension__                                                \
-     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);         \
-        !isunordered (__x, __y) && (__x < __y) || (__y < __x); }))
-#endif
-
-#ifndef islessequal
-#   define islessequal(x, y)                              \
-    (__extension__                                        \
-     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
-        !isunordered(__x, __y) && __x <= __y; })) 
-#endif
-
-#ifndef isless
-#   define isless(x, y)                                   \
-    (__extension__                                        \
-     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
-        !isunordered(__x, __y) && __x < __y; })) 
-#endif
-
-#ifndef isgreater
-#   define isgreater(x, y)                                \
-    (__extension__                                        \
-     ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
-        !isunordered(__x, __y) && __x > __y; }))
-#endif
-
-#else
-
-/*  isunordered seems to crash on HPUX when built 64 bits
-    so use generic implementation.
-*/
-#if defined(__hpux) && SIZEOF_VOID_P == 8
-#undef isunordered
-#undef islessgreater
-#undef islessequal
-#undef isless
-#undef isgreater
-#endif
-
-#ifndef isunordered
-#   define isunordered(u, v) (isnan(u) || isnan(v))
-#endif
-
-#ifndef islessgreater
-#   define islessgreater(x, u) (!isunordered (x, y) && (x < y) || (y < x))
-#endif
-
-#ifndef islessequal
-#   define islessequal(x, y) (!isunordered(x, y) && x <= y)
-#endif
-
-#ifndef isless
-#   define isless(x, y) (!isunordered(x, y) && x < y) 
-#endif
-
-#ifndef isgreater
-#   define isgreater(x, y) (!isunordered(x, y) && x > y)
-#endif
-
-#endif
-
-/*
- * Attempt at using the goto label construct of GNU GCC:
- * it turns out this does give some benefit: 5-15% speedup.
- * Don't look at these macros, it hurts...
- */
-#define GOTO_LABEL
-#undef GOTO_LABEL
-#ifdef GOTO_LABEL
-
-#define SWITCH(a) goto *goto_map [(a)];
-#define BREAK SWITCH(*ip)
-#define CASE(l)        l ## _LABEL:
-#define DEFAULT        \
-       CEE_ILLEGAL_LABEL:      \
-       CEE_ENDMAC_LABEL:
-#define SUB_SWITCH \
-       CEE_PREFIX1_LABEL: \
-       CEE_ARGLIST_LABEL: \
-       CEE_CEQ_LABEL: \
-       CEE_CGT_LABEL: \
-       CEE_CGT_UN_LABEL: \
-       CEE_CLT_LABEL: \
-       CEE_CLT_UN_LABEL: \
-       CEE_LDFTN_LABEL: \
-       CEE_LDVIRTFTN_LABEL: \
-       CEE_UNUSED56_LABEL: \
-       CEE_LDARG_LABEL: \
-       CEE_LDARGA_LABEL: \
-       CEE_STARG_LABEL: \
-       CEE_LDLOC_LABEL: \
-       CEE_LDLOCA_LABEL: \
-       CEE_STLOC_LABEL: \
-       CEE_LOCALLOC_LABEL: \
-       CEE_UNUSED57_LABEL: \
-       CEE_ENDFILTER_LABEL: \
-       CEE_UNALIGNED__LABEL: \
-       CEE_VOLATILE__LABEL: \
-       CEE_TAIL__LABEL: \
-       CEE_INITOBJ_LABEL: \
-       CEE_UNUSED68_LABEL: \
-       CEE_CPBLK_LABEL: \
-       CEE_INITBLK_LABEL: \
-       CEE_UNUSED69_LABEL: \
-       CEE_RETHROW_LABEL: \
-       CEE_UNUSED_LABEL: \
-       CEE_SIZEOF_LABEL: \
-       CEE_REFANYTYPE_LABEL: \
-       CEE_UNUSED52_LABEL: \
-       CEE_UNUSED53_LABEL: \
-       CEE_UNUSED54_LABEL: \
-       CEE_UNUSED55_LABEL: \
-       CEE_UNUSED70_LABEL:
-#define GOTO_LABEL_VARS \
-       const static void * const goto_map [] = {\
-#define OPDEF(a,b,c,d,e,f,g,h,i,j) \   \
-       && a ## _LABEL, \
-#include "mono/cil/opcode.def" \
-#undef OPDEF   \
-       &&DUMMY_LABEL   \
-       };      \
-       DUMMY_LABEL:
-
-#else
-       
-#define SWITCH(a) switch(a)
-#define BREAK  break
-#define CASE(l)        case l:
-#define DEFAULT        \
-               default:        \
-                       g_error ("Unimplemented opcode: %x at 0x%x\n", *ip, ip-header->code);
-#define SUB_SWITCH case 0xFE:
-#define GOTO_LABEL_VARS
-
-#endif
diff --git a/mono/mini/interpreter/interp-internals.h b/mono/mini/interpreter/interp-internals.h
deleted file mode 100644 (file)
index 603e20a..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef __MONO_MINI_INTERPRETER_INTERNALS_H__
-#define __MONO_MINI_INTERPRETER_INTERNALS_H__
-
-#include <setjmp.h>
-#include <glib.h>
-#include <mono/metadata/loader.h>
-#include <mono/metadata/object.h>
-#include <mono/metadata/domain-internals.h>
-#include <mono/metadata/class-internals.h>
-#include "config.h"
-
-enum {
-       VAL_I32     = 0,
-       VAL_DOUBLE  = 1,
-       VAL_I64     = 2,
-       VAL_VALUET  = 3,
-       VAL_POINTER = 4,
-       VAL_NATI    = 0 + VAL_POINTER,
-       VAL_MP      = 1 + VAL_POINTER,
-       VAL_TP      = 2 + VAL_POINTER,
-       VAL_OBJ     = 3 + VAL_POINTER
-};
-
-#if SIZEOF_VOID_P == 4
-typedef guint32 mono_u;
-typedef gint32  mono_i;
-#elif SIZEOF_VOID_P == 8
-typedef guint64 mono_u;
-typedef gint64  mono_i;
-#endif
-
-/*
- * Value types are represented on the eval stack as pointers to the
- * actual storage. The size field tells how much storage is allocated.
- * A value type can't be larger than 16 MB.
- */
-typedef struct {
-       union {
-               gint32 i;
-               gint64 l;
-               double f;
-               /* native size integer and pointer types */
-               gpointer p;
-               mono_u nati;
-               gpointer vt;
-       } data;
-#if defined(__ppc__) || defined(__powerpc__)
-       int pad;
-#endif
-} stackval;
-
-typedef struct _MonoInvocation MonoInvocation;
-
-typedef void (*MonoFuncV) (void);
-typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
-
-/* 
- * Structure representing a method transformed for the interpreter 
- * This is domain specific
- */
-typedef struct _RuntimeMethod
-{
-       /* NOTE: These first two elements (method and
-          next_jit_code_hash) must be in the same order and at the
-          same offset as in MonoJitInfo, because of the jit_code_hash
-          internal hash table in MonoDomain. */
-       MonoMethod *method;
-       struct _RuntimeMethod *next_jit_code_hash;
-       guint32 locals_size;
-       guint32 args_size;
-       guint32 stack_size;
-       guint32 vt_stack_size;
-       guint32 alloca_size;
-       unsigned short *code;
-       unsigned short *new_body_start; /* after all STINARG instrs */
-       MonoPIFunc func;
-       int num_clauses;
-       MonoExceptionClause *clauses;
-       void **data_items;
-       int transformed;
-       guint32 *arg_offsets;
-       guint32 *local_offsets;
-       unsigned int param_count;
-       unsigned int hasthis;
-       unsigned int valuetype;
-} RuntimeMethod;
-
-struct _MonoInvocation {
-       MonoInvocation *parent; /* parent */
-       RuntimeMethod  *runtime_method; /* parent */
-       MonoMethod     *method; /* parent */
-       stackval       *retval; /* parent */
-       char           *args;
-       stackval       *stack_args; /* parent */
-       stackval       *stack;
-       stackval       *sp; /* For GC stack marking */
-       /* exception info */
-       unsigned char  invoke_trap;
-       const unsigned short  *ip;
-       MonoException     *ex;
-       MonoExceptionClause *ex_handler;
-};
-
-typedef struct {
-       MonoDomain *domain;
-       MonoInvocation *base_frame;
-       MonoInvocation *current_frame;
-       MonoInvocation *env_frame;
-       jmp_buf *current_env;
-       unsigned char search_for_handler;
-       unsigned char managed_code;
-} ThreadContext;
-
-extern int mono_interp_traceopt;
-
-MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
-
-MonoDelegate*
-mono_interp_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
-
-void
-mono_interp_transform_init (void);
-
-RuntimeMethod *
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error);
-
-#endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */
diff --git a/mono/mini/interpreter/interp.c b/mono/mini/interpreter/interp.c
deleted file mode 100644 (file)
index 2ec0105..0000000
+++ /dev/null
@@ -1,4533 +0,0 @@
-/*
- * PLEASE NOTE: This is a research prototype.
- *
- *
- * interp.c: Interpreter for CIL byte codes
- *
- * Authors:
- *   Paolo Molaro (lupus@ximian.com)
- *   Miguel de Icaza (miguel@ximian.com)
- *   Dietmar Maurer (dietmar@ximian.com)
- *
- * (C) 2001, 2002 Ximian, Inc.
- */
-#ifndef __USE_ISOC99
-#define __USE_ISOC99
-#endif
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <math.h>
-#include <locale.h>
-
-#include <mono/utils/gc_wrapper.h>
-
-#ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#else
-#   ifdef __CYGWIN__
-#      define alloca __builtin_alloca
-#   endif
-#endif
-
-/* trim excessive headers */
-#include <mono/metadata/image.h>
-#include <mono/metadata/assembly.h>
-#include <mono/metadata/cil-coff.h>
-#include <mono/metadata/mono-endian.h>
-#include <mono/metadata/tabledefs.h>
-#include <mono/metadata/tokentype.h>
-#include <mono/metadata/loader.h>
-#include <mono/metadata/threads.h>
-#include <mono/metadata/threadpool.h>
-#include <mono/metadata/profiler-private.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/reflection.h>
-#include <mono/metadata/reflection-internals.h>
-#include <mono/metadata/exception.h>
-#include <mono/metadata/verify.h>
-#include <mono/metadata/opcodes.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/mono-config.h>
-#include <mono/metadata/marshal.h>
-#include <mono/metadata/environment.h>
-#include <mono/metadata/mono-debug.h>
-
-#include "interp.h"
-#include "interp-internals.h"
-#include "mintops.h"
-#include "hacks.h"
-
-#include <mono/mini/mini.h>
-#include <mono/mini/jit-icalls.h>
-
-
-/* Mingw 2.1 doesnt need this any more, but leave it in for now for older versions */
-#ifdef _WIN32
-#define isnan _isnan
-#define finite _finite
-#endif
-#ifndef HAVE_FINITE
-#ifdef HAVE_ISFINITE
-#define finite isfinite
-#endif
-#endif
-
-#define INIT_FRAME(frame,parent_frame,method_args,method_retval,domain,mono_method,error)      \
-       do {    \
-               (frame)->parent = (parent_frame);       \
-               (frame)->stack_args = (method_args);    \
-               (frame)->retval = (method_retval);      \
-               (frame)->runtime_method = mono_interp_get_runtime_method ((domain), (mono_method), (error));    \
-               (frame)->ex = NULL;     \
-               (frame)->ip = NULL;     \
-               (frame)->invoke_trap = 0;       \
-       } while (0)
-
-void ves_exec_method (MonoInvocation *frame);
-
-static char* dump_stack (stackval *stack, stackval *sp);
-static char* dump_frame (MonoInvocation *inv);
-static MonoArray *get_trace_ips (MonoDomain *domain, MonoInvocation *top);
-static void ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context);
-
-typedef void (*ICallMethod) (MonoInvocation *frame);
-
-static guint32 die_on_exception = 0;
-static MonoNativeTlsKey thread_context_id;
-
-static char* dump_args (MonoInvocation *inv);
-
-#define DEBUG_INTERP 0
-#define COUNT_OPS 0
-#if DEBUG_INTERP
-int mono_interp_traceopt = 2;
-/* If true, then we output the opcodes as we interpret them */
-static int global_tracing = 2;
-
-static int debug_indent_level = 0;
-
-static int break_on_method = 0;
-static int nested_trace = 0;
-static GList *db_methods = NULL;
-
-static void
-output_indent (void)
-{
-       int h;
-
-       for (h = 0; h < debug_indent_level; h++)
-               g_print ("  ");
-}
-
-static void
-db_match_method (gpointer data, gpointer user_data)
-{
-       MonoMethod *m = (MonoMethod*)user_data;
-       MonoMethodDesc *desc = data;
-
-       if (mono_method_desc_full_match (desc, m))
-               break_on_method = 1;
-}
-
-static void debug_enter (MonoInvocation *frame, int *tracing)
-{
-       if (db_methods) {
-               g_list_foreach (db_methods, db_match_method, (gpointer)frame->runtime_method->method);
-               if (break_on_method)
-                       *tracing = nested_trace ? (global_tracing = 2, 3) : 2;
-               break_on_method = 0;
-       }
-       if (*tracing) {
-               MonoMethod *method = frame->runtime_method->method;
-               char *mn, *args = dump_args (frame);
-               debug_indent_level++;
-               output_indent ();
-               mn = mono_method_full_name (method, FALSE);
-               g_print ("(%p) Entering %s (", mono_thread_internal_current (), mn);
-               g_free (mn);
-               g_print  ("%s)\n", args);
-               g_free (args);
-       }
-       if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE)
-               mono_profiler_method_enter (frame->runtime_method->method);
-}
-
-
-#define DEBUG_LEAVE()  \
-       if (tracing) {  \
-               char *mn, *args;        \
-               args = dump_retval (frame);     \
-               output_indent ();       \
-               mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
-               g_print  ("(%p) Leaving %s", mono_thread_internal_current (),  mn);     \
-               g_free (mn); \
-               g_print  (" => %s\n", args);    \
-               g_free (args);  \
-               debug_indent_level--;   \
-               if (tracing == 3) global_tracing = 0; \
-       }       \
-       if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE)    \
-               mono_profiler_method_leave (frame->runtime_method->method);
-
-#else
-
-int mono_interp_traceopt = 0;
-static void debug_enter (MonoInvocation *frame, int *tracing)
-{
-}
-#define DEBUG_LEAVE()
-
-#endif
-
-static void
-interp_ex_handler (MonoException *ex) {
-       MonoError error;
-       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
-       char *stack_trace;
-       if (context == NULL)
-               return;
-       stack_trace = dump_frame (context->current_frame);
-       ex->stack_trace = mono_string_new (mono_domain_get(), stack_trace);
-       g_free (stack_trace);
-       if (context->current_env == NULL || strcmp(ex->object.vtable->klass->name, "ExecutionEngineException") == 0) {
-               char *strace = mono_string_to_utf8_checked (ex->stack_trace, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               fprintf(stderr, "Nothing can catch this exception: ");
-               fprintf(stderr, "%s", ex->object.vtable->klass->name);
-               if (ex->message != NULL) {
-                       char *m = mono_string_to_utf8_checked (ex->message, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       fprintf(stderr, ": %s", m);
-                       g_free(m);
-               }
-               fprintf(stderr, "\n%s\n", strace);
-               g_free (strace);
-               if (ex->inner_ex != NULL) {
-                       ex = (MonoException *)ex->inner_ex;
-                       fprintf(stderr, "Inner exception: %s", ex->object.vtable->klass->name);
-                       if (ex->message != NULL) {
-                               char *m = mono_string_to_utf8_checked (ex->message, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               fprintf(stderr, ": %s", m);
-                               g_free(m);
-                       }
-                       strace = mono_string_to_utf8_checked (ex->stack_trace, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       fprintf(stderr, "\n");
-                       fprintf(stderr, "%s\n", strace);
-                       g_free (strace);
-               }
-               /* wait for other threads to also collapse */
-               // Sleep(1000); // TODO: proper sleep
-               exit(1);
-       }
-       context->env_frame->ex = ex;
-       context->search_for_handler = 1;
-       longjmp (*context->current_env, 1);
-}
-
-static void
-ves_real_abort (int line, MonoMethod *mh,
-               const unsigned short *ip, stackval *stack, stackval *sp)
-{
-       MonoError error;
-       fprintf (stderr, "Execution aborted in method: %s::%s\n", mh->klass->name, mh->name);
-       fprintf (stderr, "Line=%d IP=0x%04lx, Aborted execution\n", line,
-                ip-(const unsigned short *)mono_method_get_header_checked (mh, &error)->code);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       g_print ("0x%04x %02x\n",
-                ip-(const unsigned short *)mono_method_get_header_checked (mh, &error)->code, *ip);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       if (sp > stack)
-               printf ("\t[%ld] 0x%08x %0.5f\n", sp-stack, sp[-1].data.i, sp[-1].data.f);
-}
-
-#define ves_abort() \
-       do {\
-               ves_real_abort(__LINE__, frame->runtime_method->method, ip, frame->stack, sp); \
-               THROW_EX (mono_get_exception_execution_engine (NULL), ip); \
-       } while (0);
-
-static mono_mutex_t runtime_method_lookup_section;
-
-RuntimeMethod*
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error)
-{
-       RuntimeMethod *rtm;
-       error_init (error);
-
-       mono_os_mutex_lock (&runtime_method_lookup_section);
-       if ((rtm = mono_internal_hash_table_lookup (&domain->jit_code_hash, method))) {
-               mono_os_mutex_unlock (&runtime_method_lookup_section);
-               return rtm;
-       }
-       rtm = mono_mempool_alloc (domain->mp, sizeof (RuntimeMethod));
-       memset (rtm, 0, sizeof (*rtm));
-       rtm->method = method;
-       rtm->param_count = mono_method_signature (method)->param_count;
-       rtm->hasthis = mono_method_signature (method)->hasthis;
-       rtm->valuetype = method->klass->valuetype;
-       mono_internal_hash_table_insert (&domain->jit_code_hash, method, rtm);
-       mono_os_mutex_unlock (&runtime_method_lookup_section);
-
-       return rtm;
-}
-
-static gpointer
-interp_create_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *error)
-{
-       if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
-               method = mono_marshal_get_synchronized_wrapper (method);
-       return mono_interp_get_runtime_method (domain, method, error);
-}
-
-static inline RuntimeMethod*
-get_virtual_method (MonoDomain *domain, RuntimeMethod *runtime_method, MonoObject *obj)
-{
-       MonoMethod *m = runtime_method->method;
-       MonoError error;
-
-       if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
-               RuntimeMethod *ret = NULL;
-               if (mono_object_is_transparent_proxy (obj)) {
-                       ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               } else if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
-                       ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               } else {
-                       ret = runtime_method;
-               }
-               return ret;
-       }
-
-       mono_class_setup_vtable (obj->vtable->klass);
-
-       int slot = mono_method_get_vtable_slot (m);
-       if (mono_class_is_interface (m->klass)) {
-               g_assert (obj->vtable->klass != m->klass);
-               /* TODO: interface offset lookup is slow, go through IMT instead */
-               slot += mono_class_interface_offset (obj->vtable->klass, m->klass);
-       }
-       MonoMethod *virtual_method = obj->vtable->klass->vtable [slot];
-       RuntimeMethod *virtual_runtime_method = mono_interp_get_runtime_method (domain, virtual_method, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       return virtual_runtime_method;
-}
-
-static void inline
-stackval_from_data (MonoType *type, stackval *result, char *data, gboolean pinvoke)
-{
-       if (type->byref) {
-               switch (type->type) {
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_ARRAY:
-               case MONO_TYPE_SZARRAY:
-                       break;
-               default:
-                       break;
-               }
-               result->data.p = *(gpointer*)data;
-               return;
-       }
-       switch (type->type) {
-       case MONO_TYPE_VOID:
-               return;
-       case MONO_TYPE_I1:
-               result->data.i = *(gint8*)data;
-               return;
-       case MONO_TYPE_U1:
-       case MONO_TYPE_BOOLEAN:
-               result->data.i = *(guint8*)data;
-               return;
-       case MONO_TYPE_I2:
-               result->data.i = *(gint16*)data;
-               return;
-       case MONO_TYPE_U2:
-       case MONO_TYPE_CHAR:
-               result->data.i = *(guint16*)data;
-               return;
-       case MONO_TYPE_I4:
-               result->data.i = *(gint32*)data;
-               return;
-       case MONO_TYPE_U:
-       case MONO_TYPE_I:
-               result->data.nati = *(mono_i*)data;
-               return;
-       case MONO_TYPE_PTR:
-               result->data.p = *(gpointer*)data;
-               return;
-       case MONO_TYPE_U4:
-               result->data.i = *(guint32*)data;
-               return;
-       case MONO_TYPE_R4:
-               result->data.f = *(float*)data;
-               return;
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-               result->data.l = *(gint64*)data;
-               return;
-       case MONO_TYPE_R8:
-               result->data.f = *(double*)data;
-               return;
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_ARRAY:
-               result->data.p = *(gpointer*)data;
-               return;
-       case MONO_TYPE_VALUETYPE:
-               if (type->data.klass->enumtype) {
-                       stackval_from_data (mono_class_enum_basetype (type->data.klass), result, data, pinvoke);
-                       return;
-               } else
-                       mono_value_copy (result->data.vt, data, type->data.klass);
-               return;
-       case MONO_TYPE_GENERICINST:
-               stackval_from_data (&type->data.generic_class->container_class->byval_arg, result, data, pinvoke);
-               return;
-       default:
-               g_warning ("got type 0x%02x", type->type);
-               g_assert_not_reached ();
-       }
-}
-
-static void inline
-stackval_to_data (MonoType *type, stackval *val, char *data, gboolean pinvoke)
-{
-       if (type->byref) {
-               gpointer *p = (gpointer*)data;
-               *p = val->data.p;
-               return;
-       }
-       /* printf ("TODAT0 %p\n", data); */
-       switch (type->type) {
-       case MONO_TYPE_I1:
-       case MONO_TYPE_U1: {
-               guint8 *p = (guint8*)data;
-               *p = val->data.i;
-               return;
-       }
-       case MONO_TYPE_BOOLEAN: {
-               guint8 *p = (guint8*)data;
-               *p = (val->data.i != 0);
-               return;
-       }
-       case MONO_TYPE_I2:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_CHAR: {
-               guint16 *p = (guint16*)data;
-               *p = val->data.i;
-               return;
-       }
-       case MONO_TYPE_I: {
-               mono_i *p = (mono_i*)data;
-               /* In theory the value used by stloc should match the local var type
-                  but in practice it sometimes doesn't (a int32 gets dup'd and stloc'd into
-                  a native int - both by csc and mcs). Not sure what to do about sign extension
-                  as it is outside the spec... doing the obvious */
-               *p = (mono_i)val->data.nati;
-               return;
-       }
-       case MONO_TYPE_U: {
-               mono_u *p = (mono_u*)data;
-               /* see above. */
-               *p = (mono_u)val->data.nati;
-               return;
-       }
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U4: {
-               gint32 *p = (gint32*)data;
-               *p = val->data.i;
-               return;
-       }
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8: {
-               gint64 *p = (gint64*)data;
-               *p = val->data.l;
-               return;
-       }
-       case MONO_TYPE_R4: {
-               float *p = (float*)data;
-               *p = val->data.f;
-               return;
-       }
-       case MONO_TYPE_R8: {
-               double *p = (double*)data;
-               *p = val->data.f;
-               return;
-       }
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_ARRAY:
-       case MONO_TYPE_PTR: {
-               gpointer *p = (gpointer*)data;
-               *p = val->data.p;
-               return;
-       }
-       case MONO_TYPE_VALUETYPE:
-               if (type->data.klass->enumtype) {
-                       stackval_to_data (mono_class_enum_basetype (type->data.klass), val, data, pinvoke);
-                       return;
-               } else
-                       mono_value_copy (data, val->data.vt, type->data.klass);
-               return;
-       case MONO_TYPE_GENERICINST:
-               stackval_to_data (&type->data.generic_class->container_class->byval_arg, val, data, pinvoke);
-               return;
-       default:
-               g_warning ("got type %x", type->type);
-               g_assert_not_reached ();
-       }
-}
-
-static void
-fill_in_trace (MonoException *exception, MonoInvocation *frame)
-{
-       char *stack_trace = dump_frame (frame);
-       MonoDomain *domain = mono_domain_get();
-       (exception)->stack_trace = mono_string_new (domain, stack_trace);
-       (exception)->trace_ips = get_trace_ips (domain, frame);
-       g_free (stack_trace);
-}
-
-#define FILL_IN_TRACE(exception, frame) fill_in_trace(exception, frame)
-
-#define THROW_EX(exception,ex_ip)      \
-       do {\
-               frame->ip = (ex_ip);            \
-               frame->ex = (MonoException*)(exception);        \
-               FILL_IN_TRACE(frame->ex, frame); \
-               goto handle_exception;  \
-       } while (0)
-
-static MonoObject*
-ves_array_create (MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
-{
-       uintptr_t *lengths;
-       intptr_t *lower_bounds;
-       MonoObject *obj;
-       MonoError error;
-       int i;
-
-       lengths = alloca (sizeof (uintptr_t) * klass->rank * 2);
-       for (i = 0; i < sig->param_count; ++i) {
-               lengths [i] = values->data.i;
-               values ++;
-       }
-       if (klass->rank == sig->param_count) {
-               /* Only lengths provided. */
-               lower_bounds = NULL;
-       } else {
-               /* lower bounds are first. */
-               lower_bounds = (intptr_t *) lengths;
-               lengths += klass->rank;
-       }
-       obj = (MonoObject*) mono_array_new_full_checked (domain, klass, lengths, lower_bounds, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       return obj;
-}
-
-static void 
-ves_array_set (MonoInvocation *frame)
-{
-       stackval *sp = frame->stack_args;
-       MonoObject *o;
-       MonoArray *ao;
-       MonoClass *ac;
-       gint32 i, t, pos, esize;
-       gpointer ea;
-       MonoType *mt;
-
-       o = frame->stack_args->data.p;
-       ao = (MonoArray *)o;
-       ac = o->vtable->klass;
-
-       g_assert (ac->rank >= 1);
-
-       pos = sp [0].data.i;
-       if (ao->bounds != NULL) {
-               pos -= ao->bounds [0].lower_bound;
-               for (i = 1; i < ac->rank; i++) {
-                       if ((t = sp [i].data.i - ao->bounds [i].lower_bound) >= 
-                           ao->bounds [i].length) {
-                               frame->ex = mono_get_exception_index_out_of_range ();
-                               FILL_IN_TRACE(frame->ex, frame);
-                               return;
-                       }
-                       pos = pos*ao->bounds [i].length + sp [i].data.i - 
-                               ao->bounds [i].lower_bound;
-               }
-       } else if (pos >= ao->max_length) {
-               frame->ex = mono_get_exception_index_out_of_range ();
-               FILL_IN_TRACE(frame->ex, frame);
-               return;
-       }
-
-       if (sp [ac->rank].data.p && !mono_object_class (o)->element_class->valuetype) {
-               MonoError error;
-               MonoObject *isinst = mono_object_isinst_checked (sp [ac->rank].data.p, mono_object_class (o)->element_class, &error);
-               mono_error_cleanup (&error);
-               if (!isinst) {
-                       frame->ex = mono_get_exception_array_type_mismatch ();
-                       FILL_IN_TRACE (frame->ex, frame);
-                       return;
-               }
-       }
-
-       esize = mono_array_element_size (ac);
-       ea = mono_array_addr_with_size (ao, esize, pos);
-
-       mt = mono_method_signature (frame->runtime_method->method)->params [ac->rank];
-       stackval_to_data (mt, &sp [ac->rank], ea, FALSE);
-}
-
-static void 
-ves_array_get (MonoInvocation *frame)
-{
-       stackval *sp = frame->stack_args;
-       MonoObject *o;
-       MonoArray *ao;
-       MonoClass *ac;
-       gint32 i, t, pos, esize;
-       gpointer ea;
-       MonoType *mt;
-
-       o = frame->stack_args->data.p;
-       ao = (MonoArray *)o;
-       ac = o->vtable->klass;
-
-       g_assert (ac->rank >= 1);
-
-       pos = sp [0].data.i;
-       if (ao->bounds != NULL) {
-               pos -= ao->bounds [0].lower_bound;
-               for (i = 1; i < ac->rank; i++) {
-                       if ((t = sp [i].data.i - ao->bounds [i].lower_bound) >= 
-                           ao->bounds [i].length) {
-                               frame->ex = mono_get_exception_index_out_of_range ();
-                               FILL_IN_TRACE(frame->ex, frame);
-                               return;
-                       }
-
-                       pos = pos*ao->bounds [i].length + sp [i].data.i - 
-                               ao->bounds [i].lower_bound;
-               }
-       } else if (pos >= ao->max_length) {
-               frame->ex = mono_get_exception_index_out_of_range ();
-               FILL_IN_TRACE(frame->ex, frame);
-               return;
-       }
-
-       esize = mono_array_element_size (ac);
-       ea = mono_array_addr_with_size (ao, esize, pos);
-
-       mt = mono_method_signature (frame->runtime_method->method)->ret;
-       stackval_from_data (mt, frame->retval, ea, FALSE);
-}
-
-static void
-ves_array_element_address (MonoInvocation *frame)
-{
-       stackval *sp = frame->stack_args;
-       MonoObject *o;
-       MonoArray *ao;
-       MonoClass *ac;
-       gint32 i, t, pos, esize;
-       gpointer ea;
-
-       o = frame->stack_args->data.p;
-       ao = (MonoArray *)o;
-       ac = o->vtable->klass;
-
-       g_assert (ac->rank >= 1);
-
-       pos = sp [0].data.i;
-       if (ao->bounds != NULL) {
-               pos -= ao->bounds [0].lower_bound;
-               for (i = 1; i < ac->rank; i++) {
-                       if ((t = sp [i].data.i - ao->bounds [i].lower_bound) >= 
-                           ao->bounds [i].length) {
-                               frame->ex = mono_get_exception_index_out_of_range ();
-                               FILL_IN_TRACE(frame->ex, frame);
-                               return;
-                       }
-                       pos = pos*ao->bounds [i].length + sp [i].data.i - 
-                               ao->bounds [i].lower_bound;
-               }
-       } else if (pos >= ao->max_length) {
-               frame->ex = mono_get_exception_index_out_of_range ();
-               FILL_IN_TRACE(frame->ex, frame);
-               return;
-       }
-
-       esize = mono_array_element_size (ac);
-       ea = mono_array_addr_with_size (ao, esize, pos);
-
-       frame->retval->data.p = ea;
-}
-
-static void
-interp_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data)
-{
-       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
-       MonoInvocation *frame;
-       int il_offset;
-       MonoMethodHeader *hd;
-       MonoError error;
-
-       if (!context) return;
-               
-       frame = context->current_frame;
-
-       while (frame) {
-               gboolean managed = FALSE;
-               MonoMethod *method = frame->runtime_method->method;
-               if (!method || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)))
-                       il_offset = -1;
-               else {
-                       hd = mono_method_get_header_checked (method, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       il_offset = frame->ip - (const unsigned short *)hd->code;
-                       if (!method->wrapper_type)
-                               managed = TRUE;
-               }
-               if (func (method, -1, il_offset, managed, user_data))
-                       return;
-               frame = frame->parent;
-       }
-}
-
-static MonoPIFunc mono_interp_enter_icall_trampoline = NULL;
-
-struct _MethodArguments {
-       size_t ilen;
-       gpointer *iargs;
-       size_t flen;
-       gpointer *fargs;
-       gpointer *retval;
-};
-
-typedef struct _MethodArguments MethodArguments;
-
-// TODO: this function is also arch dependent (register width).
-static MethodArguments* build_args_from_sig (MonoMethodSignature *sig, MonoInvocation *frame)
-{
-       // TODO: don't malloc this data structure.
-       MethodArguments *margs = g_malloc0 (sizeof (MethodArguments));
-
-       if (sig->hasthis)
-               margs->ilen++;
-
-       for (int i = 0; i < sig->param_count; i++) {
-               guint32 ptype = sig->params [i]->byref ? MONO_TYPE_PTR : sig->params [i]->type;
-               switch (ptype) {
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_PTR:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_I8:
-               case MONO_TYPE_VALUETYPE:
-                       margs->ilen++;
-                       break;
-               default:
-                       g_error ("build_args_from_sig: not implemented yet (1): 0x%x\n", ptype);
-               }
-       }
-
-       if (margs->ilen > 0)
-               margs->iargs = g_malloc0 (sizeof (gpointer) * margs->ilen);
-
-       if (margs->ilen > 6)
-               g_error ("build_args_from_sig: TODO, more than 6 iregs: %d\n", margs->ilen);
-
-       if (margs->flen > 0)
-               g_error ("build_args_from_sig: TODO, allocate floats: %d\n", margs->flen);
-
-
-       size_t int_i = 0;
-
-       if (sig->hasthis) {
-               margs->iargs [0] = frame->stack_args->data.p;
-               int_i++;
-       }
-
-       for (int i = 0; i < sig->param_count; i++) {
-               guint32 ptype = sig->params [i]->byref ? MONO_TYPE_PTR : sig->params [i]->type;
-               switch (ptype) {
-               case MONO_TYPE_BOOLEAN:
-               case MONO_TYPE_CHAR:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_U1:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_U2:
-               case MONO_TYPE_I4:
-               case MONO_TYPE_U4:
-               case MONO_TYPE_I:
-               case MONO_TYPE_U:
-               case MONO_TYPE_PTR:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_OBJECT:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_I8:
-               case MONO_TYPE_VALUETYPE:
-                       margs->iargs [int_i] = frame->stack_args [i].data.p;
-#if DEBUG_INTERP
-                       g_print ("build_args_from_sig: margs->iargs[%d]: %p (frame @ %d)\n", int_i, margs->iargs[int_i], i);
-#endif
-                       int_i++;
-                       break;
-               default:
-                       g_error ("build_args_from_sig: not implemented yet (2): 0x%x\n", ptype);
-               }
-       }
-
-       if (sig->ret->type != MONO_TYPE_VOID) {
-               margs->retval = &(frame->retval->data.p);
-       } else {
-               margs->retval = NULL;
-       }
-
-       return margs;
-}
-
-static void 
-ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
-{
-       jmp_buf env;
-       MonoInvocation *old_frame = context->current_frame;
-       MonoInvocation *old_env_frame = context->env_frame;
-       jmp_buf *old_env = context->current_env;
-
-       if (setjmp (env)) {
-               context->current_frame = old_frame;
-               context->env_frame = old_env_frame;
-               context->current_env = old_env;
-               context->managed_code = 1;
-               return;
-       }
-
-       frame->ex = NULL;
-       context->env_frame = frame;
-       context->current_env = &env;
-
-       g_assert (!frame->runtime_method);
-       if (!mono_interp_enter_icall_trampoline) {
-               MonoTrampInfo *info;
-               mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
-               // TODO:
-               // mono_tramp_info_register (info, NULL);
-       }
-
-       MethodArguments *margs = build_args_from_sig (sig, frame);
-#if DEBUG_INTERP
-       g_print ("ICALL: mono_interp_enter_icall_trampoline = %p, addr = %p\n", mono_interp_enter_icall_trampoline, addr);
-       g_print ("margs(out): ilen=%d, flen=%d\n", margs->ilen, margs->flen);
-#endif
-
-       context->current_frame = frame;
-       context->managed_code = 0;
-
-       mono_interp_enter_icall_trampoline (addr, margs);
-
-       context->managed_code = 1;
-       /* domain can only be changed by native code */
-       context->domain = mono_domain_get ();
-
-       if (*mono_thread_interruption_request_flag ())
-               mono_thread_interruption_checkpoint ();
-       
-       if (!MONO_TYPE_ISSTRUCT (sig->ret))
-               stackval_from_data (sig->ret, frame->retval, (char*)&frame->retval->data.p, sig->pinvoke);
-
-       context->current_frame = old_frame;
-       context->env_frame = old_env_frame;
-       context->current_env = old_env;
-
-       g_free (margs->iargs);
-       g_free (margs->fargs);
-       g_free (margs);
-}
-
-static void
-interp_delegate_ctor (MonoDomain *domain, MonoObject *this, MonoObject *target, RuntimeMethod *runtime_method)
-{
-       MonoDelegate *delegate = (MonoDelegate *)this;
-       MonoError error;
-
-       delegate->method_info = mono_method_get_object_checked (domain, runtime_method->method, NULL, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       delegate->target = target;
-
-       if (target && mono_object_is_transparent_proxy (target)) {
-               MonoMethod *method = mono_marshal_get_remoting_invoke (runtime_method->method);
-               delegate->method_ptr = mono_interp_get_runtime_method (domain, method, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       } else {
-               delegate->method_ptr = runtime_method;
-       }
-}
-
-MonoDelegate*
-mono_interp_ftnptr_to_delegate (MonoClass *klass, gpointer ftn)
-{
-       MonoDelegate *d;
-       MonoJitInfo *ji;
-       MonoDomain *domain = mono_domain_get ();
-       MonoError error;
-
-       d = (MonoDelegate*)mono_object_new_checked (domain, klass, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       ji = mono_jit_info_table_find (domain, ftn);
-       if (ji == NULL)
-               mono_raise_exception (mono_get_exception_argument ("", "Function pointer was not created by a Delegate."));
-
-       /* FIXME: discard the wrapper and call the original method */
-       interp_delegate_ctor (domain, (MonoObject*)d, NULL, mono_interp_get_runtime_method (domain, ji->d.method, &error));
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       return d;
-}
-
-/*
- * From the spec:
- * runtime specifies that the implementation of the method is automatically
- * provided by the runtime and is primarily used for the methods of delegates.
- */
-static void
-ves_runtime_method (MonoInvocation *frame, ThreadContext *context)
-{
-       MonoMethod *method = frame->runtime_method->method;
-       const char *name = method->name;
-       MonoObject *obj = (MonoObject*) frame->stack_args->data.p;
-       MonoObject *isinst_obj;
-       MonoError error;
-
-       mono_class_init (method->klass);
-
-       isinst_obj = mono_object_isinst_checked (obj, mono_defaults.multicastdelegate_class, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       if (obj && isinst_obj) {
-               if (*name == '.' && (strcmp (name, ".ctor") == 0)) {
-                       interp_delegate_ctor (context->domain, obj, frame->stack_args [1].data.p, frame->stack_args[2].data.p);
-                       return;
-               }
-       }
-
-       isinst_obj = mono_object_isinst_checked (obj, mono_defaults.array_class, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       if (obj && isinst_obj) {
-               if (*name == 'S' && (strcmp (name, "Set") == 0)) {
-                       ves_array_set (frame);
-                       return;
-               }
-               if (*name == 'G' && (strcmp (name, "Get") == 0)) {
-                       ves_array_get (frame);
-                       return;
-               }
-               if (*name == 'A' && (strcmp (name, "Address") == 0)) {
-                       ves_array_element_address (frame);
-                       return;
-               }
-       }
-       
-       g_error ("Don't know how to exec runtime method %s.%s::%s", 
-                       method->klass->name_space, method->klass->name,
-                       method->name);
-}
-
-static char*
-dump_stack (stackval *stack, stackval *sp)
-{
-       stackval *s = stack;
-       GString *str = g_string_new ("");
-       
-       if (sp == stack)
-               return g_string_free (str, FALSE);
-       
-       while (s < sp) {
-               g_string_append_printf (str, "[%p (%lld)] ", s->data.l, s->data.l);
-               ++s;
-       }
-       return g_string_free (str, FALSE);
-}
-
-static void
-dump_stackval (GString *str, stackval *s, MonoType *type)
-{
-       switch (type->type) {
-       case MONO_TYPE_I1:
-       case MONO_TYPE_U1:
-       case MONO_TYPE_I2:
-       case MONO_TYPE_U2:
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U4:
-       case MONO_TYPE_CHAR:
-       case MONO_TYPE_BOOLEAN:
-               g_string_append_printf (str, "[%d] ", s->data.i);
-               break;
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_ARRAY:
-       case MONO_TYPE_PTR:
-       case MONO_TYPE_I:
-       case MONO_TYPE_U:
-               g_string_append_printf (str, "[%p] ", s->data.p);
-               break;
-       case MONO_TYPE_VALUETYPE:
-               if (type->data.klass->enumtype)
-                       g_string_append_printf (str, "[%d] ", s->data.i);
-               else
-                       g_string_append_printf (str, "[vt:%p] ", s->data.p);
-               break;
-       case MONO_TYPE_R4:
-       case MONO_TYPE_R8:
-               g_string_append_printf (str, "[%g] ", s->data.f);
-               break;
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-       default: {
-               GString *res = g_string_new ("");
-               mono_type_get_desc (res, type, TRUE);
-               g_string_append_printf (str, "[{%s} %lld/0x%0llx] ", res->str, s->data.l, s->data.l);
-               g_string_free (res, TRUE);
-               break;
-       }
-       }
-}
-
-static char*
-dump_args (MonoInvocation *inv)
-{
-       GString *str = g_string_new ("");
-       int i;
-       MonoMethodSignature *signature = mono_method_signature (inv->runtime_method->method);
-       
-       if (signature->param_count == 0 && !signature->hasthis)
-               return g_string_free (str, FALSE);
-
-       if (signature->hasthis) {
-               MonoMethod *method = inv->runtime_method->method;
-               dump_stackval (str, inv->stack_args, &method->klass->byval_arg);
-       }
-
-       for (i = 0; i < signature->param_count; ++i)
-               dump_stackval (str, inv->stack_args + (!!signature->hasthis) + i, signature->params [i]);
-
-       return g_string_free (str, FALSE);
-}
-
-static char*
-dump_retval (MonoInvocation *inv)
-{
-       GString *str = g_string_new ("");
-       MonoType *ret = mono_method_signature (inv->runtime_method->method)->ret;
-
-       if (ret->type != MONO_TYPE_VOID)
-               dump_stackval (str, inv->retval, ret);
-
-       return g_string_free (str, FALSE);
-}
-static char*
-dump_frame (MonoInvocation *inv)
-{
-       GString *str = g_string_new ("");
-       int i;
-       char *args;
-       MonoError error;
-
-       for (i = 0; inv; inv = inv->parent) {
-               if (inv->runtime_method != NULL) {
-                       MonoMethod *method = inv->runtime_method->method;
-                       MonoClass *k;
-
-                       int codep = 0;
-                       const char * opname = "";
-                       char *name;
-                       gchar *source = NULL;
-
-                       k = method->klass;
-
-                       if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) == 0 &&
-                               (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) == 0) {
-                               MonoMethodHeader *hd = mono_method_get_header_checked (method, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-                               if (hd != NULL) {
-                                       if (inv->ip) {
-                                               opname = mono_interp_opname [*inv->ip];
-                                               codep = inv->ip - inv->runtime_method->code;
-                                               source = g_strdup_printf ("%s:%d // (TODO: proper stacktrace)", method->name, codep);
-                                       } else 
-                                               opname = "";
-
-#if 0
-                                       MonoDebugSourceLocation *minfo = mono_debug_lookup_method (method);
-                                       source = mono_debug_method_lookup_location (minfo, codep);
-#endif
-                               }
-                       }
-                       args = dump_args (inv);
-                       name = mono_method_full_name (method, TRUE);
-                       if (source)
-                               g_string_append_printf (str, "#%d: 0x%05x %-10s in %s (%s) at %s\n", i, codep, opname, name, args, source);
-                       else
-                               g_string_append_printf (str, "#%d: 0x%05x %-10s in %s (%s)\n", i, codep, opname, name, args);
-                       g_free (name);
-                       g_free (args);
-                       g_free (source);
-                       ++i;
-               }
-       }
-       return g_string_free (str, FALSE);
-}
-
-static MonoArray *
-get_trace_ips (MonoDomain *domain, MonoInvocation *top)
-{
-       int i;
-       MonoArray *res;
-       MonoInvocation *inv;
-       MonoError error;
-
-       for (i = 0, inv = top; inv; inv = inv->parent)
-               if (inv->runtime_method != NULL)
-                       ++i;
-
-       res = mono_array_new_checked (domain, mono_defaults.int_class, 2 * i, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       for (i = 0, inv = top; inv; inv = inv->parent)
-               if (inv->runtime_method != NULL) {
-                       mono_array_set (res, gpointer, i, inv->runtime_method);
-                       ++i;
-                       mono_array_set (res, gpointer, i, (gpointer)inv->ip);
-                       ++i;
-               }
-
-       return res;
-}
-
-
-#define MYGUINT64_MAX 18446744073709551615ULL
-#define MYGINT64_MAX 9223372036854775807LL
-#define MYGINT64_MIN (-MYGINT64_MAX -1LL)
-
-#define MYGUINT32_MAX 4294967295U
-#define MYGINT32_MAX 2147483647
-#define MYGINT32_MIN (-MYGINT32_MAX -1)
-       
-#define CHECK_ADD_OVERFLOW(a,b) \
-       (gint32)(b) >= 0 ? (gint32)(MYGINT32_MAX) - (gint32)(b) < (gint32)(a) ? -1 : 0  \
-       : (gint32)(MYGINT32_MIN) - (gint32)(b) > (gint32)(a) ? +1 : 0
-
-#define CHECK_SUB_OVERFLOW(a,b) \
-       (gint32)(b) < 0 ? (gint32)(MYGINT32_MAX) + (gint32)(b) < (gint32)(a) ? -1 : 0   \
-       : (gint32)(MYGINT32_MIN) + (gint32)(b) > (gint32)(a) ? +1 : 0
-
-#define CHECK_ADD_OVERFLOW_UN(a,b) \
-       (guint32)(MYGUINT32_MAX) - (guint32)(b) < (guint32)(a) ? -1 : 0
-
-#define CHECK_SUB_OVERFLOW_UN(a,b) \
-       (guint32)(a) < (guint32)(b) ? -1 : 0
-
-#define CHECK_ADD_OVERFLOW64(a,b) \
-       (gint64)(b) >= 0 ? (gint64)(MYGINT64_MAX) - (gint64)(b) < (gint64)(a) ? -1 : 0  \
-       : (gint64)(MYGINT64_MIN) - (gint64)(b) > (gint64)(a) ? +1 : 0
-
-#define CHECK_SUB_OVERFLOW64(a,b) \
-       (gint64)(b) < 0 ? (gint64)(MYGINT64_MAX) + (gint64)(b) < (gint64)(a) ? -1 : 0   \
-       : (gint64)(MYGINT64_MIN) + (gint64)(b) > (gint64)(a) ? +1 : 0
-
-#define CHECK_ADD_OVERFLOW64_UN(a,b) \
-       (guint64)(MYGUINT64_MAX) - (guint64)(b) < (guint64)(a) ? -1 : 0
-
-#define CHECK_SUB_OVERFLOW64_UN(a,b) \
-       (guint64)(a) < (guint64)(b) ? -1 : 0
-
-#if SIZEOF_VOID_P == 4
-#define CHECK_ADD_OVERFLOW_NAT(a,b) CHECK_ADD_OVERFLOW(a,b)
-#define CHECK_ADD_OVERFLOW_NAT_UN(a,b) CHECK_ADD_OVERFLOW_UN(a,b)
-#else
-#define CHECK_ADD_OVERFLOW_NAT(a,b) CHECK_ADD_OVERFLOW64(a,b)
-#define CHECK_ADD_OVERFLOW_NAT_UN(a,b) CHECK_ADD_OVERFLOW64_UN(a,b)
-#endif
-
-/* Resolves to TRUE if the operands would overflow */
-#define CHECK_MUL_OVERFLOW(a,b) \
-       ((gint32)(a) == 0) || ((gint32)(b) == 0) ? 0 : \
-       (((gint32)(a) > 0) && ((gint32)(b) == -1)) ? FALSE : \
-       (((gint32)(a) < 0) && ((gint32)(b) == -1)) ? (a == - MYGINT32_MAX) : \
-       (((gint32)(a) > 0) && ((gint32)(b) > 0)) ? (gint32)(a) > ((MYGINT32_MAX) / (gint32)(b)) : \
-       (((gint32)(a) > 0) && ((gint32)(b) < 0)) ? (gint32)(a) > ((MYGINT32_MIN) / (gint32)(b)) : \
-       (((gint32)(a) < 0) && ((gint32)(b) > 0)) ? (gint32)(a) < ((MYGINT32_MIN) / (gint32)(b)) : \
-       (gint32)(a) < ((MYGINT32_MAX) / (gint32)(b))
-
-#define CHECK_MUL_OVERFLOW_UN(a,b) \
-       ((guint32)(a) == 0) || ((guint32)(b) == 0) ? 0 : \
-       (guint32)(b) > ((MYGUINT32_MAX) / (guint32)(a))
-
-#define CHECK_MUL_OVERFLOW64(a,b) \
-       ((gint64)(a) == 0) || ((gint64)(b) == 0) ? 0 : \
-       (((gint64)(a) > 0) && ((gint64)(b) == -1)) ? FALSE : \
-       (((gint64)(a) < 0) && ((gint64)(b) == -1)) ? (a == - MYGINT64_MAX) : \
-       (((gint64)(a) > 0) && ((gint64)(b) > 0)) ? (gint64)(a) > ((MYGINT64_MAX) / (gint64)(b)) : \
-       (((gint64)(a) > 0) && ((gint64)(b) < 0)) ? (gint64)(a) > ((MYGINT64_MIN) / (gint64)(b)) : \
-       (((gint64)(a) < 0) && ((gint64)(b) > 0)) ? (gint64)(a) < ((MYGINT64_MIN) / (gint64)(b)) : \
-       (gint64)(a) < ((MYGINT64_MAX) / (gint64)(b))
-
-#define CHECK_MUL_OVERFLOW64_UN(a,b) \
-       ((guint64)(a) == 0) || ((guint64)(b) == 0) ? 0 : \
-       (guint64)(b) > ((MYGUINT64_MAX) / (guint64)(a))
-
-#if SIZEOF_VOID_P == 4
-#define CHECK_MUL_OVERFLOW_NAT(a,b) CHECK_MUL_OVERFLOW(a,b)
-#define CHECK_MUL_OVERFLOW_NAT_UN(a,b) CHECK_MUL_OVERFLOW_UN(a,b)
-#else
-#define CHECK_MUL_OVERFLOW_NAT(a,b) CHECK_MUL_OVERFLOW64(a,b)
-#define CHECK_MUL_OVERFLOW_NAT_UN(a,b) CHECK_MUL_OVERFLOW64_UN(a,b)
-#endif
-
-MonoObject*
-mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error)
-{
-       MonoInvocation frame;
-       ThreadContext * volatile context = mono_native_tls_get_value (thread_context_id);
-       MonoObject *retval = NULL;
-       MonoMethodSignature *sig = mono_method_signature (method);
-       MonoClass *klass = mono_class_from_mono_type (sig->ret);
-       int i, type, isobject = 0;
-       void *ret = NULL;
-       stackval result;
-       stackval *args = alloca (sizeof (stackval) * (sig->param_count + !!sig->hasthis));
-       ThreadContext context_struct;
-       MonoInvocation *old_frame = NULL;
-       jmp_buf env;
-
-       error_init (error);
-
-       frame.ex = NULL;
-
-       if (setjmp(env)) {
-               if (context != &context_struct) {
-                       context->domain = mono_domain_get ();
-                       context->current_frame = old_frame;
-                       context->managed_code = 0;
-               } else 
-                       mono_native_tls_set_value (thread_context_id, NULL);
-               if (exc != NULL)
-                       *exc = (MonoObject *)frame.ex;
-               return retval;
-       }
-
-       if (context == NULL) {
-               context = &context_struct;
-               context_struct.base_frame = &frame;
-               context_struct.current_frame = NULL;
-               context_struct.env_frame = &frame;
-               context_struct.current_env = &env;
-               context_struct.search_for_handler = 0;
-               context_struct.managed_code = 0;
-               mono_native_tls_set_value (thread_context_id, context);
-       }
-       else
-               old_frame = context->current_frame;
-
-       context->domain = mono_domain_get ();
-
-       switch (sig->ret->type) {
-       case MONO_TYPE_VOID:
-               break;
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_ARRAY:
-       case MONO_TYPE_SZARRAY:
-               isobject = 1;
-               break;
-       case MONO_TYPE_VALUETYPE:
-               retval = mono_object_new_checked (context->domain, klass, error);
-               ret = ((char*)retval) + sizeof (MonoObject);
-               if (!sig->ret->data.klass->enumtype)
-                       result.data.vt = ret;
-               break;
-       default:
-               retval = mono_object_new_checked (context->domain, klass, error);
-               ret = ((char*)retval) + sizeof (MonoObject);
-               break;
-       }
-
-       if (sig->hasthis)
-               args [0].data.p = obj;
-
-       for (i = 0; i < sig->param_count; ++i) {
-               int a_index = i + !!sig->hasthis;
-               if (sig->params [i]->byref) {
-                       args [a_index].data.p = params [i];
-                       continue;
-               }
-               type = sig->params [i]->type;
-handle_enum:
-               switch (type) {
-               case MONO_TYPE_U1:
-               case MONO_TYPE_I1:
-               case MONO_TYPE_BOOLEAN:
-                       args [a_index].data.i = *(MonoBoolean*)params [i];
-                       break;
-               case MONO_TYPE_U2:
-               case MONO_TYPE_I2:
-               case MONO_TYPE_CHAR:
-                       args [a_index].data.i = *(gint16*)params [i];
-                       break;
-#if SIZEOF_VOID_P == 4
-               case MONO_TYPE_U: /* use VAL_POINTER? */
-               case MONO_TYPE_I:
-#endif
-               case MONO_TYPE_U4:
-               case MONO_TYPE_I4:
-                       args [a_index].data.i = *(gint32*)params [i];
-                       break;
-#if SIZEOF_VOID_P == 8
-               case MONO_TYPE_U:
-               case MONO_TYPE_I:
-#endif
-               case MONO_TYPE_U8:
-               case MONO_TYPE_I8:
-                       args [a_index].data.l = *(gint64*)params [i];
-                       break;
-               case MONO_TYPE_VALUETYPE:
-                       if (sig->params [i]->data.klass->enumtype) {
-                               type = mono_class_enum_basetype (sig->params [i]->data.klass)->type;
-                               goto handle_enum;
-                       } else {
-                               args [a_index].data.p = params [i];
-                       }
-                       break;
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_CLASS:
-               case MONO_TYPE_ARRAY:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_OBJECT:
-                       args [a_index].data.p = params [i];
-                       break;
-               default:
-                       g_error ("type 0x%x not handled in  runtime invoke", sig->params [i]->type);
-               }
-       }
-
-       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
-               method = mono_marshal_get_native_wrapper (method, FALSE, FALSE);
-       INIT_FRAME (&frame,context->current_frame,args,&result,mono_get_root_domain (),method,error);
-       if (exc)
-               frame.invoke_trap = 1;
-       context->managed_code = 1;
-       ves_exec_method_with_context (&frame, context);
-       context->managed_code = 0;
-       if (context == &context_struct)
-               mono_native_tls_set_value (thread_context_id, NULL);
-       else
-               context->current_frame = old_frame;
-       if (frame.ex != NULL) {
-               if (exc != NULL) {
-                       *exc = (MonoObject*) frame.ex;
-                       return NULL;
-               }
-               if (context->current_env != NULL) {
-                       context->env_frame->ex = frame.ex;
-                       longjmp(*context->current_env, 1);
-               }
-               else
-                       printf("dropped exception...\n");
-       }
-       if (sig->ret->type == MONO_TYPE_VOID && !method->string_ctor)
-               return NULL;
-       if (isobject || method->string_ctor)
-               return result.data.p;
-       stackval_to_data (sig->ret, &result, ret, sig->pinvoke);
-       return retval;
-}
-
-static stackval * 
-do_icall (ThreadContext *context, int op, stackval *sp, gpointer ptr)
-{
-       MonoInvocation *old_frame = context->current_frame;
-       MonoInvocation *old_env_frame = context->env_frame;
-       jmp_buf *old_env = context->current_env;
-       jmp_buf env;
-
-       if (setjmp (env)) {
-               context->current_frame = old_frame;
-               context->env_frame = old_env_frame;
-               context->current_env = old_env;
-               context->managed_code = 1;
-               return sp;
-       }
-
-       context->env_frame = context->current_frame;
-       context->current_env = &env;
-       context->managed_code = 0;
-
-       switch (op) {
-       case MINT_ICALL_V_V: {
-               void (*func)() = ptr;
-               func ();
-               break;
-       }
-       case MINT_ICALL_V_P: {
-               gpointer (*func)() = ptr;
-               sp++;
-               sp [-1].data.p = func ();
-               break;
-       }
-       case MINT_ICALL_P_V: {
-               void (*func)(gpointer) = ptr;
-               func (sp [-1].data.p);
-               sp --;
-               break;
-       }
-       case MINT_ICALL_P_P: {
-               gpointer (*func)(gpointer) = ptr;
-               sp [-1].data.p = func (sp [-1].data.p);
-               break;
-       }
-       case MINT_ICALL_PP_V: {
-               void (*func)(gpointer,gpointer) = ptr;
-               sp -= 2;
-               func (sp [0].data.p, sp [1].data.p);
-               break;
-       }
-       case MINT_ICALL_PI_V: {
-               void (*func)(gpointer,int) = ptr;
-               sp -= 2;
-               func (sp [0].data.p, sp [1].data.i);
-               break;
-       }
-       case MINT_ICALL_PP_P: {
-               gpointer (*func)(gpointer,gpointer) = ptr;
-               --sp;
-               sp [-1].data.p = func (sp [-1].data.p, sp [0].data.p);
-               break;
-       }
-       case MINT_ICALL_PI_P: {
-               gpointer (*func)(gpointer,int) = ptr;
-               --sp;
-               sp [-1].data.p = func (sp [-1].data.p, sp [0].data.i);
-               break;
-       }
-       case MINT_ICALL_PPP_V: {
-               void (*func)(gpointer,gpointer,gpointer) = ptr;
-               sp -= 3;
-               func (sp [0].data.p, sp [1].data.p, sp [2].data.p);
-               break;
-       }
-       case MINT_ICALL_PPI_V: {
-               void (*func)(gpointer,gpointer,int) = ptr;
-               sp -= 3;
-               func (sp [0].data.p, sp [1].data.p, sp [2].data.i);
-               break;
-       }
-       default:
-               g_assert_not_reached ();
-       }
-
-       context->env_frame = old_env_frame;
-       context->current_env = old_env;
-
-       return sp;
-}
-
-static mono_mutex_t create_method_pointer_mutex;
-
-static GHashTable *method_pointer_hash = NULL;
-
-static MonoMethod *method_pointers [2] = {0};
-
-static MonoObject *
-mp_tramp_0 (MonoObject *this_obj, void **params, MonoObject **exc, void *compiled_method) {
-       MonoError error;
-       void *params_real[] = {this_obj, &params, &exc, &compiled_method};
-       MonoObject *ret = mono_interp_runtime_invoke (method_pointers [0], NULL, params_real, NULL, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       return ret;
-}
-
-static MonoObject *
-mp_tramp_1 (MonoObject *this_obj, void **params, MonoObject **exc, void *compiled_method) {
-       MonoError error;
-       void *params_real[] = {this_obj, &params, &exc, &compiled_method};
-       MonoObject *ret = mono_interp_runtime_invoke (method_pointers [1], NULL, params_real, NULL, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       return ret;
-}
-
-gpointer *mp_tramps[] = {(gpointer) mp_tramp_0, (gpointer) mp_tramp_1};
-
-static int tramps_used = 0;
-
-gpointer
-mono_interp_create_method_pointer (MonoMethod *method, MonoError *error)
-{
-       gpointer addr;
-       MonoJitInfo *ji;
-
-       mono_os_mutex_lock (&create_method_pointer_mutex);
-       if (!method_pointer_hash) {
-               // FIXME: is registering method table as GC root really necessary?
-               // MONO_GC_REGISTER_ROOT_FIXED (method_pointer_hash);
-               method_pointer_hash = g_hash_table_new (NULL, NULL);
-       }
-       addr = g_hash_table_lookup (method_pointer_hash, method);
-       if (addr) {
-               mono_os_mutex_unlock (&create_method_pointer_mutex);
-               return addr;
-       }
-
-       /*
-        * If it is a static P/Invoke method, we can just return the pointer
-        * to the method implementation.
-        */
-       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL && ((MonoMethodPInvoke*) method)->addr) {
-               ji = g_new0 (MonoJitInfo, 1);
-               ji->d.method = method;
-               ji->code_size = 1;
-               ji->code_start = addr = ((MonoMethodPInvoke*) method)->addr;
-
-               mono_jit_info_table_add (mono_get_root_domain (), ji);
-       }               
-       else {
-               g_assert (method->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE);
-               g_assert (tramps_used < 2);
-
-               /* FIXME: needs locking */
-               method_pointers [tramps_used] = method;
-               addr = mp_tramps [tramps_used];
-               tramps_used++;
-       }
-
-       g_hash_table_insert (method_pointer_hash, method, addr);
-       mono_os_mutex_unlock (&create_method_pointer_mutex);
-
-       return addr;
-}
-
-#if COUNT_OPS
-static int opcode_counts[512];
-
-#define COUNT_OP(op) opcode_counts[op]++
-#else
-#define COUNT_OP(op) 
-#endif
-
-#if DEBUG_INTERP
-#define DUMP_INSTR() \
-       if (tracing > 1) { \
-               char *ins; \
-               if (sp > frame->stack) { \
-                       ins = dump_stack (frame->stack, sp); \
-               } else { \
-                       ins = g_strdup (""); \
-               } \
-               sp->data.l = 0; \
-               output_indent (); \
-               char *mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
-               g_print ("(%p) %s -> ", mono_thread_internal_current (), mn); \
-               g_free (mn); \
-               mono_interp_dis_mintop(rtm->code, ip); \
-               g_print ("\t%d:%s\n", vt_sp - vtalloc, ins); \
-               g_free (ins); \
-       }
-#else
-#define DUMP_INSTR()
-#endif
-
-#ifdef __GNUC__
-#define USE_COMPUTED_GOTO 1
-#endif
-#if USE_COMPUTED_GOTO
-#define MINT_IN_SWITCH(op) COUNT_OP(op); goto *in_labels[op];
-#define MINT_IN_CASE(x) LAB_ ## x:
-#if DEBUG_INTERP
-#define MINT_IN_BREAK if (tracing > 1) goto main_loop; else { COUNT_OP(*ip); goto *in_labels[*ip]; }
-#else
-#define MINT_IN_BREAK { COUNT_OP(*ip); goto *in_labels[*ip]; }
-#endif
-#define MINT_IN_DEFAULT mint_default: if (0) goto mint_default; /* make gcc shut up */
-#else
-#define MINT_IN_SWITCH(op) switch (op)
-#define MINT_IN_CASE(x) case x:
-#define MINT_IN_BREAK break
-#define MINT_IN_DEFAULT default:
-#endif
-
-/* 
- * Defining this causes register allocation errors in some versions of gcc:
- * error: unable to find a register to spill in class `SIREG'
- */
-/* #define MINT_USE_DEDICATED_IP_REG */
-
-static void 
-ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context)
-{
-       MonoInvocation child_frame;
-       GSList *finally_ips = NULL;
-       const unsigned short *endfinally_ip = NULL;
-#if defined(__GNUC__) && defined (i386) && defined (MINT_USE_DEDICATED_IP_REG)
-       register const unsigned short *ip asm ("%esi");
-#else
-       register const unsigned short *ip;
-#endif
-       register stackval *sp;
-       RuntimeMethod *rtm;
-#if DEBUG_INTERP
-       gint tracing = global_tracing;
-       unsigned char *vtalloc;
-#endif
-       int i32;
-       unsigned char *vt_sp;
-       unsigned char *locals;
-       MonoError error;
-       MonoObject *o = NULL;
-       MonoClass *c;
-#if USE_COMPUTED_GOTO
-       static void *in_labels[] = {
-#define OPDEF(a,b,c,d) \
-       &&LAB_ ## a,
-#include "mintops.def"
-       0 };
-#endif
-
-       frame->ex = NULL;
-       frame->ex_handler = NULL;
-       frame->ip = NULL;
-       context->current_frame = frame;
-
-#if DEBUG_INTERP
-       debug_enter (frame, &tracing);
-#endif
-
-       if (!frame->runtime_method->transformed) {
-               context->managed_code = 0;
-#if DEBUG_INTERP
-               char *mn = mono_method_full_name (frame->runtime_method->method, FALSE);
-               g_print ("(%p) Transforming %s\n", mono_thread_internal_current (), mn);
-               g_free (mn);
-#endif
-               frame->ex = mono_interp_transform_method (frame->runtime_method, context);
-               context->managed_code = 1;
-               if (frame->ex) {
-                       rtm = NULL;
-                       ip = NULL;
-                       goto exit_frame;
-               }
-       }
-
-       rtm = frame->runtime_method;
-       frame->args = alloca (rtm->alloca_size);
-       sp = frame->stack = (stackval *)((char *)frame->args + rtm->args_size);
-#if DEBUG_INTERP
-       if (tracing > 1)
-               memset(sp, 0, rtm->stack_size);
-#endif
-       vt_sp = (unsigned char *) sp + rtm->stack_size;
-#if DEBUG_INTERP
-       vtalloc = vt_sp;
-#endif
-       locals = (unsigned char *) vt_sp + rtm->vt_stack_size;
-
-       child_frame.parent = frame;
-
-       /* ready to go */
-       ip = rtm->code;
-
-       /*
-        * using while (ip < end) may result in a 15% performance drop, 
-        * but it may be useful for debug
-        */
-       while (1) {
-       main_loop:
-               /* g_assert (sp >= frame->stack); */
-               /* g_assert(vt_sp - vtalloc <= rtm->vt_stack_size); */
-               DUMP_INSTR();
-               MINT_IN_SWITCH (*ip) {
-               MINT_IN_CASE(MINT_INITLOCALS)
-                       memset (locals, 0, rtm->locals_size);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NOP)
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BREAK)
-                       ++ip;
-                       G_BREAKPOINT (); /* this is not portable... */
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDNULL) 
-                       sp->data.p = NULL;
-                       ++ip;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_VTRESULT) {
-                       int ret_size = * (guint16 *)(ip + 1);
-                       unsigned char *ret_vt_sp = vt_sp;
-                       vt_sp -= READ32(ip + 2);
-                       if (ret_size > 0) {
-                               memmove (vt_sp, ret_vt_sp, ret_size);
-                               sp [-1].data.p = vt_sp;
-                               vt_sp += (ret_size + 7) & ~7;
-                       }
-                       ip += 4;
-                       MINT_IN_BREAK;
-               }
-#define LDC(n) do { sp->data.i = (n); ++ip; ++sp; } while (0)
-               MINT_IN_CASE(MINT_LDC_I4_M1)
-                       LDC(-1);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_0)
-                       LDC(0);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_1)
-                       LDC(1);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_2)
-                       LDC(2);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_3)
-                       LDC(3);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_4)
-                       LDC(4);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_5)
-                       LDC(5);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_6)
-                       LDC(6);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_7)
-                       LDC(7);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_8)
-                       LDC(8);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4_S) 
-                       sp->data.i = *(const short *)(ip + 1);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I4)
-                       ++ip;
-                       sp->data.i = READ32 (ip);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_I8)
-                       ++ip;
-                       sp->data.l = READ64 (ip);
-                       ip += 4;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDC_R4) {
-                       guint32 val;
-                       ++ip;
-                       val = READ32(ip);
-                       sp->data.f = * (float *)&val;
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDC_R8) 
-                       sp->data.l = READ64 (ip + 1); /* note union usage */
-                       ip += 5;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DUP) 
-                       sp [0] = sp[-1];
-                       ++sp;
-                       ++ip; 
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DUP_VT)
-                       i32 = READ32 (ip + 1);
-                       sp->data.p = vt_sp;
-                       memcpy(sp->data.p, sp [-1].data.p, i32);
-                       vt_sp += (i32 + 7) & ~7;
-                       ++sp;
-                       ip += 3;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_POP)
-                       ++ip;
-                       --sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_JMP) {
-                       RuntimeMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
-                       if (!new_method->transformed) {
-                               frame->ip = ip;
-                               frame->ex = mono_interp_transform_method (new_method, context);
-                               if (frame->ex)
-                                       goto exit_frame;
-                       }
-                       ip += 2;
-                       if (new_method->alloca_size > rtm->alloca_size)
-                               g_error ("MINT_JMP to method which needs more stack space (%d > %d)", new_method->alloca_size, rtm->alloca_size); 
-                       rtm = frame->runtime_method = new_method;
-                       vt_sp = (unsigned char *) sp + rtm->stack_size;
-#if DEBUG_INTERP
-                       vtalloc = vt_sp;
-#endif
-                       locals = vt_sp + rtm->vt_stack_size;
-                       ip = rtm->new_body_start; /* bypass storing input args from callers frame */
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CALLI) {
-                       MonoMethodSignature *csignature;
-                       stackval *endsp = sp;
-
-                       frame->ip = ip;
-                       
-                       csignature = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       --sp;
-                       --endsp;
-                       child_frame.runtime_method = sp->data.p;
-
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-                       /* decrement by the actual number of args */
-                       sp -= csignature->param_count;
-                       if (csignature->hasthis)
-                               --sp;
-                       child_frame.stack_args = sp;
-
-                       /* `this' can be NULL for string:.ctor */
-                       if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       }
-
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               goto handle_finally;
-                       }
-
-                       /* need to handle typedbyref ... */
-                       if (csignature->ret->type != MONO_TYPE_VOID) {
-                               *sp = *endsp;
-                               sp++;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CALLI_NAT) {
-                       MonoMethodSignature *csignature;
-                       stackval *endsp = sp;
-                       unsigned char *code = NULL;
-
-                       frame->ip = ip;
-                       
-                       csignature = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       --sp;
-                       --endsp;
-                       code = sp->data.p;
-                       child_frame.runtime_method = NULL;
-
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-                       /* decrement by the actual number of args */
-                       sp -= csignature->param_count;
-                       if (csignature->hasthis)
-                               --sp;
-                       child_frame.stack_args = sp;
-                       ves_pinvoke_method (&child_frame, csignature, (MonoFuncV) code, FALSE, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               if (context->search_for_handler) {
-                                       context->search_for_handler = 0;
-                                       goto handle_exception;
-                               }
-                               goto handle_finally;
-                       }
-
-                       /* need to handle typedbyref ... */
-                       if (csignature->ret->type != MONO_TYPE_VOID) {
-                               *sp = *endsp;
-                               sp++;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CALL) {
-                       stackval *endsp = sp;
-
-                       frame->ip = ip;
-                       
-                       child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-                       /* decrement by the actual number of args */
-                       sp -= child_frame.runtime_method->param_count;
-                       if (child_frame.runtime_method->hasthis)
-                               --sp;
-                       child_frame.stack_args = sp;
-
-                       /* `this' can be NULL for string:.ctor */
-                       if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       }
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               goto handle_finally;
-                       }
-
-                       /* need to handle typedbyref ... */
-                       *sp = *endsp;
-                       sp++;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_VCALL) {
-                       frame->ip = ip;
-                       
-                       child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ip += 2;
-
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-                       /* decrement by the actual number of args */
-                       sp -= child_frame.runtime_method->param_count;
-                       if (child_frame.runtime_method->hasthis)
-                               --sp;
-                       child_frame.stack_args = sp;
-
-                       if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       }
-
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               goto handle_finally;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CALLVIRT) {
-                       stackval *endsp = sp;
-                       MonoObject *this_arg;
-                       guint32 token;
-
-                       frame->ip = ip;
-                       
-                       token = * (unsigned short *)(ip + 1);
-                       ip += 2;
-                       child_frame.runtime_method = rtm->data_items [token];
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-
-                       /* decrement by the actual number of args */
-                       sp -= child_frame.runtime_method->param_count + 1;
-                       child_frame.stack_args = sp;
-                       this_arg = sp->data.p;
-                       if (!this_arg)
-                               THROW_EX (mono_get_exception_null_reference(), ip - 2);
-                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
-
-                       if (this_arg->vtable->klass->valuetype && child_frame.runtime_method->valuetype) {
-                               /* unbox */
-                               gpointer *unboxed = mono_object_unbox (this_arg);
-                               stackval_from_data (&this_arg->vtable->klass->byval_arg, sp, (char *) unboxed, FALSE);
-                       }
-
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               if (context->search_for_handler) {
-                                       context->search_for_handler = 0;
-                                       goto handle_exception;
-                               }
-                               goto handle_finally;
-                       }
-
-                       /* need to handle typedbyref ... */
-                       *sp = *endsp;
-                       sp++;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_VCALLVIRT) {
-                       MonoObject *this_arg;
-                       guint32 token;
-
-                       frame->ip = ip;
-                       
-                       token = * (unsigned short *)(ip + 1);
-                       ip += 2;
-                       child_frame.runtime_method = rtm->data_items [token];
-                       sp->data.p = vt_sp;
-                       child_frame.retval = sp;
-
-                       /* decrement by the actual number of args */
-                       sp -= child_frame.runtime_method->param_count + 1;
-                       child_frame.stack_args = sp;
-                       this_arg = sp->data.p;
-                       if (!this_arg)
-                               THROW_EX (mono_get_exception_null_reference(), ip - 2);
-                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
-
-                       if (this_arg->vtable->klass->valuetype && child_frame.runtime_method->valuetype) {
-                               gpointer *unboxed = mono_object_unbox (this_arg);
-                               stackval_from_data (&this_arg->vtable->klass->byval_arg, sp, (char *) unboxed, FALSE);
-                       }
-
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               if (context->search_for_handler) {
-                                       context->search_for_handler = 0;
-                                       goto handle_exception;
-                               }
-                               goto handle_finally;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CALLRUN)
-                       ves_runtime_method (frame, context);
-                       if (frame->ex) {
-                               rtm = NULL;
-                               goto handle_exception;
-                       }
-                       goto exit_frame;
-               MINT_IN_CASE(MINT_RET)
-                       --sp;
-                       *frame->retval = *sp;
-                       if (sp > frame->stack)
-                               g_warning ("ret: more values on stack: %d", sp-frame->stack);
-                       goto exit_frame;
-               MINT_IN_CASE(MINT_RET_VOID)
-                       if (sp > frame->stack)
-                               g_warning ("ret.void: more values on stack: %d", sp-frame->stack);
-                       goto exit_frame;
-               MINT_IN_CASE(MINT_RET_VT)
-                       i32 = READ32(ip + 1);
-                       --sp;
-                       memcpy(frame->retval->data.p, sp->data.p, i32);
-                       if (sp > frame->stack)
-                               g_warning ("ret.vt: more values on stack: %d", sp-frame->stack);
-                       goto exit_frame;
-               MINT_IN_CASE(MINT_BR_S)
-                       ip += (short) *(ip + 1);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BR)
-                       ip += (gint32) READ32(ip + 1);
-                       MINT_IN_BREAK;
-#define ZEROP_S(datamem, op) \
-       --sp; \
-       if (sp->data.datamem op 0) \
-               ip += * (gint16 *)(ip + 1); \
-       else \
-               ip += 2;
-
-#define ZEROP(datamem, op) \
-       --sp; \
-       if (sp->data.datamem op 0) \
-               ip += READ32(ip + 1); \
-       else \
-               ip += 3;
-
-               MINT_IN_CASE(MINT_BRFALSE_I4_S)
-                       ZEROP_S(i, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRFALSE_I8_S)
-                       ZEROP_S(l, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRFALSE_R8_S)
-                       ZEROP_S(f, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRFALSE_I4)
-                       ZEROP(i, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRFALSE_I8)
-                       ZEROP(l, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRFALSE_R8)
-                       ZEROP_S(f, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_I4_S)
-                       ZEROP_S(i, !=);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_I8_S)
-                       ZEROP_S(l, !=);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_R8_S)
-                       ZEROP_S(f, !=);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_I4)
-                       ZEROP(i, !=);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_I8)
-                       ZEROP(l, !=);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BRTRUE_R8)
-                       ZEROP(f, !=);
-                       MINT_IN_BREAK;
-#define CONDBR_S(cond) \
-       sp -= 2; \
-       if (cond) \
-               ip += * (gint16 *)(ip + 1); \
-       else \
-               ip += 2;
-#define BRELOP_S(datamem, op) \
-       CONDBR_S(sp[0].data.datamem op sp[1].data.datamem)
-
-#define CONDBR(cond) \
-       sp -= 2; \
-       if (cond) \
-               ip += READ32(ip + 1); \
-       else \
-               ip += 3;
-
-#define BRELOP(datamem, op) \
-       CONDBR(sp[0].data.datamem op sp[1].data.datamem)
-
-               MINT_IN_CASE(MINT_BEQ_I4_S)
-                       BRELOP_S(i, ==)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BEQ_I8_S)
-                       BRELOP_S(l, ==)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BEQ_R8_S)
-                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f == sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BEQ_I4)
-                       BRELOP(i, ==)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BEQ_I8)
-                       BRELOP(l, ==)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BEQ_R8)
-                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f == sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_I4_S)
-                       BRELOP_S(i, >=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_I8_S)
-                       BRELOP_S(l, >=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_R8_S)
-                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f >= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_I4)
-                       BRELOP(i, >=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_I8)
-                       BRELOP(l, >=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_R8)
-                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f >= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_I4_S)
-                       BRELOP_S(i, >)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_I8_S)
-                       BRELOP_S(l, >)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_R8_S)
-                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f > sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_I4)
-                       BRELOP(i, >)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_I8)
-                       BRELOP(l, >)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_R8)
-                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f > sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_I4_S)
-                       BRELOP_S(i, <)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_I8_S)
-                       BRELOP_S(l, <)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_R8_S)
-                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f < sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_I4)
-                       BRELOP(i, <)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_I8)
-                       BRELOP(l, <)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_R8)
-                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f < sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_I4_S)
-                       BRELOP_S(i, <=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_I8_S)
-                       BRELOP_S(l, <=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_R8_S)
-                       CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_I4)
-                       BRELOP(i, <=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_I8)
-                       BRELOP(l, <=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_R8)
-                       CONDBR(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_I4_S)
-                       BRELOP_S(i, !=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_I8_S)
-                       BRELOP_S(l, !=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_R8_S)
-                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f != sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_I4)
-                       BRELOP(i, !=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_I8)
-                       BRELOP(l, !=)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BNE_UN_R8)
-                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f != sp[1].data.f)
-                       MINT_IN_BREAK;
-
-#define BRELOP_S_CAST(datamem, op, type) \
-       sp -= 2; \
-       if ((type) sp[0].data.datamem op (type) sp[1].data.datamem) \
-               ip += * (gint16 *)(ip + 1); \
-       else \
-               ip += 2;
-
-#define BRELOP_CAST(datamem, op, type) \
-       sp -= 2; \
-       if ((type) sp[0].data.datamem op (type) sp[1].data.datamem) \
-               ip += READ32(ip + 1); \
-       else \
-               ip += 3;
-
-               MINT_IN_CASE(MINT_BGE_UN_I4_S)
-                       BRELOP_S_CAST(i, >=, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_UN_I8_S)
-                       BRELOP_S_CAST(l, >=, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_UN_R8_S)
-                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f >= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_UN_I4)
-                       BRELOP_CAST(i, >=, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_UN_I8)
-                       BRELOP_CAST(l, >=, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGE_UN_R8)
-                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f >= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_I4_S)
-                       BRELOP_S_CAST(i, >, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_I8_S)
-                       BRELOP_S_CAST(l, >, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_R8_S)
-                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f > sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_I4)
-                       BRELOP_CAST(i, >, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_I8)
-                       BRELOP_CAST(l, >, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BGT_UN_R8)
-                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f > sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_I4_S)
-                       BRELOP_S_CAST(i, <=, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_I8_S)
-                       BRELOP_S_CAST(l, <=, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_R8_S)
-                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f <= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_I4)
-                       BRELOP_CAST(i, <=, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_I8)
-                       BRELOP_CAST(l, <=, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLE_UN_R8)
-                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f <= sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_I4_S)
-                       BRELOP_S_CAST(i, <, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_I8_S)
-                       BRELOP_S_CAST(l, <, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_R8_S)
-                       CONDBR_S(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f < sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_I4)
-                       BRELOP_CAST(i, <, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_I8)
-                       BRELOP_CAST(l, <, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BLT_UN_R8)
-                       CONDBR(isunordered (sp [0].data.f, sp [1].data.f) || sp[0].data.f < sp[1].data.f)
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SWITCH) {
-                       guint32 n;
-                       const unsigned short *st;
-                       ++ip;
-                       n = READ32 (ip);
-                       ip += 2;
-                       st = ip + 2 * n;
-                       --sp;
-                       if ((guint32)sp->data.i < n) {
-                               gint offset;
-                               ip += 2 * (guint32)sp->data.i;
-                               offset = READ32 (ip);
-                               ip = st + offset;
-                       } else {
-                               ip = st;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDIND_I1)
-                       ++ip;
-                       sp[-1].data.i = *(gint8*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_U1)
-                       ++ip;
-                       sp[-1].data.i = *(guint8*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_I2)
-                       ++ip;
-                       sp[-1].data.i = *(gint16*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_U2)
-                       ++ip;
-                       sp[-1].data.i = *(guint16*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_I4) /* Fall through */
-               MINT_IN_CASE(MINT_LDIND_U4)
-                       ++ip;
-                       sp[-1].data.i = *(gint32*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_I8)
-                       ++ip;
-                       sp[-1].data.l = *(gint64*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_I) {
-                       guint16 offset = * (guint16 *)(ip + 1);
-                       sp[-1 - offset].data.p = *(gpointer*)sp[-1 - offset].data.p;
-                       ip += 2;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDIND_R4)
-                       ++ip;
-                       sp[-1].data.f = *(gfloat*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_R8)
-                       ++ip;
-                       sp[-1].data.f = *(gdouble*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDIND_REF)
-                       ++ip;
-                       sp[-1].data.p = *(gpointer*)sp[-1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_REF) 
-                       ++ip;
-                       sp -= 2;
-                       * (gpointer *) sp->data.p = sp[1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_I1)
-                       ++ip;
-                       sp -= 2;
-                       * (gint8 *) sp->data.p = (gint8)sp[1].data.i;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_I2)
-                       ++ip;
-                       sp -= 2;
-                       * (gint16 *) sp->data.p = (gint16)sp[1].data.i;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_I4)
-                       ++ip;
-                       sp -= 2;
-                       * (gint32 *) sp->data.p = sp[1].data.i;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_I)
-                       ++ip;
-                       sp -= 2;
-                       * (mono_i *) sp->data.p = (mono_i)sp[1].data.p;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_I8)
-                       ++ip;
-                       sp -= 2;
-                       * (gint64 *) sp->data.p = sp[1].data.l;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_R4)
-                       ++ip;
-                       sp -= 2;
-                       * (float *) sp->data.p = (gfloat)sp[1].data.f;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STIND_R8)
-                       ++ip;
-                       sp -= 2;
-                       * (double *) sp->data.p = sp[1].data.f;
-                       MINT_IN_BREAK;
-#define BINOP(datamem, op) \
-       --sp; \
-       sp [-1].data.datamem = sp [-1].data.datamem op sp [0].data.datamem; \
-       ++ip;
-               MINT_IN_CASE(MINT_ADD_I4)
-                       BINOP(i, +);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_I8)
-                       BINOP(l, +);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_R8)
-                       BINOP(f, +);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD1_I4)
-                       ++sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_I4)
-                       BINOP(i, -);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_I8)
-                       BINOP(l, -);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_R8)
-                       BINOP(f, -);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB1_I4)
-                       --sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_I4)
-                       BINOP(i, *);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_I8)
-                       BINOP(l, *);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_R8)
-                       BINOP(f, *);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DIV_I4)
-                       if (sp [-1].data.i == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       if (sp [-1].data.i == (-1))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(i, /);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DIV_I8)
-                       if (sp [-1].data.l == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       if (sp [-1].data.l == (-1))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(l, /);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DIV_R8)
-                       BINOP(f, /);
-                       MINT_IN_BREAK;
-
-#define BINOP_CAST(datamem, op, type) \
-       --sp; \
-       sp [-1].data.datamem = (type)sp [-1].data.datamem op (type)sp [0].data.datamem; \
-       ++ip;
-               MINT_IN_CASE(MINT_DIV_UN_I4)
-                       if (sp [-1].data.i == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP_CAST(i, /, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_DIV_UN_I8)
-                       if (sp [-1].data.l == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP_CAST(l, /, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_REM_I4)
-                       if (sp [-1].data.i == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP(i, %);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_REM_I8)
-                       if (sp [-1].data.l == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP(l, %);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_REM_R8)
-                       /* FIXME: what do we actually do here? */
-                       --sp;
-                       sp [-1].data.f = fmod (sp [-1].data.f, sp [0].data.f);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_REM_UN_I4)
-                       if (sp [-1].data.i == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP_CAST(i, %, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_REM_UN_I8)
-                       if (sp [-1].data.l == 0)
-                               THROW_EX (mono_get_exception_divide_by_zero (), ip);
-                       BINOP_CAST(l, %, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_AND_I4)
-                       BINOP(i, &);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_AND_I8)
-                       BINOP(l, &);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_OR_I4)
-                       BINOP(i, |);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_OR_I8)
-                       BINOP(l, |);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_XOR_I4)
-                       BINOP(i, ^);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_XOR_I8)
-                       BINOP(l, ^);
-                       MINT_IN_BREAK;
-
-#define SHIFTOP(datamem, op) \
-       --sp; \
-       sp [-1].data.datamem = sp [-1].data.datamem op sp [0].data.i; \
-       ++ip;
-
-               MINT_IN_CASE(MINT_SHL_I4)
-                       SHIFTOP(i, <<);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SHL_I8)
-                       SHIFTOP(l, <<);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SHR_I4)
-                       SHIFTOP(i, >>);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SHR_I8)
-                       SHIFTOP(l, >>);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SHR_UN_I4)
-                       --sp;
-                       sp [-1].data.i = (guint32)sp [-1].data.i >> sp [0].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SHR_UN_I8)
-                       --sp;
-                       sp [-1].data.l = (guint64)sp [-1].data.l >> sp [0].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NEG_I4)
-                       sp [-1].data.i = - sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NEG_I8)
-                       sp [-1].data.l = - sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NEG_R8)
-                       sp [-1].data.f = - sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NOT_I4)
-                       sp [-1].data.i = ~ sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NOT_I8)
-                       sp [-1].data.l = ~ sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I1_I4)
-                       sp [-1].data.i = (gint8)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I1_I8)
-                       sp [-1].data.i = (gint8)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I1_R8)
-                       sp [-1].data.i = (gint8)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U1_I4)
-                       sp [-1].data.i = (guint8)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U1_I8)
-                       sp [-1].data.i = (guint8)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U1_R8)
-                       sp [-1].data.i = (guint8)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I2_I4)
-                       sp [-1].data.i = (gint16)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I2_I8)
-                       sp [-1].data.i = (gint16)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I2_R8)
-                       sp [-1].data.i = (gint16)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U2_I4)
-                       sp [-1].data.i = (guint16)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U2_I8)
-                       sp [-1].data.i = (guint16)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U2_R8)
-                       sp [-1].data.i = (guint16)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I4_R8)
-                       sp [-1].data.i = (gint32)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U4_I8)
-               MINT_IN_CASE(MINT_CONV_I4_I8)
-                       sp [-1].data.i = (gint32)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I4_I8_SP)
-                       sp [-2].data.i = (gint32)sp [-2].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U4_R8)
-                       sp [-1].data.i = (guint32)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I8_I4)
-                       sp [-1].data.l = sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I8_I4_SP)
-                       sp [-2].data.l = sp [-2].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I8_U4)
-                       sp [-1].data.l = (guint32)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_I8_R8)
-                       sp [-1].data.l = (gint64)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R4_I4)
-                       sp [-1].data.f = (float)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R4_I8)
-                       sp [-1].data.f = (float)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R4_R8)
-                       sp [-1].data.f = (float)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R8_I4)
-                       sp [-1].data.f = (double)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R8_I8)
-                       sp [-1].data.f = (double)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U8_I4)
-                       sp [-1].data.l = sp [-1].data.i & 0xffffffff;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_U8_R8)
-                       sp [-1].data.l = (guint64)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_CPOBJ) {
-                       MonoClass *vtklass;
-                       ++ip;
-                       vtklass = rtm->data_items[READ32 (ip)];
-                       ip += 2;
-                       sp -= 2;
-                       memcpy (sp [0].data.p, sp [1].data.p, mono_class_value_size (vtklass, NULL));
-                       MINT_IN_BREAK;
-               }
-#endif
-               MINT_IN_CASE(MINT_LDOBJ) {
-                       int size;
-                       void *p;
-                       c = rtm->data_items[* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       if (c->byval_arg.type != MONO_TYPE_VALUETYPE || c->byval_arg.data.klass->enumtype) {
-                               p = sp [-1].data.p;
-                               stackval_from_data (&c->byval_arg, &sp [-1], p, FALSE);
-                       } else {
-                               size = mono_class_value_size (c, NULL);
-                               p = sp [-1].data.p;
-                               sp [-1].data.p = vt_sp;
-                               memcpy(vt_sp, p, size);
-                               vt_sp += (size + 7) & ~7;
-                       }
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDSTR)
-                       sp->data.p = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ++sp;
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_NEWOBJ) {
-                       MonoClass *newobj_class;
-                       MonoMethodSignature *csig;
-                       stackval valuetype_this;
-                       guint32 token;
-                       stackval retval;
-
-                       frame->ip = ip;
-
-                       token = * (guint16 *)(ip + 1);
-                       ip += 2;
-
-                       child_frame.runtime_method = rtm->data_items [token];
-                       csig = mono_method_signature (child_frame.runtime_method->method);
-                       newobj_class = child_frame.runtime_method->method->klass;
-                       /*if (profiling_classes) {
-                               guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, newobj_class));
-                               count++;
-                               g_hash_table_insert (profiling_classes, newobj_class, GUINT_TO_POINTER (count));
-                       }*/
-                               
-                       if (newobj_class->parent == mono_defaults.array_class) {
-                               sp -= csig->param_count;
-                               o = ves_array_create (context->domain, newobj_class, csig, sp);
-                               goto array_constructed;
-                       }
-
-                       g_assert (csig->hasthis);
-                       if (csig->param_count) {
-                               sp -= csig->param_count;
-                               memmove (sp + 1, sp, csig->param_count * sizeof (stackval));
-                       }
-                       child_frame.stack_args = sp;
-
-                       /*
-                        * First arg is the object.
-                        */
-                       if (newobj_class->valuetype) {
-                               MonoType *t = &newobj_class->byval_arg;
-                               if (!newobj_class->enumtype && (t->type == MONO_TYPE_VALUETYPE || (t->type == MONO_TYPE_GENERICINST && mono_type_generic_inst_is_valuetype (t)))) {
-                                       sp->data.p = vt_sp;
-                                       valuetype_this.data.p = vt_sp;
-                               } else {
-                                       memset (&valuetype_this, 0, sizeof (stackval));
-                                       sp->data.p = &valuetype_this;
-                               }
-                       } else {
-                               if (newobj_class != mono_defaults.string_class) {
-                                       context->managed_code = 0;
-                                       o = mono_object_new_checked (context->domain, newobj_class, &error);
-                                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                                       context->managed_code = 1;
-                                       if (*mono_thread_interruption_request_flag ())
-                                               mono_thread_interruption_checkpoint ();
-                                       sp->data.p = o;
-                               } else {
-                                       sp->data.p = NULL;
-                                       child_frame.retval = &retval;
-                               }
-                       }
-
-                       g_assert (csig->call_convention == MONO_CALL_DEFAULT);
-
-                       child_frame.ip = NULL;
-                       child_frame.ex = NULL;
-
-                       ves_exec_method_with_context (&child_frame, context);
-
-                       context->current_frame = frame;
-
-                       if (child_frame.ex) {
-                               /*
-                                * An exception occurred, need to run finally, fault and catch handlers..
-                                */
-                               frame->ex = child_frame.ex;
-                               goto handle_finally;
-                       }
-                       /*
-                        * a constructor returns void, but we need to return the object we created
-                        */
-array_constructed:
-                       if (newobj_class->valuetype && !newobj_class->enumtype) {
-                               *sp = valuetype_this;
-                       } else if (newobj_class == mono_defaults.string_class) {
-                               *sp = retval;
-                       } else {
-                               sp->data.p = o;
-                       }
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CASTCLASS)
-                       c = rtm->data_items [*(guint16 *)(ip + 1)];
-                       if ((o = sp [-1].data.p)) {
-                               MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               if (!isinst_obj)
-                                       THROW_EX (mono_get_exception_invalid_cast (), ip);
-                       }
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ISINST)
-                       c = rtm->data_items [*(guint16 *)(ip + 1)];
-                       if ((o = sp [-1].data.p)) {
-                               MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               if (!isinst_obj)
-                                       sp [-1].data.p = NULL;
-                       }
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R_UN_I4)
-                       sp [-1].data.f = (double)(guint32)sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_R_UN_I8)
-                       sp [-1].data.f = (double)(guint64)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_UNBOX)
-                       c = rtm->data_items[*(guint16 *)(ip + 1)];
-                       
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-
-                       MonoObject *isinst_obj = mono_object_isinst_checked (o, c, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       if (!(isinst_obj || ((o->vtable->klass->rank == 0) && (o->vtable->klass->element_class == c->element_class))))
-                               THROW_EX (mono_get_exception_invalid_cast (), ip);
-
-                       if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
-                               int size = mono_class_native_size (c, NULL);
-                               sp [-1].data.p = vt_sp;
-                               vt_sp += (size + 7) & ~7;
-                       }
-                       stackval_from_data (&c->byval_arg, &sp [-1], mono_object_unbox (o), FALSE);
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_THROW)
-                       --sp;
-                       frame->ex_handler = NULL;
-                       if (!sp->data.p)
-                               sp->data.p = mono_get_exception_null_reference ();
-                       THROW_EX ((MonoException *)sp->data.p, ip);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLDA)
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       sp[-1].data.p = (char *)o + * (guint16 *)(ip + 1);
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CKNULL)
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-
-#define LDFLD(datamem, fieldtype) \
-       o = sp [-1].data.p; \
-       if (!o) \
-               THROW_EX (mono_get_exception_null_reference (), ip); \
-       sp[-1].data.datamem = * (fieldtype *)((char *)o + * (guint16 *)(ip + 1)) ; \
-       ip += 2;
-
-               MINT_IN_CASE(MINT_LDFLD_I1) LDFLD(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_U1) LDFLD(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_I2) LDFLD(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_U2) LDFLD(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_I4) LDFLD(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_I8) LDFLD(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_R4) LDFLD(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_R8) LDFLD(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_O) LDFLD(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFLD_P) LDFLD(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LDFLD_VT)
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       i32 = READ32(ip + 2);
-                       sp [-1].data.p = vt_sp;
-                       memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
-                       vt_sp += (i32 + 7) & ~7;
-                       ip += 4;
-                       MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LDRMFLD) {
-                       gpointer tmp;
-                       MonoClassField *field;
-                       char *addr;
-
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       field = rtm->data_items[* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       if (mono_object_is_transparent_proxy (o)) {
-                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
-
-                               addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else {
-                               addr = (char*)o + field->offset;
-                       }                               
-
-                       stackval_from_data (field->type, &sp [-1], addr, FALSE);
-                       MINT_IN_BREAK;
-               }
-
-               MINT_IN_CASE(MINT_LDRMFLD_VT) {
-                       MonoClassField *field;
-                       char *addr;
-                       gpointer tmp;
-
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       field = rtm->data_items[* (guint16 *)(ip + 1)];
-                       i32 = READ32(ip + 2);
-                       ip += 4;
-                       if (mono_object_is_transparent_proxy (o)) {
-                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
-                               addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else {
-                               addr = (char*)o + field->offset;
-                       }                               
-
-                       sp [-1].data.p = vt_sp;
-                       memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
-                       vt_sp += (i32 + 7) & ~7;
-                       memcpy(sp [-1].data.p, addr, i32);
-                       MINT_IN_BREAK;
-               }
-
-#define STFLD(datamem, fieldtype) \
-       o = sp [-2].data.p; \
-       if (!o) \
-               THROW_EX (mono_get_exception_null_reference (), ip); \
-       sp -= 2; \
-       * (fieldtype *)((char *)o + * (guint16 *)(ip + 1)) = sp[1].data.datamem; \
-       ip += 2;
-
-               MINT_IN_CASE(MINT_STFLD_I1) STFLD(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_U1) STFLD(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_I2) STFLD(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_U2) STFLD(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_I4) STFLD(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_I8) STFLD(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_R4) STFLD(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_R8) STFLD(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_O) STFLD(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STFLD_P) STFLD(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_STFLD_VT)
-                       o = sp [-2].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       i32 = READ32(ip + 2);
-                       sp -= 2;
-                       memcpy((char *)o + * (guint16 *)(ip + 1), sp [1].data.p, i32);
-                       vt_sp -= (i32 + 7) & ~7;
-                       ip += 4;
-                       MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_STRMFLD) {
-                       MonoClassField *field;
-
-                       o = sp [-2].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       
-                       field = rtm->data_items[* (guint16 *)(ip + 1)];
-                       ip += 2;
-
-                       if (mono_object_is_transparent_proxy (o)) {
-                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
-                               mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else
-                               stackval_to_data (field->type, &sp [-1], (char*)o + field->offset, FALSE);
-
-                       sp -= 2;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STRMFLD_VT) {
-                       MonoClassField *field;
-
-                       o = sp [-2].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       field = rtm->data_items[* (guint16 *)(ip + 1)];
-                       i32 = READ32(ip + 2);
-                       ip += 4;
-
-                       if (mono_object_is_transparent_proxy (o)) {
-                               MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
-                               mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else
-                               memcpy((char*)o + field->offset, sp [-1].data.p, i32);
-
-                       sp -= 2;
-                       vt_sp -= (i32 + 7) & ~7;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDSFLDA) {
-                       MonoClassField *field = rtm->data_items[*(guint16 *)(ip + 1)];
-                       sp->data.p = mono_class_static_field_address (context->domain, field);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDSFLD) {
-                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
-                       stackval_from_data (field->type, sp, addr, FALSE);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDSFLD_VT) {
-                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
-                       int size = READ32 (ip + 2);
-                       ip += 4;
-
-                       sp->data.p = vt_sp;
-                       vt_sp += (size + 7) & ~7;
-                       stackval_from_data (field->type, sp, addr, FALSE);
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STSFLD) {
-                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
-                       ip += 2;
-                       --sp;
-                       stackval_to_data (field->type, sp, addr, FALSE);
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STSFLD_VT) {
-                       MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
-                       int size = READ32 (ip + 2);
-                       ip += 4;
-
-                       --sp;
-                       stackval_to_data (field->type, sp, addr, FALSE);
-                       vt_sp -= (size + 7) & ~7;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STOBJ_VT) {
-                       int size;
-                       c = rtm->data_items[* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       size = mono_class_value_size (c, NULL);
-                       memcpy(sp [-2].data.p, sp [-1].data.p, size);
-                       vt_sp -= (size + 7) & ~7;
-                       sp -= 2;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STOBJ) {
-                       int size;
-                       c = rtm->data_items[* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       size = mono_class_value_size (c, NULL);
-                       memcpy(sp [-2].data.p, &sp [-1].data, size);
-                       sp -= 2;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CONV_OVF_I4_UN_R8)
-                       if (sp [-1].data.f < 0 || sp [-1].data.f > MYGUINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint32)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U8_I4)
-                       if (sp [-1].data.i < 0)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.l = sp [-1].data.i;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U8_R8)
-               MINT_IN_CASE(MINT_CONV_OVF_I8_UN_R8)
-                       if (sp [-1].data.f < 0 || sp [-1].data.f > 9223372036854775807LL)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.l = (guint64)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I8_R8)
-                       if (sp [-1].data.f < MYGINT64_MIN || sp [-1].data.f > MYGINT64_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.l = (gint64)sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I4_UN_I8)
-                       if ((mono_u)sp [-1].data.l > MYGUINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (mono_u)sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BOX) {
-                       c = rtm->data_items [* (guint16 *)(ip + 1)];
-                       guint16 offset = * (guint16 *)(ip + 2);
-
-                       if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
-                               int size = mono_class_value_size (c, NULL);
-                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, sp [-1 - offset].data.p, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               size = (size + 7) & ~7;
-                               vt_sp -= size;
-                       } else {
-                               stackval_to_data (&c->byval_arg, &sp [-1 - offset], (char *) &sp [-1 - offset], FALSE);
-                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, &sp [-1 - offset], &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       }
-                       ip += 3;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_NEWARR)
-                       sp [-1].data.p = (MonoObject*) mono_array_new_checked (context->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       ip += 2;
-                       /*if (profiling_classes) {
-                               guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, o->vtable->klass));
-                               count++;
-                               g_hash_table_insert (profiling_classes, o->vtable->klass, GUINT_TO_POINTER (count));
-                       }*/
-
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLEN)
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       sp [-1].data.nati = mono_array_length ((MonoArray *)o);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_GETCHR) {
-                       MonoString *s;
-                       s = sp [-2].data.p;
-                       if (!s)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       i32 = sp [-1].data.i;
-                       if (i32 < 0 || i32 >= mono_string_length (s))
-                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
-                       --sp;
-                       sp [-1].data.i = mono_string_chars(s)[i32];
-                       ++ip;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STRLEN)
-                       ++ip;
-                       sp [-1].data.i = mono_string_length ((MonoString*)sp [-1].data.p);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ARRAY_RANK)
-                       o = sp [-1].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-                       sp [-1].data.i = mono_object_class (sp [-1].data.p)->rank;
-                       ip++;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDELEMA) {
-                       guint32 esize;
-                       mono_u aindex;
-                       
-                       /*token = READ32 (ip)*/;
-                       ip += 2;
-                       sp -= 2;
-
-                       o = sp [0].data.p;
-
-                       aindex = sp [1].data.i;
-                       if (aindex >= mono_array_length ((MonoArray *) o))
-                               THROW_EX (mono_get_exception_index_out_of_range (), ip - 2);
-
-                       /* check the array element corresponds to token */
-                       esize = mono_array_element_size (((MonoArray *) o)->obj.vtable->klass);
-                       
-                       sp->data.p = mono_array_addr_with_size ((MonoArray *) o, esize, aindex);
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDELEM_I1) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_U1) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_I2) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_U2) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_I4) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_U4) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_I8)  /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_I)  /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_R4) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_R8) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_REF) /* fall through */
-               MINT_IN_CASE(MINT_LDELEM_VT) {
-                       MonoArray *o;
-                       mono_u aindex;
-
-                       sp -= 2;
-
-                       o = sp [0].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-
-                       aindex = sp [1].data.i;
-                       if (aindex >= mono_array_length (o))
-                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
-
-                       /*
-                        * FIXME: throw mono_get_exception_array_type_mismatch () if needed 
-                        */
-                       switch (*ip) {
-                       case MINT_LDELEM_I1:
-                               sp [0].data.i = mono_array_get (o, gint8, aindex);
-                               break;
-                       case MINT_LDELEM_U1:
-                               sp [0].data.i = mono_array_get (o, guint8, aindex);
-                               break;
-                       case MINT_LDELEM_I2:
-                               sp [0].data.i = mono_array_get (o, gint16, aindex);
-                               break;
-                       case MINT_LDELEM_U2:
-                               sp [0].data.i = mono_array_get (o, guint16, aindex);
-                               break;
-                       case MINT_LDELEM_I:
-                               sp [0].data.nati = mono_array_get (o, mono_i, aindex);
-                               break;
-                       case MINT_LDELEM_I4:
-                               sp [0].data.i = mono_array_get (o, gint32, aindex);
-                               break;
-                       case MINT_LDELEM_U4:
-                               sp [0].data.i = mono_array_get (o, guint32, aindex);
-                               break;
-                       case MINT_LDELEM_I8:
-                               sp [0].data.l = mono_array_get (o, guint64, aindex);
-                               break;
-                       case MINT_LDELEM_R4:
-                               sp [0].data.f = mono_array_get (o, float, aindex);
-                               break;
-                       case MINT_LDELEM_R8:
-                               sp [0].data.f = mono_array_get (o, double, aindex);
-                               break;
-                       case MINT_LDELEM_REF:
-                               sp [0].data.p = mono_array_get (o, gpointer, aindex);
-                               break;
-                       case MINT_LDELEM_VT: {
-                               MonoClass *klass_vt = rtm->data_items [*(guint16 *) (ip + 1)];
-                               i32 = READ32 (ip + 2);
-                               char *src_addr = mono_array_addr_with_size ((MonoArray *) o, i32, aindex);
-                               sp [0].data.vt = vt_sp;
-                               stackval_from_data (&klass_vt->byval_arg, sp, src_addr, FALSE);
-                               vt_sp += (i32 + 7) & ~7;
-                               ip += 3;
-                               break;
-                       }
-                       default:
-                               ves_abort();
-                       }
-
-                       ++ip;
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_STELEM_I)  /* fall through */
-               MINT_IN_CASE(MINT_STELEM_I1) /* fall through */ 
-               MINT_IN_CASE(MINT_STELEM_I2) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_I4) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_I8) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_R4) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_R8) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_REF) /* fall through */
-               MINT_IN_CASE(MINT_STELEM_VT) {
-                       mono_u aindex;
-
-                       sp -= 3;
-
-                       o = sp [0].data.p;
-                       if (!o)
-                               THROW_EX (mono_get_exception_null_reference (), ip);
-
-                       aindex = sp [1].data.i;
-                       if (aindex >= mono_array_length ((MonoArray *)o))
-                               THROW_EX (mono_get_exception_index_out_of_range (), ip);
-
-                       switch (*ip) {
-                       case MINT_STELEM_I:
-                               mono_array_set ((MonoArray *)o, mono_i, aindex, sp [2].data.nati);
-                               break;
-                       case MINT_STELEM_I1:
-                               mono_array_set ((MonoArray *)o, gint8, aindex, sp [2].data.i);
-                               break;
-                       case MINT_STELEM_I2:
-                               mono_array_set ((MonoArray *)o, gint16, aindex, sp [2].data.i);
-                               break;
-                       case MINT_STELEM_I4:
-                               mono_array_set ((MonoArray *)o, gint32, aindex, sp [2].data.i);
-                               break;
-                       case MINT_STELEM_I8:
-                               mono_array_set ((MonoArray *)o, gint64, aindex, sp [2].data.l);
-                               break;
-                       case MINT_STELEM_R4:
-                               mono_array_set ((MonoArray *)o, float, aindex, sp [2].data.f);
-                               break;
-                       case MINT_STELEM_R8:
-                               mono_array_set ((MonoArray *)o, double, aindex, sp [2].data.f);
-                               break;
-                       case MINT_STELEM_REF: {
-                               MonoObject *isinst_obj = mono_object_isinst_checked (sp [2].data.p, mono_object_class (o)->element_class, &error);
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               if (sp [2].data.p && !isinst_obj)
-                                       THROW_EX (mono_get_exception_array_type_mismatch (), ip);
-                               mono_array_set ((MonoArray *)o, gpointer, aindex, sp [2].data.p);
-                               break;
-                       }
-                       case MINT_STELEM_VT: {
-                               MonoClass *klass_vt = rtm->data_items [*(guint16 *) (ip + 1)];
-                               i32 = READ32 (ip + 2);
-                               char *dst_addr = mono_array_addr_with_size ((MonoArray *) o, i32, aindex);
-
-                               stackval_to_data (&klass_vt->byval_arg, &sp [2], dst_addr, FALSE);
-                               vt_sp -= (i32 + 7) & ~7;
-                               ip += 3;
-                               break;
-                       }
-                       default:
-                               ves_abort();
-                       }
-
-                       ++ip;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_CONV_OVF_I4_U4)
-                       if (sp [-1].data.i < 0)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I4_I8)
-                       if (sp [-1].data.l < MYGINT32_MIN || sp [-1].data.l > MYGINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint32) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I4_R8)
-                       if (sp [-1].data.f < MYGINT32_MIN || sp [-1].data.f > MYGINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint32) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U4_I4)
-                       if (sp [-1].data.i < 0)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U4_I8)
-                       if (sp [-1].data.l < 0 || sp [-1].data.l > MYGUINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint32) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U4_R8)
-                       if (sp [-1].data.f < 0 || sp [-1].data.f > MYGUINT32_MAX)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint32) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I2_I4)
-                       if (sp [-1].data.i < -32768 || sp [-1].data.i > 32767)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I2_I8)
-                       if (sp [-1].data.l < -32768 || sp [-1].data.l > 32767)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint16) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I2_R8)
-                       if (sp [-1].data.f < -32768 || sp [-1].data.f > 32767)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint16) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U2_I4)
-                       if (sp [-1].data.i < 0 || sp [-1].data.i > 65535)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U2_I8)
-                       if (sp [-1].data.l < 0 || sp [-1].data.l > 65535)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint16) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U2_R8)
-                       if (sp [-1].data.f < 0 || sp [-1].data.f > 65535)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint16) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I1_I4)
-                       if (sp [-1].data.i < -128 || sp [-1].data.i > 127)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I1_I8)
-                       if (sp [-1].data.l < -128 || sp [-1].data.l > 127)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint8) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_I1_R8)
-                       if (sp [-1].data.f < -128 || sp [-1].data.f > 127)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (gint8) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U1_I4)
-                       if (sp [-1].data.i < 0 || sp [-1].data.i > 255)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U1_I8)
-                       if (sp [-1].data.l < 0 || sp [-1].data.l > 255)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint8) sp [-1].data.l;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CONV_OVF_U1_R8)
-                       if (sp [-1].data.f < 0 || sp [-1].data.f > 255)
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       sp [-1].data.i = (guint8) sp [-1].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_LDELEM) 
-               MINT_IN_CASE(MINT_STELEM) 
-               MINT_IN_CASE(MINT_UNBOX_ANY) 
-
-               MINT_IN_CASE(MINT_REFANYVAL) ves_abort(); MINT_IN_BREAK;
-#endif
-               MINT_IN_CASE(MINT_CKFINITE)
-                       if (!isfinite(sp [-1].data.f))
-                               THROW_EX (mono_get_exception_arithmetic (), ip);
-                       ++ip;
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_MKREFANY) ves_abort(); MINT_IN_BREAK;
-#endif
-               MINT_IN_CASE(MINT_LDTOKEN)
-                       sp->data.p = vt_sp;
-                       vt_sp += 8;
-                       * (gpointer *)sp->data.p = rtm->data_items[*(guint16 *)(ip + 1)];
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_OVF_I4)
-                       if (CHECK_ADD_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(i, +);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_OVF_I8)
-                       if (CHECK_ADD_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(l, +);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_OVF_UN_I4)
-                       if (CHECK_ADD_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(i, +, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ADD_OVF_UN_I8)
-                       if (CHECK_ADD_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(l, +, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_OVF_I4)
-                       if (CHECK_MUL_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(i, *);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_OVF_I8)
-                       if (CHECK_MUL_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(l, *);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_OVF_UN_I4)
-                       if (CHECK_MUL_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(i, *, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MUL_OVF_UN_I8)
-                       if (CHECK_MUL_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(l, *, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_OVF_I4)
-                       if (CHECK_SUB_OVERFLOW (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(i, -);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_OVF_I8)
-                       if (CHECK_SUB_OVERFLOW64 (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP(l, -);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_OVF_UN_I4)
-                       if (CHECK_SUB_OVERFLOW_UN (sp [-2].data.i, sp [-1].data.i))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(i, -, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_SUB_OVF_UN_I8)
-                       if (CHECK_SUB_OVERFLOW64_UN (sp [-2].data.l, sp [-1].data.l))
-                               THROW_EX (mono_get_exception_overflow (), ip);
-                       BINOP_CAST(l, -, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ENDFINALLY)
-                       if (finally_ips) {
-                               ip = finally_ips->data;
-                               finally_ips = g_slist_remove (finally_ips, ip);
-                               goto main_loop;
-                       }
-                       if (frame->ex)
-                               goto handle_fault;
-                       ves_abort();
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LEAVE) /* Fall through */
-               MINT_IN_CASE(MINT_LEAVE_S)
-                       while (sp > frame->stack) {
-                               --sp;
-                       }
-                       frame->ip = ip;
-                       if (*ip == MINT_LEAVE_S) {
-                               ip += (short) *(ip + 1);
-                       } else {
-                               ip += (gint32) READ32 (ip + 1);
-                       }
-                       endfinally_ip = ip;
-                       if (frame->ex_handler != NULL && MONO_OFFSET_IN_HANDLER(frame->ex_handler, frame->ip - rtm->code)) {
-                               frame->ex_handler = NULL;
-                               frame->ex = NULL;
-                       }
-                       goto handle_finally;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_ICALL_V_V) 
-               MINT_IN_CASE(MINT_ICALL_V_P)
-               MINT_IN_CASE(MINT_ICALL_P_V) 
-               MINT_IN_CASE(MINT_ICALL_P_P)
-               MINT_IN_CASE(MINT_ICALL_PP_V)
-               MINT_IN_CASE(MINT_ICALL_PI_V)
-               MINT_IN_CASE(MINT_ICALL_PP_P)
-               MINT_IN_CASE(MINT_ICALL_PI_P)
-               MINT_IN_CASE(MINT_ICALL_PPP_V)
-               MINT_IN_CASE(MINT_ICALL_PPI_V)
-                       sp = do_icall (context, *ip, sp, rtm->data_items [*(guint16 *)(ip + 1)]);
-                       if (frame->ex != NULL)
-                               goto handle_exception;
-                       ip += 2;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MONO_LDPTR) 
-                       sp->data.p = rtm->data_items [*(guint16 *)(ip + 1)];
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MONO_NEWOBJ)
-                       sp->data.p = mono_object_new_checked (context->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       ip += 2;
-                       sp++;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MONO_FREE)
-                       ++ip;
-                       --sp;
-                       g_error ("that doesn't seem right");
-                       g_free (sp->data.p);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_MONO_RETOBJ)
-                       ++ip;
-                       sp--;
-                       stackval_from_data (mono_method_signature (frame->runtime_method->method)->ret, frame->retval, sp->data.p,
-                            mono_method_signature (frame->runtime_method->method)->pinvoke);
-                       if (sp > frame->stack)
-                               g_warning ("retobj: more values on stack: %d", sp-frame->stack);
-                       goto exit_frame;
-
-#define RELOP(datamem, op) \
-       --sp; \
-       sp [-1].data.i = sp [-1].data.datamem op sp [0].data.datamem; \
-       ++ip;
-               MINT_IN_CASE(MINT_CEQ_I4)
-                       RELOP(i, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CEQ0_I4)
-                       sp [-1].data.i = (sp [-1].data.i == 0);
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CEQ_I8)
-                       RELOP(l, ==);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CEQ_R8)
-                       --sp; 
-                       if (isunordered (sp [-1].data.f, sp [0].data.f))
-                               sp [-1].data.i = 0;
-                       else
-                               sp [-1].data.i = sp [-1].data.f == sp [0].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CGT_I4)
-                       RELOP(i, >);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CGT_I8)
-                       RELOP(l, >);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CGT_R8)
-                       --sp; 
-                       if (isunordered (sp [-1].data.f, sp [0].data.f))
-                               sp [-1].data.i = 0;
-                       else
-                               sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-
-#define RELOP_CAST(datamem, op, type) \
-       --sp; \
-       sp [-1].data.i = (type)sp [-1].data.datamem op (type)sp [0].data.datamem; \
-       ++ip;
-
-               MINT_IN_CASE(MINT_CGT_UN_I4)
-                       RELOP_CAST(i, >, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CGT_UN_I8)
-                       RELOP_CAST(l, >, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CGT_UN_R8)
-                       --sp; 
-                       if (isunordered (sp [-1].data.f, sp [0].data.f))
-                               sp [-1].data.i = 1;
-                       else
-                               sp [-1].data.i = sp [-1].data.f > sp [0].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_I4)
-                       RELOP(i, <);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_I8)
-                       RELOP(l, <);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_R8)
-                       --sp; 
-                       if (isunordered (sp [-1].data.f, sp [0].data.f))
-                               sp [-1].data.i = 0;
-                       else
-                               sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_UN_I4)
-                       RELOP_CAST(i, <, guint32);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_UN_I8)
-                       RELOP_CAST(l, <, guint64);
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CLT_UN_R8)
-                       --sp; 
-                       if (isunordered (sp [-1].data.f, sp [0].data.f))
-                               sp [-1].data.i = 1;
-                       else
-                               sp [-1].data.i = sp [-1].data.f < sp [0].data.f;
-                       ++ip;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDFTN) {
-                       sp->data.p = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ++sp;
-                       ip += 2;
-                       MINT_IN_BREAK;
-               }
-               MINT_IN_CASE(MINT_LDVIRTFTN) {
-                       RuntimeMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
-                       ip += 2;
-                       --sp;
-                       if (!sp->data.p)
-                               THROW_EX (mono_get_exception_null_reference (), ip - 2);
-                               
-                       sp->data.p = get_virtual_method (context->domain, m, sp->data.p);
-                       ++sp;
-                       MINT_IN_BREAK;
-               }
-
-               MINT_IN_CASE(MINT_LDTHISA)
-                       g_error ("should not happen");
-                       // sp->data.p = &frame->obj;
-                       ++ip;
-                       ++sp; 
-                       MINT_IN_BREAK;
-
-#define LDARG(datamem, argtype) \
-       sp->data.datamem = * (argtype *)(frame->args + * (guint16 *)(ip + 1)); \
-       ip += 2; \
-       ++sp; 
-       
-               MINT_IN_CASE(MINT_LDARG_I1) LDARG(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_U1) LDARG(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_I2) LDARG(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_U2) LDARG(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_I4) LDARG(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_I8) LDARG(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_R4) LDARG(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_R8) LDARG(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_O) LDARG(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDARG_P) LDARG(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LDARG_VT)
-                       sp->data.p = vt_sp;
-                       i32 = READ32(ip + 2);
-                       memcpy(sp->data.p, frame->args + * (guint16 *)(ip + 1), i32);
-                       vt_sp += (i32 + 7) & ~7;
-                       ip += 4;
-                       ++sp;
-                       MINT_IN_BREAK;
-
-#define STARG(datamem, argtype) \
-       --sp; \
-       * (argtype *)(frame->args + * (guint16 *)(ip + 1)) = sp->data.datamem; \
-       ip += 2; \
-       
-               MINT_IN_CASE(MINT_STARG_I1) STARG(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_U1) STARG(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_I2) STARG(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_U2) STARG(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_I4) STARG(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_I8) STARG(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_R4) STARG(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_R8) STARG(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_O) STARG(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STARG_P) STARG(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_STARG_VT) 
-                       i32 = READ32(ip + 2);
-                       --sp;
-                       memcpy(frame->args + * (guint16 *)(ip + 1), sp->data.p, i32);
-                       vt_sp -= (i32 + 7) & ~7;
-                       ip += 4;
-                       MINT_IN_BREAK;
-
-#define STINARG(datamem, argtype) \
-       do { \
-               int n = * (guint16 *)(ip + 1); \
-               * (argtype *)(frame->args + rtm->arg_offsets [n]) = frame->stack_args [n].data.datamem; \
-               ip += 2; \
-       } while (0)
-       
-               MINT_IN_CASE(MINT_STINARG_I1) STINARG(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_U1) STINARG(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_I2) STINARG(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_U2) STINARG(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_I4) STINARG(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_I8) STINARG(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_R4) STINARG(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_R8) STINARG(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_O) STINARG(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STINARG_P) STINARG(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_STINARG_VT) {
-                       int n = * (guint16 *)(ip + 1);
-                       i32 = READ32(ip + 2);
-                       memcpy (frame->args + rtm->arg_offsets [n], frame->stack_args [n].data.p, i32);
-                       ip += 4;
-                       MINT_IN_BREAK;
-               }
-
-               MINT_IN_CASE(MINT_LDARGA)
-                       sp->data.p = frame->args + * (guint16 *)(ip + 1);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-
-#define LDLOC(datamem, argtype) \
-       sp->data.datamem = * (argtype *)(locals + * (guint16 *)(ip + 1)); \
-       ip += 2; \
-       ++sp; 
-       
-               MINT_IN_CASE(MINT_LDLOC_I1) LDLOC(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_U1) LDLOC(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_I2) LDLOC(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_U2) LDLOC(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_I4) LDLOC(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_I8) LDLOC(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_R4) LDLOC(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_R8) LDLOC(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_O) LDLOC(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_LDLOC_P) LDLOC(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LDLOC_VT)
-                       sp->data.p = vt_sp;
-                       i32 = READ32(ip + 2);
-                       memcpy(sp->data.p, locals + * (guint16 *)(ip + 1), i32);
-                       vt_sp += (i32 + 7) & ~7;
-                       ip += 4;
-                       ++sp;
-                       MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LDLOCA_S)
-                       sp->data.p = locals + * (guint16 *)(ip + 1);
-                       ip += 2;
-                       ++sp;
-                       MINT_IN_BREAK;
-
-#define STLOC(datamem, argtype) \
-       --sp; \
-       * (argtype *)(locals + * (guint16 *)(ip + 1)) = sp->data.datamem; \
-       ip += 2;
-       
-               MINT_IN_CASE(MINT_STLOC_I1) STLOC(i, gint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_U1) STLOC(i, guint8); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_I2) STLOC(i, gint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_U2) STLOC(i, guint16); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_I4) STLOC(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_I8) STLOC(l, gint64); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_R4) STLOC(f, float); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_R8) STLOC(f, double); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_O) STLOC(p, gpointer); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_P) STLOC(p, gpointer); MINT_IN_BREAK;
-
-#define STLOC_NP(datamem, argtype) \
-       * (argtype *)(locals + * (guint16 *)(ip + 1)) = sp [-1].data.datamem; \
-       ip += 2;
-
-               MINT_IN_CASE(MINT_STLOC_NP_I4) STLOC_NP(i, gint32); MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_STLOC_NP_O) STLOC_NP(p, gpointer); MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_STLOC_VT)
-                       i32 = READ32(ip + 2);
-                       --sp;
-                       memcpy(locals + * (guint16 *)(ip + 1), sp->data.p, i32);
-                       vt_sp -= (i32 + 7) & ~7;
-                       ip += 4;
-                       MINT_IN_BREAK;
-
-               MINT_IN_CASE(MINT_LOCALLOC)
-                       if (sp != frame->stack + 1) /*FIX?*/
-                               THROW_EX (mono_get_exception_execution_engine (NULL), ip);
-                       sp [-1].data.p = alloca (sp [-1].data.i);
-                       ++ip;
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_ENDFILTER) ves_abort(); MINT_IN_BREAK;
-#endif
-               MINT_IN_CASE(MINT_INITOBJ)
-                       --sp;
-                       memset (sp->data.vt, 0, READ32(ip + 1));
-                       ip += 3;
-                       MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_CPBLK)
-                       sp -= 3;
-                       if (!sp [0].data.p || !sp [1].data.p)
-                               THROW_EX (mono_get_exception_null_reference(), ip - 1);
-                       ++ip;
-                       /* FIXME: value and size may be int64... */
-                       memcpy (sp [0].data.p, sp [1].data.p, sp [2].data.i);
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_CONSTRAINED_) {
-                       guint32 token;
-                       /* FIXME: implement */
-                       ++ip;
-                       token = READ32 (ip);
-                       ip += 2;
-                       MINT_IN_BREAK;
-               }
-#endif
-               MINT_IN_CASE(MINT_INITBLK)
-                       sp -= 3;
-                       if (!sp [0].data.p)
-                               THROW_EX (mono_get_exception_null_reference(), ip - 1);
-                       ++ip;
-                       /* FIXME: value and size may be int64... */
-                       memset (sp [0].data.p, sp [1].data.i, sp [2].data.i);
-                       MINT_IN_BREAK;
-#if 0
-               MINT_IN_CASE(MINT_NO_)
-                       /* FIXME: implement */
-                       ip += 2;
-                       MINT_IN_BREAK;
-#endif
-               MINT_IN_CASE(MINT_RETHROW)
-                       /* 
-                        * need to clarify what this should actually do:
-                        * start the search from the last found handler in
-                        * this method or continue in the caller or what.
-                        * Also, do we need to run finally/fault handlers after a retrow?
-                        * Well, this implementation will follow the usual search
-                        * for an handler, considering the current ip as throw spot.
-                        * We need to NULL frame->ex_handler for the later code to
-                        * actually run the new found handler.
-                        */
-                       frame->ex_handler = NULL;
-                       THROW_EX (frame->ex, ip - 1);
-                       MINT_IN_BREAK;
-               MINT_IN_DEFAULT
-                       g_print ("Unimplemented opcode: %04x %s at 0x%x\n", *ip, mono_interp_opname[*ip], ip-rtm->code);
-                       THROW_EX (mono_get_exception_execution_engine ("Unimplemented opcode"), ip);
-               }
-       }
-
-       g_assert_not_reached ();
-       /*
-        * Exception handling code.
-        * The exception object is stored in frame->ex.
-        */
-
-       handle_exception:
-       {
-               int i;
-               guint32 ip_offset;
-               MonoInvocation *inv;
-               MonoExceptionClause *clause;
-               /*char *message;*/
-               MonoObject *ex_obj;
-
-#if DEBUG_INTERP
-               if (tracing)
-                       g_print ("* Handling exception '%s' at IL_%04x\n", 
-                               frame->ex == NULL ? "** Unknown **" : mono_object_class (frame->ex)->name, 
-                               rtm == NULL ? 0 : frame->ip - rtm->code);
-#endif
-               if (die_on_exception)
-                       goto die_on_ex;
-
-               for (inv = frame; inv; inv = inv->parent) {
-                       MonoMethod *method;
-                       if (inv->runtime_method == NULL)
-                               continue;
-                       method = inv->runtime_method->method;
-                       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
-                               continue;
-                       if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
-                               continue;
-                       if (inv->ip == NULL)
-                               continue;
-                       ip_offset = inv->ip - inv->runtime_method->code;
-                       inv->ex_handler = NULL; /* clear this in case we are trhowing an exception while handling one  - this one wins */
-                       for (i = 0; i < inv->runtime_method->num_clauses; ++i) {
-                               clause = &inv->runtime_method->clauses [i];
-                               if (clause->flags <= 1 && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
-                                       if (!clause->flags) {
-                                               MonoObject *isinst_obj = mono_object_isinst_checked ((MonoObject*)frame->ex, clause->data.catch_class, &error);
-                                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                                               if (isinst_obj) {
-                                                       /* 
-                                                        * OK, we found an handler, now we need to execute the finally
-                                                        * and fault blocks before branching to the handler code.
-                                                        */
-                                                       inv->ex_handler = clause;
-#if DEBUG_INTERP
-                                                       if (tracing)
-                                                               g_print ("* Found handler at '%s'\n", method->name);
-#endif
-                                                       goto handle_finally;
-                                               }
-                                       } else {
-                                               /* FIXME: handle filter clauses */
-                                               g_assert (0);
-                                       }
-                               }
-                       }
-               }
-               /*
-                * If we get here, no handler was found: print a stack trace.
-                */
-               for (inv = frame; inv; inv = inv->parent) {
-                       if (inv->invoke_trap)
-                               goto handle_finally;
-               }
-die_on_ex:
-               ex_obj = (MonoObject*)frame->ex;
-               mono_unhandled_exception (ex_obj);
-               exit (1);
-       }
-       handle_finally:
-       {
-               int i;
-               guint32 ip_offset;
-               MonoExceptionClause *clause;
-               GSList *old_list = finally_ips;
-               MonoMethod *method = frame->runtime_method->method;
-               MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               
-#if DEBUG_INTERP
-               if (tracing)
-                       g_print ("* Handle finally IL_%04x\n", endfinally_ip == NULL ? 0 : endfinally_ip - rtm->code);
-#endif
-               if (rtm == NULL || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) 
-                               || (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))) {
-                       goto exit_frame;
-               }
-               ip_offset = frame->ip - rtm->code;
-
-               if (endfinally_ip != NULL)
-                       finally_ips = g_slist_prepend(finally_ips, (void *)endfinally_ip);
-               for (i = 0; i < header->num_clauses; ++i)
-                       if (frame->ex_handler == &rtm->clauses [i])
-                               break;
-               while (i > 0) {
-                       --i;
-                       clause = &rtm->clauses [i];
-                       if (MONO_OFFSET_IN_CLAUSE (clause, ip_offset) && (endfinally_ip == NULL || !(MONO_OFFSET_IN_CLAUSE (clause, endfinally_ip - rtm->code)))) {
-                               if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
-                                       ip = rtm->code + clause->handler_offset;
-                                       finally_ips = g_slist_prepend (finally_ips, (gpointer) ip);
-#if DEBUG_INTERP
-                                       if (tracing)
-                                               g_print ("* Found finally at IL_%04x with exception: %s\n", clause->handler_offset, frame->ex? "yes": "no");
-#endif
-                               }
-                       }
-               }
-
-               endfinally_ip = NULL;
-
-               if (old_list != finally_ips && finally_ips) {
-                       ip = finally_ips->data;
-                       finally_ips = g_slist_remove (finally_ips, ip);
-                       sp = frame->stack; /* spec says stack should be empty at endfinally so it should be at the start too */
-                       goto main_loop;
-               }
-
-               /*
-                * If an exception is set, we need to execute the fault handler, too,
-                * otherwise, we continue normally.
-                */
-               if (frame->ex)
-                       goto handle_fault;
-               ves_abort();
-       }
-       handle_fault:
-       {
-               int i;
-               guint32 ip_offset;
-               MonoExceptionClause *clause;
-               MonoMethod *method = frame->runtime_method->method;
-               MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               
-#if DEBUG_INTERP
-               if (tracing)
-                       g_print ("* Handle fault\n");
-#endif
-               ip_offset = frame->ip - rtm->code;
-               for (i = 0; i < header->num_clauses; ++i) {
-                       clause = &rtm->clauses [i];
-                       if (clause->flags == MONO_EXCEPTION_CLAUSE_FAULT && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
-                               ip = rtm->code + clause->handler_offset;
-#if DEBUG_INTERP
-                               if (tracing)
-                                       g_print ("* Executing handler at IL_%04x\n", clause->handler_offset);
-#endif
-                               goto main_loop;
-                       }
-               }
-               /*
-                * If the handler for the exception was found in this method, we jump
-                * to it right away, otherwise we return and let the caller run
-                * the finally, fault and catch blocks.
-                * This same code should be present in the endfault opcode, but it
-                * is corrently not assigned in the ECMA specs: LAMESPEC.
-                */
-               if (frame->ex_handler) {
-#if DEBUG_INTERP
-                       if (tracing)
-                               g_print ("* Executing handler at IL_%04x\n", frame->ex_handler->handler_offset);
-#endif
-                       ip = rtm->code + frame->ex_handler->handler_offset;
-                       sp = frame->stack;
-                       vt_sp = (unsigned char *) sp + rtm->stack_size;
-                       sp->data.p = frame->ex;
-                       ++sp;
-                       goto main_loop;
-               }
-               goto exit_frame;
-       }
-exit_frame:
-       DEBUG_LEAVE ();
-}
-
-void
-ves_exec_method (MonoInvocation *frame)
-{
-       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
-       ThreadContext context_struct;
-       MonoError error;
-       jmp_buf env;
-
-       frame->ex = NULL;
-
-       if (setjmp(env)) {
-               mono_unhandled_exception ((MonoObject*)frame->ex);
-               return;
-       }
-       if (context == NULL) {
-               context = &context_struct;
-               context_struct.domain = mono_domain_get ();
-               context_struct.base_frame = frame;
-               context_struct.current_frame = NULL;
-               context_struct.env_frame = frame;
-               context_struct.current_env = &env;
-               context_struct.search_for_handler = 0;
-               context_struct.managed_code = 0;
-               mono_native_tls_set_value (thread_context_id, context);
-       }
-       frame->ip = NULL;
-       frame->parent = context->current_frame;
-       frame->runtime_method = mono_interp_get_runtime_method (context->domain, frame->method, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       context->managed_code = 1;
-       ves_exec_method_with_context (frame, context);
-       context->managed_code = 0;
-       if (frame->ex) {
-               if (context != &context_struct && context->current_env) {
-                       context->env_frame->ex = frame->ex;
-                       longjmp (*context->current_env, 1);
-               }
-               else
-                       mono_unhandled_exception ((MonoObject*)frame->ex);
-       }
-       if (context->base_frame == frame)
-               mono_native_tls_set_value (thread_context_id, NULL);
-       else
-               context->current_frame = frame->parent;
-}
-
-static int 
-ves_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
-{
-       MonoImage *image = mono_assembly_get_image (assembly);
-       MonoMethod *method;
-       MonoError error;
-       int rval;
-
-       method = mono_get_method_checked (image, mono_image_get_entry_point (image), NULL, NULL, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       if (!method)
-               g_error ("No entry point method found in %s", mono_image_get_filename (image));
-
-       rval = mono_runtime_run_main_checked (method, argc, argv, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-       return rval;
-}
-
-static void
-usage (void)
-{
-       fprintf (stderr,
-                "mint %s, the Mono ECMA CLI interpreter, (C) 2001, 2002 Ximian, Inc.\n\n"
-                "Usage is: mint [options] executable args...\n\n", VERSION);
-       fprintf (stderr,
-                "Runtime Debugging:\n"
-#ifdef DEBUG_INTERP
-                "   --debug\n"
-#endif
-                "   --dieonex\n"
-                "   --noptr\t\t\tdon't print pointer addresses in trace output\n"
-                "   --opcode-count\n"
-                "   --print-vtable\n"
-                "   --traceclassinit\n"
-                "\n"
-                "Development:\n"
-                "   --debug method_name\n"
-                "   --profile\n"
-                "   --trace\n"
-                "   --traceops\n"
-                "   --regression\n"
-                "\n"
-                "Runtime:\n"
-                "   --config filename  load the specified config file instead of the default\n"
-                "   --workers n        maximum number of worker threads\n"
-               );
-       exit (1);
-}
-
-static MonoBoolean
-interp_ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info, 
-                         MonoReflectionMethod **method, 
-                         gint32 *iloffset, gint32 *native_offset,
-                         MonoString **file, gint32 *line, gint32 *column)
-{
-       ThreadContext *context = mono_native_tls_get_value (thread_context_id);
-       MonoInvocation *inv = context->current_frame;
-       MonoError error;
-       int i;
-
-       for (i = 0; inv && i < skip; inv = inv->parent)
-               if (inv->runtime_method != NULL)
-                       ++i;
-
-       if (iloffset)
-               *iloffset = 0;
-       if (native_offset)
-               *native_offset = 0;
-       if (method) {
-               if (inv == NULL) {
-                       *method = NULL;
-               } else {
-                       *method = mono_method_get_object_checked (context->domain, inv->runtime_method->method, NULL, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               }
-       }
-       if (line)
-               *line = 0;
-       if (need_file_info) {
-               if (column)
-                       *column = 0;
-               if (file)
-                       *file = mono_string_new (mono_domain_get (), "unknown");
-       }
-
-       return TRUE;
-}
-
-static MonoArray *
-interp_ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info)
-{
-       MonoDomain *domain = mono_domain_get ();
-       MonoArray *res;
-       MonoArray *ta = exc->trace_ips;
-       MonoError error;
-       int i, len;
-
-       if (ta == NULL) {
-               /* Exception is not thrown yet */
-               MonoArray *array = mono_array_new_checked (domain, mono_defaults.stack_frame_class, 0, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               return array;
-       }
-       
-       len = mono_array_length (ta);
-
-       res = mono_array_new_checked (domain, mono_defaults.stack_frame_class, len > skip ? len - skip : 0, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       for (i = skip; i < len / 2; i++) {
-               MonoStackFrame *sf = (MonoStackFrame *)mono_object_new_checked (domain, mono_defaults.stack_frame_class, &error);
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               gushort *ip = mono_array_get (ta, gpointer, 2 * i + 1);
-               RuntimeMethod *rtm = mono_array_get (ta, gpointer, 2 * i);
-
-               if (rtm != NULL) {
-                       sf->method = mono_method_get_object_checked (domain, rtm->method, NULL, &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       sf->native_offset = ip - rtm->code;
-               }
-
-#if 0
-               sf->il_offset = mono_debug_il_offset_from_address (ji->method, sf->native_offset, domain);
-
-               if (need_file_info) {
-                       gchar *filename;
-                       
-                       filename = mono_debug_source_location_from_address (ji->method, sf->native_offset, &sf->line, domain);
-
-                       sf->filename = filename? mono_string_new (domain, filename): NULL;
-                       sf->column = 0;
-
-                       g_free (filename);
-               }
-#endif
-
-               mono_array_set (res, gpointer, i, sf);
-       }
-
-       return res;
-}
-
-static MonoObject *
-ves_icall_System_Delegate_CreateDelegate_internal (MonoReflectionType *type, MonoObject *target, MonoReflectionMethod *info)
-{
-       MonoClass *delegate_class = mono_class_from_mono_type (type->type);
-       MonoObject *delegate;
-       MonoError error;
-
-       g_assert (delegate_class->parent == mono_defaults.multicastdelegate_class);
-
-       delegate = mono_object_new_checked (mono_object_domain (type), delegate_class, &error);
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       interp_delegate_ctor (mono_object_domain (type), delegate, target, mono_interp_get_runtime_method (mono_get_root_domain (), info->method, &error));
-       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-       return delegate;
-}
-
-void
-mono_interp_init ()
-{
-       mono_native_tls_alloc (&thread_context_id, NULL);
-    mono_native_tls_set_value (thread_context_id, NULL);
-       mono_os_mutex_init_recursive (&runtime_method_lookup_section);
-       mono_os_mutex_init_recursive (&create_method_pointer_mutex);
-
-       mono_interp_transform_init ();
-}
-
-typedef int (*TestMethod) (void);
-
-static void
-interp_regression_step (MonoImage *image, int verbose, int *total_run, int *total, GTimer *timer, MonoDomain *domain)
-{
-       int result, expected, failed, cfailed, run;
-       double elapsed, transform_time;
-       int i;
-       MonoObject *result_obj;
-       static gboolean filter_method_init = FALSE;
-       static const char *filter_method = NULL;
-
-       g_print ("Test run: image=%s\n", mono_image_get_filename (image));
-       cfailed = failed = run = 0;
-       transform_time = elapsed = 0.0;
-
-#if 0
-       /* fixme: ugly hack - delete all previously compiled methods */
-       if (domain_jit_info (domain)) {
-               g_hash_table_destroy (domain_jit_info (domain)->jit_trampoline_hash);
-               domain_jit_info (domain)->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
-               mono_internal_hash_table_destroy (&(domain->jit_code_hash));
-               mono_jit_code_hash_init (&(domain->jit_code_hash));
-       }
-#endif
-
-       g_timer_start (timer);
-       for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
-               MonoObject *exc = NULL;
-               MonoError error;
-               MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
-               if (!method) {
-                       mono_error_cleanup (&error); /* FIXME don't swallow the error */
-                       continue;
-               }
-
-               if (!filter_method_init) {
-                       filter_method = g_getenv ("INTERP_FILTER_METHOD");
-                       filter_method_init = TRUE;
-               }
-               gboolean filter = FALSE;
-               if (filter_method) {
-                       const char *name = filter_method;
-
-                       if ((strchr (name, '.') > name) || strchr (name, ':')) {
-                               MonoMethodDesc *desc = mono_method_desc_new (name, TRUE);
-                               filter = mono_method_desc_full_match (desc, method);
-                               mono_method_desc_free (desc);
-                       } else {
-                               filter = strcmp (method->name, name) == 0;
-                       }
-               } else { /* no filter, check for `Category' attribute on method */
-                       filter = TRUE;
-                       MonoCustomAttrInfo* ainfo = mono_custom_attrs_from_method_checked (method, &error);
-                       mono_error_cleanup (&error);
-
-                       if (ainfo) {
-                               int j;
-                               for (j = 0; j < ainfo->num_attrs && filter; ++j) {
-                                       MonoCustomAttrEntry *centry = &ainfo->attrs [j];
-                                       if (centry->ctor == NULL)
-                                               continue;
-
-                                       MonoClass *klass = centry->ctor->klass;
-                                       if (strcmp (klass->name, "CategoryAttribute"))
-                                               continue;
-
-                                       MonoObject *obj = mono_custom_attrs_get_attr_checked (ainfo, klass, &error);
-                                       /* FIXME: there is an ordering problem if there're multiple attributes, do this instead:
-                                        * MonoObject *obj = create_custom_attr (ainfo->image, centry->ctor, centry->data, centry->data_size, &error); */
-                                       mono_error_cleanup (&error);
-                                       MonoMethod *getter = mono_class_get_method_from_name (klass, "get_Category", -1);
-                                       MonoObject *str = mono_interp_runtime_invoke (getter, obj, NULL, &exc, &error);
-                                       mono_error_cleanup (&error);
-                                       char *utf8_str = mono_string_to_utf8_checked ((MonoString *) str, &error);
-                                       mono_error_cleanup (&error);
-                                       if (!strcmp (utf8_str, "!INTERPRETER")) {
-                                               g_print ("skip %s...\n", method->name);
-                                               filter = FALSE;
-                                       }
-                               }
-                       }
-               }
-               if (strncmp (method->name, "test_", 5) == 0 && filter) {
-                       MonoError interp_error;
-                       MonoObject *exc = NULL;
-
-                       result_obj = mono_interp_runtime_invoke (method, NULL, NULL, &exc, &interp_error);
-                       if (!mono_error_ok (&interp_error)) {
-                               cfailed++;
-                               g_print ("Test '%s' execution failed.\n", method->name);
-                       } else if (exc != NULL) {
-                               g_print ("Exception in Test '%s' occured:\n", method->name);
-                               mono_object_describe (exc);
-                               run++;
-                               failed++;
-                       } else {
-                               result = *(gint32 *) mono_object_unbox (result_obj);
-                               expected = atoi (method->name + 5);  // FIXME: oh no.
-                               run++;
-
-                               if (result != expected) {
-                                       failed++;
-                                       g_print ("Test '%s' failed result (got %d, expected %d).\n", method->name, result, expected);
-                               }
-                       }
-               }
-       }
-       g_timer_stop (timer);
-       elapsed = g_timer_elapsed (timer, NULL);
-       if (failed > 0 || cfailed > 0){
-               g_print ("Results: total tests: %d, failed: %d, cfailed: %d (pass: %.2f%%)\n",
-                               run, failed, cfailed, 100.0*(run-failed-cfailed)/run);
-       } else {
-               g_print ("Results: total tests: %d, all pass \n",  run);
-       }
-
-       g_print ("Elapsed time: %f secs (%f, %f)\n\n", elapsed,
-                       elapsed - transform_time, transform_time);
-       *total += failed + cfailed;
-       *total_run += run;
-}
-static int
-interp_regression (MonoImage *image, int verbose, int *total_run)
-{
-       MonoMethod *method;
-       GTimer *timer = g_timer_new ();
-       MonoDomain *domain = mono_domain_get ();
-       guint32 i;
-       int total;
-
-       /* load the metadata */
-       for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
-               MonoError error;
-               method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
-               if (!method) {
-                       mono_error_cleanup (&error);
-                       continue;
-               }
-               mono_class_init (method->klass);
-       }
-
-       total = 0;
-       *total_run = 0;
-       interp_regression_step (image, verbose, total_run, &total, timer, domain);
-
-       g_timer_destroy (timer);
-       return total;
-}
-
-int
-mono_interp_regression_list (int verbose, int count, char *images [])
-{
-       int i, total, total_run, run;
-       
-       total_run = total = 0;
-       for (i = 0; i < count; ++i) {
-               MonoAssembly *ass = mono_assembly_open (images [i], NULL);
-               if (!ass) {
-                       g_warning ("failed to load assembly: %s", images [i]);
-                       continue;
-               }
-               total += interp_regression (mono_assembly_get_image (ass), verbose, &run);
-               total_run += run;
-       }
-       if (total > 0) {
-               g_print ("Overall results: tests: %d, failed: %d (pass: %.2f%%)\n", total_run, total, 100.0*(total_run-total)/total_run);
-       } else {
-               g_print ("Overall results: tests: %d, 100%% pass\n", total_run);
-       }
-       
-       return total;
-}
-
diff --git a/mono/mini/interpreter/interp.h b/mono/mini/interpreter/interp.h
deleted file mode 100644 (file)
index 8c75b94..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __MONO_MINI_INTERPRETER_H__
-#define __MONO_MINI_INTERPRETER_H__
-#include <mono/mini/mini.h>
-
-int
-mono_interp_regression_list (int verbose, int count, char *images []);
-
-void
-mono_interp_init (void);
-
-gpointer
-mono_interp_create_method_pointer (MonoMethod *method, MonoError *error);
-
-MonoObject*
-mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error);
-
-#endif /* __MONO_MINI_INTERPRETER_H__ */
diff --git a/mono/mini/interpreter/mintops.c b/mono/mini/interpreter/mintops.c
deleted file mode 100644 (file)
index 5b4d692..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Utilities for handling interpreter VM instructions
- *
- * Authors:
- *   Bernie Solomon (bernard@ugsolutions.com)
- *
- */
-#include <glib.h>
-#include <stdio.h>
-#include "mintops.h"
-
-#define OPDEF(a,b,c,d) \
-       b,
-const char *mono_interp_opname[] = {
-#include "mintops.def"
-       ""
-};
-#undef OPDEF
-
-#define OPDEF(a,b,c,d) \
-       c,
-unsigned char mono_interp_oplen[] = {
-#include "mintops.def"
-       0
-};
-#undef OPDEF
-
-
-#define OPDEF(a,b,c,d) \
-       d,
-MintOpArgType mono_interp_opargtype[] = {
-#include "mintops.def"
-       0
-};
-#undef OPDEF
-
-const guint16 *
-mono_interp_dis_mintop(const guint16 *base, const guint16 *ip)
-{
-       int len = mono_interp_oplen [*ip];
-       guint32 token;
-       int target;
-       if (len < 0 || len > 10) {
-               g_print ("op %d len %d\n", *ip, len);
-               g_assert_not_reached ();
-       } else if (len == 0) { /* SWITCH */
-               int n = READ32 (ip + 1);
-               len = 3 + n * 2;
-       }
-
-       g_print ("IL_%04x: %-10s", ip - base, mono_interp_opname [*ip]);
-       switch (mono_interp_opargtype [*ip]) {
-       case MintOpNoArgs:
-               break;
-       case MintOpUShortInt:
-               g_print (" %u", * (guint16 *)(ip + 1));
-               break;
-       case MintOpTwoShorts:
-               g_print (" %u,%u", * (guint16 *)(ip + 1), * (guint16 *)(ip + 2));
-               break;
-       case MintOpShortAndInt:
-               g_print (" %u,%u", * (guint16 *)(ip + 1), (guint32)READ32(ip + 2));
-               break;
-       case MintOpShortInt:
-               g_print (" %d", * (short *)(ip + 1));
-               break;
-       case MintOpClassToken:
-       case MintOpMethodToken:
-       case MintOpFieldToken:
-               token = * (guint16 *)(ip + 1);
-               g_print (" %u", token);
-               break;
-       case MintOpInt:
-               g_print (" %d", (gint32)READ32 (ip + 1));
-               break;
-       case MintOpLongInt:
-               g_print (" %lld", (gint64)READ64 (ip + 1));
-               break;
-       case MintOpFloat: {
-               gint32 tmp = READ32 (ip + 1);
-               g_print (" %g", * (float *)&tmp);
-               break;
-       }
-       case MintOpDouble: {
-               gint64 tmp = READ64 (ip + 1);
-               g_print (" %g", * (double *)&tmp);
-               break;
-       }
-       case MintOpShortBranch:
-               target = ip + * (short *)(ip + 1) - base;
-               g_print (" IL_%04x", target);
-               break;
-       case MintOpBranch:
-               target = ip + (gint32)READ32 (ip + 1) - base;
-               g_print (" IL_%04x", target);
-               break;
-       case MintOpSwitch: {
-               const guint16 *p = ip + 1;
-               int sval = (gint32)READ32 (p);
-               int i;
-               p += 2;
-               g_print ("(");
-               for (i = 0; i < sval; ++i) {
-                       int offset;
-                       if (i > 0)
-                               g_print (", ");
-                       offset = (gint32)READ32 (p);
-                       g_print ("IL_%04x", ip - base + 3 + 2 * sval + offset);
-                       p += 2;
-               }
-               g_print (")");
-               break;
-       }
-       default:
-               g_print("unknown arg type\n");
-       }
-
-       return ip + len;
-}
-
diff --git a/mono/mini/interpreter/mintops.def b/mono/mini/interpreter/mintops.def
deleted file mode 100644 (file)
index a9ed29f..0000000
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Definitions of VM instructions executed by interp.c
- *
- * Authors:
- *   Bernie Solomon (bernard@ugsolutions.com)
- *
- */
-
-/* OPDEF (opsymbol, opstring, oplength, optype) */
-
-OPDEF(MINT_NOP, "nop", 1, MintOpNoArgs)
-OPDEF(MINT_BREAK, "break", 1, MintOpNoArgs)
-OPDEF(MINT_LDNULL, "ldnull", 1, MintOpNoArgs)
-OPDEF(MINT_DUP, "dup", 1, MintOpNoArgs)
-OPDEF(MINT_DUP_VT, "dup.vt", 3, MintOpInt)
-OPDEF(MINT_POP, "pop", 1, MintOpNoArgs)
-
-OPDEF(MINT_RET, "ret", 1, MintOpNoArgs)
-OPDEF(MINT_RET_VOID, "ret.void", 1, MintOpNoArgs)
-OPDEF(MINT_RET_VT, "ret.vt", 3, MintOpInt)
-
-OPDEF(MINT_VTRESULT, "vtresult", 4, MintOpShortAndInt) /*FIX should be unsigned*/
-
-OPDEF(MINT_LDC_I4_M1, "ldc.i4.m1", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_0, "ldc.i4.0", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_1, "ldc.i4.1", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_2, "ldc.i4.2", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_3, "ldc.i4.3", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_4, "ldc.i4.4", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_5, "ldc.i4.5", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_6, "ldc.i4.6", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_7, "ldc.i4.7", 1, MintOpNoArgs)
-OPDEF(MINT_LDC_I4_8, "ldc.i4.8", 1, MintOpNoArgs)
-
-OPDEF(MINT_LDC_I4_S, "ldc.i4.s", 2, MintOpShortInt)
-OPDEF(MINT_LDC_I4, "ldc.i4", 3, MintOpInt)
-OPDEF(MINT_LDC_I8, "ldc.i8", 5, MintOpLongInt)
-
-OPDEF(MINT_LDC_R4, "ldc.r4", 3, MintOpFloat)
-OPDEF(MINT_LDC_R8, "ldc.r8", 5, MintOpDouble)
-
-OPDEF(MINT_LDARG_I1, "ldarg.i1", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_U1, "ldarg.u1", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_I2, "ldarg.i2", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_U2, "ldarg.u2", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_I4, "ldarg.i4", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_I8, "ldarg.i8", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_R4, "ldarg.r4", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_R8, "ldarg.r8", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_O, "ldarg.o", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_P, "ldarg.p", 2, MintOpUShortInt)
-OPDEF(MINT_LDARG_VT, "ldarg.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_STARG_I1, "starg.i1", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_U1, "starg.u1", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_I2, "starg.i2", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_U2, "starg.u2", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_I4, "starg.i4", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_I8, "starg.i8", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_R4, "starg.r4", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_R8, "starg.r8", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_O, "starg.o", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_P, "starg.p", 2, MintOpUShortInt)
-OPDEF(MINT_STARG_VT, "starg.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_STINARG_I1, "stinarg.i1", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_U1, "stinarg.u1", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_I2, "stinarg.i2", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_U2, "stinarg.u2", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_I4, "stinarg.i4", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_I8, "stinarg.i8", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_R4, "stinarg.r4", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_R8, "stinarg.r8", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_O, "stinarg.o", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_P, "stinarg.p", 2, MintOpUShortInt)
-OPDEF(MINT_STINARG_VT, "stinarg.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDARGA, "ldarga", 2, MintOpUShortInt)
-OPDEF(MINT_LDTHISA, "ldthisa", 1, MintOpNoArgs)
-
-OPDEF(MINT_LDFLD_I1, "ldfld.i1", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_U1, "ldfld.u1", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_I2, "ldfld.i2", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_U2, "ldfld.u2", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_I4, "ldfld.i4", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_I8, "ldfld.i8", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_R4, "ldfld.r4", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_R8, "ldfld.r8", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_O, "ldfld.o", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_P, "ldfld.p", 2, MintOpUShortInt)
-OPDEF(MINT_LDFLD_VT, "ldfld.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDRMFLD, "ldrmfld", 2, MintOpFieldToken)
-OPDEF(MINT_LDRMFLD_VT, "ldrmfld.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDFLDA, "ldflda", 2, MintOpUShortInt)
-
-OPDEF(MINT_STFLD_I1, "stfld.i1", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_U1, "stfld.u1", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_I2, "stfld.i2", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_U2, "stfld.u2", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_I4, "stfld.i4", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_I8, "stfld.i8", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_R4, "stfld.r4", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_R8, "stfld.r8", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_O, "stfld.o", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_P, "stfld.p", 2, MintOpUShortInt)
-OPDEF(MINT_STFLD_VT, "stfld.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_STRMFLD, "strmfld", 2, MintOpFieldToken)
-OPDEF(MINT_STRMFLD_VT, "strmfld.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDSFLD, "ldsfld", 2, MintOpFieldToken)
-OPDEF(MINT_LDSFLD_VT, "ldsfld.vt", 4, MintOpShortAndInt)
-OPDEF(MINT_STSFLD, "stsfld", 2, MintOpUShortInt)
-OPDEF(MINT_STSFLD_VT, "stsfld.vt", 4, MintOpShortAndInt)
-OPDEF(MINT_LDSFLDA, "ldsflda", 2, MintOpUShortInt)
-
-OPDEF(MINT_LDLOC_I1, "ldloc.i1", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_U1, "ldloc.u1", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_I2, "ldloc.i2", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_U2, "ldloc.u2", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_I4, "ldloc.i4", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_I8, "ldloc.i8", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_R4, "ldloc.r4", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_R8, "ldloc.r8", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_O, "ldloc.o", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_P, "ldloc.p", 2, MintOpUShortInt)
-OPDEF(MINT_LDLOC_VT, "ldloc.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_STLOC_I1, "stloc.i1", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_U1, "stloc.u1", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_I2, "stloc.i2", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_U2, "stloc.u2", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_I4, "stloc.i4", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_I8, "stloc.i8", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_R4, "stloc.r4", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_R8, "stloc.r8", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_O, "stloc.o", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_P, "stloc.p", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_VT, "stloc.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_STLOC_NP_I4, "stloc.np.i4", 2, MintOpUShortInt)
-OPDEF(MINT_STLOC_NP_O, "stloc.np.o", 2, MintOpUShortInt)
-
-OPDEF(MINT_LDLOCA_S, "ldloca.s", 2, MintOpUShortInt)
-
-OPDEF(MINT_LDIND_I1, "ldind.i1", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_U1, "ldind.u1", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_I2, "ldind.i2", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_U2, "ldind.u2", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_I4, "ldind.i4", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_U4, "ldind.u4", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_I8, "ldind.i8", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_I, "ldind.i", 2, MintOpUShortInt)
-OPDEF(MINT_LDIND_R4, "ldind.r4", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_R8, "ldind.r8", 1, MintOpNoArgs)
-OPDEF(MINT_LDIND_REF, "ldind.ref", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_I1, "stind.i1", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_I2, "stind.i2", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_I4, "stind.i4", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_I8, "stind.i8", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_I, "stind.i", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_R4, "stind.r4", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_R8, "stind.r8", 1, MintOpNoArgs)
-OPDEF(MINT_STIND_REF, "stind.ref", 1, MintOpNoArgs)
-
-OPDEF(MINT_BR, "br", 3, MintOpBranch)
-OPDEF(MINT_LEAVE, "leave", 3, MintOpBranch)
-OPDEF(MINT_BR_S, "br.s", 2, MintOpShortBranch)
-OPDEF(MINT_LEAVE_S, "leave.s", 2, MintOpShortBranch)
-
-OPDEF(MINT_THROW, "throw", 1, MintOpNoArgs)
-OPDEF(MINT_RETHROW, "rethrow", 1, MintOpNoArgs)
-OPDEF(MINT_ENDFINALLY, "endfinally", 1, MintOpNoArgs)
-
-OPDEF(MINT_BRFALSE_I4, "brfalse.i4", 3, MintOpBranch)
-OPDEF(MINT_BRFALSE_I8, "brfalse.i8", 3, MintOpBranch)
-OPDEF(MINT_BRFALSE_R8, "brfalse.r8", 3, MintOpBranch)
-OPDEF(MINT_BRTRUE_I4, "brtrue.i4", 3, MintOpBranch)
-OPDEF(MINT_BRTRUE_I8, "brtrue.i8", 3, MintOpBranch)
-OPDEF(MINT_BRTRUE_R8, "brtrue.r8", 3, MintOpBranch)
-
-OPDEF(MINT_BRFALSE_I4_S, "brfalse.i4.s", 2, MintOpShortBranch)
-OPDEF(MINT_BRFALSE_I8_S, "brfalse.i8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BRFALSE_R8_S, "brfalse.r8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BRTRUE_I4_S, "brtrue.i4.s", 2, MintOpShortBranch)
-OPDEF(MINT_BRTRUE_I8_S, "brtrue.i8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BRTRUE_R8_S, "brtrue.r8.s", 2, MintOpShortBranch)
-
-OPDEF(MINT_BEQ_I4, "beq.i4", 3, MintOpBranch)
-OPDEF(MINT_BEQ_I8, "beq.i8", 3, MintOpBranch)
-OPDEF(MINT_BEQ_R8, "beq.r8", 3, MintOpBranch)
-OPDEF(MINT_BGE_I4, "bge.i4", 3, MintOpBranch) 
-OPDEF(MINT_BGE_I8, "bge.i8", 3, MintOpBranch) 
-OPDEF(MINT_BGE_R8, "bge.r8", 3, MintOpBranch) 
-OPDEF(MINT_BGT_I4, "bgt.i4", 3, MintOpBranch) 
-OPDEF(MINT_BGT_I8, "bgt.i8", 3, MintOpBranch) 
-OPDEF(MINT_BGT_R8, "bgt.r8", 3, MintOpBranch) 
-OPDEF(MINT_BLT_I4, "blt.i4", 3, MintOpBranch) 
-OPDEF(MINT_BLT_I8, "blt.i8", 3, MintOpBranch) 
-OPDEF(MINT_BLT_R8, "blt.r8", 3, MintOpBranch) 
-OPDEF(MINT_BLE_I4, "ble.i4", 3, MintOpBranch) 
-OPDEF(MINT_BLE_I8, "ble.i8", 3, MintOpBranch) 
-OPDEF(MINT_BLE_R8, "ble.r8", 3, MintOpBranch) 
-
-OPDEF(MINT_BNE_UN_I4, "bne.un.i4", 3, MintOpBranch)
-OPDEF(MINT_BNE_UN_I8, "bne.un.i8", 3, MintOpBranch)
-OPDEF(MINT_BNE_UN_R8, "bne.un.r8", 3, MintOpBranch)
-OPDEF(MINT_BGE_UN_I4, "bge.un.i4", 3, MintOpBranch) 
-OPDEF(MINT_BGE_UN_I8, "bge.un.i8", 3, MintOpBranch) 
-OPDEF(MINT_BGE_UN_R8, "bge.un.r8", 3, MintOpBranch) 
-OPDEF(MINT_BGT_UN_I4, "bgt.un.i4", 3, MintOpBranch) 
-OPDEF(MINT_BGT_UN_I8, "bgt.un.i8", 3, MintOpBranch) 
-OPDEF(MINT_BGT_UN_R8, "bgt.un.r8", 3, MintOpBranch) 
-OPDEF(MINT_BLE_UN_I4, "ble.un.i4", 3, MintOpBranch) 
-OPDEF(MINT_BLE_UN_I8, "ble.un.i8", 3, MintOpBranch) 
-OPDEF(MINT_BLE_UN_R8, "ble.un.r8", 3, MintOpBranch) 
-OPDEF(MINT_BLT_UN_I4, "blt.un.i4", 3, MintOpBranch) 
-OPDEF(MINT_BLT_UN_I8, "blt.un.i8", 3, MintOpBranch) 
-OPDEF(MINT_BLT_UN_R8, "blt.un.r8", 3, MintOpBranch) 
-
-OPDEF(MINT_BEQ_I4_S, "beq.i4.s", 2, MintOpShortBranch)
-OPDEF(MINT_BEQ_I8_S, "beq.i8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BEQ_R8_S, "beq.r8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BGE_I4_S, "bge.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGE_I8_S, "bge.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGE_R8_S, "bge.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_I4_S, "bgt.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_I8_S, "bgt.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_R8_S, "bgt.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_I4_S, "blt.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_I8_S, "blt.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_R8_S, "blt.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_I4_S, "ble.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_I8_S, "ble.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_R8_S, "ble.r8.s", 2, MintOpShortBranch) 
-
-OPDEF(MINT_BNE_UN_I4_S, "bne.un.i4.s", 2, MintOpShortBranch)
-OPDEF(MINT_BNE_UN_I8_S, "bne.un.i8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BNE_UN_R8_S, "bne.un.r8.s", 2, MintOpShortBranch)
-OPDEF(MINT_BGE_UN_I4_S, "bge.un.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGE_UN_I8_S, "bge.un.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGE_UN_R8_S, "bge.un.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_UN_I4_S, "bgt.un.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_UN_I8_S, "bgt.un.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BGT_UN_R8_S, "bgt.un.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_UN_I4_S, "ble.un.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_UN_I8_S, "ble.un.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLE_UN_R8_S, "ble.un.r8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_UN_I4_S, "blt.un.i4.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_UN_I8_S, "blt.un.i8.s", 2, MintOpShortBranch) 
-OPDEF(MINT_BLT_UN_R8_S, "blt.un.r8.s", 2, MintOpShortBranch) 
-
-OPDEF(MINT_SWITCH, "switch", 0, MintOpSwitch)
-
-OPDEF(MINT_LDSTR, "ldstr", 2, MintOpMethodToken) /* not really */
-
-OPDEF(MINT_CALL, "call", 2, MintOpMethodToken) 
-OPDEF(MINT_VCALL, "vcall", 2, MintOpMethodToken) 
-OPDEF(MINT_CALLVIRT, "callvirt", 2, MintOpMethodToken) 
-OPDEF(MINT_VCALLVIRT, "vcallvirt", 2, MintOpMethodToken) 
-OPDEF(MINT_CALLI, "calli", 2, MintOpMethodToken) 
-OPDEF(MINT_CALLI_NAT, "calli.nat", 2, MintOpMethodToken) 
-OPDEF(MINT_JMP, "jmp", 2, MintOpMethodToken) 
-
-OPDEF(MINT_CALLRUN, "callrun", 1, MintOpNoArgs)
-
-OPDEF(MINT_NEWOBJ, "newobj", 2, MintOpMethodToken) 
-OPDEF(MINT_INITOBJ, "initobj", 3, MintOpInt) 
-OPDEF(MINT_CASTCLASS, "castclass", 2, MintOpClassToken) 
-OPDEF(MINT_ISINST, "isinst", 2, MintOpClassToken) 
-OPDEF(MINT_NEWARR, "newarr", 2, MintOpClassToken) 
-OPDEF(MINT_BOX, "box", 3, MintOpTwoShorts)
-OPDEF(MINT_UNBOX, "unbox", 2, MintOpClassToken) 
-OPDEF(MINT_LDTOKEN, "ldtoken", 2, MintOpClassToken) /* not really */
-OPDEF(MINT_LDFTN, "ldftn", 2, MintOpMethodToken) 
-OPDEF(MINT_LDVIRTFTN, "ldvirtftn", 2, MintOpMethodToken) 
-OPDEF(MINT_LDOBJ, "ldobj", 2, MintOpClassToken) 
-OPDEF(MINT_STOBJ, "stobj", 2, MintOpClassToken) 
-OPDEF(MINT_STOBJ_VT, "stobj.vt", 2, MintOpClassToken) 
-OPDEF(MINT_CPBLK, "cpblk", 1, MintOpNoArgs) 
-OPDEF(MINT_INITBLK, "initblk", 1, MintOpNoArgs) 
-OPDEF(MINT_LOCALLOC, "localloc", 1, MintOpNoArgs) 
-OPDEF(MINT_INITLOCALS, "initlocals", 1, MintOpNoArgs) 
-
-OPDEF(MINT_LDELEM_I, "ldelem.i", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_I1, "ldelem.i1", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_U1, "ldelem.u1", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_I2, "ldelem.i2", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_U2, "ldelem.u2", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_I4, "ldelem.i4", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_U4, "ldelem.u4", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_I8, "ldelem.i8", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_R4, "ldelem.r4", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_R8, "ldelem.r8", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_REF, "ldelem.ref", 1, MintOpNoArgs)
-OPDEF(MINT_LDELEM_VT, "ldelem.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDELEMA, "ldelema", 2, MintOpClassToken)
-
-OPDEF(MINT_STELEM_I, "stelem.i", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_I1, "stelem.i1", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_I2, "stelem.i2", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_I4, "stelem.i4", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_I8, "stelem.i8", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_R4, "stelem.r4", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_R8, "stelem.r8", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_REF, "stelem.ref", 1, MintOpNoArgs)
-OPDEF(MINT_STELEM_VT, "stelem.vt", 4, MintOpShortAndInt)
-
-OPDEF(MINT_LDLEN, "ldlen", 1, MintOpNoArgs)
-
-OPDEF(MINT_ADD_I4, "add.i4", 1, MintOpNoArgs)
-OPDEF(MINT_ADD_I8, "add.i8", 1, MintOpNoArgs)
-OPDEF(MINT_ADD_R8, "add.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_ADD1_I4, "add1.i4", 1, MintOpNoArgs)
-
-OPDEF(MINT_SUB_I4, "sub.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SUB_I8, "sub.i8", 1, MintOpNoArgs)
-OPDEF(MINT_SUB_R8, "sub.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_SUB1_I4, "sub1.i4", 1, MintOpNoArgs)
-
-OPDEF(MINT_MUL_I4, "mul.i4", 1, MintOpNoArgs)
-OPDEF(MINT_MUL_I8, "mul.i8", 1, MintOpNoArgs)
-OPDEF(MINT_MUL_R8, "mul.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_DIV_I4, "div.i4", 1, MintOpNoArgs)
-OPDEF(MINT_DIV_I8, "div.i8", 1, MintOpNoArgs)
-OPDEF(MINT_DIV_R8, "div.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_DIV_UN_I4, "div.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_DIV_UN_I8, "div.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_ADD_OVF_I4, "add.ovf.i4", 1, MintOpNoArgs)
-OPDEF(MINT_ADD_OVF_I8, "add.ovf.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_ADD_OVF_UN_I4, "add.ovf.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_ADD_OVF_UN_I8, "add.ovf.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_MUL_OVF_I4, "mul.ovf.i4", 1, MintOpNoArgs)
-OPDEF(MINT_MUL_OVF_I8, "mul.ovf.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_MUL_OVF_UN_I4, "mul.ovf.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_MUL_OVF_UN_I8, "mul.ovf.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_SUB_OVF_I4, "sub.ovf.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SUB_OVF_I8, "sub.ovf.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_SUB_OVF_UN_I4, "sub.ovf.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SUB_OVF_UN_I8, "sub.ovf.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_NEG_I4, "neg.i4", 1, MintOpNoArgs)
-OPDEF(MINT_NEG_I8, "neg.i8", 1, MintOpNoArgs)
-OPDEF(MINT_NEG_R8, "neg.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_NOT_I4, "not.i4", 1, MintOpNoArgs)
-OPDEF(MINT_NOT_I8, "not.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_AND_I4, "and.i4", 1, MintOpNoArgs)
-OPDEF(MINT_AND_I8, "and.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_OR_I4, "or.i4", 1, MintOpNoArgs)
-OPDEF(MINT_OR_I8, "or.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_XOR_I4, "xor.i4", 1, MintOpNoArgs)
-OPDEF(MINT_XOR_I8, "xor.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_REM_I4, "rem.i4", 1, MintOpNoArgs)
-OPDEF(MINT_REM_I8, "rem.i8", 1, MintOpNoArgs)
-OPDEF(MINT_REM_R8, "rem.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_REM_UN_I4, "rem.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_REM_UN_I8, "rem.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_SHR_UN_I4, "shr.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SHR_UN_I8, "shr.un.i8", 1, MintOpNoArgs)
-OPDEF(MINT_SHL_I4, "shl.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SHL_I8, "shl.i8", 1, MintOpNoArgs)
-OPDEF(MINT_SHR_I4, "shr.i4", 1, MintOpNoArgs)
-OPDEF(MINT_SHR_I8, "shr.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_R_UN_I4, "conv.r.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_R_UN_I8, "conv.r.un.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_I1_I4, "conv.i1.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I1_I8, "conv.i1.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I1_R8, "conv.i1.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_U1_I4, "conv.u1.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U1_I8, "conv.u1.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U1_R8, "conv.u1.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_I2_I4, "conv.i2.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I2_I8, "conv.i2.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I2_R8, "conv.i2.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_U2_I4, "conv.u2.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U2_I8, "conv.u2.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U2_R8, "conv.u2.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_I4_I8, "conv.i4.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I4_R8, "conv.i4.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_U4_I8, "conv.u4.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U4_R8, "conv.u4.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_I8_I4, "conv.i8.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I8_U4, "conv.i8.u4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_I8_R8, "conv.i8.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_R4_I4, "conv.r4.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_R4_I8, "conv.r4.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_R4_R8, "conv.r4.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_R8_I4, "conv.r8.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_R8_I8, "conv.r8.i8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_I4_I8_SP, "conv.i4.i8.sp", 1, MintOpNoArgs) /* special for narrowing sp[-2] on 64 bits */
-OPDEF(MINT_CONV_I8_I4_SP, "conv.i8.i4.sp", 1, MintOpNoArgs) /* special for widening sp[-2] on 64 bits */
-
-OPDEF(MINT_CONV_U8_I4, "conv.u8.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_U8_R8, "conv.u8.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I1_I4, "conv.ovf.i1.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I1_I8, "conv.ovf.i1.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I1_R8, "conv.ovf.i1.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_U1_I4, "conv.ovf.u1.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U1_I8, "conv.ovf.u1.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U1_R8, "conv.ovf.u1.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I2_I4, "conv.ovf.i2.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I2_I8, "conv.ovf.i2.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I2_R8, "conv.ovf.i2.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_U2_I4, "conv.ovf.u2.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U2_I8, "conv.ovf.u2.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U2_R8, "conv.ovf.u2.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I4_U4, "conv.ovf.i4.u4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I4_I8, "conv.ovf.i4.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I4_R8, "conv.ovf.i4.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I4_UN_I8, "conv.ovf.i4.un.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_I4_UN_R8, "conv.ovf.i4.un.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_U4_I4, "conv.ovf.u4.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U4_I8, "conv.ovf.u4.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U4_R8, "conv.ovf.u4.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I8_R8, "conv.ovf.i8.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_I8_UN_R8, "conv.ovf.i8.un.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CONV_OVF_U8_I4, "conv.ovf.u8.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CONV_OVF_U8_R8, "conv.ovf.u8.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CEQ_I4, "ceq.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CEQ_I8, "ceq.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CEQ_R8, "ceq.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CEQ0_I4, "ceq0.i4", 1, MintOpNoArgs)
-
-OPDEF(MINT_CGT_I4, "cgt.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CGT_I8, "cgt.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CGT_R8, "cgt.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CGT_UN_I4, "cgt.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CGT_UN_I8, "cgt.un.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CGT_UN_R8, "cgt.un.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CLT_I4, "clt.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CLT_I8, "clt.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CLT_R8, "clt.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CLT_UN_I4, "clt.un.i4", 1, MintOpNoArgs)
-OPDEF(MINT_CLT_UN_I8, "clt.un.i8", 1, MintOpNoArgs)
-OPDEF(MINT_CLT_UN_R8, "clt.un.r8", 1, MintOpNoArgs)
-
-OPDEF(MINT_CKFINITE, "ckfinite", 1, MintOpNoArgs)
-
-OPDEF(MINT_CKNULL, "cknull", 1, MintOpNoArgs)
-
-OPDEF(MINT_GETCHR, "getchr", 1, MintOpNoArgs)
-OPDEF(MINT_STRLEN, "strlen", 1, MintOpNoArgs)
-OPDEF(MINT_ARRAY_RANK, "array_rank", 1, MintOpNoArgs)
-
-OPDEF(MINT_ICALL_V_V, "mono_icall_v_v", 2, MintOpClassToken) /* not really */
-OPDEF(MINT_ICALL_V_P, "mono_icall_v_p", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_P_V, "mono_icall_p_v", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_P_P, "mono_icall_p_p", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PP_V, "mono_icall_pp_v", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PI_V, "mono_icall_pi_v", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PP_P, "mono_icall_pp_p", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PI_P, "mono_icall_pi_p", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PPP_V, "mono_icall_ppp_v", 2, MintOpClassToken)
-OPDEF(MINT_ICALL_PPI_V, "mono_icall_ppi_v", 2, MintOpClassToken)
-OPDEF(MINT_MONO_LDPTR, "mono_ldptr", 2, MintOpClassToken) 
-OPDEF(MINT_MONO_NEWOBJ, "mono_newobj", 2, MintOpClassToken)
-OPDEF(MINT_MONO_RETOBJ, "mono_retobj", 1, MintOpNoArgs)
-OPDEF(MINT_MONO_FREE, "mono_free", 1, MintOpNoArgs)
-
-
diff --git a/mono/mini/interpreter/mintops.h b/mono/mini/interpreter/mintops.h
deleted file mode 100644 (file)
index e787526..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef __INTERPRETER_MINTOPS_H
-#define __INTERPRETER_MINTOPS_H
-
-#include <glib.h>
-
-typedef enum
-{
-       MintOpNoArgs,
-       MintOpShortInt,
-       MintOpUShortInt,
-       MintOpInt,
-       MintOpLongInt,
-       MintOpFloat,
-       MintOpDouble,
-       MintOpBranch,
-       MintOpShortBranch,
-       MintOpSwitch,
-       MintOpMethodToken,
-       MintOpFieldToken,
-       MintOpClassToken,
-       MintOpTwoShorts,
-       MintOpShortAndInt
-} MintOpArgType;
-
-#define OPDEF(a,b,c,d) \
-       a,
-enum {
-#include "mintops.def"
-       MINT_LASTOP
-};
-#undef OPDEF
-
-#if NO_UNALIGNED_ACCESS
-#  if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define READ32(x) (((guint16 *)(x)) [0] | ((guint16 *)(x)) [1] << 16)
-#define READ64(x) ((guint64)((guint16 *)(x)) [0] | \
-                   (guint64)((guint16 *)(x)) [1] << 16 | \
-                   (guint64)((guint16 *)(x)) [2] << 32 | \
-                   (guint64)((guint16 *)(x)) [3] << 48)
-#  else
-#define READ32(x) (((guint16 *)(x)) [0] << 16 | ((guint16 *)(x)) [1])
-#define READ64(x) ((guint64)((guint16 *)(x)) [0] << 48 | \
-                   (guint64)((guint16 *)(x)) [1] << 32 | \
-                   (guint64)((guint16 *)(x)) [2] << 16 | \
-                   (guint64)((guint16 *)(x)) [3])
-#  endif
-#else /* unaligned access OK */
-#define READ32(x) (*(guint32 *)(x))
-#define READ64(x) (*(guint64 *)(x))
-#endif
-
-extern const char *mono_interp_opname[];
-extern unsigned char mono_interp_oplen[];
-extern MintOpArgType mono_interp_opargtype[];
-extern const guint16 *mono_interp_dis_mintop(const unsigned short *base, const guint16 *ip);
-
-#endif
-
diff --git a/mono/mini/interpreter/transform.c b/mono/mini/interpreter/transform.c
deleted file mode 100644 (file)
index 149b452..0000000
+++ /dev/null
@@ -1,3284 +0,0 @@
-/*
- * transform CIL into different opcodes for more
- * efficient interpretation
- *
- * Written by Bernie Solomon (bernard@ugsolutions.com)
- * Copyright (c) 2004.
- */
-
-#include <string.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/exception.h>
-#include <mono/metadata/mono-endian.h>
-#include <mono/metadata/marshal.h>
-#include <mono/metadata/profiler-private.h>
-#include <mono/metadata/tabledefs.h>
-
-#include <mono/mini/mini.h>
-
-#include "mintops.h"
-#include "interp-internals.h"
-#include "interp.h"
-
-// TODO: export from marshal.c
-MonoDelegate* mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
-
-#define DEBUG 0
-
-typedef struct
-{
-       MonoClass *klass;
-       unsigned char type;
-       unsigned char flags;
-} StackInfo;
-
-typedef struct
-{
-       MonoMethod *method;
-       MonoMethodHeader *header;
-       RuntimeMethod *rtm;
-       const unsigned char *il_code;
-       const unsigned char *ip;
-       const unsigned char *last_ip;
-       const unsigned char *in_start;
-       int code_size;
-       int *in_offsets;
-       int *forward_refs;
-       StackInfo **stack_state;
-       int *stack_height;
-       int *vt_stack_size;
-       unsigned char *is_bb_start;
-       unsigned short *new_code;
-       unsigned short *new_code_end;
-       unsigned short *new_ip;
-       unsigned short *last_new_ip;
-       unsigned int max_code_size;
-       StackInfo *stack;
-       StackInfo *sp;
-       unsigned int max_stack_height;
-       unsigned int vt_sp;
-       unsigned int max_vt_sp;
-       int n_data_items;
-       int max_data_items;
-       void **data_items;
-       GHashTable *data_hash;
-} TransformData;
-
-#define MINT_TYPE_I1 0
-#define MINT_TYPE_U1 1
-#define MINT_TYPE_I2 2
-#define MINT_TYPE_U2 3
-#define MINT_TYPE_I4 4
-#define MINT_TYPE_I8 5
-#define MINT_TYPE_R4 6
-#define MINT_TYPE_R8 7
-#define MINT_TYPE_O  8
-#define MINT_TYPE_P  9
-#define MINT_TYPE_VT 10
-
-#define STACK_TYPE_I4 0
-#define STACK_TYPE_I8 1
-#define STACK_TYPE_R8 2
-#define STACK_TYPE_O  3
-#define STACK_TYPE_VT 4
-#define STACK_TYPE_MP 5
-#define STACK_TYPE_F  6
-
-static const char *stack_type_string [] = { "I4", "I8", "R8", "O ", "VT", "MP", "F " };
-
-#if SIZEOF_VOID_P == 8
-#define STACK_TYPE_I STACK_TYPE_I8
-#else
-#define STACK_TYPE_I STACK_TYPE_I4
-#endif
-
-static int stack_type [] = {
-       STACK_TYPE_I4, /*I1*/
-       STACK_TYPE_I4, /*U1*/
-       STACK_TYPE_I4, /*I2*/
-       STACK_TYPE_I4, /*U2*/
-       STACK_TYPE_I4, /*I4*/
-       STACK_TYPE_I8, /*I8*/
-       STACK_TYPE_R8, /*R4*/
-       STACK_TYPE_R8, /*R8*/
-       STACK_TYPE_O,  /*O*/
-       STACK_TYPE_MP, /*P*/
-       STACK_TYPE_VT
-};
-
-static void
-grow_code (TransformData *td)
-{
-       unsigned int old_ip_offset = td->new_ip - td->new_code;
-       unsigned int old_last_ip_offset = td->last_new_ip - td->new_code;
-       g_assert (old_ip_offset <= td->max_code_size);
-       td->new_code = g_realloc (td->new_code, (td->max_code_size *= 2) * sizeof (td->new_code [0]));
-       td->new_code_end = td->new_code + td->max_code_size;
-       td->new_ip = td->new_code + old_ip_offset;
-       td->last_new_ip = td->new_code + old_last_ip_offset;
-}
-
-#define ENSURE_CODE(td, n) \
-       do { \
-               if ((td)->new_ip + (n) > (td)->new_code_end) \
-                       grow_code (td); \
-       } while (0)
-
-#define ADD_CODE(td, n) \
-       do { \
-               if ((td)->new_ip == (td)->new_code_end) \
-                       grow_code (td); \
-               *(td)->new_ip++ = (n); \
-       } while (0)
-
-#define CHECK_STACK(td, n) \
-       do { \
-               int stack_size = (td)->sp - (td)->stack; \
-               if (stack_size < (n)) \
-                       g_warning ("%s.%s: not enough values (%d < %d) on stack at %04x", \
-                               (td)->method->klass->name, (td)->method->name, \
-                               stack_size, n, (td)->ip - (td)->il_code); \
-       } while (0)
-
-#define ENSURE_I4(td, sp_off) \
-       do { \
-               if ((td)->sp [-sp_off].type == STACK_TYPE_I8) \
-                       ADD_CODE(td, sp_off == 1 ? MINT_CONV_I4_I8 : MINT_CONV_I4_I8_SP); \
-       } while (0)
-
-static void 
-handle_branch(TransformData *td, int short_op, int long_op, int offset) 
-{
-       int shorten_branch = 0;
-       int target = td->ip + offset - td->il_code;
-       if (target < 0 || target >= td->code_size)
-               g_assert_not_reached ();
-       if (offset > 0 && td->stack_height [target] < 0) {
-               td->stack_height [target] = td->sp - td->stack;
-               if (td->stack_height [target] > 0)
-                       td->stack_state [target] = g_memdup (td->stack, td->stack_height [target] * sizeof (td->stack [0]));
-               td->vt_stack_size [target] = td->vt_sp;
-       }
-       if (offset < 0) {
-               offset = td->in_offsets [target] - (td->new_ip - td->new_code);
-               if (offset >= -32768) {
-                       shorten_branch = 1;
-               }
-       } else {
-               int prev = td->forward_refs [target];
-               td->forward_refs [td->ip - td->il_code] = prev;
-               td->forward_refs [target] = td->ip - td->il_code;
-               offset = 0;
-               if (td->header->code_size <= 25000) /* FIX to be precise somehow? */
-                       shorten_branch = 1;
-       }
-       if (shorten_branch) {
-               ADD_CODE(td, short_op);
-               ADD_CODE(td, offset);
-       } else {
-               ADD_CODE(td, long_op);
-               ADD_CODE(td, * (unsigned short *)(&offset));
-               ADD_CODE(td, * ((unsigned short *)&offset + 1));
-       }
-}
-
-static void 
-one_arg_branch(TransformData *td, int mint_op, int offset) 
-{
-       int type = td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-1].type;
-       int long_op = mint_op + type - STACK_TYPE_I4;
-       int short_op = long_op + MINT_BRFALSE_I4_S - MINT_BRFALSE_I4;
-       CHECK_STACK(td, 1);
-       --td->sp;
-       handle_branch (td, short_op, long_op, offset);
-}
-
-static void 
-two_arg_branch(TransformData *td, int mint_op, int offset) 
-{
-       int type1 = td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-1].type;
-       int type2 = td->sp [-2].type == STACK_TYPE_O || td->sp [-2].type == STACK_TYPE_MP ? STACK_TYPE_I : td->sp [-2].type;
-       int long_op = mint_op + type1 - STACK_TYPE_I4;
-       int short_op = long_op + MINT_BEQ_I4_S - MINT_BEQ_I4;
-       CHECK_STACK(td, 2);
-       if (type1 == STACK_TYPE_I4 && type2 == STACK_TYPE_I8) {
-               ADD_CODE(td, MINT_CONV_I8_I4);
-               td->in_offsets [td->ip - td->il_code]++;
-       } else if (type1 == STACK_TYPE_I8 && type2 == STACK_TYPE_I4) {
-               ADD_CODE(td, MINT_CONV_I8_I4_SP);
-               td->in_offsets [td->ip - td->il_code]++;
-       } else if (type1 != type2) {
-               g_warning("%s.%s: branch type mismatch %d %d", 
-                       td->method->klass->name, td->method->name, 
-                       td->sp [-1].type, td->sp [-2].type);
-       }
-       td->sp -= 2;
-       handle_branch (td, short_op, long_op, offset);
-}
-
-static void
-unary_arith_op(TransformData *td, int mint_op)
-{
-       int op = mint_op + td->sp [-1].type - STACK_TYPE_I4;
-       CHECK_STACK(td, 1);
-       ADD_CODE(td, op);
-}
-
-static void
-binary_arith_op(TransformData *td, int mint_op)
-{
-       int type1 = td->sp [-2].type;
-       int type2 = td->sp [-1].type;
-       int op;
-#if SIZEOF_VOID_P == 8
-       if ((type1 == STACK_TYPE_MP || type1 == STACK_TYPE_I8) && type2 == STACK_TYPE_I4) {
-               ADD_CODE(td, MINT_CONV_I8_I4);
-               type2 = STACK_TYPE_I8;
-       }
-       if (type1 == STACK_TYPE_I4 && (type2 == STACK_TYPE_MP || type2 == STACK_TYPE_I8)) {
-               ADD_CODE(td, MINT_CONV_I8_I4_SP);
-               type1 = STACK_TYPE_I8;
-               td->sp [-2].type = STACK_TYPE_I8;
-       }
-#endif
-       if (type1 == STACK_TYPE_MP)
-               type1 = STACK_TYPE_I;
-       if (type2 == STACK_TYPE_MP)
-               type2 = STACK_TYPE_I;
-       if (type1 != type2) {
-               g_warning("%s.%s: %04x arith type mismatch %s %d %d", 
-                       td->method->klass->name, td->method->name, 
-                       td->ip - td->il_code, mono_interp_opname[mint_op], type1, type2);
-       }
-       op = mint_op + type1 - STACK_TYPE_I4;
-       CHECK_STACK(td, 2);
-       ADD_CODE(td, op);
-       --td->sp;
-}
-
-static void
-binary_int_op(TransformData *td, int mint_op)
-{
-       int op = mint_op + td->sp [-1].type - STACK_TYPE_I4;
-       CHECK_STACK(td, 2);
-       if (td->sp [-1].type != td->sp [-2].type)
-               g_warning("%s.%s: int type mismatch", td->method->klass->name, td->method->name);
-       ADD_CODE(td, op);
-       --td->sp;
-}
-
-static void
-shift_op(TransformData *td, int mint_op)
-{
-       int op = mint_op + td->sp [-2].type - STACK_TYPE_I4;
-       CHECK_STACK(td, 2);
-       if (td->sp [-1].type != STACK_TYPE_I4) {
-               g_warning("%s.%s: shift type mismatch %d", 
-                       td->method->klass->name, td->method->name,
-                       td->sp [-2].type);
-       }
-       ADD_CODE(td, op);
-       --td->sp;
-}
-
-static int 
-mint_type(MonoType *type)
-{
-       if (type->byref)
-               return MINT_TYPE_P;
-enum_type:
-       switch (type->type) {
-       case MONO_TYPE_I1:
-               return MINT_TYPE_I1;
-       case MONO_TYPE_U1:
-       case MONO_TYPE_BOOLEAN:
-               return MINT_TYPE_U1;
-       case MONO_TYPE_I2:
-               return MINT_TYPE_I2;
-       case MONO_TYPE_U2:
-       case MONO_TYPE_CHAR:
-               return MINT_TYPE_U2;
-       case MONO_TYPE_I4:
-       case MONO_TYPE_U4:
-               return MINT_TYPE_I4;
-       case MONO_TYPE_I:
-       case MONO_TYPE_U:
-#if SIZEOF_VOID_P == 4
-               return MINT_TYPE_I4;
-#else
-               return MINT_TYPE_I8;
-#endif
-       case MONO_TYPE_PTR:
-               return MINT_TYPE_P;
-       case MONO_TYPE_R4:
-               return MINT_TYPE_R4;
-       case MONO_TYPE_I8:
-       case MONO_TYPE_U8:
-               return MINT_TYPE_I8;
-       case MONO_TYPE_R8:
-               return MINT_TYPE_R8;
-       case MONO_TYPE_STRING:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_OBJECT:
-       case MONO_TYPE_ARRAY:
-               return MINT_TYPE_O;
-       case MONO_TYPE_VALUETYPE:
-               if (type->data.klass->enumtype) {
-                       type = mono_class_enum_basetype (type->data.klass);
-                       goto enum_type;
-               } else
-                       return MINT_TYPE_VT;
-       case MONO_TYPE_GENERICINST:
-               type = &type->data.generic_class->container_class->byval_arg;
-               goto enum_type;
-       default:
-               g_warning ("got type 0x%02x", type->type);
-               g_assert_not_reached ();
-       }
-       return -1;
-}
-
-static int 
-can_store (int stack_type, int var_type)
-{
-       if (stack_type == STACK_TYPE_O || stack_type == STACK_TYPE_MP)
-               stack_type = STACK_TYPE_I;
-       if (var_type == STACK_TYPE_O || var_type == STACK_TYPE_MP)
-               var_type = STACK_TYPE_I;
-       return stack_type == var_type;
-}
-
-#define SET_SIMPLE_TYPE(s, ty) \
-       do { \
-               (s)->type = (ty); \
-               (s)->flags = 0; \
-               (s)->klass = NULL; \
-       } while (0)
-
-#define SET_TYPE(s, ty, k) \
-       do { \
-               (s)->type = (ty); \
-               (s)->flags = 0; \
-               (s)->klass = k; \
-       } while (0)
-
-#define PUSH_SIMPLE_TYPE(td, ty) \
-       do { \
-               int sp_height; \
-               (td)->sp++; \
-               sp_height = (td)->sp - (td)->stack; \
-               if (sp_height > (td)->max_stack_height) \
-                       (td)->max_stack_height = sp_height; \
-               SET_SIMPLE_TYPE((td)->sp - 1, ty); \
-       } while (0)
-
-#define PUSH_TYPE(td, ty, k) \
-       do { \
-               int sp_height; \
-               (td)->sp++; \
-               sp_height = (td)->sp - (td)->stack; \
-               if (sp_height > (td)->max_stack_height) \
-                       (td)->max_stack_height = sp_height; \
-               SET_TYPE((td)->sp - 1, ty, k); \
-       } while (0)
-
-#define PUSH_VT(td, size) \
-       do { \
-               (td)->vt_sp += ((size) + 7) & ~7; \
-               if ((td)->vt_sp > (td)->max_vt_sp) \
-                       (td)->max_vt_sp = (td)->vt_sp; \
-       } while (0)
-
-#define POP_VT(td, size) \
-       do { \
-               (td)->vt_sp -= ((size) + 7) & ~7; \
-       } while (0)
-
-#if NO_UNALIGNED_ACCESS
-#define WRITE32(td, v) \
-       do { \
-               ENSURE_CODE(td, 2); \
-               * (guint16 *)((td)->new_ip) = * (guint16 *)(v); \
-               * ((guint16 *)((td)->new_ip) + 1) = * ((guint16 *)(v) + 1); \
-               (td)->new_ip += 2; \
-       } while (0)
-
-#define WRITE64(td, v) \
-       do { \
-               ENSURE_CODE(td, 4); \
-               * (guint16 *)((td)->new_ip) = * (guint16 *)(v); \
-               * ((guint16 *)((td)->new_ip) + 1) = * ((guint16 *)(v) + 1); \
-               * ((guint16 *)((td)->new_ip) + 2) = * ((guint16 *)(v) + 2); \
-               * ((guint16 *)((td)->new_ip) + 3) = * ((guint16 *)(v) + 3); \
-               (td)->new_ip += 4; \
-       } while (0)
-#else
-#define WRITE32(td, v) \
-       do { \
-               ENSURE_CODE(td, 2); \
-               * (guint32 *)((td)->new_ip) = * (guint32 *)(v); \
-               (td)->new_ip += 2; \
-       } while (0)
-
-#define WRITE64(td, v) \
-       do { \
-               ENSURE_CODE(td, 4); \
-               * (guint64 *)((td)->new_ip) = * (guint64 *)(v); \
-               (td)->new_ip += 4; \
-       } while (0)
-
-#endif
-
-static void 
-load_arg(TransformData *td, int n)
-{
-       int mt;
-       MonoClass *klass = NULL;
-       MonoType *type;
-
-       gboolean hasthis = mono_method_signature (td->method)->hasthis;
-       if (hasthis && n == 0)
-               type = &td->method->klass->byval_arg;
-       else
-               type = mono_method_signature (td->method)->params [hasthis ? n - 1 : n];
-
-       mt = mint_type (type);
-       if (mt == MINT_TYPE_VT) {
-               gint32 size;
-               klass = mono_class_from_mono_type (type);
-               if (mono_method_signature (td->method)->pinvoke)
-                       size = mono_class_native_size (klass, NULL);
-               else
-                       size = mono_class_value_size (klass, NULL);
-
-               if (hasthis && n == 0) {
-                       mt = MINT_TYPE_P;
-                       ADD_CODE (td, MINT_LDARG_P);
-                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
-                       klass = NULL;
-               } else {
-                       PUSH_VT (td, size);
-                       ADD_CODE (td, MINT_LDARG_VT);
-                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
-                       WRITE32 (td, &size);
-               }
-       } else {
-               if (hasthis && n == 0) {
-                       mt = MINT_TYPE_P;
-                       ADD_CODE (td, MINT_LDARG_P);
-                       ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offset */
-                       klass = NULL;
-               } else {
-                       ADD_CODE(td, MINT_LDARG_I1 + (mt - MINT_TYPE_I1));
-                       ADD_CODE(td, td->rtm->arg_offsets [n]); /* FIX for large offset */
-                       if (mt == MINT_TYPE_O)
-                               klass = mono_class_from_mono_type (type);
-               }
-       }
-       PUSH_TYPE(td, stack_type[mt], klass);
-}
-
-static void 
-store_arg(TransformData *td, int n)
-{
-       int mt;
-       CHECK_STACK (td, 1);
-       MonoType *type;
-
-       gboolean hasthis = mono_method_signature (td->method)->hasthis;
-       if (hasthis && n == 0)
-               type = &td->method->klass->byval_arg;
-       else
-               type = mono_method_signature (td->method)->params [n - !!hasthis];
-
-       mt = mint_type (type);
-       if (mt == MINT_TYPE_VT) {
-               gint32 size;
-               g_error ("data.klass");
-               if (mono_method_signature (td->method)->pinvoke)
-                       size = mono_class_native_size (type->data.klass, NULL);
-               else
-                       size = mono_class_value_size (type->data.klass, NULL);
-               ADD_CODE(td, MINT_STARG_VT);
-               ADD_CODE(td, n);
-               WRITE32(td, &size);
-               if (td->sp [-1].type == STACK_TYPE_VT)
-                       POP_VT(td, size);
-       } else {
-               ADD_CODE(td, MINT_STARG_I1 + (mt - MINT_TYPE_I1));
-               ADD_CODE(td, td->rtm->arg_offsets [n]);
-       }
-       --td->sp;
-}
-
-static void 
-store_inarg(TransformData *td, int n)
-{
-       MonoType *type;
-       gboolean hasthis = mono_method_signature (td->method)->hasthis;
-       if (hasthis && n == 0)
-               type = &td->method->klass->byval_arg;
-       else
-               type = mono_method_signature (td->method)->params [n - !!hasthis];
-
-       int mt = mint_type (type);
-       if (hasthis && n == 0) {
-               ADD_CODE (td, MINT_STINARG_P);
-               ADD_CODE (td, n);
-               return;
-       }
-       if (mt == MINT_TYPE_VT) {
-               MonoClass *klass = mono_class_from_mono_type (type);
-               gint32 size;
-               if (mono_method_signature (td->method)->pinvoke)
-                       size = mono_class_native_size (klass, NULL);
-               else
-                       size = mono_class_value_size (klass, NULL);
-               ADD_CODE(td, MINT_STINARG_VT);
-               ADD_CODE(td, n);
-               WRITE32(td, &size);
-       } else {
-               ADD_CODE(td, MINT_STINARG_I1 + (mt - MINT_TYPE_I1));
-               ADD_CODE(td, n);
-       }
-}
-
-static void 
-load_local(TransformData *td, int n)
-{
-       MonoType *type = td->header->locals [n];
-       int mt = mint_type (type);
-       int offset = td->rtm->local_offsets [n];
-       MonoClass *klass = NULL;
-       if (mt == MINT_TYPE_VT) {
-               klass = mono_class_from_mono_type (type);
-               gint32 size = mono_class_value_size (klass, NULL);
-               PUSH_VT(td, size);
-               ADD_CODE(td, MINT_LDLOC_VT);
-               ADD_CODE(td, offset); /*FIX for large offset */
-               WRITE32(td, &size);
-       } else {
-               g_assert (mt < MINT_TYPE_VT);
-               if (mt == MINT_TYPE_I4 && !td->is_bb_start [td->in_start - td->il_code] && td->last_new_ip != NULL &&
-                       td->last_new_ip [0] == MINT_STLOC_I4 && td->last_new_ip [1] == offset) {
-                       td->last_new_ip [0] = MINT_STLOC_NP_I4;
-               } else if (mt == MINT_TYPE_O && !td->is_bb_start [td->in_start - td->il_code] && td->last_new_ip != NULL &&
-                       td->last_new_ip [0] == MINT_STLOC_O && td->last_new_ip [1] == offset) {
-                       td->last_new_ip [0] = MINT_STLOC_NP_O;
-               } else {
-                       ADD_CODE(td, MINT_LDLOC_I1 + (mt - MINT_TYPE_I1));
-                       ADD_CODE(td, offset); /*FIX for large offset */
-               }
-               if (mt == MINT_TYPE_O)
-                       klass = mono_class_from_mono_type (type);
-       }
-       PUSH_TYPE(td, stack_type[mt], klass);
-}
-
-static void 
-store_local(TransformData *td, int n)
-{
-       MonoType *type = td->header->locals [n];
-       int mt = mint_type (type);
-       int offset = td->rtm->local_offsets [n];
-       CHECK_STACK (td, 1);
-#if SIZEOF_VOID_P == 8
-       if (td->sp [-1].type == STACK_TYPE_I4 && stack_type [mt] == STACK_TYPE_I8) {
-               ADD_CODE(td, MINT_CONV_I8_I4);
-               td->sp [-1].type = STACK_TYPE_I8;
-       }
-#endif
-       if (!can_store(td->sp [-1].type, stack_type [mt])) {
-               g_warning("%s.%s: Store local stack type mismatch %d %d", 
-                       td->method->klass->name, td->method->name,
-                       stack_type [mt], td->sp [-1].type);
-       }
-       if (mt == MINT_TYPE_VT) {
-               MonoClass *klass = mono_class_from_mono_type (type);
-               gint32 size = mono_class_value_size (klass, NULL);
-               ADD_CODE(td, MINT_STLOC_VT);
-               ADD_CODE(td, offset); /*FIX for large offset */
-               WRITE32(td, &size);
-               if (td->sp [-1].type == STACK_TYPE_VT)
-                       POP_VT(td, size);
-       } else {
-               g_assert (mt < MINT_TYPE_VT);
-               ADD_CODE(td, MINT_STLOC_I1 + (mt - MINT_TYPE_I1));
-               ADD_CODE(td, offset); /*FIX for large offset */
-       }
-       --td->sp;
-}
-
-#define SIMPLE_OP(td, op) \
-       do { \
-               ADD_CODE(&td, op); \
-               ++td.ip; \
-       } while (0)
-
-static guint16
-get_data_item_index (TransformData *td, void *ptr)
-{
-       gpointer p = g_hash_table_lookup (td->data_hash, ptr);
-       guint index;
-       if (p != NULL)
-               return GPOINTER_TO_UINT (p) - 1;
-       if (td->max_data_items == td->n_data_items) {
-               td->max_data_items = td->n_data_items == 0 ? 16 : 2 * td->max_data_items;
-               td->data_items = g_realloc (td->data_items, td->max_data_items * sizeof(td->data_items [0]));
-       }
-       index = td->n_data_items;
-       td->data_items [index] = ptr;
-       ++td->n_data_items;
-       g_hash_table_insert (td->data_hash, ptr, GUINT_TO_POINTER (index + 1));
-       return index;
-}
-
-static void
-interp_transform_call (TransformData *td, MonoMethod *method, MonoMethod *target_method, MonoDomain *domain, MonoGenericContext *generic_context, unsigned char *is_bb_start, int body_start_offset, MonoClass *constrained_class)
-{
-       MonoImage *image = method->klass->image;
-       MonoMethodSignature *csignature;
-       MonoError error;
-       int virtual = *td->ip == CEE_CALLVIRT;
-       int calli = *td->ip == CEE_CALLI || *td->ip == CEE_MONO_CALLI_EXTRA_ARG;
-       int i;
-       guint32 vt_stack_used = 0;
-       guint32 vt_res_size = 0;
-       int op = -1;
-       int native = 0;
-       int is_void = 0;
-
-       guint32 token = read32 (td->ip + 1);
-
-       if (target_method == NULL) {
-               if (calli) {
-                       CHECK_STACK(td, 1);
-                       native = (method->wrapper_type != MONO_WRAPPER_DELEGATE_INVOKE && td->sp [-1].type == STACK_TYPE_I);
-                       --td->sp;
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               csignature = (MonoMethodSignature *)mono_method_get_wrapper_data (method, token);
-                       else
-                               csignature = mono_metadata_parse_signature (image, token);
-                       target_method = NULL;
-               } else {
-                       if (method->wrapper_type == MONO_WRAPPER_NONE)
-                               target_method = mono_get_method_full (image, token, NULL, generic_context);
-                       else
-                               target_method = (MonoMethod *)mono_method_get_wrapper_data (method, token);
-                       csignature = mono_method_signature (target_method);
-                       if (target_method->klass == mono_defaults.string_class) {
-                               if (target_method->name [0] == 'g') {
-                                       if (strcmp (target_method->name, "get_Chars") == 0)
-                                               op = MINT_GETCHR;
-                                       else if (strcmp (target_method->name, "get_Length") == 0)
-                                               op = MINT_STRLEN;
-                               }
-                       } else if (target_method->klass == mono_defaults.array_class) {
-                               if (strcmp (target_method->name, "get_Rank") == 0)
-                                       op = MINT_ARRAY_RANK;
-                               else if (strcmp (target_method->name, "get_Length") == 0)
-                                       op = MINT_LDLEN;
-                       }
-               }
-       } else {
-               csignature = mono_method_signature (target_method);
-       }
-
-       if (constrained_class) {
-               if (constrained_class->enumtype && !strcmp (target_method->name, "GetHashCode")) {
-                       /* Use the corresponding method from the base type to avoid boxing */
-                       MonoType *base_type = mono_class_enum_basetype (constrained_class);
-                       g_assert (base_type);
-                       constrained_class = mono_class_from_mono_type (base_type);
-                       target_method = mono_class_get_method_from_name (constrained_class, target_method->name, 0);
-                       g_assert (target_method);
-               }
-       }
-
-       if (constrained_class) {
-               mono_class_setup_vtable (constrained_class);
-#if DEBUG_INTERP
-               g_print ("CONSTRAINED.CALLVIRT: %s::%s.  %s (%p) ->\n", target_method->klass->name, target_method->name, mono_signature_full_name (target_method->signature), target_method);
-#endif
-               target_method = mono_get_method_constrained_with_method (image, target_method, constrained_class, generic_context, &error);
-#if DEBUG_INTERP
-               g_print ("                    : %s::%s.  %s (%p)\n", target_method->klass->name, target_method->name, mono_signature_full_name (target_method->signature), target_method);
-#endif
-               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               mono_class_setup_vtable (target_method->klass);
-
-               if (constrained_class->valuetype && (target_method->klass == mono_defaults.object_class || target_method->klass == mono_defaults.enum_class->parent || target_method->klass == mono_defaults.enum_class)) {
-                       ADD_CODE (td, MINT_BOX);
-                       ADD_CODE (td, get_data_item_index (td, constrained_class));
-                       ADD_CODE (td, csignature->param_count);
-               } else if (!constrained_class->valuetype) {
-                       /* managed pointer on the stack, we need to deref that puppy */
-                       ADD_CODE (td, MINT_LDIND_I);
-                       ADD_CODE (td, csignature->param_count);
-               } else {
-                       g_assert (target_method->klass->valuetype);
-                       virtual = FALSE;
-               }
-       }
-
-       if (target_method)
-               mono_class_init (target_method->klass);
-
-       CHECK_STACK (td, csignature->param_count + csignature->hasthis);
-       if (!calli && (!virtual || (target_method->flags & METHOD_ATTRIBUTE_VIRTUAL) == 0) &&
-               (target_method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) == 0 && 
-               (target_method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) == 0) {
-               int called_inited = mono_class_vtable (domain, target_method->klass)->initialized;
-               MonoMethodHeader *mheader = mono_method_get_header (target_method);
-
-               if (/*mono_metadata_signature_equal (method->signature, target_method->signature) */ method == target_method && *(td->ip + 5) == CEE_RET) {
-                       int offset;
-                       if (mono_interp_traceopt)
-                               g_print ("Optimize tail call of %s.%s\n", target_method->klass->name, target_method->name);
-                       for (i = csignature->param_count - 1; i >= 0; --i)
-                               store_arg (td, i + csignature->hasthis);
-
-                       if (csignature->hasthis) {
-                               g_error ("STTHIS removal");
-                               // ADD_CODE(td, MINT_STTHIS);
-                               --td->sp;
-                       }
-                       ADD_CODE(td, MINT_BR_S);
-                       offset = body_start_offset - ((td->new_ip - 1) - td->new_code);
-                       ADD_CODE(td, offset);
-                       if (!is_bb_start [td->ip + 5 - td->il_code])
-                               ++td->ip; /* gobble the CEE_RET if it isn't branched to */                              
-                       td->ip += 5;
-                       return;
-               } else {
-                       /* mheader might not exist if this is a delegate invoc, etc */
-                       if (mheader && *mheader->code == CEE_RET && called_inited) {
-                               if (mono_interp_traceopt)
-                                       g_print ("Inline (empty) call of %s.%s\n", target_method->klass->name, target_method->name);
-                               for (i = 0; i < csignature->param_count; i++)
-                                       ADD_CODE(td, MINT_POP); /*FIX: vt */
-                               if (csignature->hasthis) {
-                                       if (virtual)
-                                               ADD_CODE(td, MINT_CKNULL);
-                                       ADD_CODE(td, MINT_POP);
-                               }
-                               td->sp -= csignature->param_count + csignature->hasthis;
-                               td->ip += 5;
-                               return;
-                       }
-               }
-       }
-       if (method->wrapper_type == MONO_WRAPPER_NONE && target_method != NULL) {
-               if (target_method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
-                       target_method = mono_marshal_get_native_wrapper (target_method, FALSE, FALSE);
-               if (!virtual && target_method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
-                       target_method = mono_marshal_get_synchronized_wrapper (target_method);
-       }
-       g_assert (csignature->call_convention == MONO_CALL_DEFAULT || csignature->call_convention == MONO_CALL_C);
-       td->sp -= csignature->param_count + !!csignature->hasthis;
-       for (i = 0; i < csignature->param_count; ++i) {
-               if (td->sp [i + !!csignature->hasthis].type == STACK_TYPE_VT) {
-                       gint32 size;
-                       MonoClass *klass = mono_class_from_mono_type (csignature->params [i]);
-                       if (csignature->pinvoke && method->wrapper_type != MONO_WRAPPER_NONE)
-                               size = mono_class_native_size (klass, NULL);
-                       else
-                               size = mono_class_value_size (klass, NULL);
-                       size = (size + 7) & ~7;
-                       vt_stack_used += size;
-               }
-       }
-
-       /* need to handle typedbyref ... */
-       if (csignature->ret->type != MONO_TYPE_VOID) {
-               int mt = mint_type(csignature->ret);
-               MonoClass *klass = mono_class_from_mono_type (csignature->ret);
-               if (mt == MINT_TYPE_VT) {
-                       if (csignature->pinvoke && method->wrapper_type != MONO_WRAPPER_NONE)
-                               vt_res_size = mono_class_native_size (klass, NULL);
-                       else
-                               vt_res_size = mono_class_value_size (klass, NULL);
-                       PUSH_VT(td, vt_res_size);
-               }
-               PUSH_TYPE(td, stack_type[mt], klass);
-       } else
-               is_void = TRUE;
-
-       if (op >= 0) {
-               ADD_CODE(td, op);
-#if SIZEOF_VOID_P == 8
-               if (op == MINT_LDLEN)
-                       ADD_CODE(td, MINT_CONV_I4_I8);
-#endif
-       } else {
-               if (calli)
-                       ADD_CODE(td, native ? MINT_CALLI_NAT : MINT_CALLI);
-               else if (virtual)
-                       ADD_CODE(td, is_void ? MINT_VCALLVIRT : MINT_CALLVIRT);
-               else
-                       ADD_CODE(td, is_void ? MINT_VCALL : MINT_CALL);
-               
-               if (calli) {
-                       ADD_CODE(td, get_data_item_index (td, (void *)csignature));
-               } else {
-                       ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               }
-       }
-       td->ip += 5;
-       if (vt_stack_used != 0 || vt_res_size != 0) {
-               ADD_CODE(td, MINT_VTRESULT);
-               ADD_CODE(td, vt_res_size);
-               WRITE32(td, &vt_stack_used);
-               td->vt_sp -= vt_stack_used;
-       }
-}
-
-static void
-generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start)
-{
-       MonoMethodHeader *header = mono_method_get_header (method);
-       MonoMethodSignature *signature = mono_method_signature (method);
-       MonoImage *image = method->klass->image;
-       MonoDomain *domain = mono_domain_get ();
-       MonoGenericContext *generic_context = NULL;
-       MonoClass *constrained_class = NULL;
-       MonoError error;
-       int offset, mt;
-       int i;
-       int i32;
-       MonoClass *klass;
-       MonoClassField *field;
-       const unsigned char *end;
-       int new_in_start_offset;
-       int body_start_offset;
-       int target;
-       guint32 token;
-       TransformData td;
-       int generating_code = 1;
-
-       if (mono_method_signature (method)->is_inflated)
-               generic_context = &((MonoMethodInflated *) method)->context;
-
-       memset(&td, 0, sizeof(td));
-       td.method = method;
-       td.rtm = rtm;
-       td.is_bb_start = is_bb_start;
-       td.il_code = header->code;
-       td.code_size = header->code_size;
-       td.header = header;
-       td.max_code_size = td.code_size;
-       td.new_code = (unsigned short *)g_malloc(td.max_code_size * sizeof(gushort));
-       td.new_code_end = td.new_code + td.max_code_size;
-       td.in_offsets = g_malloc0(header->code_size * sizeof(int));
-       td.forward_refs = g_malloc(header->code_size * sizeof(int));
-       td.stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
-       td.stack_height = g_malloc(header->code_size * sizeof(int));
-       td.vt_stack_size = g_malloc(header->code_size * sizeof(int));
-       td.n_data_items = 0;
-       td.max_data_items = 0;
-       td.data_items = NULL;
-       td.data_hash = g_hash_table_new (NULL, NULL);
-       rtm->data_items = td.data_items;
-       for (i = 0; i < header->code_size; i++) {
-               td.forward_refs [i] = -1;
-               td.stack_height [i] = -1;
-       }
-       td.new_ip = td.new_code;
-       td.last_new_ip = NULL;
-
-       td.stack = g_malloc0(header->max_stack * sizeof(td.stack[0]));
-       td.sp = td.stack;
-       td.max_stack_height = 0;
-
-       for (i = 0; i < header->num_clauses; i++) {
-               MonoExceptionClause *c = header->clauses + i;
-               td.stack_height [c->handler_offset] = 0;
-               td.vt_stack_size [c->handler_offset] = 0;
-               td.is_bb_start [c->handler_offset] = 1;
-               if (c->flags == MONO_EXCEPTION_CLAUSE_NONE) {
-                       td.stack_height [c->handler_offset] = 1;
-                       td.stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
-                       td.stack_state [c->handler_offset][0].type = STACK_TYPE_O;
-                       td.stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
-               }
-       }
-
-       td.ip = header->code;
-       end = td.ip + header->code_size;
-
-       if (mono_interp_traceopt) {
-               char *tmp = mono_disasm_code (NULL, method, td.ip, end);
-               char *name = mono_method_full_name (method, TRUE);
-               g_print ("Method %s, original code:\n", name);
-               g_print ("%s\n", tmp);
-               g_free (tmp);
-               g_free (name);
-       }
-
-       if (signature->hasthis)
-               store_inarg (&td, 0);
-       for (i = 0; i < signature->param_count; i++)
-               store_inarg (&td, i + !!signature->hasthis);
-
-       body_start_offset = td.new_ip - td.new_code;
-
-       for (i = 0; i < header->num_locals; i++) {
-               int mt = mint_type(header->locals [i]);
-               if (mt == MINT_TYPE_VT || mt == MINT_TYPE_O) {
-                       ADD_CODE(&td, MINT_INITLOCALS);
-                       break;
-               }
-       }
-
-       while (td.ip < end) {
-               int in_offset;
-
-               g_assert (td.sp >= td.stack);
-               g_assert (td.vt_sp < 0x10000000);
-               in_offset = td.ip - header->code;
-               td.in_offsets [in_offset] = td.new_ip - td.new_code;
-               new_in_start_offset = td.new_ip - td.new_code;
-               td.in_start = td.ip;
-               while (td.forward_refs [in_offset] >= 0) {
-                       int j = td.forward_refs [in_offset];
-                       int slot;
-                       td.forward_refs [in_offset] = td.forward_refs [j];
-                       if (td.in_offsets [j] < 0) {                        
-                               int old_switch_offset = -td.in_offsets [j];
-                               int new_switch_offset = td.in_offsets [old_switch_offset];
-                               int switch_case = (j - old_switch_offset - 5) / 4;
-                               int n_cases = read32 (header->code + old_switch_offset + 1);
-                               offset = (td.new_ip - td.new_code) - (new_switch_offset + 2 * n_cases + 3);
-                               slot = new_switch_offset + 3 + 2 * switch_case;
-                               td.new_code [slot] = * (unsigned short *)(&offset);
-                               td.new_code [slot + 1] = * ((unsigned short *)&offset + 1);
-                       } else {
-                               int op = td.new_code [td.in_offsets [j]];
-                               if (mono_interp_opargtype [op] == MintOpShortBranch) {
-                                       offset = (td.new_ip - td.new_code) - td.in_offsets [j];
-                                       g_assert (offset <= 32767);
-                                       slot = td.in_offsets [j] + 1;
-                                       td.new_code [slot] = offset;
-                               } else {
-                                       offset = (td.new_ip - td.new_code) - td.in_offsets [j];
-                                       slot = td.in_offsets [j] + 1;
-                                       td.new_code [slot] = * (unsigned short *)(&offset);
-                                       td.new_code [slot + 1] = * ((unsigned short *)&offset + 1);
-                               }
-                       }
-               }
-               if (td.stack_height [in_offset] >= 0) {
-                       g_assert (is_bb_start [in_offset]);
-                       if (td.stack_height [in_offset] > 0)
-                               memcpy (td.stack, td.stack_state [in_offset], td.stack_height [in_offset] * sizeof(td.stack [0]));
-                       td.sp = td.stack + td.stack_height [in_offset];
-                       td.vt_sp = td.vt_stack_size [in_offset];
-               }
-               if (is_bb_start [in_offset]) {
-                       generating_code = 1;
-               }
-               if (!generating_code) {
-                       while (td.ip < end && !is_bb_start [td.ip - td.il_code])
-                               ++td.ip;
-                       continue;
-               }
-               if (mono_interp_traceopt > 1) {
-                       printf("IL_%04lx %s %-10s -> IL_%04lx, sp %ld, %s %-12s vt_sp %u (max %u)\n", 
-                               td.ip - td.il_code,
-                               td.is_bb_start [td.ip - td.il_code] == 3 ? "<>" :
-                               td.is_bb_start [td.ip - td.il_code] == 2 ? "< " :
-                               td.is_bb_start [td.ip - td.il_code] == 1 ? " >" : "  ",
-                               mono_opcode_name (*td.ip), td.new_ip - td.new_code, td.sp - td.stack, 
-                               td.sp > td.stack ? stack_type_string [td.sp [-1].type] : "  ",
-                               (td.sp > td.stack && (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_VT)) ? (td.sp [-1].klass == NULL ? "?" : td.sp [-1].klass->name) : "",
-                               td.vt_sp, td.max_vt_sp);
-               }
-               switch (*td.ip) {
-               case CEE_NOP: 
-                       /* lose it */
-                       ++td.ip;
-                       break;
-               case CEE_BREAK:
-                       SIMPLE_OP(td, MINT_BREAK);
-                       break;
-               case CEE_LDARG_0:
-               case CEE_LDARG_1:
-               case CEE_LDARG_2:
-               case CEE_LDARG_3:
-                       load_arg (&td, *td.ip - CEE_LDARG_0);
-                       ++td.ip;
-                       break;
-               case CEE_LDLOC_0:
-               case CEE_LDLOC_1:
-               case CEE_LDLOC_2:
-               case CEE_LDLOC_3:
-                       load_local (&td, *td.ip - CEE_LDLOC_0);
-                       ++td.ip;
-                       break;
-               case CEE_STLOC_0:
-               case CEE_STLOC_1:
-               case CEE_STLOC_2:
-               case CEE_STLOC_3:
-                       store_local (&td, *td.ip - CEE_STLOC_0);
-                       ++td.ip;
-                       break;
-               case CEE_LDARG_S:
-                       load_arg (&td, ((guint8 *)td.ip)[1]);
-                       td.ip += 2;
-                       break;
-               case CEE_LDARGA_S: {
-                       /* NOTE: n includes this */
-                       int n = ((guint8 *)td.ip)[1];
-                       if (n == 0 && signature->hasthis) {
-                               g_error ("LDTHISA: NOPE");
-                               ADD_CODE(&td, MINT_LDTHISA);
-                       }
-                       else {
-                               ADD_CODE(&td, MINT_LDARGA);
-                               ADD_CODE(&td, td.rtm->arg_offsets [n]);
-                       }
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
-                       td.ip += 2;
-                       break;
-               }
-               case CEE_STARG_S:
-                       store_arg (&td, ((guint8 *)td.ip)[1]);
-                       td.ip += 2;
-                       break;
-               case CEE_LDLOC_S:
-                       load_local (&td, ((guint8 *)td.ip)[1]);
-                       td.ip += 2;
-                       break;
-               case CEE_LDLOCA_S:
-                       ADD_CODE(&td, MINT_LDLOCA_S);
-                       ADD_CODE(&td, td.rtm->local_offsets [((guint8 *)td.ip)[1]]);
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
-                       td.ip += 2;
-                       break;
-               case CEE_STLOC_S:
-                       store_local (&td, ((guint8 *)td.ip)[1]);
-                       td.ip += 2;
-                       break;
-               case CEE_LDNULL: 
-                       SIMPLE_OP(td, MINT_LDNULL);
-                       PUSH_TYPE(&td, STACK_TYPE_O, NULL);
-                       break;
-               case CEE_LDC_I4_M1:
-                       SIMPLE_OP(td, MINT_LDC_I4_M1);
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       break;
-               case CEE_LDC_I4_0:
-                       if (!td.is_bb_start[td.ip + 1 - td.il_code] && td.ip [1] == 0xfe && td.ip [2] == CEE_CEQ && 
-                               td.sp > td.stack && td.sp [-1].type == STACK_TYPE_I4) {
-                               SIMPLE_OP(td, MINT_CEQ0_I4);
-                               td.ip += 2;
-                       } else {
-                               SIMPLE_OP(td, MINT_LDC_I4_0);
-                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       }
-                       break;
-               case CEE_LDC_I4_1:
-                       if (!td.is_bb_start[td.ip + 1 - td.il_code] && 
-                               (td.ip [1] == CEE_ADD || td.ip [1] == CEE_SUB) && td.sp [-1].type == STACK_TYPE_I4) {
-                               ADD_CODE(&td, td.ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
-                               td.ip += 2;
-                       } else {
-                               SIMPLE_OP(td, MINT_LDC_I4_1);
-                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       }
-                       break;
-               case CEE_LDC_I4_2:
-               case CEE_LDC_I4_3:
-               case CEE_LDC_I4_4:
-               case CEE_LDC_I4_5:
-               case CEE_LDC_I4_6:
-               case CEE_LDC_I4_7:
-               case CEE_LDC_I4_8:
-                       SIMPLE_OP(td, (*td.ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       break;
-               case CEE_LDC_I4_S: 
-                       ADD_CODE(&td, MINT_LDC_I4_S);
-                       ADD_CODE(&td, ((gint8 *) td.ip) [1]);
-                       td.ip += 2;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       break;
-               case CEE_LDC_I4:
-                       i32 = read32 (td.ip + 1);
-                       ADD_CODE(&td, MINT_LDC_I4);
-                       WRITE32(&td, &i32);
-                       td.ip += 5;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                       break;
-               case CEE_LDC_I8: {
-                       gint64 val = read64 (td.ip + 1);
-                       ADD_CODE(&td, MINT_LDC_I8);
-                       WRITE64(&td, &val);
-                       td.ip += 9;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I8);
-                       break;
-               }
-               case CEE_LDC_R4: {
-                       float val;
-                       readr4 (td.ip + 1, &val);
-                       ADD_CODE(&td, MINT_LDC_R4);
-                       WRITE32(&td, &val);
-                       td.ip += 5;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
-                       break;
-               }
-               case CEE_LDC_R8: {
-                       double val;
-                       readr8 (td.ip + 1, &val);
-                       ADD_CODE(&td, MINT_LDC_R8);
-                       WRITE64(&td, &val);
-                       td.ip += 9;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
-                       break;
-               }
-               case CEE_DUP: {
-                       int type = td.sp [-1].type;
-                       MonoClass *klass = td.sp [-1].klass;
-                       if (td.sp [-1].type == STACK_TYPE_VT) {
-                               gint32 size = mono_class_value_size (klass, NULL);
-                               PUSH_VT(&td, size);
-                               ADD_CODE(&td, MINT_DUP_VT);
-                               WRITE32(&td, &size);
-                               td.ip ++;
-                       } else 
-                               SIMPLE_OP(td, MINT_DUP);
-                       PUSH_TYPE(&td, type, klass);
-                       break;
-               }
-               case CEE_POP:
-                       CHECK_STACK(&td, 1);
-                       SIMPLE_OP(td, MINT_POP);
-                       if (td.sp [-1].type == STACK_TYPE_VT) {
-                               int size = mono_class_value_size (td.sp [-1].klass, NULL);
-                               size = (size + 7) & ~7;
-                               ADD_CODE(&td, MINT_VTRESULT);
-                               ADD_CODE(&td, 0);
-                               WRITE32(&td, &size);
-                               td.vt_sp -= size;
-                       }
-                       --td.sp;
-                       break;
-               case CEE_JMP: {
-                       MonoMethod *m;
-                       if (td.sp > td.stack)
-                               g_warning ("CEE_JMP: stack must be empty");
-                       token = read32 (td.ip + 1);
-                       m = mono_get_method_full (image, token, NULL, generic_context);
-                       ADD_CODE (&td, MINT_JMP);
-                       ADD_CODE (&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       td.ip += 5;
-                       break;
-               }
-               case CEE_CALLVIRT: /* Fall through */
-               case CEE_CALLI:    /* Fall through */
-               case CEE_CALL: {
-                       interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class);
-                       constrained_class = NULL;
-                       break;
-               }
-               case CEE_RET: {
-                       int vt_size = 0;
-                       if (signature->ret->type != MONO_TYPE_VOID) {
-                               --td.sp;
-                               MonoClass *klass = mono_class_from_mono_type (signature->ret);
-                               if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
-                                       vt_size = mono_class_value_size (klass, NULL);
-                                       vt_size = (vt_size + 7) & ~7;
-                               }
-                       }
-                       if (td.sp > td.stack)
-                               g_warning ("%s.%s: CEE_RET: more values on stack: %d", td.method->klass->name, td.method->name, td.sp - td.stack);
-                       if (td.vt_sp != vt_size)
-                               g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td.method->klass->name, td.method->name, td.vt_sp, vt_size);
-                       if (vt_size == 0)
-                               SIMPLE_OP(td, signature->ret->type == MONO_TYPE_VOID ? MINT_RET_VOID : MINT_RET);
-                       else {
-                               ADD_CODE(&td, MINT_RET_VT);
-                               WRITE32(&td, &vt_size);
-                               ++td.ip;
-                       }
-                       generating_code = 0;
-                       break;
-               }
-               case CEE_BR:
-                       handle_branch (&td, MINT_BR_S, MINT_BR, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       generating_code = 0;
-                       break;
-               case CEE_BR_S:
-                       handle_branch (&td, MINT_BR_S, MINT_BR, 2 + (gint8)td.ip [1]);
-                       td.ip += 2;
-                       generating_code = 0;
-                       break;
-               case CEE_BRFALSE:
-                       one_arg_branch (&td, MINT_BRFALSE_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BRFALSE_S:
-                       one_arg_branch (&td, MINT_BRFALSE_I4, 2 + (gint8)td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BRTRUE:
-                       one_arg_branch (&td, MINT_BRTRUE_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BRTRUE_S:
-                       one_arg_branch (&td, MINT_BRTRUE_I4, 2 + (gint8)td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BEQ:
-                       two_arg_branch (&td, MINT_BEQ_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BEQ_S:
-                       two_arg_branch (&td, MINT_BEQ_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BGE:
-                       two_arg_branch (&td, MINT_BGE_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BGE_S:
-                       two_arg_branch (&td, MINT_BGE_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BGT:
-                       two_arg_branch (&td, MINT_BGT_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BGT_S:
-                       two_arg_branch (&td, MINT_BGT_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BLT:
-                       two_arg_branch (&td, MINT_BLT_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BLT_S:
-                       two_arg_branch (&td, MINT_BLT_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BLE:
-                       two_arg_branch (&td, MINT_BLE_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BLE_S:
-                       two_arg_branch (&td, MINT_BLE_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BNE_UN:
-                       two_arg_branch (&td, MINT_BNE_UN_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BNE_UN_S:
-                       two_arg_branch (&td, MINT_BNE_UN_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BGE_UN:
-                       two_arg_branch (&td, MINT_BGE_UN_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BGE_UN_S:
-                       two_arg_branch (&td, MINT_BGE_UN_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BGT_UN:
-                       two_arg_branch (&td, MINT_BGT_UN_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BGT_UN_S:
-                       two_arg_branch (&td, MINT_BGT_UN_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BLE_UN:
-                       two_arg_branch (&td, MINT_BLE_UN_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BLE_UN_S:
-                       two_arg_branch (&td, MINT_BLE_UN_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_BLT_UN:
-                       two_arg_branch (&td, MINT_BLT_UN_I4, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       break;
-               case CEE_BLT_UN_S:
-                       two_arg_branch (&td, MINT_BLT_UN_I4, 2 + (gint8) td.ip [1]);
-                       td.ip += 2;
-                       break;
-               case CEE_SWITCH: {
-                       guint32 n;
-                       const unsigned char *next_ip;
-                       const unsigned char *base_ip = td.ip;
-                       unsigned short *next_new_ip;
-                       ++td.ip;
-                       n = read32 (td.ip);
-                       ADD_CODE(&td, MINT_SWITCH);
-                       ADD_CODE(&td, * (unsigned short *)(&n));
-                       ADD_CODE(&td, * ((unsigned short *)&n + 1));
-                       td.ip += 4;
-                       next_ip = td.ip + n * 4;
-                       next_new_ip = td.new_ip + n * 2;
-                       for (i = 0; i < n; i++) {
-                               offset = read32 (td.ip);
-                               target = next_ip - td.il_code + offset;
-                               if (offset < 0)
-                                       target = td.in_offsets [target] - (next_new_ip - td.new_code);
-                               else {
-                                       int prev = td.forward_refs [target];
-                                       td.forward_refs [td.ip - td.il_code] = prev;
-                                       td.forward_refs [target] = td.ip - td.il_code;
-                                       td.in_offsets [td.ip - td.il_code] = - (base_ip - td.il_code);
-                               }
-                               ADD_CODE(&td, * (unsigned short *)(&target));
-                               ADD_CODE(&td, * ((unsigned short *)&target + 1));
-                               td.ip += 4;
-                       }
-                       --td.sp;
-                       break;
-               }
-               case CEE_LDIND_I1:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_I1);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_U1:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_U1);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_I2:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_I2);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_U2:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_U2);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_I4:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_I4);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_U4:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_U4);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDIND_I8:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_I8);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-               case CEE_LDIND_I:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_I);
-                       ADD_CODE (&td, 0);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                       break;
-               case CEE_LDIND_R4:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_R4);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_LDIND_R8:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_R8);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_LDIND_REF:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDIND_REF);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
-                       break;
-               case CEE_STIND_REF:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_REF);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_I1:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_I1);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_I2:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_I2);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_I4:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_I4);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_I:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_I);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_I8:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_I8);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_R4:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_R4);
-                       td.sp -= 2;
-                       break;
-               case CEE_STIND_R8:
-                       CHECK_STACK (&td, 2);
-                       SIMPLE_OP (td, MINT_STIND_R8);
-                       td.sp -= 2;
-                       break;
-               case CEE_ADD:
-                       binary_arith_op(&td, MINT_ADD_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SUB:
-                       binary_arith_op(&td, MINT_SUB_I4);
-                       ++td.ip;
-                       break;
-               case CEE_MUL:
-                       binary_arith_op(&td, MINT_MUL_I4);
-                       ++td.ip;
-                       break;
-               case CEE_DIV:
-                       binary_arith_op(&td, MINT_DIV_I4);
-                       ++td.ip;
-                       break;
-               case CEE_DIV_UN:
-                       binary_arith_op(&td, MINT_DIV_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_REM:
-                       binary_int_op (&td, MINT_REM_I4);
-                       ++td.ip;
-                       break;
-               case CEE_REM_UN:
-                       binary_int_op (&td, MINT_REM_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_AND:
-                       binary_int_op (&td, MINT_AND_I4);
-                       ++td.ip;
-                       break;
-               case CEE_OR:
-                       binary_int_op (&td, MINT_OR_I4);
-                       ++td.ip;
-                       break;
-               case CEE_XOR:
-                       binary_int_op (&td, MINT_XOR_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SHL:
-                       shift_op (&td, MINT_SHL_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SHR:
-                       shift_op (&td, MINT_SHR_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SHR_UN:
-                       shift_op (&td, MINT_SHR_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_NEG:
-                       unary_arith_op (&td, MINT_NEG_I4);
-                       ++td.ip;
-                       break;
-               case CEE_NOT:
-                       unary_arith_op (&td, MINT_NOT_I4);
-                       ++td.ip;
-                       break;
-               case CEE_CONV_U1:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_U1_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_U1_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_U1_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_I1:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_I1_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_I1_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_I1_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_U2:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_U2_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_U2_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_U2_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_I2:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_I2_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_I2_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_I2_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_U:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-#if SIZEOF_VOID_P == 4
-                               ADD_CODE(&td, MINT_CONV_U4_R8);
-#else
-                               ADD_CODE(&td, MINT_CONV_U8_R8);
-#endif
-                               break;
-                       case STACK_TYPE_I4:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_U8_I4);
-#endif
-                               break;
-                       case STACK_TYPE_I8:
-#if SIZEOF_VOID_P == 4
-                               ADD_CODE(&td, MINT_CONV_U4_I8);
-#endif
-                               break;
-                       case STACK_TYPE_MP:
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                       break;
-               case CEE_CONV_I: 
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_I8_R8);
-#else
-                               ADD_CODE(&td, MINT_CONV_I4_R8);
-#endif
-                               break;
-                       case STACK_TYPE_I4:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_I8_I4);
-#endif
-                               break;
-                       case STACK_TYPE_O:
-                               break;
-                       case STACK_TYPE_MP:
-                               break;
-                       case STACK_TYPE_I8:
-#if SIZEOF_VOID_P == 4
-                               ADD_CODE(&td, MINT_CONV_I4_I8);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                       break;
-               case CEE_CONV_U4:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_U4_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_U4_I8);
-                               break;
-                       case STACK_TYPE_MP:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_U4_I8);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_I4:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_I4_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_I4_I8);
-                               break;
-                       case STACK_TYPE_MP:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_I4_I8);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_I8:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_I8_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_I8_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               break;
-                       case STACK_TYPE_MP:
-#if SIZEOF_VOID_P == 4
-                               ADD_CODE(&td, MINT_CONV_I8_I4);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-               case CEE_CONV_R4:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_R4_R8);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_R4_I8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_R4_I4);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_CONV_R8:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_R8_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_R8_I8);
-                               break;
-                       case STACK_TYPE_R8:
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_CONV_U8:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_U8_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               break;
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_U8_R8);
-                               break;
-                       case STACK_TYPE_MP:
-#if SIZEOF_VOID_P == 4
-                               ADD_CODE(&td, MINT_CONV_U8_I4);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-#if 0
-               case CEE_CPOBJ: {
-                       MonoClass *vtklass;
-                       ++ip;
-                       vtklass = mono_class_get_full (image, read32 (ip), generic_context);
-                       ip += 4;
-                       sp -= 2;
-                       memcpy (sp [0].data.p, sp [1].data.p, mono_class_value_size (vtklass, NULL));
-                       break;
-               }
-#endif
-               case CEE_LDOBJ: {
-                       int size;
-                       CHECK_STACK (&td, 1);
-
-                       token = read32 (td.ip + 1);
-
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       ADD_CODE(&td, MINT_LDOBJ);
-                       ADD_CODE(&td, get_data_item_index(&td, klass));
-                       if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
-                               size = mono_class_value_size (klass, NULL);
-                               PUSH_VT(&td, size);
-                       }
-                       td.ip += 5;
-                       SET_TYPE(td.sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
-                       break;
-               }
-               case CEE_LDSTR: {
-                       MonoString *s;
-                       token = mono_metadata_token_index (read32 (td.ip + 1));
-                       td.ip += 5;
-                       if (method->wrapper_type != MONO_WRAPPER_NONE) {
-                               s = mono_string_new_wrapper(
-                                       mono_method_get_wrapper_data (method, token));
-                       }
-                       else
-                               s = mono_ldstr (domain, image, token);
-                       ADD_CODE(&td, MINT_LDSTR);
-                       ADD_CODE(&td, get_data_item_index (&td, s));
-                       PUSH_TYPE(&td, STACK_TYPE_O, mono_defaults.string_class);
-                       break;
-               }
-               case CEE_NEWOBJ: {
-                       MonoMethod *m;
-                       MonoMethodSignature *csignature;
-                       guint32 vt_stack_used = 0;
-                       guint32 vt_res_size = 0;
-
-                       td.ip++;
-                       token = read32 (td.ip);
-                       td.ip += 4;
-
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
-                       else 
-                               m = mono_get_method_full (image, token, NULL, generic_context);
-
-                       csignature = mono_method_signature (m);
-                       klass = m->klass;
-                       td.sp -= csignature->param_count;
-                       ADD_CODE(&td, MINT_NEWOBJ);
-                       ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-
-                       if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
-                               vt_res_size = mono_class_value_size (klass, NULL);
-                               PUSH_VT (&td, vt_res_size);
-                       }
-                       for (i = 0; i < csignature->param_count; ++i) {
-                               int mt = mint_type(csignature->params [i]);
-                               if (mt == MINT_TYPE_VT) {
-                                       MonoClass *k = mono_class_from_mono_type (csignature->params [i]);
-                                       gint32 size = mono_class_value_size (k, NULL);
-                                       size = (size + 7) & ~7;
-                                       vt_stack_used += size;
-                               }
-                       }
-                       if (vt_stack_used != 0 || vt_res_size != 0) {
-                               ADD_CODE(&td, MINT_VTRESULT);
-                               ADD_CODE(&td, vt_res_size);
-                               WRITE32(&td, &vt_stack_used);
-                               td.vt_sp -= vt_stack_used;
-                       }
-                       PUSH_TYPE (&td, stack_type [mint_type (&klass->byval_arg)], klass);
-                       break;
-               }
-               case CEE_CASTCLASS:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       klass = mono_class_get_full (image, token, generic_context);
-                       ADD_CODE(&td, MINT_CASTCLASS);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       td.sp [-1].klass = klass;
-                       td.ip += 5;
-                       break;
-               case CEE_ISINST:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       klass = mono_class_get_full (image, token, generic_context);
-                       ADD_CODE(&td, MINT_ISINST);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       td.ip += 5;
-                       break;
-               case CEE_CONV_R_UN:
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_R_UN_I8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_R_UN_I4);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       ++td.ip;
-                       break;
-               case CEE_UNBOX:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else 
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       if (mono_class_is_nullable (klass)) {
-                               g_error ("cee_unbox: implement Nullable");
-                       }
-                       
-                       ADD_CODE(&td, MINT_UNBOX);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                       td.ip += 5;
-                       break;
-               case CEE_UNBOX_ANY:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-
-                       g_assert (method->wrapper_type == MONO_WRAPPER_NONE);
-                       klass = mono_class_get_full (image, token, generic_context);
-
-                       if (mini_type_is_reference (&klass->byval_arg)) {
-                               g_error ("unbox_any: generic class is reference type");
-                       } else if (mono_class_is_nullable (klass)) {
-                               MonoMethod *target_method = mono_class_get_method_from_name (klass, "Unbox", 1);
-                               /* td.ip is incremented by interp_transform_call */
-                               interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL);
-                       } else {
-                               int mt = mint_type (&klass->byval_arg);
-                               ADD_CODE (&td, MINT_UNBOX);
-                               ADD_CODE (&td, get_data_item_index (&td, klass));
-                               SET_TYPE (td.sp - 1, stack_type [mt], klass);
-                               if (mt == MINT_TYPE_VT) {
-                                       int size = mono_class_value_size (klass, NULL);
-                                       PUSH_VT (&td, size);
-                               }
-                               td.ip += 5;
-                       }
-
-                       break;
-               case CEE_THROW:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_THROW);
-                       --td.sp;
-                       generating_code = 0;
-                       break;
-               case CEE_LDFLDA:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       mono_class_init (klass);
-                       mt = mint_type(field->type);
-                       ADD_CODE(&td, MINT_LDFLDA);
-                       ADD_CODE(&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
-                       td.ip += 5;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                       break;
-               case CEE_LDFLD: {
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       mono_class_init (klass);
-
-                       MonoClass *field_klass = mono_class_from_mono_type (field->type);
-                       mt = mint_type (&field_klass->byval_arg);
-                       if (klass->marshalbyref) {
-                               ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT :  MINT_LDRMFLD);
-                               ADD_CODE(&td, get_data_item_index (&td, field));
-                       } else  {
-                               ADD_CODE(&td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
-                               ADD_CODE(&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
-                       }
-                       if (mt == MINT_TYPE_VT) {
-                               int size = mono_class_value_size (field_klass, NULL);
-                               PUSH_VT(&td, size);
-                               WRITE32(&td, &size);
-                       }
-                       if (td.sp [-1].type == STACK_TYPE_VT) {
-                               int size = mono_class_value_size (klass, NULL);
-                               size = (size + 7) & ~7;
-                               td.vt_sp -= size;
-                               ADD_CODE (&td, MINT_VTRESULT);
-                               ADD_CODE (&td, 0);
-                               WRITE32 (&td, &size);
-                       }
-                       td.ip += 5;
-                       SET_TYPE(td.sp - 1, stack_type [mt], field_klass);
-                       break;
-               }
-               case CEE_STFLD:
-                       CHECK_STACK (&td, 2);
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       mono_class_init (klass);
-                       mt = mint_type(field->type);
-                       if (klass->marshalbyref) {
-                               ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
-                               ADD_CODE(&td, get_data_item_index (&td, field));
-                       } else  {
-                               ADD_CODE(&td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
-                               ADD_CODE(&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
-                       }
-                       if (mt == MINT_TYPE_VT) {
-                               MonoClass *klass = mono_class_from_mono_type (field->type);
-                               int size = mono_class_value_size (klass, NULL);
-                               POP_VT(&td, size);
-                               WRITE32(&td, &size);
-                       }
-                       td.ip += 5;
-                       td.sp -= 2;
-                       break;
-               case CEE_LDSFLDA:
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       ADD_CODE(&td, MINT_LDSFLDA);
-                       ADD_CODE(&td, get_data_item_index (&td, field));
-                       td.ip += 5;
-                       PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
-                       break;
-               case CEE_LDSFLD:
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       mt = mint_type(field->type);
-                       ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
-                       ADD_CODE(&td, get_data_item_index (&td, field));
-                       klass = NULL;
-                       if (mt == MINT_TYPE_VT) {
-                               MonoClass *klass = mono_class_from_mono_type (field->type);
-                               int size = mono_class_value_size (klass, NULL);
-                               PUSH_VT(&td, size);
-                               WRITE32(&td, &size);
-                               klass = field->type->data.klass;
-                       } else {
-                               if (mt == MINT_TYPE_O) 
-                                       klass = mono_class_from_mono_type (field->type);
-                       }
-                       td.ip += 5;
-                       PUSH_TYPE(&td, stack_type [mt], klass);
-                       break;
-               case CEE_STSFLD:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       field = mono_field_from_token (image, token, &klass, generic_context);
-                       mt = mint_type(field->type);
-                       ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
-                       ADD_CODE(&td, get_data_item_index (&td, field));
-                       if (mt == MINT_TYPE_VT) {
-                               MonoClass *klass = mono_class_from_mono_type (field->type);
-                               int size = mono_class_value_size (klass, NULL);
-                               POP_VT (&td, size);
-                               WRITE32 (&td, &size);
-                       }
-                       td.ip += 5;
-                       --td.sp;
-                       break;
-               case CEE_STOBJ: {
-                       int size;
-                       token = read32 (td.ip + 1);
-
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       ADD_CODE(&td, td.sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       if (td.sp [-1].type == STACK_TYPE_VT) {
-                               size = mono_class_value_size (klass, NULL);
-                               size = (size + 7) & ~7;
-                               td.vt_sp -= size;
-                       }
-                       td.ip += 5;
-                       td.sp -= 2;
-                       break;
-               }
-               case CEE_CONV_OVF_I_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
-#else
-                               ADD_CODE(&td, MINT_CONV_OVF_I4_UN_R8);
-#endif
-                               break;
-                       case STACK_TYPE_I8:
-                               /*FIX*/
-                               break;
-                       case STACK_TYPE_I4:
-#if SIZEOF_VOID_P == 8
-                               ADD_CODE(&td, MINT_CONV_I8_U4);
-#endif
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                               break;
-                       }
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       ++td.ip;
-                       break;
-               case CEE_CONV_OVF_I8_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
-                               break;
-                       case STACK_TYPE_I8:
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_I8_U4);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                               break;
-                       }
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       ++td.ip;
-                       break;
-               case CEE_BOX: {
-                       int size;
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       if (mono_class_is_nullable (klass)) {
-                               MonoMethod *target_method = mono_class_get_method_from_name (klass, "Box", 1);
-                               /* td.ip is incremented by interp_transform_call */
-                               interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL);
-                       } else if (!klass->valuetype) {
-                               /* already boxed, do nothing. */
-                               td.ip += 5;
-                       } else {
-                               if (mint_type (&klass->byval_arg) == MINT_TYPE_VT && !klass->enumtype) {
-                                       size = mono_class_value_size (klass, NULL);
-                                       size = (size + 7) & ~7;
-                                       td.vt_sp -= size;
-                               }
-                               ADD_CODE(&td, MINT_BOX);
-                               ADD_CODE(&td, get_data_item_index (&td, klass));
-                               ADD_CODE (&td, 0);
-                               SET_TYPE(td.sp - 1, STACK_TYPE_O, klass);
-                               td.ip += 5;
-                       }
-
-                       break;
-               }
-               case CEE_NEWARR:
-                       CHECK_STACK (&td, 1);
-                       token = read32 (td.ip + 1);
-
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       ADD_CODE(&td, MINT_NEWARR);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       SET_TYPE(td.sp - 1, STACK_TYPE_O, klass);
-                       td.ip += 5;
-                       break;
-               case CEE_LDLEN:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_LDLEN);
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                       break;
-               case CEE_LDELEMA:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       token = read32 (td.ip + 1);
-
-                       if (method->wrapper_type != MONO_WRAPPER_NONE)
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                       else
-                               klass = mono_class_get_full (image, token, generic_context);
-
-                       ADD_CODE(&td, MINT_LDELEMA);
-                       ADD_CODE(&td, get_data_item_index (&td, klass));
-                       td.ip += 5;
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                       break;
-               case CEE_LDELEM_I1:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_I1);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_U1:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_U1);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_I2:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_I2);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_U2:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_U2);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_I4:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_I4);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_U4:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_U4);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_LDELEM_I8:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_I8);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-               case CEE_LDELEM_I:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_I);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                       break;
-               case CEE_LDELEM_R4:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_R4);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_LDELEM_R8:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_R8);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
-                       break;
-               case CEE_LDELEM_REF:
-                       CHECK_STACK (&td, 2);
-                       ENSURE_I4 (&td, 1);
-                       SIMPLE_OP (td, MINT_LDELEM_REF);
-                       --td.sp;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
-                       break;
-               case CEE_LDELEM:
-                       CHECK_STACK (&td, 2);
-                       token = read32 (td.ip + 1);
-                       klass = mono_class_get_full (image, token, generic_context);
-                       switch (mint_type (&klass->byval_arg)) {
-                               case MINT_TYPE_I4:
-                                       ENSURE_I4 (&td, 1);
-                                       SIMPLE_OP (td, MINT_LDELEM_I4);
-                                       --td.sp;
-                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                                       break;
-                               case MINT_TYPE_VT: {
-                                       int size = mono_class_value_size (klass, NULL);
-                                       ENSURE_I4 (&td, 1);
-                                       SIMPLE_OP (td, MINT_LDELEM_VT);
-                                       ADD_CODE (&td, get_data_item_index (&td, klass));
-                                       WRITE32 (&td, &size);
-                                       --td.sp;
-                                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_VT);
-                                       PUSH_VT (&td, size);
-                                       break;
-                               }
-                               default: {
-                                       GString *res = g_string_new ("");
-                                       mono_type_get_desc (res, &klass->byval_arg, TRUE);
-                                       g_print ("LDELEM: %s -> %d (%s)\n", klass->name, mint_type (&klass->byval_arg), res->str);
-                                       g_string_free (res, TRUE);
-                                       g_assert (0);
-                                       break;
-                               }
-                       }
-                       td.ip += 4;
-                       break;
-               case CEE_STELEM_I:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_I);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_I1:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_I1);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_I2:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_I2);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_I4:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_I4);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_I8:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_I8);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_R4:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_R4);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_R8:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_R8);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM_REF:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       SIMPLE_OP (td, MINT_STELEM_REF);
-                       td.sp -= 3;
-                       break;
-               case CEE_STELEM:
-                       CHECK_STACK (&td, 3);
-                       ENSURE_I4 (&td, 2);
-                       token = read32 (td.ip + 1);
-                       klass = mono_class_get_full (image, token, generic_context);
-                       switch (mint_type (&klass->byval_arg)) {
-                               case MINT_TYPE_I4:
-                                       SIMPLE_OP (td, MINT_STELEM_I4);
-                                       break;
-                               case MINT_TYPE_O:
-                                       SIMPLE_OP (td, MINT_STELEM_REF);
-                                       break;
-                               case MINT_TYPE_VT: {
-                                       int size = mono_class_value_size (klass, NULL);
-                                       SIMPLE_OP (td, MINT_STELEM_VT);
-                                       ADD_CODE (&td, get_data_item_index (&td, klass));
-                                       WRITE32 (&td, &size);
-                                       POP_VT (&td, size);
-                                       break;
-                               }
-                               default: {
-                                       GString *res = g_string_new ("");
-                                       mono_type_get_desc (res, &klass->byval_arg, TRUE);
-                                       g_print ("STELEM: %s -> %d (%s)\n", klass->name, mint_type (&klass->byval_arg), res->str);
-                                       g_string_free (res, TRUE);
-                                       g_assert (0);
-                                       break;
-                               }
-                       }
-                       td.ip += 4;
-                       td.sp -= 3;
-                       break;
-#if 0
-               case CEE_CONV_OVF_U1:
-
-               case CEE_CONV_OVF_I8:
-
-#if SIZEOF_VOID_P == 8
-               case CEE_CONV_OVF_U:
-#endif
-               case CEE_REFANYVAL: ves_abort(); break;
-#endif
-               case CEE_CKFINITE:
-                       CHECK_STACK (&td, 1);
-                       SIMPLE_OP (td, MINT_CKFINITE);
-                       break;
-               case CEE_CONV_OVF_I1:
-               case CEE_CONV_OVF_I1_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I1_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_OVF_I1_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I1_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_OVF_U1:
-               case CEE_CONV_OVF_U1_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U1_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_OVF_U1_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U1_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_OVF_I2:
-               case CEE_CONV_OVF_I2_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I2_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_OVF_I2_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I2_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-               case CEE_CONV_OVF_U2_UN:
-               case CEE_CONV_OVF_U2:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U2_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_OVF_U2_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U2_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-#if SIZEOF_VOID_P == 4
-               case CEE_CONV_OVF_I:
-#endif
-               case CEE_CONV_OVF_I4:
-               case CEE_CONV_OVF_I4_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I4_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               if (*td.ip == CEE_CONV_OVF_I4_UN)
-                                       ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I4_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-#if SIZEOF_VOID_P == 4
-               case CEE_CONV_OVF_U:
-#endif
-               case CEE_CONV_OVF_U4:
-               case CEE_CONV_OVF_U4_UN:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U4_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               if (*td.ip != CEE_CONV_OVF_U4_UN)
-                                       ADD_CODE(&td, MINT_CONV_OVF_U4_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U4_I8);
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                       break;
-#if SIZEOF_VOID_P == 8
-               case CEE_CONV_OVF_I:
-#endif
-               case CEE_CONV_OVF_I8:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_I8_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_I8_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-#if SIZEOF_VOID_P == 8
-               case CEE_CONV_OVF_U:
-#endif
-               case CEE_CONV_OVF_U8:
-                       CHECK_STACK (&td, 1);
-                       switch (td.sp [-1].type) {
-                       case STACK_TYPE_R8:
-                               ADD_CODE(&td, MINT_CONV_OVF_U8_R8);
-                               break;
-                       case STACK_TYPE_I4:
-                               ADD_CODE(&td, MINT_CONV_OVF_U8_I4);
-                               break;
-                       case STACK_TYPE_I8:
-                               break;
-                       default:
-                               g_assert_not_reached ();
-                       }
-                       ++td.ip;
-                       SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
-                       break;
-               case CEE_LDTOKEN: {
-                       int size;
-                       gpointer handle;
-                       token = read32 (td.ip + 1);
-                       handle = mono_ldtoken (image, token, &klass, generic_context);
-                       mt = mint_type(&klass->byval_arg);
-                       g_assert (mt == MINT_TYPE_VT);
-                       size = mono_class_value_size (klass, NULL);
-                       g_assert (size == sizeof(gpointer));
-                       PUSH_VT(&td, sizeof(gpointer));
-                       ADD_CODE(&td, MINT_LDTOKEN);
-                       ADD_CODE(&td, get_data_item_index (&td, handle));
-                       PUSH_SIMPLE_TYPE(&td, stack_type [mt]);
-                       td.ip += 5;
-                       break;
-               }
-               case CEE_ADD_OVF:
-                       binary_arith_op(&td, MINT_ADD_OVF_I4);
-                       ++td.ip;
-                       break;
-               case CEE_ADD_OVF_UN:
-                       binary_arith_op(&td, MINT_ADD_OVF_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_MUL_OVF:
-                       binary_arith_op(&td, MINT_MUL_OVF_I4);
-                       ++td.ip;
-                       break;
-               case CEE_MUL_OVF_UN:
-                       binary_arith_op(&td, MINT_MUL_OVF_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SUB_OVF:
-                       binary_arith_op(&td, MINT_SUB_OVF_I4);
-                       ++td.ip;
-                       break;
-               case CEE_SUB_OVF_UN:
-                       binary_arith_op(&td, MINT_SUB_OVF_UN_I4);
-                       ++td.ip;
-                       break;
-               case CEE_ENDFINALLY:
-                       SIMPLE_OP (td, MINT_ENDFINALLY);
-                       generating_code = 0;
-                       break;
-               case CEE_LEAVE:
-                       td.sp = td.stack;
-                       handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td.ip + 1));
-                       td.ip += 5;
-                       generating_code = 0;
-                       break;
-               case CEE_LEAVE_S:
-                       td.sp = td.stack;
-                       handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td.ip [1]);
-                       td.ip += 2;
-                       generating_code = 0;
-                       break;
-               case CEE_UNUSED41:
-                       ++td.ip;
-                       switch (*td.ip) {
-                               case CEE_MONO_CALLI_EXTRA_ARG:
-                                       /* Same as CEE_CALLI, llvm specific */
-                                       interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL);
-                                       break;
-                               case CEE_MONO_ICALL: {
-                                       guint32 token;
-                                       gpointer func;
-                                       MonoJitICallInfo *info;
-
-                                       token = read32 (td.ip + 1);
-                                       td.ip += 5;
-                                       func = mono_method_get_wrapper_data (method, token);
-                                       info = mono_find_jit_icall_by_addr (func);
-                                       g_assert (info);
-
-                                       CHECK_STACK (&td, info->sig->param_count);
-                                       switch (info->sig->param_count) {
-                                       case 0:
-                                               if (MONO_TYPE_IS_VOID (info->sig->ret))
-                                                       ADD_CODE (&td,MINT_ICALL_V_V);
-                                               else
-                                                       ADD_CODE (&td, MINT_ICALL_V_P);
-                                               break;
-                                       case 1:
-                                               if (MONO_TYPE_IS_VOID (info->sig->ret))
-                                                       ADD_CODE (&td,MINT_ICALL_P_V);
-                                               else
-                                                       ADD_CODE (&td,MINT_ICALL_P_P);
-                                               break;
-                                       case 2:
-                                               if (MONO_TYPE_IS_VOID (info->sig->ret)) {
-                                                       if (info->sig->params [1]->type == MONO_TYPE_I4)
-                                                               ADD_CODE (&td,MINT_ICALL_PI_V);
-                                                       else
-                                                               ADD_CODE (&td,MINT_ICALL_PP_V);
-                                               } else {
-                                                       if (info->sig->params [1]->type == MONO_TYPE_I4)
-                                                               ADD_CODE (&td,MINT_ICALL_PI_P);
-                                                       else
-                                                               ADD_CODE (&td,MINT_ICALL_PP_P);
-                                               }
-                                               break;
-                                       case 3:
-                                               g_assert (MONO_TYPE_IS_VOID (info->sig->ret));
-                                               if (info->sig->params [2]->type == MONO_TYPE_I4)
-                                                       ADD_CODE (&td,MINT_ICALL_PPI_V);
-                                               else
-                                                       ADD_CODE (&td,MINT_ICALL_PPP_V);
-                                               break;
-                                       default:
-                                               g_assert_not_reached ();
-                                       }
-
-                                       if (func == mono_ftnptr_to_delegate) {
-                                               g_error ("TODO: ?");
-                                               func = mono_interp_ftnptr_to_delegate;
-                                       }
-                                       ADD_CODE(&td, get_data_item_index (&td, func));
-                                       td.sp -= info->sig->param_count;
-
-                                       if (!MONO_TYPE_IS_VOID (info->sig->ret)) {
-                                               td.sp ++;
-                                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
-                                       }
-                                       break;
-                               }
-                       case CEE_MONO_VTADDR: {
-                               int size;
-                               CHECK_STACK (&td, 1);
-                               if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE)
-                                       size = mono_class_native_size(td.sp [-1].klass, NULL);
-                               else
-                                       size = mono_class_value_size(td.sp [-1].klass, NULL);
-                               size = (size + 7) & ~7;
-                               ADD_CODE(&td, MINT_VTRESULT);
-                               ADD_CODE(&td, 0);
-                               WRITE32(&td, &size);
-                               td.vt_sp -= size;
-                               ++td.ip;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                               break;
-                       }
-                       case CEE_MONO_LDPTR:
-                       case CEE_MONO_CLASSCONST:
-                               token = read32 (td.ip + 1);
-                               td.ip += 5;
-                               ADD_CODE(&td, MINT_MONO_LDPTR);
-                               ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
-                               td.sp [0].type = STACK_TYPE_I;
-                               ++td.sp;
-                               break;
-                       case CEE_MONO_OBJADDR:
-                               CHECK_STACK (&td, 1);
-                               ++td.ip;
-                               td.sp[-1].type = STACK_TYPE_MP;
-                               /* do nothing? */
-                               break;
-                       case CEE_MONO_NEWOBJ:
-                               token = read32 (td.ip + 1);
-                               td.ip += 5;
-                               ADD_CODE(&td, MINT_MONO_NEWOBJ);
-                               ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
-                               td.sp [0].type = STACK_TYPE_O;
-                               ++td.sp;
-                               break;
-                       case CEE_MONO_RETOBJ:
-                               CHECK_STACK (&td, 1);
-                               token = read32 (td.ip + 1);
-                               td.ip += 5;
-                               ADD_CODE(&td, MINT_MONO_RETOBJ);
-                               td.sp--;
-
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                               
-                               /*stackval_from_data (signature->ret, frame->retval, sp->data.vt, signature->pinvoke);*/
-
-                               if (td.sp > td.stack)
-                                       g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td.sp-td.stack);
-                               break;
-                       case CEE_MONO_LDNATIVEOBJ:
-                               token = read32 (td.ip + 1);
-                               td.ip += 5;
-                               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-                               g_assert(klass->valuetype);
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                               break;
-                       case CEE_MONO_SAVE_LMF:
-                       case CEE_MONO_RESTORE_LMF:
-                       case CEE_MONO_NOT_TAKEN:
-                               ++td.ip;
-                               break;
-                       case CEE_MONO_LDPTR_INT_REQ_FLAG:
-                               ADD_CODE (&td, MINT_MONO_LDPTR);
-                               ADD_CODE (&td, get_data_item_index (&td, mono_thread_interruption_request_flag ()));
-                               PUSH_TYPE (&td, STACK_TYPE_MP, NULL);
-                               ++td.ip;
-                               break;
-                       default:
-                               g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td.ip, td.ip-header->code);
-                       }
-                       break;
-#if 0
-               case CEE_PREFIX7:
-               case CEE_PREFIX6:
-               case CEE_PREFIX5:
-               case CEE_PREFIX4:
-               case CEE_PREFIX3:
-               case CEE_PREFIX2:
-               case CEE_PREFIXREF: ves_abort(); break;
-#endif
-               /*
-                * Note: Exceptions thrown when executing a prefixed opcode need
-                * to take into account the number of prefix bytes (usually the
-                * throw point is just (ip - n_prefix_bytes).
-                */
-               case CEE_PREFIX1: 
-                       ++td.ip;
-                       switch (*td.ip) {
-#if 0
-                       case CEE_ARGLIST: ves_abort(); break;
-#endif
-                       case CEE_CEQ:
-                               CHECK_STACK(&td, 2);
-                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
-                                       ADD_CODE(&td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
-                               else
-                                       ADD_CODE(&td, MINT_CEQ_I4 + td.sp [-1].type - STACK_TYPE_I4);
-                               --td.sp;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                               ++td.ip;
-                               break;
-                       case CEE_CGT:
-                               CHECK_STACK(&td, 2);
-                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
-                                       ADD_CODE(&td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
-                               else
-                                       ADD_CODE(&td, MINT_CGT_I4 + td.sp [-1].type - STACK_TYPE_I4);
-                               --td.sp;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                               ++td.ip;
-                               break;
-                       case CEE_CGT_UN:
-                               CHECK_STACK(&td, 2);
-                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
-                                       ADD_CODE(&td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
-                               else
-                                       ADD_CODE(&td, MINT_CGT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
-                               --td.sp;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                               ++td.ip;
-                               break;
-                       case CEE_CLT:
-                               CHECK_STACK(&td, 2);
-                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
-                                       ADD_CODE(&td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
-                               else
-                                       ADD_CODE(&td, MINT_CLT_I4 + td.sp [-1].type - STACK_TYPE_I4);
-                               --td.sp;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                               ++td.ip;
-                               break;
-                       case CEE_CLT_UN:
-                               CHECK_STACK(&td, 2);
-                               if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
-                                       ADD_CODE(&td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
-                               else
-                                       ADD_CODE(&td, MINT_CLT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
-                               --td.sp;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
-                               ++td.ip;
-                               break;
-                       case CEE_LDVIRTFTN: /* fallthrough */
-                       case CEE_LDFTN: {
-                               MonoMethod *m;
-                               if (*td.ip == CEE_LDVIRTFTN) {
-                                       CHECK_STACK (&td, 1);
-                                       --td.sp;
-                               }
-                               token = read32 (td.ip + 1);
-                               if (method->wrapper_type != MONO_WRAPPER_NONE)
-                                       m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
-                               else 
-                                       m = mono_get_method_full (image, token, NULL, generic_context);
-
-                               if (method->wrapper_type == MONO_WRAPPER_NONE && m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
-                                       m = mono_marshal_get_synchronized_wrapper (m);
-
-                               ADD_CODE(&td, *td.ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
-                               ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
-                               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                               td.ip += 5;
-                               PUSH_SIMPLE_TYPE (&td, STACK_TYPE_F);
-                               break;
-                       }
-                       case CEE_LDARG:
-                               load_arg (&td, read16 (td.ip + 1));
-                               td.ip += 3;
-                               break;
-                       case CEE_LDARGA: {
-                               int n = read16 (td.ip + 1);
-                               if (n == 0 && signature->hasthis) {
-                                       g_error ("LDTHISA: NOPE");
-                                       ADD_CODE(&td, MINT_LDTHISA);
-                               }
-                               else {
-                                       ADD_CODE(&td, MINT_LDARGA);
-                                       ADD_CODE(&td, td.rtm->arg_offsets [n]); /* FIX for large offsets */
-                               }
-                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
-                               td.ip += 3;
-                               break;
-                       }
-                       case CEE_STARG:
-                               store_arg (&td, read16 (td.ip + 1));
-                               td.ip += 3;
-                               break;
-                       case CEE_LDLOC:
-                               load_local (&td, read16 (td.ip + 1));
-                               td.ip += 3;
-                               break;
-                       case CEE_LDLOCA:
-                               ADD_CODE(&td, MINT_LDLOCA_S);
-                               ADD_CODE(&td, td.rtm->local_offsets [read16 (td.ip + 1)]);
-                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
-                               td.ip += 3;
-                               break;
-                       case CEE_STLOC:
-                               store_local (&td, read16 (td.ip + 1));
-                               td.ip += 3;
-                               break;
-                       case CEE_LOCALLOC:
-                               CHECK_STACK (&td, 1);
-#if SIZEOF_VOID_P == 8
-                               if (td.sp [-1].type == STACK_TYPE_I8)
-                                       ADD_CODE(&td, MINT_CONV_I4_I8);
-#endif                         
-                               ADD_CODE(&td, MINT_LOCALLOC);
-                               if (td.sp != td.stack + 1)
-                                       g_warning("CEE_LOCALLOC: stack not empty");
-                               ++td.ip;
-                               SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
-                               break;
-#if 0
-                       case CEE_UNUSED57: ves_abort(); break;
-                       case CEE_ENDFILTER: ves_abort(); break;
-#endif
-                       case CEE_UNALIGNED_:
-                               ++td.ip;
-                               /* FIX: should do something? */;
-                               break;
-                       case CEE_VOLATILE_:
-                               ++td.ip;
-                               /* FIX: should do something? */;
-                               break;
-                       case CEE_TAIL_:
-                               ++td.ip;
-                               /* FIX: should do something? */;
-                               break;
-                       case CEE_INITOBJ:
-                               CHECK_STACK(&td, 1);
-                               token = read32 (td.ip + 1);
-                               klass = mono_class_get_full (image, token, generic_context);
-                               ADD_CODE(&td, MINT_INITOBJ);
-                               i32 = mono_class_value_size (klass, NULL);
-                               WRITE32(&td, &i32);
-                               td.ip += 5;
-                               --td.sp;
-                               break;
-                       case CEE_CPBLK:
-                               CHECK_STACK(&td, 3);
-                               /* FIX? convert length to I8? */
-                               ADD_CODE(&td, MINT_CPBLK);
-                               td.sp -= 3;
-                               ++td.ip;
-                               break;
-                       case CEE_CONSTRAINED_:
-                               token = read32 (td.ip + 1);
-                               constrained_class = mono_class_get_full (image, token, generic_context);
-                               mono_class_init (constrained_class);
-                               td.ip += 5;
-                               break;
-                       case CEE_INITBLK:
-                               CHECK_STACK(&td, 3);
-                               ADD_CODE(&td, MINT_INITBLK);
-                               td.sp -= 3;
-                               break;
-#if 0
-                       case CEE_NO_:
-                               /* FIXME: implement */
-                               ip += 2;
-                               break;
-#endif
-                       case CEE_RETHROW:
-                               SIMPLE_OP (td, MINT_RETHROW);
-                               generating_code = 0;
-                               break;
-                       case CEE_SIZEOF: {
-                               gint32 size;
-                               token = read32 (td.ip + 1);
-                               td.ip += 5;
-                               if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC) {
-                                       int align;
-                                       MonoType *type = mono_type_create_from_typespec (image, token);
-                                       size = mono_type_size (type, &align);
-                               } else {
-                                       guint32 align;
-                                       MonoClass *szclass = mono_class_get_full (image, token, generic_context);
-                                       mono_class_init (szclass);
-#if 0
-                                       if (!szclass->valuetype)
-                                               THROW_EX (mono_exception_from_name (mono_defaults.corlib, "System", "InvalidProgramException"), ip - 5);
-#endif
-                                       size = mono_class_value_size (szclass, &align);
-                               } 
-                               ADD_CODE(&td, MINT_LDC_I4);
-                               WRITE32(&td, &size);
-                               PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
-                               break;
-                       }
-#if 0
-                       case CEE_REFANYTYPE: ves_abort(); break;
-#endif
-                       default:
-                               g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td.ip, mono_opcode_name (256 + *td.ip), td.ip-header->code);
-                       }
-                       break;
-               default:
-                       g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td.ip, td.ip-header->code);
-               }
-
-               if (td.new_ip - td.new_code != new_in_start_offset) 
-                       td.last_new_ip = td.new_code + new_in_start_offset;
-               else if (td.is_bb_start [td.in_start - td.il_code])
-                       td.is_bb_start [td.ip - td.il_code] = 1;
-                       
-               td.last_ip = td.in_start;
-       }
-
-       if (mono_interp_traceopt) {
-               const guint16 *p = td.new_code;
-               printf("Runtime method: %p, VT stack size: %d\n", rtm, td.max_vt_sp);
-               printf("Calculated stack size: %d, stated size: %d\n", td.max_stack_height, header->max_stack);
-               while (p < td.new_ip) {
-                       p = mono_interp_dis_mintop(td.new_code, p);
-                       printf("\n");
-               }
-       }
-
-       rtm->clauses = mono_mempool_alloc (domain->mp, header->num_clauses * sizeof(MonoExceptionClause));
-       memcpy (rtm->clauses, header->clauses, header->num_clauses * sizeof(MonoExceptionClause));
-       rtm->code = mono_mempool_alloc (domain->mp, (td.new_ip - td.new_code) * sizeof(gushort));
-       memcpy (rtm->code, td.new_code, (td.new_ip - td.new_code) * sizeof(gushort));
-       g_free (td.new_code);
-       rtm->new_body_start = rtm->code + body_start_offset;
-       rtm->num_clauses = header->num_clauses;
-       for (i = 0; i < header->num_clauses; i++) {
-               MonoExceptionClause *c = rtm->clauses + i;
-               int end_off = c->try_offset + c->try_len;
-               c->try_offset = td.in_offsets [c->try_offset];
-               c->try_len = td.in_offsets [end_off] - c->try_offset;
-               end_off = c->handler_offset + c->handler_len;
-               c->handler_offset = td.in_offsets [c->handler_offset];
-               c->handler_len = td.in_offsets [end_off] - c->handler_offset;
-       }
-       rtm->vt_stack_size = td.max_vt_sp;
-       rtm->alloca_size = rtm->locals_size + rtm->args_size + rtm->vt_stack_size + rtm->stack_size;
-       rtm->data_items = mono_mempool_alloc (domain->mp, td.n_data_items * sizeof (td.data_items [0]));
-       memcpy (rtm->data_items, td.data_items, td.n_data_items * sizeof (td.data_items [0]));
-       g_free (td.in_offsets);
-       g_free (td.forward_refs);
-       for (i = 0; i < header->code_size; ++i)
-               g_free (td.stack_state [i]);
-       g_free (td.stack_state);
-       g_free (td.stack_height);
-       g_free (td.vt_stack_size);
-       g_free (td.data_items);
-       g_hash_table_destroy (td.data_hash);
-}
-
-static mono_mutex_t calc_section;
-
-void 
-mono_interp_transform_init (void)
-{
-       mono_os_mutex_init_recursive(&calc_section);
-}
-
-MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context)
-{
-       int i, align, size, offset;
-       MonoMethod *method = runtime_method->method;
-       MonoImage *image = method->klass->image;
-       MonoMethodHeader *header = mono_method_get_header (method);
-       MonoMethodSignature *signature = mono_method_signature (method);
-       register const unsigned char *ip, *end;
-       const MonoOpcode *opcode;
-       MonoMethod *m;
-       MonoClass *class;
-       MonoDomain *domain = mono_domain_get ();
-       unsigned char *is_bb_start;
-       int in;
-       MonoVTable *method_class_vt;
-       int backwards;
-       MonoGenericContext *generic_context = NULL;
-
-       // g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
-       method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
-       if (!method_class_vt->initialized) {
-               jmp_buf env;
-               MonoInvocation *last_env_frame = context->env_frame;
-               jmp_buf *old_env = context->current_env;
-
-               if (setjmp(env)) {
-                       MonoException *failed = context->env_frame->ex;
-                       context->env_frame->ex = NULL;
-                       context->env_frame = last_env_frame;
-                       context->current_env = old_env;
-                       return failed;
-               }
-               context->env_frame = context->current_frame;
-               context->current_env = &env;
-               mono_runtime_class_init (method_class_vt);
-               context->env_frame = last_env_frame;
-               context->current_env = old_env;
-       }
-
-       mono_profiler_method_jit (method); /* sort of... */
-
-       if (mono_method_signature (method)->is_inflated)
-               generic_context = &((MonoMethodInflated *) method)->context;
-
-       if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
-               MonoMethod *nm = NULL;
-               mono_os_mutex_lock(&calc_section);
-               if (runtime_method->transformed) {
-                       mono_os_mutex_unlock(&calc_section);
-                       g_error ("FIXME: no jit info?");
-                       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
-                       return NULL;
-               }
-
-               /* assumes all internal calls with an array this are built in... */
-               if (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL && (! mono_method_signature (method)->hasthis || method->klass->rank == 0)) {
-                       nm = mono_marshal_get_native_wrapper (method, TRUE, FALSE);
-                       signature = mono_method_signature (nm);
-               } else {
-                       const char *name = method->name;
-                       if (method->klass->parent == mono_defaults.multicastdelegate_class) {
-                               if (*name == 'I' && (strcmp (name, "Invoke") == 0)) {
-                                       nm = mono_marshal_get_delegate_invoke (method, NULL);
-                               } else if (*name == 'B' && (strcmp (name, "BeginInvoke") == 0)) {
-                                       nm = mono_marshal_get_delegate_begin_invoke (method);
-                               } else if (*name == 'E' && (strcmp (name, "EndInvoke") == 0)) {
-                                       nm = mono_marshal_get_delegate_end_invoke (method);
-                               }
-                       } 
-                       if (nm == NULL) {
-                               runtime_method->code = g_malloc(sizeof(short));
-                               runtime_method->code[0] = MINT_CALLRUN;
-                       }
-               }
-               if (nm == NULL) {
-                       runtime_method->stack_size = sizeof (stackval); /* for tracing */
-                       runtime_method->alloca_size = runtime_method->stack_size;
-                       runtime_method->transformed = TRUE;
-                       mono_os_mutex_unlock(&calc_section);
-                       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
-                       return NULL;
-               }
-               method = nm;
-               header = mono_method_get_header (nm);
-               mono_os_mutex_unlock(&calc_section);
-       }
-       g_assert ((signature->param_count + signature->hasthis) < 1000);
-       g_assert (header->max_stack < 10000);
-       /* intern the strings in the method. */
-       ip = header->code;
-       end = ip + header->code_size;
-
-       is_bb_start = g_malloc0(header->code_size);
-       is_bb_start [0] = 1;
-       while (ip < end) {
-               in = *ip;
-               if (in == 0xfe) {
-                       ip++;
-                       in = *ip + 256;
-               }
-               else if (in == 0xf0) {
-                       ip++;
-                       in = *ip + MONO_CEE_MONO_ICALL;
-               }
-               opcode = &mono_opcodes [in];
-               switch (opcode->argument) {
-               case MonoInlineNone:
-                       ++ip;
-                       break;
-               case MonoInlineString:
-                       if (method->wrapper_type == MONO_WRAPPER_NONE)
-                               mono_ldstr (domain, image, mono_metadata_token_index (read32 (ip + 1)));
-                       ip += 5;
-                       break;
-               case MonoInlineType:
-                       if (method->wrapper_type == MONO_WRAPPER_NONE) {
-                               class = mono_class_get_full (image, read32 (ip + 1), generic_context);
-                               mono_class_init (class);
-                               /* quick fix to not do this for the fake ptr classes - probably should not be getting the vtable at all here */
-#if 0
-                               g_error ("FIXME: interface method lookup: %s (in method %s)", class->name, method->name);
-                               if (!(class->flags & TYPE_ATTRIBUTE_INTERFACE) && class->interface_offsets != NULL)
-                                       mono_class_vtable (domain, class);
-#endif
-                       }
-                       ip += 5;
-                       break;
-               case MonoInlineMethod:
-                       if (method->wrapper_type == MONO_WRAPPER_NONE && *ip != CEE_CALLI) {
-                               m = mono_get_method_full (image, read32 (ip + 1), NULL, generic_context);
-                               if (m == NULL) {
-                                       g_free (is_bb_start);
-                                       g_error ("FIXME: where to get method and class string?"); 
-                                       return NULL;
-                                       // return mono_get_exception_missing_method ();
-                               }
-                               mono_class_init (m->klass);
-                               if (!mono_class_is_interface (m->klass))
-                                       mono_class_vtable (domain, m->klass);
-                       }
-                       ip += 5;
-                       break;
-               case MonoInlineField:
-               case MonoInlineSig:
-               case MonoInlineI:
-               case MonoInlineTok:
-               case MonoShortInlineR:
-                       ip += 5;
-                       break;
-               case MonoInlineBrTarget:
-                       offset = read32 (ip + 1);
-                       ip += 5;
-                       backwards = offset < 0;
-                       offset += ip - header->code;
-                       g_assert (offset >= 0 && offset < header->code_size);
-                       is_bb_start [offset] |= backwards ? 2 : 1;
-                       break;
-               case MonoShortInlineBrTarget:
-                       offset = ((gint8 *)ip) [1];
-                       ip += 2;
-                       backwards = offset < 0;
-                       offset += ip - header->code;
-                       g_assert (offset >= 0 && offset < header->code_size);
-                       is_bb_start [offset] |= backwards ? 2 : 1;
-                       break;
-               case MonoInlineVar:
-                       ip += 3;
-                       break;
-               case MonoShortInlineVar:
-               case MonoShortInlineI:
-                       ip += 2;
-                       break;
-               case MonoInlineSwitch: {
-                       guint32 n;
-                       const unsigned char *next_ip;
-                       ++ip;
-                       n = read32 (ip);
-                       ip += 4;
-                       next_ip = ip + 4 * n;
-                       for (i = 0; i < n; i++) {
-                               offset = read32 (ip);
-                               backwards = offset < 0;
-                               offset += next_ip - header->code;
-                               g_assert (offset >= 0 && offset < header->code_size);
-                               is_bb_start [offset] |= backwards ? 2 : 1;
-                               ip += 4;
-                       }
-                       break;
-               }
-               case MonoInlineR:
-               case MonoInlineI8:
-                       ip += 9;
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
-       }
-       // g_printerr ("TRANSFORM(0x%016lx): end %s::%s\n", mono_thread_current (), method->klass->name, method->name);
-
-       /* the rest needs to be locked so it is only done once */
-       mono_os_mutex_lock(&calc_section);
-       if (runtime_method->transformed) {
-               mono_os_mutex_unlock(&calc_section);
-               g_free (is_bb_start);
-               mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
-               return NULL;
-       }
-
-       runtime_method->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
-       runtime_method->stack_size = (sizeof (stackval) + 2) * header->max_stack; /* + 1 for returns of called functions  + 1 for 0-ing in trace*/
-       runtime_method->stack_size = (runtime_method->stack_size + 7) & ~7;
-       offset = 0;
-       for (i = 0; i < header->num_locals; ++i) {
-               size = mono_type_size (header->locals [i], &align);
-               offset += align - 1;
-               offset &= ~(align - 1);
-               runtime_method->local_offsets [i] = offset;
-               offset += size;
-       }
-       offset = (offset + 7) & ~7;
-       runtime_method->locals_size = offset;
-       g_assert (runtime_method->locals_size < 65536);
-       offset = 0;
-       runtime_method->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
-
-       if (signature->hasthis) {
-               g_assert (!signature->pinvoke);
-               size = mono_type_stack_size (&method->klass->byval_arg, &align);
-               offset += align - 1;
-               offset &= ~(align - 1);
-               runtime_method->arg_offsets [0] = offset;
-               offset += size;
-       }
-
-       for (i = 0; i < signature->param_count; ++i) {
-               if (signature->pinvoke) {
-                       guint32 dummy;
-                       size = mono_type_native_stack_size (signature->params [i], &dummy);
-                       align = 8;
-               }
-               else
-                       size = mono_type_stack_size (signature->params [i], &align);
-               offset += align - 1;
-               offset &= ~(align - 1);
-               runtime_method->arg_offsets [i + !!signature->hasthis] = offset;
-               offset += size;
-       }
-       offset = (offset + 7) & ~7;
-       runtime_method->args_size = offset;
-       g_assert (runtime_method->args_size < 10000);
-
-       generate(method, runtime_method, is_bb_start);
-
-       g_free (is_bb_start);
-
-       mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_OK);
-       runtime_method->transformed = TRUE;
-       mono_os_mutex_unlock(&calc_section);
-
-       return NULL;
-}
-
index 765d3096a1cd2707f02b2d45e89bb1b2a75f8943..ab4ab1295f8f3f6fb8d73bcca4ba8e7b9d320f16 100644 (file)
@@ -1909,14 +1909,14 @@ mono_interruption_checkpoint_from_trampoline (void)
 }
 
 void
-mono_throw_method_access (MonoMethod *callee, MonoMethod *caller)
+mono_throw_method_access (MonoMethod *caller, MonoMethod *callee)
 {
-       char *callee_name = mono_method_full_name (callee, 1);
        char *caller_name = mono_method_full_name (caller, 1);
+       char *callee_name = mono_method_full_name (callee, 1);
        MonoError error;
 
        error_init (&error);
-       mono_error_set_generic_error (&error, "System", "MethodAccessException", "Method `%s' is inaccessible from method `%s'\n", callee_name, caller_name);
+       mono_error_set_generic_error (&error, "System", "MethodAccessException", "Method `%s' is inaccessible from method `%s'", callee_name, caller_name);
        mono_error_set_pending_exception (&error);
        g_free (callee_name);
        g_free (caller_name);
index 9d8deb26198c77832464ab704408e37ec51115cf..a83b337baaafb9d7fa97c1dc66313aca59c983b7 100644 (file)
@@ -224,7 +224,7 @@ MonoObject* mono_get_method_object (MonoMethod *method);
 
 double mono_ckfinite (double d);
 
-void mono_throw_method_access (MonoMethod *callee, MonoMethod *caller);
+void mono_throw_method_access (MonoMethod *caller, MonoMethod *callee);
 
 void mono_dummy_jit_icall (void);
 
index 6ff4ef6cc09108ae31d0e74d227f57cab0f8b655..360fbfbb67d80d1fedcf697645430f907a2befee 100644 (file)
@@ -12,9 +12,7 @@
 #include "lldb.h"
 #include "seq-points.h"
 
-#include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/utils/mono-counters.h>
 
 #if !defined(DISABLE_JIT) && !defined(DISABLE_LLDB)
index 5982e0c200851a771b00e243d5a71586c450c074..78d0c219216cd033ca369312d2963955f063beb1 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <config.h>
 #include <mono/utils/mono-compiler.h>
+#include "mini.h"
 
 #ifndef DISABLE_JIT
 
@@ -35,7 +36,6 @@
 #endif
 
 #include <mono/utils/memcheck.h>
-#include "mini.h"
 #include <mono/metadata/abi-details.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/attrdefs.h>
@@ -50,8 +50,7 @@
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/metadata/security-manager.h>
 #include <mono/metadata/threads-types.h>
@@ -59,7 +58,6 @@
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/profiler.h>
 #include <mono/metadata/monitor.h>
-#include <mono/metadata/debug-mono-symfile.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-error-internals.h>
 #include <mono/metadata/mono-basic-block.h>
@@ -144,8 +142,6 @@ static int stind_to_store_membase (int opcode);
 int mono_op_to_op_imm (int opcode);
 int mono_op_to_op_imm_noemul (int opcode);
 
-MONO_API MonoInst* mono_emit_native_call (MonoCompile *cfg, gconstpointer func, MonoMethodSignature *sig, MonoInst **args);
-
 static int inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp,
                                                  guchar *ip, guint real_offset, gboolean inline_always);
 static MonoInst*
@@ -2953,12 +2949,12 @@ mono_emit_widen_call_res (MonoCompile *cfg, MonoInst *ins, MonoMethodSignature *
 
 
 static void
-emit_method_access_failure (MonoCompile *cfg, MonoMethod *method, MonoMethod *cil_method)
+emit_method_access_failure (MonoCompile *cfg, MonoMethod *caller, MonoMethod *callee)
 {
        MonoInst *args [16];
 
-       args [0] = emit_get_rgctx_method (cfg, mono_method_check_context_used (method), method, MONO_RGCTX_INFO_METHOD);
-       args [1] = emit_get_rgctx_method (cfg, mono_method_check_context_used (cil_method), cil_method, MONO_RGCTX_INFO_METHOD);
+       args [0] = emit_get_rgctx_method (cfg, mono_method_check_context_used (caller), caller, MONO_RGCTX_INFO_METHOD);
+       args [1] = emit_get_rgctx_method (cfg, mono_method_check_context_used (callee), callee, MONO_RGCTX_INFO_METHOD);
 
        mono_emit_jit_icall (cfg, mono_throw_method_access, args);
 }
@@ -14549,6 +14545,9 @@ NOTES
 
 #else /* !DISABLE_JIT */
 
-MONO_EMPTY_SOURCE_FILE (method_to_ir);
+void
+mono_set_break_policy (MonoBreakPolicyFunc policy_callback)
+{
+}
 
 #endif /* !DISABLE_JIT */
index 6a4e7af9d4485ea1894c08f45c9421519744cc12..c4518da3deda497facfea4dd426603893915f970 100644 (file)
@@ -17,7 +17,6 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/arch/amd64/amd64-codegen.h>
index f85644d42ca6d5446732a7427bb27e48b48d9177..1ab5eeab15c852da548777f57ae2659139d46854 100644 (file)
@@ -781,7 +781,7 @@ mono_arch_init (void)
        mono_aot_register_jit_icall ("mono_arm_start_gsharedvt_call", mono_arm_start_gsharedvt_call);
 #endif
        mono_aot_register_jit_icall ("mono_arm_unaligned_stack", mono_arm_unaligned_stack);
-
+       mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
 #if defined(__ARM_EABI__)
        eabi_supported = TRUE;
 #endif
@@ -7446,3 +7446,17 @@ emit_aotconst (MonoCompile *cfg, guint8 *code, int dreg, int patch_type, gpointe
        ARM_LDR_REG_REG (code, dreg, ARMREG_PC, dreg);
        return code;
 }
+
+guint8*
+mono_arm_emit_aotconst (gpointer ji_list, guint8 *code, guint8 *buf, int dreg, int patch_type, gconstpointer data)
+{
+       MonoJumpInfo **ji = (MonoJumpInfo**)ji_list;
+
+       *ji = mono_patch_info_list_prepend (*ji, code - buf, patch_type, data);
+       ARM_LDR_IMM (code, dreg, ARMREG_PC, 0);
+       ARM_B (code, 0);
+       *(gpointer*)code = NULL;
+       code += 4;
+       ARM_LDR_REG_REG (code, dreg, ARMREG_PC, dreg);
+       return code;
+}
index 31194f2e60d596b17facb97b744e482f3abb3864..98f8ef946bd345234cfad4e89badb04f4bcd511b 100644 (file)
@@ -340,6 +340,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
 #define MONO_ARCH_HAVE_CONTEXT_SET_INT_REG 1
 #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
+#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GSHAREDVT_SUPPORTED 1
 #define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1
@@ -403,6 +404,13 @@ mono_arm_is_hard_float (void);
 void
 mono_arm_unaligned_stack (MonoMethod *method);
 
+gpointer
+mono_arm_handler_block_trampoline_helper (gpointer *ptr);
+
+/* MonoJumpInfo **ji */
+guint8*
+mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *buf, int dreg, int patch_type, gconstpointer data);
+
 CallInfo*
 mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig);
 
index 1884dc1d49d714d53444064d6e76947b989aedd0..10acac62282508876ba07dc56e093fd53b739441 100644 (file)
@@ -233,6 +233,7 @@ mono_arch_init (void)
 {
        mono_aot_register_jit_icall ("mono_arm_throw_exception", mono_arm_throw_exception);
        mono_aot_register_jit_icall ("mono_arm_resume_unwind", mono_arm_resume_unwind);
+       mono_aot_register_jit_icall ("mono_arm_handler_block_trampoline_helper", mono_arm_handler_block_trampoline_helper);
 
        if (!mono_aot_only)
                bp_trampoline = mini_get_breakpoint_trampoline ();
@@ -1348,6 +1349,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                        /* Pass the argument address in the next register */
                        if (cinfo->gr >= PARAM_REGS) {
                                ainfo->storage = ArgVtypeByRefOnStack;
+                               cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, 8);
                                ainfo->offset = cinfo->stack_usage;
                                cinfo->stack_usage += 8;
                        } else {
index 28745040b6b4db50673b3717e738fd56b4426e53..179d34ca4daf662d89d7135f250ced34418522ad 100644 (file)
@@ -158,6 +158,7 @@ typedef struct {
 #define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1
 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
 #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
+#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
 
 #ifdef TARGET_IOS
 
@@ -259,6 +260,8 @@ GSList* mono_arm_get_exception_trampolines (gboolean aot);
 
 void mono_arm_resume_unwind (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow);
 
+gpointer mono_arm_handler_block_trampoline_helper (gpointer *ptr);
+
 CallInfo* mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig);
 
 #endif /* __MONO_MINI_ARM64_H__ */
index e130eb59411d6d759ca059e13d4fff1c39a03365..272065388e6187182d90d5d35fe36d8d1f6730c9 100644 (file)
@@ -73,6 +73,7 @@
 #include "seq-points.h"
 #include "llvm-runtime.h"
 #include "mini-llvm.h"
+#include "interp/interp.h"
 
 #ifdef ENABLE_LLVM
 #include "mini-llvm-cpp.h"
@@ -220,7 +221,13 @@ mono_exceptions_init (void)
 #ifdef MONO_ARCH_HAVE_EXCEPTIONS_INIT
        mono_arch_exceptions_init ();
 #endif
-       cbs.mono_walk_stack_with_ctx = mono_runtime_walk_stack_with_ctx;
+#ifdef ENABLE_INTERPRETER
+       if (mono_use_interpreter)
+               cbs.mono_walk_stack_with_ctx = interp_walk_stack_with_ctx;
+       else
+#endif
+               cbs.mono_walk_stack_with_ctx = mono_runtime_walk_stack_with_ctx;
+
        cbs.mono_walk_stack_with_state = mono_walk_stack_with_state;
 
        if (mono_llvm_only)
index 745c29f13e48c77af959d7d831544421eda14bcf..3fb5dfce0117b9e7df33932b2fa3a7de384465fd 100644 (file)
@@ -9,7 +9,7 @@
 #include "config.h"
 
 #include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/object-internals.h>
@@ -9020,7 +9020,7 @@ emit_dbg_subprogram (EmitContext *ctx, MonoCompile *cfg, LLVMValueRef method, co
        if (!minfo)
                return NULL;
 
-       mono_debug_symfile_get_seq_points (minfo, &source_file, NULL, NULL, &sym_seq_points, &n_seq_points);
+       mono_debug_get_seq_points (minfo, &source_file, NULL, NULL, &sym_seq_points, &n_seq_points);
        if (!source_file)
                source_file = g_strdup ("<unknown>");
        dir = g_path_get_dirname (source_file);
@@ -9116,7 +9116,7 @@ emit_dbg_loc (EmitContext *ctx, LLVMBuilderRef builder, const unsigned char *cil
                MonoDebugSourceLocation *loc;
                LLVMValueRef loc_md;
 
-               loc = mono_debug_symfile_lookup_location (ctx->minfo, cil_code - cfg->header->code);
+               loc = mono_debug_method_lookup_location (ctx->minfo, cil_code - cfg->header->code);
 
                if (loc) {
 #if LLVM_API_VERSION > 100
@@ -9134,7 +9134,7 @@ emit_dbg_loc (EmitContext *ctx, LLVMBuilderRef builder, const unsigned char *cil
                        loc_md = LLVMMDNode (md_args, nmd_args);
                        LLVMSetCurrentDebugLocation (builder, loc_md);
 #endif
-                       mono_debug_symfile_free_location (loc);
+                       mono_debug_free_source_location (loc);
                }
        }
 }
index 22d9a5cd227a889fe2192431f7357b12f972e822..d573c31ce04be54923e55f37bb708299940016df 100644 (file)
@@ -91,7 +91,7 @@
 #endif
 
 #ifdef ENABLE_INTERPRETER
-#include "interpreter/interp.h"
+#include "interp/interp.h"
 #endif
 
 static guint32 default_opt = 0;
@@ -3052,6 +3052,10 @@ mini_init_delegate (MonoDelegate *del)
 {
        if (mono_llvm_only)
                del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
+#ifdef ENABLE_INTERPRETER
+       if (mono_use_interpreter)
+               mono_interp_init_delegate (del);
+#endif
 }
 
 char*
index c01f6eaebf4ab2f3bb6f0ebf03c5ca0c4deb8b8b..88c89e75e960ba18203b2633f707debec28a04cc 100644 (file)
 #include "mini.h"
 #include "lldb.h"
 
+#ifdef ENABLE_INTERPRETER
+#include "interp/interp.h"
+#endif
+
 /*
  * Address of the trampoline code.  This is used by the debugger to check
  * whether a method is a trampoline.
@@ -1459,6 +1463,15 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad
 
        error_init (error);
 
+#ifdef ENABLE_INTERPRETER
+       if (mono_use_interpreter) {
+               gpointer ret = mono_interp_create_trampoline (domain, method, error);
+               if (!mono_error_ok (error))
+                       return NULL;
+               return ret;
+       }
+#endif
+
        code = mono_jit_find_compiled_method_with_jit_info (domain, method, &ji);
        /*
         * We cannot recover the correct type of a shared generic
@@ -1636,7 +1649,7 @@ no_delegate_trampoline (void)
 gpointer
 mono_create_delegate_trampoline (MonoDomain *domain, MonoClass *klass)
 {
-       if (mono_llvm_only)
+       if (mono_llvm_only || mono_use_interpreter)
                return no_delegate_trampoline;
 
        return mono_create_delegate_trampoline_info (domain, klass, NULL)->invoke_impl;
index 6e04f7d37581f0f5052a76e500a02be22a959d56..edc0bb19eccc0997e504aea797953e139a72ea77 100644 (file)
@@ -34,12 +34,6 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
 
 #endif /* HOST_WIN32 */
 
-#ifdef __HAIKU__
-struct sigcontext {
-       vregs regs;
-};
-#endif /* __HAIKU__ */
-
 #if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
        defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
 #define MONO_ARCH_USE_SIGACTION
index d8e9f9ca547311b597c6fa42f6a1e599a26ec0b4..a9c6f3209b467576ddbf6540a121086a603b4030 100644 (file)
@@ -2398,7 +2398,7 @@ void      mono_print_code                   (MonoCompile *cfg, const char *msg);
 MONO_API void      mono_print_method_from_ip         (void *ip);
 MONO_API char     *mono_pmip                         (void *ip);
 gboolean  mono_debug_count                  (void);
-MONO_API const char* mono_inst_name                  (int op);
+MONO_LLVM_INTERNAL const char* mono_inst_name                  (int op);
 int       mono_op_to_op_imm                 (int opcode);
 int       mono_op_imm_to_op                 (int opcode);
 int       mono_load_membase_to_load_mem     (int opcode);
@@ -2449,6 +2449,7 @@ MonoInst* mono_emit_jit_icall (MonoCompile *cfg, gconstpointer func, MonoInst **
 MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, int il_offset, MonoJitICallInfo *info, MonoInst **args);
 MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this_ins);
 void      mono_create_helper_signatures (void);
+MonoInst* mono_emit_native_call (MonoCompile *cfg, gconstpointer func, MonoMethodSignature *sig, MonoInst **args);
 
 gboolean  mini_class_is_system_array (MonoClass *klass);
 MonoMethodSignature *mono_get_element_address_signature (int arity);
@@ -2543,7 +2544,7 @@ void      mono_draw_graph                   (MonoCompile *cfg, MonoGraphOptions
 void      mono_add_ins_to_end               (MonoBasicBlock *bb, MonoInst *inst);
 gpointer  mono_create_ftnptr                (MonoDomain *domain, gpointer addr);
 
-MONO_API void      mono_replace_ins                  (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst **prev, MonoBasicBlock *first_bb, MonoBasicBlock *last_bb);
+void      mono_replace_ins                  (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst **prev, MonoBasicBlock *first_bb, MonoBasicBlock *last_bb);
 
 int               mono_find_method_opcode      (MonoMethod *method);
 MonoJitICallInfo *mono_register_jit_icall      (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
index 3aa8a24aaf45ad48caba52720f067ee06133f6ad..21fd43e7d437f0ed5689d9d63c455e19add2be50 100644 (file)
@@ -473,7 +473,6 @@ class Tests {
                return o.GetHashCode ();
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_unbox_trampoline2 () {
                int i = 12;
                object o = i;
@@ -623,7 +622,6 @@ class Tests {
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_multi_array_cast () {
                Duper[,] d = new Duper [1, 1];
                object[,] o = d;
@@ -876,6 +874,23 @@ class Tests {
                return 2;
        }
 
+       class InstanceDelegateTest {
+               public int a;
+
+               public int return_field () {
+                       return a;
+               }
+       }
+
+       public static int test_2_instance_delegate_with_field () {
+               InstanceDelegateTest t = new InstanceDelegateTest () { a = 1337 };
+               GetIntDel del = new GetIntDel (t.return_field);
+               int v = del ();
+               if (v != 1337)
+                       return 0;
+               return 2;
+       }
+
        interface IFaceVirtualDel {
                int return_field ();
        }
@@ -890,21 +905,18 @@ class Tests {
                }
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_42_vtype_delegate () {
                var s = new VtypeVirtualDelStruct () { f = 42 };
                Func<int> f = s.return_field_nonvirt;
                return f ();
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_42_vtype_virtual_delegate () {
                IFaceVirtualDel s = new VtypeVirtualDelStruct () { f = 42 };
                Func<int> f = s.return_field;
                return f ();
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_1_store_decimal () {
                decimal[,] a = {{1}};
 
@@ -1423,7 +1435,6 @@ ncells ) {
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
        static int test_0_array_get_set_soft_float () {
                float[,] arr = new float [2, 2];
                arr [0, 0] = 256f;
@@ -1584,7 +1595,6 @@ ncells ) {
                return mInstance;
        }
 
-       [Category ("!INTERPRETER")]
        static int test_0_synchronized () {
                getInstance ();
                return 0;
@@ -1753,7 +1763,6 @@ ncells ) {
                }
        }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_delegate_to_virtual_generic_on_ifaces () {
                IComparer2 c = new AClass ();
 
@@ -1776,7 +1785,6 @@ ncells ) {
 
        enum Mine { One, Two }
 
-       [Category ("!INTERPRETER")]
        public static int test_0_enum_gethashcode_opt () {
                int sum = 0;
         for (int i = 0; i < 1000000; ++i)
index 6497094328f27edbc433ca6d198a116c81f5e775..5cf1f75540db1a921bea4ea3755ebc5edd7118dd 100644 (file)
@@ -17,7 +17,6 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/arch/amd64/amd64-codegen.h>
@@ -491,4 +490,4 @@ mono_amd64_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoi
        return NULL;
 }
 
-#endif
\ No newline at end of file
+#endif
index 0a93c0e69e69b6300abab3ab163abbc8cb3c5e02..7ec7437eb30de65ba5895512bfc4619f583718d2 100644 (file)
@@ -19,7 +19,6 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/arch/amd64/amd64-codegen.h>
@@ -997,7 +996,6 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
 
        return buf;
 }
-#endif /* !DISABLE_JIT */
 
 /*
  * mono_arch_get_enter_icall_trampoline:
@@ -1010,80 +1008,144 @@ gpointer
 mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
 {
 #ifdef ENABLE_INTERPRETER
-       const int gregs_num = 6;
-       guint8 *start = NULL, *code, *exits [gregs_num], *leave_tramp;
+       const int gregs_num = 8;
+       const int fregs_num = 3;
+       guint8 *start = NULL, *code, *label_gexits [gregs_num], *label_fexits [fregs_num], *label_leave_tramp [3], *label_is_float_ret;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
-       static int arg_regs[] = {AMD64_ARG_REG1, AMD64_ARG_REG2, AMD64_ARG_REG3, AMD64_ARG_REG4, AMD64_R8, AMD64_R9};
-       int i, offset = 0;
+       static int farg_regs[] = {AMD64_XMM0, AMD64_XMM1, AMD64_XMM2};
+       int i, framesize = 0, off_rbp, off_methodargs, off_targetaddr;
 
        start = code = (guint8 *) mono_global_codeman_reserve (256 + MONO_TRAMPOLINE_UNWINDINFO_SIZE(0));
 
+       off_rbp = -framesize;
+
+       framesize += sizeof (mgreg_t);
+       off_methodargs = -framesize;
+
+       framesize += sizeof (mgreg_t);
+       off_targetaddr = -framesize;
+
+       framesize += (gregs_num - PARAM_REGS) * sizeof (mgreg_t);
+
+       amd64_push_reg (code, AMD64_RBP);
+       amd64_mov_reg_reg (code, AMD64_RBP, AMD64_RSP, sizeof (mgreg_t));
+       amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT));
+
        /* save MethodArguments* onto stack */
-       amd64_push_reg (code, AMD64_ARG_REG2);
+       amd64_mov_membase_reg (code, AMD64_RBP, off_methodargs, AMD64_ARG_REG2, sizeof (mgreg_t));
 
        /* save target address on stack */
-       amd64_push_reg (code, AMD64_ARG_REG1);
-       amd64_push_reg (code, AMD64_RAX);
+       amd64_mov_membase_reg (code, AMD64_RBP, off_targetaddr, AMD64_ARG_REG1, sizeof (mgreg_t));
 
        /* load pointer to MethodArguments* into R11 */
        amd64_mov_reg_reg (code, AMD64_R11, AMD64_ARG_REG2, 8);
        
-       /* TODO: do float stuff first */
+       /* move flen into RAX */ // TODO: struct offset
+       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 16, sizeof (mgreg_t));
+       /* load pointer to fregs into R11 */ // TODO: struct offset
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 24, sizeof (mgreg_t));
+
+       for (i = 0; i < fregs_num; ++i) {
+               amd64_test_reg_reg (code, AMD64_RAX, AMD64_RAX);
+               label_fexits [i] = code;
+               x86_branch8 (code, X86_CC_Z, 0, FALSE);
+
+               amd64_sse_movsd_reg_membase (code, farg_regs [i], AMD64_R11, i * sizeof (double));
+               amd64_dec_reg_size (code, AMD64_RAX, 1);
+       }
+
+       for (i = 0; i < fregs_num; i++) {
+               x86_patch (label_fexits [i], code);
+       }
 
+       /* load pointer to MethodArguments* into R11 */
+       amd64_mov_reg_reg (code, AMD64_R11, AMD64_ARG_REG2, sizeof (mgreg_t));
        /* move ilen into RAX */ // TODO: struct offset
-       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 0, 8);
-       /* load pointer to iregs into R11 */ // TODO: struct offset
-       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 8, 8);
+       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, 0, sizeof (mgreg_t));
 
+       int stack_offset = 0;
        for (i = 0; i < gregs_num; i++) {
                amd64_test_reg_reg (code, AMD64_RAX, AMD64_RAX);
-               exits [i] = code;
-               x86_branch8 (code, X86_CC_Z, 0, FALSE);
+               label_gexits [i] = code;
+               x86_branch32 (code, X86_CC_Z, 0, FALSE);
 
-#ifdef TARGET_WIN32
-               if (i < 4) {
-#else
-               if (i < 6) {
-#endif
-                       amd64_mov_reg_membase (code, arg_regs [i], AMD64_R11, i * sizeof (gpointer), 8);
+               /* load pointer to MethodArguments* into R11 */
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t));
+               /* load pointer to iregs into R11 */ // TODO: struct offset
+               amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 8, sizeof (mgreg_t));
+
+               if (i < PARAM_REGS) {
+                       amd64_mov_reg_membase (code, param_regs [i], AMD64_R11, i * sizeof (mgreg_t), sizeof (mgreg_t));
                } else {
-                       g_error ("not tested yet.");
-                       amd64_push_reg (code, AMD64_RAX);
-                       amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, i * sizeof (gpointer), 8);
-                       amd64_mov_membase_reg (code, AMD64_RBP, offset, AMD64_RAX, sizeof (gpointer));
-                       offset += sizeof (gpointer);
-                       amd64_pop_reg (code, AMD64_RAX);
+                       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, i * sizeof (mgreg_t), sizeof (mgreg_t));
+                       amd64_mov_membase_reg (code, AMD64_RSP, stack_offset, AMD64_R11, sizeof (mgreg_t));
+                       stack_offset += sizeof (mgreg_t);
                }
                amd64_dec_reg_size (code, AMD64_RAX, 1);
        }
 
        for (i = 0; i < gregs_num; i++) {
-               x86_patch (exits [i], code);
+               x86_patch (label_gexits [i], code);
        }
 
-
-       amd64_pop_reg (code, AMD64_RAX);
-       amd64_pop_reg (code, AMD64_R11);
+       /* load target addr */
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_targetaddr, sizeof (mgreg_t));
 
        /* call into native function */
        amd64_call_reg (code, AMD64_R11);
 
        /* load MethodArguments */
-       amd64_pop_reg (code, AMD64_R11);
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t));
+
+       /* load is_float_ret */ // TODO: struct offset
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0x28, sizeof (mgreg_t));
+
+       /* check if a float return value is expected */
+       amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
+
+       label_is_float_ret = code;
+       x86_branch8 (code, X86_CC_NZ, 0, FALSE);
+
+
+
+       /* greg return */
+       /* load MethodArguments */
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t));
        /* load retval */ // TODO: struct offset
-       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0x20, 8);
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0x20, sizeof (mgreg_t));
 
        amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
-       leave_tramp = code;
+       label_leave_tramp [0] = code;
        x86_branch8 (code, X86_CC_Z, 0, FALSE);
 
-       amd64_mov_membase_reg (code, AMD64_R11, 0, AMD64_RAX, 8);
+       amd64_mov_membase_reg (code, AMD64_R11, 0, AMD64_RAX, sizeof (mgreg_t));
+
+       label_leave_tramp [1] = code;
+       x86_jump8 (code, 0);
 
-       x86_patch (leave_tramp, code);
-       amd64_ret (code);
 
 
+       /* freg return */
+       x86_patch (label_is_float_ret, code);
+       /* load MethodArguments */
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t));
+       /* load retval */ // TODO: struct offset
+       amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0x20, sizeof (mgreg_t));
+
+       amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
+       label_leave_tramp [2] = code;
+       x86_branch8 (code, X86_CC_Z, 0, FALSE);
+
+       amd64_sse_movsd_membase_reg (code, AMD64_R11, 0, AMD64_XMM0);
+
+       for (i = 0; i < 3; i++)
+               x86_patch (label_leave_tramp [i], code);
+
+       amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT));
+       amd64_pop_reg (code, AMD64_RBP);
+       amd64_ret (code);
+
        mono_arch_flush_icache (start, code - start);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL);
 
@@ -1096,6 +1158,7 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
        return NULL;
 #endif /* ENABLE_INTERPRETER */
 }
+#endif /* !DISABLE_JIT */
 
 #ifdef DISABLE_JIT
 gpointer
index 4e2a23ce6a049d3c992869e213a178e76b3c39b2..4c61ab08866e868d680141ef5647b2f05ce3a273 100644 (file)
@@ -680,8 +680,8 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo
        return buf;
 }
 
-static gpointer
-handler_block_trampoline_helper (gpointer *ptr)
+gpointer
+mono_arm_handler_block_trampoline_helper (gpointer *ptr)
 {
        MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
        return jit_tls->handler_block_return_address;
@@ -696,8 +696,6 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
 
-       g_assert (!aot);
-
        code = buf = mono_global_codeman_reserve (tramp_size);
 
        unwind_ops = mono_arch_get_cie_program ();
@@ -712,19 +710,30 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
         * We are in a method frame after the call emitted by OP_CALL_HANDLER.
         */
        /* Obtain jit_tls->handler_block_return_address */
-       ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
-       ARM_B (code, 0);
-       *(gpointer*)code = handler_block_trampoline_helper;
-       code += 4;
+       if (aot) {
+               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
+               ARM_B (code, 0);
+       } else {
+               ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               *(gpointer*)code = mono_arm_handler_block_trampoline_helper;
+               code += 4;
+       }
 
        /* Set it as the return address so the trampoline will return to it */
        ARM_MOV_REG_REG (code, ARMREG_LR, ARMREG_R0);
 
        /* Call the trampoline */
-       ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
-       code = emit_bx (code, ARMREG_R0);
-       *(gpointer*)code = tramp;
-       code += 4;
+       if (aot) {
+               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_R0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+               code = emit_bx (code, ARMREG_R0);
+       } else {
+               ARM_LDR_IMM (code, ARMREG_R0, ARMREG_PC, 0);
+               code = emit_bx (code, ARMREG_R0);
+               *(gpointer*)code = tramp;
+               code += 4;
+       }
 
        mono_arch_flush_icache (buf, code - buf);
        mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL);
index abeb5cd367c11f59ac9a057b4c2c94ccba5c9616..2e005d3c7ab703cc11d3e7c147ab1cb459df3e19 100644 (file)
@@ -93,7 +93,7 @@ mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoint
                                break;
                        case GSHAREDVT_ARG_BYVAL_TO_BYREF:
                                src_slot = src & 0x3f;
-                               src_ptr = (guint8*)(caller + src_slot + src_offset);
+                               src_ptr = (guint8*)(caller + src_slot) + src_offset;
                                callee [dst] = src_ptr;
                                break;
                        default:
index 50cf02095c3970d174b98e011b555edbd215ed77..6cc8be320f68e950e6f36e929aa1d68cb2fd0ab4 100644 (file)
@@ -507,8 +507,8 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo
        return buf;
 }
 
-static gpointer
-handler_block_trampoline_helper (gpointer *ptr)
+gpointer
+mono_arm_handler_block_trampoline_helper (gpointer *ptr)
 {
        MonoJitTlsData *jit_tls = mono_tls_get_jit_tls ();
        return jit_tls->handler_block_return_address;
@@ -523,14 +523,10 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
 
-       g_assert (!aot);
-
        code = buf = mono_global_codeman_reserve (tramp_size);
 
        unwind_ops = NULL;
 
-       tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
-
        /*
        This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
        */
@@ -538,12 +534,21 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        /*
         * We are in a method frame after the call emitted by OP_CALL_HANDLER.
         */
-       code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)handler_block_trampoline_helper);
+       if (aot)
+               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_arm_handler_block_trampoline_helper");
+       else
+               code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)mono_arm_handler_block_trampoline_helper);
        /* Set it as the return address so the trampoline will return to it */
        arm_movx (code, ARMREG_LR, ARMREG_IP0);
 
        /* Call the trampoline */
-       code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp);
+       if (aot) {
+               char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+               code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+       } else {
+               tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL);
+               code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp);
+       }
        arm_brx (code, ARMREG_IP0);
 
        mono_arch_flush_icache (buf, code - buf);
index d21ab21e17188c5cbb20c1ef74544bbb1cf80117..48338e3f757c96cdb385771aba5d2fbd97ba0478 100644 (file)
@@ -13,7 +13,6 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/arch/ia64/ia64-codegen.h>
 
 #include "mini.h"
index d0c778421d3ef278277ec627d0ead7e4264f1bfb..eac0f3141335a7a7f08152dfe6080e3c76151dac 100644 (file)
@@ -15,8 +15,6 @@
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/mono-debug.h>
-#include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/arch/x86/x86-codegen.h>
index 8d9cf6fe47c3da9a13cdb780f5b64f12ba1c8851..18a5099d977decdb86790a83a81df355b34745f9 100644 (file)
@@ -802,4 +802,7 @@ mini_emit_class_check (MonoCompile *cfg, int klass_reg, MonoClass *klass)
        mini_emit_class_check_inst (cfg, klass_reg, klass, NULL);
 }
 
+#else
+
+MONO_EMPTY_SOURCE_FILE (type_checking);
 #endif
index 960447171e690e113129845451173abf39cbcadb..f63171e52f171eaf656667e33b5a9297c37231f2 100644 (file)
@@ -382,14 +382,14 @@ mono_unwind_ops_encode_full (GSList *unwind_ops, guint32 *out_len, gboolean enab
 
                /* Emit an advance_loc if neccesary */
                while (op->when > loc) {
-                       if (op->when - loc > 65536) {
+                       if (op->when - loc >= 65536) {
                                *p ++ = DW_CFA_advance_loc4;
                                guint32 v = (guint32)(op->when - loc);
                                memcpy (p, &v, 4);
                                g_assert (read32 (p) == (guint32)(op->when - loc));
                                p += 4;
                                loc = op->when;
-                       } else if (op->when - loc > 256) {
+                       } else if (op->when - loc >= 256) {
                                *p ++ = DW_CFA_advance_loc2;
                                guint16 v = (guint16)(op->when - loc);
                                memcpy (p, &v, 2);
index 78de58aaa08de08e66e16439a294f494979335c5..2ed52c541fda284f3e81b05fa0e6f81dde8a3e6c 100644 (file)
@@ -31,7 +31,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 #include <string.h>
 #include <glib.h>
 
index a78fb3dad57e7b8d3d3d31671ba54a5d24a13f05..ae8e2ab2f20cb5498bb559cb577e9c18c37c01cf 100644 (file)
@@ -958,12 +958,6 @@ is_xdomain_ref_allowed (GCObject **ptr, GCObject *obj, MonoDomain *domain)
                        offset == G_STRUCT_OFFSET (MonoRealProxy, unwrapped_server))
                return TRUE;
 #endif
-       /* Thread.cached_culture_info */
-       if (!strcmp (ref->vtable->klass->name_space, "System.Globalization") &&
-                       !strcmp (ref->vtable->klass->name, "CultureInfo") &&
-                       !strcmp(o->vtable->klass->name_space, "System") &&
-                       !strcmp(o->vtable->klass->name, "Object[]"))
-               return TRUE;
        /*
         *  at System.IO.MemoryStream.InternalConstructor (byte[],int,int,bool,bool) [0x0004d] in /home/schani/Work/novell/trunk/mcs/class/corlib/System.IO/MemoryStream.cs:121
         * at System.IO.MemoryStream..ctor (byte[]) [0x00017] in /home/schani/Work/novell/trunk/mcs/class/corlib/System.IO/MemoryStream.cs:81
index e59f206a04201118c7ca9c6fbc1d26810a8ed16c..5139a2b4e7a2be1645a74a9be4352cbbe3461edd 100644 (file)
@@ -15,7 +15,7 @@
 #define ELEM(i) \
        (((unsigned char*)array) + ((i) * element_size))
 #define SET(i,j) \
-       do memcpy ((i), (j), element_size); while (0)
+       do memmove ((i), (j), element_size); while (0)
 #define SWAP(i,j) \
        do { \
                size_t __i = (i), __j = (j); \
index 5062f48d39cd0e7ec57f13591b9602ba0a40a7e4..aef891ca9533761070e528971ea22de4574a4caf 100644 (file)
@@ -7,7 +7,7 @@ FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
 endif
 
 check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-multi-netmodule test-cattr-type-load test-reflection-load-with-context test_platform        \
-                test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs
+                test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress test-pedump rm-empty-logs
 check-full: test-sgen check-local
 check-parallel: compile-tests check-full
 
@@ -61,7 +61,7 @@ MCS_NO_LIB = $(TOOLS_RUNTIME) $(CSC) -unsafe -debug:portable \
        -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
        -nowarn:0197 $(PROFILE_MCS_FLAGS)
 
-MCS = $(MCS_NO_LIB) -lib:$(CLASS)
+MCS = $(MCS_NO_LIB)
 
 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
 
@@ -934,7 +934,7 @@ EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
        $(ILASM) -out:$@ $<
 
 if !FULL_AOT_TESTS
-TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
+TEST_DRIVER_HARD_KILL_FEATURE=-r:$(CLASS)/Mono.Posix.dll
 endif
 
 if FULL_AOT_TESTS
@@ -948,13 +948,17 @@ endif
 endif
 
 %.exe: %.cs $(TEST_DRIVER_DEPEND)
+       $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
+
+# N.B. test-runner.exe references the TOOLS_RUNTIME versions of the framework assemblies
+test-runner.exe: test-runner.cs $(TEST_DRIVER_DEPEND)
        $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $<
 
 %.dll: %.cs
-       $(MCS) -r:System.dll -target:library -out:$@ $<
+       $(MCS) -r:$(CLASS)/System.dll -target:library -out:$@ $<
 
 reference-loader.exe: reference-loader.cs TestingReferenceAssembly.dll TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_DEPEND)
-       $(MCS) -r:System.dll -r:TestDriver.dll -r:TestingReferenceAssembly.dll -r:TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $(srcdir)/reference-loader.cs
+       $(MCS) -r:$(CLASS)/System.dll -r:TestDriver.dll -r:TestingReferenceAssembly.dll -r:TestingReferenceReferenceAssembly.dll $(TEST_DRIVER_HARD_KILL_FEATURE) -out:$@ $(srcdir)/reference-loader.cs
 
 TestingReferenceAssembly.dll: TestingReferenceAssembly.cs
        $(MCS) -target:library -out:$@ $<
@@ -1135,10 +1139,10 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
        fi
 
 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
-       $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(TOOLS_RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
-       $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(TOOLS_RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$(DISABLED_TESTS)" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 testjit:
        @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
@@ -1279,23 +1283,23 @@ sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-ms-conc-split-clear-at-gc
 
 sgen-regular-tests-ms: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-par: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc-par" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc-par" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split,alloc-ratio=95" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_REGULAR_TESTS)
 
 SGEN_TOGGLEREF_TESTS=  \
        sgen-toggleref.exe
@@ -1311,21 +1315,21 @@ sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
        $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
 
 sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 
 SGEN_BRIDGE_TESTS=     \
        sgen-bridge.exe \
@@ -1342,21 +1346,21 @@ sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
        $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
 
 sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE_TESTS)
 
 SGEN_BRIDGE2_TESTS=    \
        sgen-bridge-xref.exe
@@ -1372,21 +1376,21 @@ sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
        $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
 
 sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 SGEN_BRIDGE3_TESTS=    \
        sgen-bridge-gchandle.exe
@@ -1402,21 +1406,21 @@ sgen-bridge3-tests: $(SGEN_BRIDGE3_TESTS)
        $(MAKE) sgen-bridge3-tests-ms-split-tarjan-bridge
 
 sgen-bridge3-tests-plain: $(SGEN_bridge3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 
 
 AOT_CONFIGURATIONS=    \
@@ -1514,7 +1518,7 @@ test-unhandled-exception: unhandled-exception-test-runner.2.exe unhandled-except
 
 # We use 'test-support-files' to handle an ordering issue between the 'mono/' and 'runtime/' directories
 bug-80307.exe: $(srcdir)/bug-80307.cs
-       $(MCS) -r:System.Web.dll -out:$@ $(srcdir)/bug-80307.cs
+       $(MCS) -r:$(CLASS)/System.Web.dll -out:$@ $(srcdir)/bug-80307.cs
        cd $(top_builddir)/runtime && $(MAKE) test-support-files
 
 EXTRA_DIST += bug-81673-interface.cs
@@ -1656,7 +1660,7 @@ generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
        $(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
 
 bug-3903.exe: bug-3903.cs
-       $(MCS_NO_LIB) -lib:$(srcdir)/../../external/binary-reference-assemblies/v2.0/ $(srcdir)/bug-3903.cs -r:System.Core.dll -out:$@
+       $(MCS_NO_LIB)  $(srcdir)/bug-3903.cs -r:$(srcdir)/../../external/binary-reference-assemblies/v2.0/System.Core.dll -out:$@
 
 gshared: test-generic-sharing
 
@@ -1738,7 +1742,7 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
        done
 
 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
-       $(Q) $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+       $(Q) $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
 
 if NACL_CODEGEN
 test-generic-sharing:
@@ -1816,13 +1820,13 @@ test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION
        $(MAKE) test-unhandled-exception-2-255-without-managed-handler
 
 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 
 endif
 
@@ -1840,6 +1844,9 @@ test-console-output: console-output.exe
        @diff -w console-output.exe.stdout $(srcdir)/console-output.exe.stdout.expected \
                && diff -w console-output.exe.stderr $(srcdir)/console-output.exe.stderr.expected
 
+test-pedump: test-runner.exe
+       $(with_mono_path) $(mono_build_root)/tools/pedump/pedump --verify error test-runner.exe
+
 PROCESS_STRESS_TESTS=  \
                process-stress-1.exe    \
                process-stress-2.exe    \
@@ -1847,7 +1854,7 @@ PROCESS_STRESS_TESTS=     \
                process-leak.exe
 
 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
-       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(PROCESS_STRESS_TESTS)
+       $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(PROCESS_STRESS_TESTS)
 
 coreclr-gcstress:
        $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
index 98e9f7fa7ff6b0696a2724929e437928438b31ac..558fb5931e4b8fa25ceaa486bcb8da40c6ab66e6 100644 (file)
                        call void Test::call_sfoo ()
                        br fail
                } catch [mscorlib]System.MethodAccessException {
-                       pop
+                       call instance string [mscorlib]System.MethodAccessException::get_Message ()
+                       ldstr "Method `MethFail:sfoo ()' is inaccessible from method `Test:call_sfoo ()'"
+                       call instance bool [mscorlib]System.String::Equals (string)
+                       brfalse fail
                        br continue
                } catch [mscorlib]System.Exception {
                        pop
index 2172b996ba09a538f852ab1d32ed3aa12302254b..4b05161342070e3172109ee19dbc226e1def465a 100644 (file)
@@ -134,6 +134,7 @@ monoutils_sources = \
        mono-threads-netbsd.c   \
        mono-threads-openbsd.c  \
        mono-threads-android.c  \
+       mono-threads-haiku.c    \
        mono-threads.h  \
        mono-threads-debug.h    \
        mono-threads-api.h      \
index 3a6f44636c88a90af290d063274291f3fb432cd0..6e7cf7bd442e212121babd370ef644db76fb971d 100644 (file)
@@ -47,6 +47,13 @@ typedef struct __darwin_xmm_reg MonoContextSimdReg;
 #undef MONO_SIGNAL_USE_UCONTEXT_T
 #endif
 
+#ifdef __HAIKU__
+/* sigcontext surrogate */
+struct sigcontext {
+       vregs regs;
+};
+#endif
+
 #ifdef HOST_WIN32
 /* sigcontext surrogate */
 struct sigcontext {
@@ -74,14 +81,14 @@ struct sigcontext {
 # define SC_ESI sc_esi
 #elif defined(__HAIKU__)
 # define SC_EAX regs.eax
-# define SC_EBX regs._reserved_2[2]
+# define SC_EBX regs.ebx
 # define SC_ECX regs.ecx
 # define SC_EDX regs.edx
 # define SC_EBP regs.ebp
 # define SC_EIP regs.eip
 # define SC_ESP regs.esp
-# define SC_EDI regs._reserved_2[0]
-# define SC_ESI regs._reserved_2[1]
+# define SC_EDI regs.edi
+# define SC_ESI regs.esi
 #else
 # define SC_EAX eax
 # define SC_EBX ebx
index cd33375894c1db0f95fdf61ae054c50043a18f2d..7edd2041a3d4a954441b3bfbb677f122e73c5800 100644 (file)
@@ -123,9 +123,31 @@ mono_os_cond_init (mono_cond_t *cond)
 {
        int res;
 
+#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
        res = pthread_cond_init (cond, NULL);
        if (G_UNLIKELY (res != 0))
                g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+#else
+       /* POSIX standard does not compel to have CLOCK_MONOTONIC */
+       pthread_condattr_t attr;
+
+       res = pthread_condattr_init (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_condattr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       res = pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_condattr_setclock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       /* Attach an attribute having CLOCK_MONOTONIC to condition */
+       res = pthread_cond_init (cond, &attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       res = pthread_condattr_destroy (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_condattr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+#endif
 }
 
 static inline void
@@ -151,9 +173,10 @@ mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
 static inline int
 mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
 {
+#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
        struct timeval tv;
+#endif
        struct timespec ts;
-       gint64 usecs;
        int res;
 
        if (timeout_ms == MONO_INFINITE_WAIT) {
@@ -163,18 +186,27 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
 
        /* ms = 10^-3, us = 10^-6, ns = 10^-9 */
 
+#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX)
+       /* clock_gettime is not supported in MAC OS x */
        res = gettimeofday (&tv, NULL);
        if (G_UNLIKELY (res != 0))
                g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       tv.tv_sec += timeout_ms / 1000;
-       usecs = tv.tv_usec + ((timeout_ms % 1000) * 1000);
-       if (usecs >= 1000000) {
-               usecs -= 1000000;
-               tv.tv_sec ++;
-       }
        ts.tv_sec = tv.tv_sec;
-       ts.tv_nsec = usecs * 1000;
+       ts.tv_nsec = tv.tv_usec * 1000;
+#else
+       /* cond is using CLOCK_MONOTONIC as time source */
+       res = clock_gettime (CLOCK_MONOTONIC, &ts);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: clock_gettime failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+#endif
+
+       ts.tv_sec += timeout_ms / 1000;
+       ts.tv_nsec += (timeout_ms % 1000) * 1000 * 1000;
+       if (ts.tv_nsec >= 1000 * 1000 * 1000) {
+               ts.tv_nsec -= 1000 * 1000 * 1000;
+               ts.tv_sec ++;
+       }
 
        res = pthread_cond_timedwait (cond, mutex, &ts);
        if (G_UNLIKELY (res != 0 && res != ETIMEDOUT))
index 515104efaf645556379eb2cc0f7354f1b820ef69..5f6d145b6da32fc12c5257199e36708056beac30 100644 (file)
@@ -20,7 +20,9 @@
 #endif
 
 #if defined(_POSIX_VERSION)
+#ifdef HAVE_SYS_ERRNO_H
 #include <sys/errno.h>
+#endif
 #include <sys/param.h>
 #include <errno.h>
 #ifdef HAVE_SYS_TYPES_H
@@ -31,6 +33,9 @@
 #endif
 #include <sys/resource.h>
 #endif
+#if defined(__HAIKU__)
+#include <os/kernel/OS.h>
+#endif
 #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
 #include <sys/proc.h>
 #if defined(__APPLE__)
@@ -155,9 +160,20 @@ mono_process_list (int *size)
                *size = res;
        return buf;
 #elif defined(__HAIKU__)
-       /* FIXME: Add back the code from 9185fcc305e43428d0f40f3ee37c8a405d41c9ae */
-       g_assert_not_reached ();
-       return NULL;
+       int32 cookie = 0;
+       int32 i = 0;
+       team_info ti;
+       system_info si;
+
+       get_system_info(&si);
+       void **buf = g_calloc(si.used_teams, sizeof(void*));
+
+       while (get_next_team_info(&cookie, &ti) == B_OK && i < si.used_teams) {
+               buf[i++] = GINT_TO_POINTER (ti.team);
+       }
+       *size = i;
+
+       return buf;
 #else
        const char *name;
        void **buf = NULL;
diff --git a/mono/utils/mono-threads-haiku.c b/mono/utils/mono-threads-haiku.c
new file mode 100644 (file)
index 0000000..e5c3563
--- /dev/null
@@ -0,0 +1,19 @@
+#include <config.h>
+
+#if defined(__HAIKU__)
+
+#include <mono/utils/mono-threads.h>
+#include <pthread.h>
+#include <os/kernel/OS.h>
+
+void
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
+{
+       thread_info ti;
+       get_thread_info(get_pthread_thread_id(pthread_self()), &ti);
+
+       *staddr = ti.stack_base;
+       *stsize = ti.stack_end - ti.stack_base;
+}
+
+#endif
index fdf18bb1891eeb47c08ec7e6176341912fe57b03..3dd01e8a21dc0e267c4e2f457edd325a47ca52d2 100644 (file)
@@ -54,13 +54,6 @@ mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 void
 mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
 {
-       g_assert_not_reached ();
-}
-
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return FALSE;
 }
 
 #else /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
@@ -193,12 +186,6 @@ mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
        g_assert (ret == KERN_SUCCESS);
 }
 
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
 #endif /* defined(HOST_WATCHOS) || defined(HOST_TVOS) */
 
 void
index c19ef8fe402d6dc557057a5088bdc133bec9c218..a4de7746d9f0de61b0f7870c79608aa330f3be56 100644 (file)
@@ -80,7 +80,9 @@ abort_signal_get (void)
 static int
 suspend_signal_get (void)
 {
-#ifdef SIGRTMIN
+#if defined(PLATFORM_ANDROID)
+       return SIGPWR;
+#elif defined (SIGRTMIN)
        static int suspend_signum = -1;
        if (suspend_signum == -1)
                suspend_signum = mono_threads_suspend_search_alternative_signal ();
@@ -97,7 +99,9 @@ suspend_signal_get (void)
 static int
 restart_signal_get (void)
 {
-#ifdef SIGRTMIN
+#if defined(PLATFORM_ANDROID)
+       return SIGXCPU;
+#elif defined (SIGRTMIN)
        static int restart_signum = -1;
        if (restart_signum == -1)
                restart_signum = mono_threads_suspend_search_alternative_signal ();
@@ -236,6 +240,16 @@ mono_threads_suspend_init_signals (void)
 
        /* ensure all the new signals are unblocked */
        sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
+
+       /*
+       On 32bits arm Android, signals with values >=32 are not usable as their headers ship a broken sigset_t.
+       See 5005c6f3fbc1da584c6a550281689cc23f59fe6d for more details.
+       */
+#ifdef PLATFORM_ANDROID
+       g_assert (suspend_signal_num < 32);
+       g_assert (restart_signal_num < 32);
+       g_assert (abort_signal_num < 32);
+#endif
 }
 
 gint
index dcb7e27d2a1e16503f6d8d897f55593dd4421e3e..d978c538ae9b2d934a946088a145d8c47e379bc8 100644 (file)
@@ -35,65 +35,17 @@ extern int tkill (pid_t tid, int signal);
 
 #include <sys/resource.h>
 
-static void
-reset_priority (pthread_attr_t *attr)
-{
-       struct sched_param param;
-       gint res;
-       gint policy;
-
-       memset (&param, 0, sizeof (param));
-
-       res = pthread_attr_getschedpolicy (attr, &policy);
-       if (res != 0)
-               g_error ("%s: pthread_attr_getschedpolicy failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
-
-#ifdef _POSIX_PRIORITY_SCHEDULING
-       gint max, min;
-
-       /* Necessary to get valid priority range */
-
-       min = sched_get_priority_min (policy);
-       max = sched_get_priority_max (policy);
-
-       if (max > 0 && min >= 0 && max > min)
-               param.sched_priority = (max - min) / 2 + min;
-       else
-#endif
-       {
-               switch (policy) {
-               case SCHED_FIFO:
-               case SCHED_RR:
-                       param.sched_priority = 50;
-                       break;
-#ifdef SCHED_BATCH
-               case SCHED_BATCH:
-#endif
-               case SCHED_OTHER:
-                       param.sched_priority = 0;
-                       break;
-               default:
-                       g_warning ("%s: unknown policy %d", __func__, policy);
-                       return;
-               }
-       }
-
-       res = pthread_attr_setschedparam (attr, &param);
-       if (res != 0)
-               g_error ("%s: pthread_attr_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
-}
-
-int
-mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
+gboolean
+mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *tid)
 {
        pthread_attr_t attr;
        pthread_t thread;
        gint res;
        gsize set_stack_size;
-       gsize min_stack_size;
 
        res = pthread_attr_init (&attr);
-       g_assert (!res);
+       if (res != 0)
+               g_error ("%s: pthread_attr_init failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
 
        if (stack_size)
                set_stack_size = *stack_size;
@@ -118,28 +70,34 @@ mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_
 #endif
 
        res = pthread_attr_setstacksize (&attr, set_stack_size);
-       g_assert (!res);
+       if (res != 0)
+               g_error ("%s: pthread_attr_setstacksize failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
 #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
 
-       reset_priority (&attr);
-
-       if (stack_size) {
-               res = pthread_attr_getstacksize (&attr, &min_stack_size);
+       /* Actually start the thread */
+       res = mono_gc_pthread_create (&thread, &attr, (gpointer (*)(gpointer)) thread_fn, thread_data);
+       if (res) {
+               res = pthread_attr_destroy (&attr);
                if (res != 0)
-                       g_error ("%s: pthread_attr_getstacksize failed, error: \"%s\" (%d)", g_strerror (res), res);
+                       g_error ("%s: pthread_attr_destroy failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
 
-               *stack_size = min_stack_size;
+               return FALSE;
        }
 
-       /* Actually start the thread */
-       res = mono_gc_pthread_create (&thread, &attr, (gpointer (*)(gpointer)) thread_fn, thread_data);
-       if (res)
-               return -1;
+       if (tid)
+               *tid = thread;
 
-       if (out_tid)
-               *out_tid = thread;
+       if (stack_size) {
+               res = pthread_attr_getstacksize (&attr, stack_size);
+               if (res != 0)
+                       g_error ("%s: pthread_attr_getstacksize failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
+       }
 
-       return 0;
+       res = pthread_attr_destroy (&attr);
+       if (res != 0)
+               g_error ("%s: pthread_attr_destroy failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return TRUE;
 }
 
 void
@@ -326,12 +284,6 @@ mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
        }
 }
 
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
 void
 mono_threads_suspend_register (MonoThreadInfo *info)
 {
index 2a28e9b5a13ab6fac7ed0e76c751e68101d43e48..b350187e7e7a795a43e4f45cac2551ad0391ce09 100644 (file)
@@ -94,12 +94,6 @@ mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
        CloseHandle (handle);
 }
 
-gboolean
-mono_threads_suspend_needs_abort_syscall (void)
-{
-       return TRUE;
-}
-
 gboolean
 mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
 {
@@ -189,22 +183,22 @@ mono_threads_suspend_get_abort_signal (void)
 
 #if defined (HOST_WIN32)
 
-int
-mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
+gboolean
+mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *tid)
 {
        HANDLE result;
        DWORD thread_id;
 
        result = CreateThread (NULL, stack_size ? *stack_size : 0, (LPTHREAD_START_ROUTINE) thread_fn, thread_data, 0, &thread_id);
        if (!result)
-               return -1;
+               return FALSE;
 
        /* A new handle is open when attaching
         * the thread, so we don't need this one */
        CloseHandle (result);
 
-       if (out_tid)
-               *out_tid = thread_id;
+       if (tid)
+               *tid = thread_id;
 
        if (stack_size) {
                // TOOD: Use VirtualQuery to get correct value 
@@ -212,7 +206,7 @@ mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_
                *stack_size = 2 * 1024 * 1024;
        }
 
-       return 0;
+       return TRUE;
 }
 
 
index 76821d0d359980fb78176606d20a210f61b48b0f..a468cd9383db908131ff4eaf1f02de369c3ca701 100644 (file)
@@ -903,7 +903,7 @@ suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel)
                }
                break;
        case AsyncSuspendBlocking:
-               if (interrupt_kernel && mono_threads_suspend_needs_abort_syscall ())
+               if (interrupt_kernel)
                        mono_threads_suspend_abort_syscall (info);
 
                break;
@@ -1067,7 +1067,7 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
        MonoThreadHazardPointers *hp;
        MonoThreadInfo *info;
 
-       if (tid == mono_native_thread_id_get () || !mono_threads_suspend_needs_abort_syscall ())
+       if (tid == mono_native_thread_id_get ())
                return;
 
        hp = mono_hazard_pointer_get ();
@@ -1118,100 +1118,6 @@ mono_thread_info_is_async_context (void)
                return FALSE;
 }
 
-typedef struct {
-       MonoRefCount ref;
-       MonoThreadStart start_routine;
-       gpointer start_routine_arg;
-       MonoCoopSem registered;
-       MonoThreadHandle *handle;
-} CreateThreadData;
-
-static void
-create_thread_data_destroy (gpointer data)
-{
-       CreateThreadData *thread_data;
-
-       thread_data = (CreateThreadData*) data;
-
-       mono_coop_sem_destroy (&thread_data->registered);
-       g_free (thread_data);
-}
-
-static gsize WINAPI
-inner_start_thread (gpointer data)
-{
-       CreateThreadData *thread_data;
-       MonoThreadInfo *info;
-       MonoThreadStart start_routine;
-       gpointer start_routine_arg;
-       gsize start_routine_res;
-       gsize dummy;
-
-       thread_data = (CreateThreadData*) data;
-       g_assert (thread_data);
-
-       start_routine = thread_data->start_routine;
-       start_routine_arg = thread_data->start_routine_arg;
-
-       info = mono_thread_info_attach (&dummy);
-       info->runtime_thread = TRUE;
-
-       thread_data->handle = mono_threads_open_thread_handle (info->handle);
-
-       mono_coop_sem_post (&thread_data->registered);
-
-       mono_refcount_dec (thread_data);
-
-       /* thread_data is not valid anymore */
-       thread_data = NULL;
-
-       /* Run the actual main function of the thread */
-       start_routine_res = start_routine (start_routine_arg);
-
-       mono_thread_info_exit (start_routine_res);
-
-       g_assert_not_reached ();
-}
-
-/*
- * mono_threads_create_thread:
- *
- *   Create a new thread executing START with argument ARG. Store its id into OUT_TID.
- * Returns: a windows or io-layer handle for the thread.
- */
-MonoThreadHandle*
-mono_threads_create_thread (MonoThreadStart start, gpointer arg, gsize * const stack_size, MonoNativeThreadId *out_tid)
-{
-       CreateThreadData *thread_data;
-       gint res;
-       MonoThreadHandle *ret;
-
-       thread_data = g_new0 (CreateThreadData, 1);
-       mono_refcount_init (thread_data, create_thread_data_destroy);
-       thread_data->start_routine = start;
-       thread_data->start_routine_arg = arg;
-       mono_coop_sem_init (&thread_data->registered, 0);
-
-       res = mono_threads_platform_create_thread (inner_start_thread, (gpointer) mono_refcount_inc (thread_data), stack_size, out_tid);
-       if (res != 0) {
-               /* ref is not going to be decremented in inner_start_thread */
-               mono_refcount_dec (thread_data);
-               ret = NULL;
-               goto done;
-       }
-
-       res = mono_coop_sem_wait (&thread_data->registered, MONO_SEM_FLAGS_NONE);
-       g_assert (res == 0);
-
-       ret = thread_data->handle;
-       g_assert (ret);
-
-done:
-       mono_refcount_dec (thread_data);
-
-       return ret;
-}
-
 /*
  * mono_thread_info_get_stack_bounds:
  *
index 0e77e3956630a51a293468778eaae83ce4bb900e..867946071c3aa21c16923060f88cd4fe3e383eb0 100644 (file)
@@ -62,6 +62,10 @@ typedef gsize mono_thread_start_return_t;
 
 typedef gsize (*MonoThreadStart)(gpointer);
 
+#if !defined(__HAIKU__)
+#define MONO_THREADS_PLATFORM_HAS_ATTR_SETSCHED
+#endif /* !defined(__HAIKU__) */
+
 #endif /* #ifdef HOST_WIN32 */
 
 #ifndef MONO_INFINITE_WAIT
@@ -404,9 +408,6 @@ mono_thread_info_describe_interrupt_token (THREAD_INFO_TYPE *info, GString *text
 gboolean
 mono_thread_info_is_live (THREAD_INFO_TYPE *info);
 
-MonoThreadHandle*
-mono_threads_create_thread (MonoThreadStart start, gpointer arg, gsize * const stack_size, MonoNativeThreadId *out_tid);
-
 int
 mono_threads_get_max_stack_size (void);
 
@@ -472,13 +473,15 @@ gboolean mono_threads_suspend_begin_async_resume (THREAD_INFO_TYPE *info);
 void mono_threads_suspend_register (THREAD_INFO_TYPE *info); //ok
 void mono_threads_suspend_free (THREAD_INFO_TYPE *info);
 void mono_threads_suspend_abort_syscall (THREAD_INFO_TYPE *info);
-gboolean mono_threads_suspend_needs_abort_syscall (void);
 gint mono_threads_suspend_search_alternative_signal (void);
 gint mono_threads_suspend_get_suspend_signal (void);
 gint mono_threads_suspend_get_restart_signal (void);
 gint mono_threads_suspend_get_abort_signal (void);
 
-int mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid);
+gboolean
+mono_thread_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data,
+       gsize* const stack_size, MonoNativeThreadId *tid);
+
 void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
 void mono_threads_platform_init (void);
 gboolean mono_threads_platform_in_critical_region (MonoNativeThreadId tid);
index 83431ecc0e672298a43f45a10d35e6f6665c59e1..52e1b14888e7ec27f5e4e52003bd6254949ce1b5 100644 (file)
@@ -264,7 +264,6 @@ mono_domain_set_internal
 mono_domain_try_type_resolve
 mono_domain_try_unload
 mono_domain_unload
-mono_emit_native_call
 mono_environment_exitcode_get
 mono_environment_exitcode_set
 mono_error_cleanup
@@ -465,7 +464,6 @@ mono_images_init
 mono_init
 mono_init_from_assembly
 mono_init_version
-mono_inst_name
 mono_install_assembly_load_hook
 mono_install_assembly_postload_refonly_search_hook
 mono_install_assembly_postload_search_hook
@@ -754,7 +752,6 @@ mono_register_bundled_assemblies
 mono_register_config_for_assembly
 mono_register_machine_config
 mono_register_symfile_for_assembly
-mono_replace_ins
 mono_runtime_class_init
 mono_runtime_cleanup
 mono_runtime_delegate_invoke
index 9aeb6f7e10b461252eec24af79fe7bd3d0a8d38c..5c238113281f6de1c55010c93701817d63d81c24 100644 (file)
@@ -264,7 +264,6 @@ mono_domain_set_internal
 mono_domain_try_type_resolve
 mono_domain_try_unload
 mono_domain_unload
-mono_emit_native_call
 mono_environment_exitcode_get
 mono_environment_exitcode_set
 mono_error_cleanup
@@ -467,7 +466,6 @@ mono_images_init
 mono_init
 mono_init_from_assembly
 mono_init_version
-mono_inst_name
 mono_install_assembly_load_hook
 mono_install_assembly_postload_refonly_search_hook
 mono_install_assembly_postload_search_hook
@@ -756,7 +754,6 @@ mono_register_bundled_assemblies
 mono_register_config_for_assembly
 mono_register_machine_config
 mono_register_symfile_for_assembly
-mono_replace_ins
 mono_runtime_class_init
 mono_runtime_cleanup
 mono_runtime_delegate_invoke
index f16745292f51b9ea8239bda4efad0ec6e76bf8f1..dda2aafb936f4316201d8370105732c4e27df78e 100644 (file)
@@ -68,7 +68,7 @@
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-basic">
       <boot>true</boot>
-      <flags>/codepage:65001 /nologo /noconfig -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib -r:./../../class/lib/basic/mscorlib.dll -optimize /unsafe -nowarn:414 -nowarn:436 -r:./../../class/lib/basic/System.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib -r:./../../class/lib/basic/mscorlib.dll -optimize /unsafe -r:./../../class/lib/basic/System.dll</flags>
       <output>System.Numerics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/basic/System.Numerics.dll</library_output>
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-build">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /unsafe -nowarn:414 -nowarn:436 -r:./../../class/lib/build/System.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/build/mscorlib.dll -optimize /unsafe -r:./../../class/lib/build/System.dll</flags>
       <output>System.Numerics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/build/System.Numerics.dll</library_output>
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize /unsafe -nowarn:414 -nowarn:436 -r:./../../class/lib/net_4_x/System.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize /unsafe -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>System.Numerics.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/System.Numerics.dll</library_output>
     </project>
     <project dir="class/System.Numerics" library="System.Numerics-tests-net_4_x">
       <boot>false</boot>
-      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -r:./../../class/lib/net_4_x/System.Numerics.dll /unsafe -nowarn:414 -nowarn:436 -r:./../../class/lib/net_4_x/System.dll</flags>
+      <flags>/codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib -r:./../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize -r:./../../class/lib/net_4_x/System.Numerics.dll /unsafe -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>net_4_x_System.Numerics_test.dll</output>
       <built_sources></built_sources>
       <library_output>net_4_x_System.Numerics_test.dll</library_output>
index 0d4e336a879945a336d1099639fb1c1e210baacc..85a0eb4c6dcac5d26a000c741b1421478f867d4a 100644 (file)
@@ -23,9 +23,9 @@ class IronLanguagesPackage(GitHubTarballPackage):
         self.ironpython = os.path.join(
             self.workspace, 'ironpython', 'bin') + os.sep
         self.sh(
-            'xbuild /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
+            'xbuild /p:PublicSign=false /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
         self.sh(
-            'xbuild /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')
+            'xbuild /p:PublicSign=false /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')
 
     def install_ruby_scripts(self, path, installdir):
         for cmd, ext in map(os.path.splitext, os.listdir(path)):
index 6fba7f19ca6a29199e8033d6ac7c6d19b79efa93..2e7c807d924477595bac23801ed61ab09b77f99c 100755 (executable)
@@ -8,14 +8,14 @@ fi
 ${TESTCMD} --label=compile-runtime-tests --timeout=40m make -w -C mono/tests -j4 tests
 ${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 CI_PR=${ghprbPullId}
 ${TESTCMD} --label=runtime-unit-tests --timeout=5m make -w -C mono/unit-tests -k check
-if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=corlib --skip; else ${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test; fi
+${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
 ${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
 ${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
 ${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test
 ${TESTCMD} --label=compiler-errors --timeout=30m make -w -C mcs/errors run-test
 ${TESTCMD} --label=System --timeout=10m bash -c "export MONO_TLS_PROVIDER=legacy && make -w -C mcs/class/System run-test"
 if [[ ${label} == osx-* ]]; then ${TESTCMD} --label=System-btls --timeout=10m bash -c "export MONO_TLS_PROVIDER=btls && make -w -C mcs/class/System run-test"; fi
-if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=System.XML --skip; else ${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test; fi
+${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test
 ${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test
 ${TESTCMD} --label=System.Security --timeout=5m make -w -C mcs/class/System.Security run-test
 if [[ ${label} == w* ]]
@@ -24,7 +24,10 @@ else ${TESTCMD} --label=System.Drawing --timeout=5m make -w -C mcs/class/System.
 fi
 if [[ ${label} == osx-* ]] || [[ ${label} == w* ]]
 then ${TESTCMD} --label=Windows.Forms --skip;
-else ${TESTCMD} --label=Windows.Forms --timeout=5m make -w -C mcs/class/System.Windows.Forms run-test
+else
+    if make -C mcs/class/System.Windows.Forms test-simple;
+    then ${TESTCMD} --label=Windows.Forms --timeout=5m make -w -C mcs/class/System.Windows.Forms run-test
+    else echo "The simple test failed (maybe because of missing X server), skipping test suite." && ${TESTCMD} --label=Windows.Forms --skip; fi
 fi
 ${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test
 if [[ ${label} == w* ]]; then ${TESTCMD} --label=Mono.Data.Sqlite --skip; else ${TESTCMD} --label=Mono.Data.Sqlite --timeout=5m make -w -C mcs/class/Mono.Data.Sqlite run-test; fi
@@ -52,7 +55,7 @@ ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System
 ${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
 ${TESTCMD} --label=System.Web.Extensions --timeout=5m make -w -C mcs/class/System.Web.Extensions run-test
 ${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test
-if [[ ${label} == w* || ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=symbolicate --skip; else ${TESTCMD} --label=symbolicate --timeout=60m make -w -C mcs/tools/mono-symbolicate check; fi
+if [[ ${label} == w* ]]; then ${TESTCMD} --label=symbolicate --skip; else ${TESTCMD} --label=symbolicate --timeout=60m make -w -C mcs/tools/mono-symbolicate check; fi
 ${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test
 ${TESTCMD} --label=System.Data.DSE --timeout=5m make -w -C mcs/class/System.Data.DataSetExtensions run-test
 ${TESTCMD} --label=System.Web.Abstractions --timeout=5m make -w -C mcs/class/System.Web.Abstractions run-test
@@ -76,7 +79,7 @@ ${TESTCMD} --label=System.Xaml --timeout=5m make -w -C mcs/class/System.Xaml run
 ${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test
 ${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test
 ${TESTCMD} --label=System.Threading.Tasks.Dataflow --timeout=5m make -w -C mcs/class/System.Threading.Tasks.Dataflow run-test
-if [[ ${label} == 'debian-8-ppc64el' ]]; then ${TESTCMD} --label=Mono.Debugger.Soft --skip; else ${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test; fi
+${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test
 ${TESTCMD} --label=Microsoft.Build --timeout=5m make -w -C mcs/class/Microsoft.Build run-test
 ${TESTCMD} --label=monodoc --timeout=10m make -w -C mcs/tools/mdoc run-test
 ${TESTCMD} --label=Microsoft.Build-12 --timeout=10m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_12
index ec02e48b5e8bd37a30601aa90c5332e9bcfecba1..5e3d732c005170bbcd4052841fad7dc3b27b342c 100644 (file)
@@ -175,6 +175,11 @@ discard_buffer (int fd, gboolean input)
 gint32
 get_bytes_in_buffer (int fd, gboolean input)
 {
+#if defined(__HAIKU__)
+       /* FIXME: Haiku doesn't support TIOCOUTQ nor FIONREAD on fds */
+       return -1;
+#define TIOCOUTQ 0
+#endif
        gint32 retval;
 
        if (ioctl (fd, input ? FIONREAD : TIOCOUTQ, &retval) == -1) {
index 1dd61bc372b5343cce83bf8a677c190aca969a05..afbe46624447d87a05a10d44e367427e0b45311d 100644 (file)
@@ -88,17 +88,25 @@ Mono_Posix_Syscall_msync (void *start, mph_size_t len, int flags)
 int
 Mono_Posix_Syscall_mlock (void *start, mph_size_t len)
 {
+#if !defined(HAVE_MINCORE)
+       return ENOSYS;
+#else
        mph_return_if_size_t_overflow (len);
 
        return mlock (start, (size_t) len);
+#endif
 }
 
 int
 Mono_Posix_Syscall_munlock (void *start, mph_size_t len)
 {
+#if defined(__HAIKU__)
+       return ENOSYS;
+#else
        mph_return_if_size_t_overflow (len);
 
        return munlock (start, (size_t) len);
+#endif
 }
 
 #ifdef HAVE_MREMAP
@@ -129,9 +137,13 @@ Mono_Posix_Syscall_mremap (void *old_address, mph_size_t old_size,
 int
 Mono_Posix_Syscall_mincore (void *start, mph_size_t length, unsigned char *vec)
 {
+#if defined(__HAIKU__)
+       return ENOSYS;
+#else
        mph_return_if_size_t_overflow (length);
 
        return mincore (start, (size_t) length, (void*)vec);
+#endif
 }
 
 #ifdef HAVE_POSIX_MADVISE
index a1c0ba0b184ee7326e5788adb0371215b5703109..83afa0c8466b65f1a565d529cd01af9a7a728510 100644 (file)
@@ -47,6 +47,11 @@ Mono_Posix_Syscall_settimeofday (
        struct Mono_Posix_Timeval *tv,
        struct Mono_Posix_Timezone *tz)
 {
+#if defined(__HAIKU__)
+       /* FIXME: Haiku doesn't support this either, consider
+           using set_real_time_clock instead? */
+       return -1;
+#else
        struct timeval _tv   = {0};
        struct timeval *ptv  = NULL;
        struct timezone _tz  = {0};
@@ -67,6 +72,7 @@ Mono_Posix_Syscall_settimeofday (
        r = settimeofday (ptv, ptz);
 
        return r;
+#endif
 }
 
 static inline struct timeval*
index 9a69cc80b971dcc891314fca9aac36d337f7f94a..013097f83c8e9c1a21c27d07e423300605f6f83c 100644 (file)
@@ -90,6 +90,7 @@ class DoParse : MarshalByRefObject {
                var str = FileToEnum (name);
 
                string ver_str = version + " " + FileToMoniker (fullname);      
+
                Console.WriteLine ($"IGNORED_ASSEMBLY (0x{hash_code}, {str}, \"{id}\", \"{ver_str}\"),");
        }
 }
\ No newline at end of file
index 0f9a984833d766fdc48ceba51617882d361f3237..f167566eef3609d121bcb9ebcc3ac6cf0d860d85 100644 (file)
@@ -24,10 +24,10 @@ namespace CppSharp
         static List<string> Abis = new List<string> ();
         static string OutputDir;
 
-        static bool XamarinAndroid;
         static string MonodroidDir = @"";
         static string AndroidNdkPath = @"";
         static string MaccoreDir = @"";
+        static string TargetDir = @"";
 
         public enum TargetPlatform
         {
@@ -89,28 +89,24 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "i686-none-linux-android",
-                Build = XamarinAndroid ? "x86" : "mono-x86",
                 Defines = { "TARGET_X86" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "x86_64-none-linux-android",
-                Build = XamarinAndroid ? "x86_64" : "mono-x86_64",
                 Defines = { "TARGET_AMD64" }
             });            
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv5-none-linux-androideabi",
-                Build = XamarinAndroid ? "armeabi" : "mono-armv6",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv7-none-linux-androideabi",
-                Build = XamarinAndroid ? "armeabi-v7a" : "mono-armv7",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5", "HAVE_ARMV6",
                     "HAVE_ARMV7"
                 }
@@ -119,14 +115,12 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "aarch64-v8a-linux-android",
-                Build = XamarinAndroid ? "arm64-v8a" : "mono-aarch64",
                 Defines = { "TARGET_ARM64" }
             });            
 
             /*Targets.Add(new Target {
                     Platform = TargetPlatform.Android,
                     Triple = "mipsel-none-linux-android",
-                    Build = "mono-mips",
                     Defines = { "TARGET_MIPS", "__mips__" }
                 });*/
 
@@ -279,7 +273,7 @@ namespace CppSharp
                 { "maccore=", "include directory", v => MaccoreDir = v },
                 { "monodroid=", "top monodroid directory", v => MonodroidDir = v },
                 { "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
-                { "xamarin-android", "Generate for Xamarin.Android instead of monodroid", v => XamarinAndroid = true },
+                { "targetdir=", "Path to the directory containing the mono build", v =>TargetDir = v },
                 { "mono=", "include directory", v => MonoDir = v },
                 { "h|help",  "show this message and exit",  v => showHelp = v != null },
             };
@@ -295,9 +289,9 @@ namespace CppSharp
             if (showHelp)
             {
                 // Print usage and exit.
-                Console.WriteLine("{0} [--abi=triple] [--out=dir] "
-                    + "[--monodroid/maccore=dir] [--mono=dir]",
+                Console.WriteLine("{0} <options>",
                     AppDomain.CurrentDomain.FriendlyName);
+                options.WriteOptionDescriptions (Console.Out);
                 Environment.Exit(0);
             }
         }
@@ -325,25 +319,35 @@ namespace CppSharp
 
         static void SetupMono(Driver driver, Target target)
         {
-            string targetPath;
+            string targetBuild;
             switch (target.Platform) {
             case TargetPlatform.Android:
-                targetPath = Path.Combine (MonodroidDir, XamarinAndroid ? "build-tools/mono-runtimes/obj/Debug" : "builds");
+                if (TargetDir == "") {
+                    Console.Error.WriteLine ("The --targetdir= option is required when targeting android.");
+                    Environment.Exit (1);
+                }
+                if (MonoDir == "") {
+                    Console.Error.WriteLine ("The --mono= option is required when targeting android.");
+                    Environment.Exit (1);
+                }
+                if (Abis.Count != 1) {
+                    Console.Error.WriteLine ("Exactly one --abi= argument is required when targeting android.");
+                    Environment.Exit (1);
+                }
+                targetBuild = TargetDir;
                 break;
             case TargetPlatform.WatchOS:
-            case TargetPlatform.iOS:
-                targetPath = Path.Combine (MaccoreDir, "builds");
+            case TargetPlatform.iOS: {
+                string targetPath = Path.Combine (MaccoreDir, "builds");
+                if (!Directory.Exists (MonoDir))
+                    MonoDir = Path.GetFullPath (Path.Combine (targetPath, "../../mono"));
+                targetBuild = Path.Combine(targetPath, target.Build);
                 break;
+            }
             default:
                 throw new ArgumentOutOfRangeException ();
             }
 
-            if (!Directory.Exists (MonoDir)) {
-                MonoDir = Path.GetFullPath (Path.Combine (targetPath, "../../mono"));
-            }
-
-            var targetBuild = Path.Combine(targetPath, target.Build);
-
             if (!Directory.Exists(targetBuild))
                 throw new Exception(string.Format("Could not find the target build directory: {0}", targetBuild));
 
index 4bbcc699335a9bc8bd75a9e8e5376de774b74580..6ae2a1e1e497e30b768c728687a773408f3d1997 100644 (file)
@@ -658,6 +658,7 @@ main (int argc, char *argv [])
        mono_perfcounters_init ();
 #endif
        mono_counters_init ();
+       mono_tls_init_runtime_keys ();
        mono_metadata_init ();
        mono_images_init ();
        mono_assemblies_init ();
@@ -701,7 +702,7 @@ main (int argc, char *argv [])
        if (verify_pe || run_new_metadata_verifier) {
                run_new_metadata_verifier = 1;
        }
-       
+
        if (run_new_metadata_verifier) {
                mono_verifier_set_mode (verifier_mode);