Merge pull request #4418 from kumpera/fix_gclass_recording_on_failure
authorRodrigo Kumpera <kumpera@users.noreply.github.com>
Wed, 1 Mar 2017 23:15:56 +0000 (18:15 -0500)
committerGitHub <noreply@github.com>
Wed, 1 Mar 2017 23:15:56 +0000 (18:15 -0500)
[loader] When loading the parent of a GTD fails. We must disable gclass recording for it.

269 files changed:
.gitattributes
acceptance-tests/SUBMODULES.json
configure.ac
data/lock-decoder/LockTracerDecoder.cs
docs/.gitattributes [new file with mode: 0644]
docs/abc-removal.txt
eglib/configure.ac
external/bockbuild
external/cecil
external/corefx
external/ikvm
libgc/blacklst.c
libgc/doc/README.changes
libgc/doc/README.macros
libgc/mark.c
man/mdoc.5
man/mono.1
man/monodocer.1
man/sqlsharp.1
mcs/.gitattributes
mcs/CodingStyle
mcs/class/Microsoft.CSharp/Makefile
mcs/class/Microsoft.CSharp/Microsoft.CSharp-net_4_x.csproj
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Binder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfoFlags.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinderFlags.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeConstructorBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ErrorPrinter.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderException.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderInternalCompilerException.cs [deleted file]
mcs/class/Microsoft.CSharp/Microsoft.CSharp.dll.sources
mcs/class/Microsoft.CSharp/corefx/SR.cs [new file with mode: 0644]
mcs/class/Mono.CSharp/Mono.CSharp-net_4_x.csproj
mcs/class/Mono.CSharp/Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/aot.cs [new file with mode: 0644]
mcs/class/Mono.CSharp/monotouch.cs [deleted file]
mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.CSharp/orbis_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources [deleted file]
mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs
mcs/class/Mono.Data.Sqlite/Test/SqliteTests.cs
mcs/class/README
mcs/class/System.Core/System.Core-net_4_x.csproj
mcs/class/System.Core/dynamic_System.Core.dll.sources
mcs/class/System.Data/System.Data-net_4_x.csproj
mcs/class/System.Data/corefx.common.sources
mcs/class/System.Data/net_4_x_System.Data.dll.sources
mcs/class/System.Numerics.Vectors/SR.cs [deleted file]
mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj
mcs/class/System.Numerics.Vectors/System.Numerics.Vectors.dll.sources
mcs/class/System.Numerics.Vectors/corefx/SR.cs [new file with mode: 0644]
mcs/class/System.Numerics/Makefile
mcs/class/System.Numerics/ReferenceSources/SR.cs [deleted file]
mcs/class/System.Numerics/System.Numerics-net_4_x.csproj
mcs/class/System.Numerics/System.Numerics.dll.sources
mcs/class/System.Numerics/corefx/SR.cs [new file with mode: 0644]
mcs/class/System.Numerics/corefx/Vector.cs [new file with mode: 0644]
mcs/class/System.Runtime.Caching/ReferenceSources/R.Designer.cs
mcs/class/System/Makefile
mcs/class/System/ReferenceSources/SR.cs
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
mcs/class/System/Test/System.Net.WebSockets/ClientWebSocketTest.cs
mcs/class/System/Test/System.Net/FtpWebRequestTest.cs
mcs/class/System/common.sources
mcs/class/System/corefx/SR.cs [new file with mode: 0644]
mcs/class/corlib/Assembly/AssemblyInfo.cs
mcs/class/corlib/Makefile
mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs
mcs/class/corlib/System/Array.cs
mcs/class/corlib/corefx/SR.cs [new file with mode: 0644]
mcs/class/corlib/corert/Debug.cs
mcs/class/corlib/corert/SR.cs [deleted file]
mcs/class/corlib/corlib.dll.sources
mcs/class/referencesource/System.Data/System/Data/CodeGen/StrongTypingException.cs
mcs/class/referencesource/System.Data/System/Data/Common/AdapterUtil.cs
mcs/class/referencesource/System.Data/System/Data/Common/DBConnectionString.cs
mcs/class/referencesource/System.Data/System/Data/Common/DbConnectionOptions.cs
mcs/class/referencesource/System.Data/System/Data/Common/System.Data_BID.cs
mcs/class/referencesource/System/compmod/system/collections/generic/stack.cs
mcs/mcs/class.cs
mcs/mcs/codegen.cs
mcs/mcs/ecore.cs
mcs/mcs/generic.cs
mcs/mcs/membercache.cs
mcs/mcs/method.cs
mcs/mcs/statement.cs
mcs/tests/dtest-003.cs
mcs/tests/dtest-008.cs
mcs/tests/dtest-033.cs
mcs/tests/dtest-error-01.cs
mcs/tests/dtest-error-02.cs
mcs/tests/dtest-error-03.cs
mcs/tests/dtest-error-04.cs
mcs/tests/gtest-645-lib.cs [new file with mode: 0644]
mcs/tests/gtest-645.cs [new file with mode: 0644]
mcs/tests/test-anon-178.cs [new file with mode: 0644]
mcs/tests/test-async-90.cs [new file with mode: 0644]
mcs/tests/test-async-91.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/xbuild/Main.cs
mono/dis/main.c
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/boehm-gc.c
mono/metadata/class.c
mono/metadata/cominterop.c
mono/metadata/console-win32-uwp.c
mono/metadata/custom-attrs.c
mono/metadata/domain.c
mono/metadata/dynamic-image.c
mono/metadata/dynamic-stream.c
mono/metadata/exception.c
mono/metadata/gc-internals.h
mono/metadata/gc.c
mono/metadata/icall-windows-uwp.c
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/loader.c
mono/metadata/locales.c
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/metadata-verify.c
mono/metadata/metadata.c
mono/metadata/mono-basic-block.c
mono/metadata/mono-hash.c
mono/metadata/mono-hash.h
mono/metadata/mono-mlist.c
mono/metadata/mono-perfcounters.c
mono/metadata/mono-security-windows-uwp.c
mono/metadata/mono-security-windows.c
mono/metadata/mono-security.c
mono/metadata/null-gc.c
mono/metadata/object.c
mono/metadata/profiler.c
mono/metadata/reflection-cache.h
mono/metadata/reflection.c
mono/metadata/remoting.c
mono/metadata/runtime.c
mono/metadata/security-core-clr.c
mono/metadata/sgen-mono.c
mono/metadata/sre-encode.c
mono/metadata/sre-save.c
mono/metadata/sre.c
mono/metadata/threadpool-io.c
mono/metadata/threadpool-worker-default.c
mono/metadata/threadpool.c
mono/metadata/threads-types.h
mono/metadata/threads.c
mono/metadata/verify.c
mono/metadata/w32file-unix.c
mono/metadata/w32file-win32-uwp.c
mono/metadata/w32file.c
mono/metadata/w32process-unix-haiku.c
mono/metadata/w32process-unix-internals.h
mono/metadata/w32process-win32-uwp.c
mono/metadata/w32process.c
mono/metadata/w32socket.c
mono/mini/.gitignore
mono/mini/Makefile.am.in
mono/mini/alias-analysis.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/arrays.cs
mono/mini/basic-vectors.cs
mono/mini/debug-mini.c
mono/mini/debugger-agent.c
mono/mini/driver.c
mono/mini/dwarfwriter.c
mono/mini/exceptions.cs
mono/mini/generics.cs
mono/mini/graph.c
mono/mini/gshared.cs
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/liveness.c
mono/mini/method-to-ir.c
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-arm64.c
mono/mini/mini-exceptions.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-ia64.c
mono/mini/mini-llvm.c
mono/mini/mini-mips.c
mono/mini/mini-ops.h
mono/mini/mini-ppc.c
mono/mini/mini-runtime.c
mono/mini/mini-s390x.c
mono/mini/mini-sparc.c
mono/mini/mini-trampolines.c
mono/mini/mini-x86.h
mono/mini/mini.c
mono/mini/mini.h
mono/mini/objects.cs
mono/mini/seq-points.c
mono/mini/tramp-amd64.c
mono/sgen/gc-internal-agnostic.h
mono/sgen/sgen-cardtable.c
mono/sgen/sgen-cardtable.h
mono/sgen/sgen-debug.c
mono/sgen/sgen-descriptor.c
mono/sgen/sgen-descriptor.h
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-marksweep-drain-gray-stack.h
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-workers.c
mono/tests/Makefile.am
mono/tests/unhandled-exception-8.cs [new file with mode: 0644]
mono/tests/verifier/make_tests.sh
mono/utils/Makefile.am
mono/utils/mono-conc-hashtable.c
mono/utils/mono-context.h
mono/utils/mono-error.c
mono/utils/mono-error.h
mono/utils/mono-lazy-init.h
mono/utils/mono-proclib.c
mono/utils/mono-rand-windows.c
mono/utils/mono-rand.c
mono/utils/mono-threads-coop.c
mono/utils/mono-threads-haiku.c [new file with mode: 0644]
mono/utils/mono-threads-posix.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/monobitset.c
msvc/scripts/order.xml
po/mcs/.gitattributes [new file with mode: 0644]
po/mcs/LINGUAS
runtime/.gitattributes [new file with mode: 0644]
scripts/.gitattributes
support/serial.c
support/sys-mman.c
support/sys-time.c

index f1689375385d253a1c413d2b07a8e9200e36e684..25a58f158fc10969d96a07b31634e05431143a84 100644 (file)
@@ -4,6 +4,9 @@ config.rpath    crlf=input
 configure.host crlf=input
 mkinstalldirs  crlf=input
 *.sh   crlf=input
+*.sources      crlf=input
+.gitattributes crlf=input
+*akefile*      crlf=input
 
 # ensure native line endings on checkout
 *.c    crlf
@@ -11,10 +14,6 @@ mkinstalldirs        crlf=input
 *.cs   crlf
 *.il   crlf
 
-.gitattributes crlf
-*akefile*      crlf
-*.sources      crlf
-
 # don't do anything to line-endings.  Let CRLFs go into the repo, and CRLF on checkout
 *.bat          -crlf
 *.sln          -crlf
index 9df7b8a5811328aafe3a0a58c0def29cf80ec5bb..1fedbe94fea1f463e15b192a8cd9d6d4592227ef 100644 (file)
@@ -18,7 +18,7 @@
   {
     "name": "ms-test-suite", 
     "url": "git@github.com:xamarin/ms-test-suite.git", 
-    "rev": "55b6637eb1de61c743323ec82db1e0cadfee5b32", 
+    "rev": "73c155f76b55839f26ba707d6d40091060e4f5d8", 
     "remote-branch": "origin/master", 
     "branch": "master", 
     "directory": "ms-test-suite"
index 387b6d297ba5a3c1834e439291b5bf1276538ea0..71f242d6fc7445db79c3518dd13e5b0f8f2f4008 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
                ;;
@@ -882,10 +886,6 @@ elif test x$with_runtime_preset = xhybridaot; then
    with_testing_aot_hybrid_default=yes
    TEST_PROFILE=testing_aot_hybrid 
 
-   mono_feature_disable_com='yes'
-   mono_feature_disable_remoting='yes'
-   mono_feature_disable_appdomains='yes'
-
    AOT_BUILD_FLAGS="--aot=hybrid,$INVARIANT_AOT_OPTIONS"
    AOT_RUN_FLAGS="--hybrid-aot"
 elif test x$with_runtime_preset = xaot; then
@@ -1432,8 +1432,6 @@ if test x$host_win32 = xno; then
 
        AC_CHECK_FUNCS(getgrgid_r)
        AC_CHECK_FUNCS(getgrnam_r)
-       AC_CHECK_FUNCS(getpwnam_r)
-       AC_CHECK_FUNCS(getpwuid_r)
        AC_CHECK_FUNCS(getresuid)
        AC_CHECK_FUNCS(setresuid)
        AC_CHECK_FUNCS(kqueue)
@@ -1454,6 +1452,11 @@ if test x$host_win32 = xno; then
        AC_CHECK_FUNCS(sched_setaffinity)
        AC_CHECK_FUNCS(sched_getcpu)
 
+       if test x$platform_android != xyes; then
+               AC_CHECK_FUNCS(getpwnam_r)
+               AC_CHECK_FUNCS(getpwuid_r)
+       fi
+
        dnl ****************************************************************
        dnl *** Check for sched_setaffinity from glibc versions before   ***
        dnl *** 2.3.4. The older versions of the function only take 2    ***
@@ -1914,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")
                ;;
@@ -2323,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 **********************************
@@ -3314,7 +3325,6 @@ if test "x$host" != "x$target"; then
                TARGET=ARM;
                arch_target=arm;
                AC_DEFINE(TARGET_ARM, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                ACCESS_UNALIGNED="no"
                CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                # Can't use tls, since it depends on the runtime detection of tls offsets
@@ -3327,6 +3337,11 @@ if test "x$host" != "x$target"; then
                        CPPFLAGS="$CPPFLAGS"
                        ;;
                armv5-*-linux-androideabi*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       CPPFLAGS="$CPPFLAGS"
+                       ;;
+               *-linux-androideabi*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
                        CPPFLAGS="$CPPFLAGS"
                        ;;
                esac
@@ -3346,23 +3361,33 @@ if test "x$host" != "x$target"; then
                TARGET=X86;
                arch_target=x86;
                AC_DEFINE(TARGET_X86, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h            
                with_tls=pthread
                target_mach=no
+
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
    x86_64*-linux-*)
                TARGET=AMD64;
                arch_target=amd64;
                AC_DEFINE(TARGET_AMD64, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
                target_mach=no
+
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
    x86_64-ps4-freebsd)
                TARGET=AMD64;
@@ -3381,12 +3406,16 @@ if test "x$host" != "x$target"; then
                TARGET=ARM64;
                arch_target=arm64;
                AC_DEFINE(TARGET_ARM64, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
                target_mach=no
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
        aarch64-*)
                TARGET=ARM64
index 08576f1a7de515eeda783c2936310d8288aa6629..1471ea511817cbed7af16759188a359021cf0ca8 100644 (file)
@@ -86,7 +86,7 @@ LOCK RULES
 Simple locks:
        Can be acquired at any point regardless of which locks are taken or not.
        No other locks can be acquired or released while holding a simple lock.
-       Reentrancy is not recomended. (warning)
+       Reentrancy is not recommended. (warning)
        Simple locks are leaf locks on the lock lattice.
 
 Complex locks:
@@ -129,7 +129,7 @@ ERROR: tried to acquire lock DomainLock at mono_domain_code_reserve_align while
 WARNING: tried to acquire lock ImageDataLock at mono_image_init_name_cache while holding ImageDataLock at mono_class_from_name
 WARNING: tried to acquire lock ImageDataLock at mono_image_init_name_cache while holding ImageDataLock at mono_image_add_to_name_cache
        Both of those happen when filling up the name_cache, as it needs to alloc image memory.
-       This one is fixable by spliting mono_image_init_name_cache into a locked and an unlocked variants and calling them appropriatedly.
+       This one is fixable by splitting mono_image_init_name_cache into a locked and an unlocked variants and calling them appropriately.
 
 */
 
diff --git a/docs/.gitattributes b/docs/.gitattributes
new file mode 100644 (file)
index 0000000..1847f86
--- /dev/null
@@ -0,0 +1,3 @@
+check-coverage crlf=input
+check-exports  crlf=input
+produce-lists  crlf=input
index b44089c0de9ac4d5a5269fd91a6a4c8301f9c950..5c2ce91fd5f294e7a96b347bdb5f69200022c2c9 100755 (executable)
@@ -26,7 +26,7 @@ some combination of the two.
        
        To be clearer, and give an idea of what the algorithm can and
        cannot do without describing it in detail... keep in mind that
-       only "redunant" checks cannot be removed. By "redundant", I
+       only "redundant" checks cannot be removed. By "redundant", I
        mean "already explicitly checked" in the method code.
        
        Unfortunately, analyzing complex expressions is not so easy
@@ -136,7 +136,7 @@ some combination of the two.
        In the first case, the BB has exactly two exit BBs, and their
        execution conditions are easy to get from the condition of the
        branch (see the "get_relation_from_branch_instruction"
-       function, and expecially the end of "analyze_block" in
+       function, and especially the end of "analyze_block" in
        abcremoval.c.
 
        If there is a switch, the jump condition of every exit BB is
@@ -303,7 +303,7 @@ some combination of the two.
        each BB tried to examine all possible conditions between all
        variables, filling a sort of "evaluation matrix". The problem
        was that the complexity of this evaluation was quadratic (or
-       worse) on the number of variables, and that many wariables
+       worse) on the number of variables, and that many variables
        were examined even if they were not involved in any array
        access.
        
@@ -332,7 +332,7 @@ some combination of the two.
 
                    [1b] Prepare the evaluation graph (empty)
 
-                   [1b] Summarize each varible definition, and put
+                   [1b] Summarize each variable definition, and put
                         the resulting relations in the evaluation
                         graph
 
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 7d446abd40b5331b5900cc280dfe8c6d1a1eee4c..e8abd2e5568b32bd985befca308016d4526158ed 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7d446abd40b5331b5900cc280dfe8c6d1a1eee4c
+Subproject commit e8abd2e5568b32bd985befca308016d4526158ed
index cb70cbe67af98fcae2a35c97f86a6bbf04d05aa8..f41352fa7dce0162d3172004617121fe28f06a88 160000 (submodule)
@@ -1 +1 @@
-Subproject commit cb70cbe67af98fcae2a35c97f86a6bbf04d05aa8
+Subproject commit f41352fa7dce0162d3172004617121fe28f06a88
index 7668f9bab6c688eef882bfd0b74dd5e86a9ddc11..c718457f0540c9b19be7f866dddb153e17ea3026 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 7668f9bab6c688eef882bfd0b74dd5e86a9ddc11
+Subproject commit c718457f0540c9b19be7f866dddb153e17ea3026
index 367864ef810859ae3ce652864233b35f2dd5fdbe..7c1e61bec8c069b2cc9e214c3094b147d76bbf82 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 367864ef810859ae3ce652864233b35f2dd5fdbe
+Subproject commit 7c1e61bec8c069b2cc9e214c3094b147d76bbf82
index ae2f95cb3fe207d911dade789078327631f59aad..5e6ebcfb7a3de6675a593ee8234dff848eed4172 100644 (file)
@@ -21,7 +21,7 @@
  * See the definition of page_hash_table in gc_private.h.
  * False hits from the stack(s) are much more dangerous than false hits
  * from elsewhere, since the former can pin a large object that spans the
- * block, eventhough it does not start on the dangerous block.
+ * block, even though it does not start on the dangerous block.
  */
  
 /*
index fa6f279f518a5fac4b4778e9e869e4d82bb0539c..c30d2fc2184751a5b49d4b1c65c76655d8af6006 100644 (file)
@@ -1872,7 +1872,7 @@ Since 6.2alpha6:
  - Fixed Makefile.direct for DARWIN.  (Thanks to Manuel Serrano.)
  - There was a race between GC_pthread_detach and thread exit that could
    result in a thread structure being deallocated by GC_pthread_detach
-   eventhough it was still needed by the thread exit code.  (Thanks to
+   even though it was still needed by the thread exit code.  (Thanks to
    Dick Porter for the small test case that allowed this to be debugged.)
  - Fixed version parsing for non-alpha versions in acinclude.m4 and
    version checking in version.h.
index df0ef2cda933f68b5f2b37552a000182d38b1a5d..153a3e0f91465424070641164eae24bd5b70ae9b 100644 (file)
@@ -19,7 +19,7 @@ relatively easy to adapt to new compilers with a different set of predefined
 macros.  Currently these macros generally identify platforms instead of
 features.  In many cases, this is a mistake.
 
-3) The code currently avoids #elif, eventhough that would make it more
+3) The code currently avoids #elif, even though that would make it more
 readable.  This was done since #elif would need to be understood by ALL
 compilers used to build the collector, and that hasn't always been the case.
 It makes sense to reconsider this decision at some point, since #elif has been
index e14e5296c59f76d309ed7c7bc0d6c745019cde32..e870342e4121c2b7a92f56813605ef042502ed5f 100644 (file)
@@ -936,7 +936,7 @@ void GC_do_local_mark(mse *local_mark_stack, mse *local_top)
            /* Try to share the load, since the main stack is empty,    */
            /* and helper threads are waiting for a refill.             */
            /* The entries near the bottom of the stack are likely      */
-           /* to require more work.  Thus we return those, eventhough  */
+           /* to require more work.  Thus we return those, even though */
            /* it's harder.                                             */
            mse * p;
            mse * new_bottom = local_mark_stack
index 440fc15a39793c8747007e4fb31ec825cfcd5c0a..3cd4bbea5558369f244d1873b7f220ec20c73074 100644 (file)
@@ -765,7 +765,7 @@ Refers to a namespace, e.g. \fIN:System\fR.
 .I "P:"
 Refers to a property.  If the property is an indexer or takes parameters, 
 the parameter types are appended to the property name and enclosed with
-paranthesis:
+parenthesis:
 \fIP:System.String.Length\fR,
 \fIP:System.String.Chars(System.Int32)\fR.
 .TP
index 7b8506ae8a79cab065329ba92625b5323f0a1ecc..4c99a8dd0d8ffe38e12cbaf81b7a5710da13c1f0 100644 (file)
@@ -609,7 +609,7 @@ Finally, namespaces can be specified using the N: prefix:
 Don't align stack frames on the x86 architecture.  By default, Mono
 aligns stack frames to 16 bytes on x86, so that local floating point
 and SIMD variables can be properly aligned.  This option turns off the
-alignment, which usually saves one intruction per call, but might
+alignment, which usually saves one instruction per call, but might
 result in significantly lower floating point and SIMD performance.
 .TP
 \fB--jitmap\fR
index 19d740305271c612aa69fc4b55dfafeb2a6d06be..8bbc34cb239284d9e71ff9bd8f078fcd93bde9cc 100644 (file)
@@ -237,7 +237,7 @@ to the type name, while methods append the method name (with an optional count
 of the number of generic parameters).
 .Sp
 If the constructor or method take arguments, these are listed within
-paranthesis after the constructor/method name:
+parenthesis after the constructor/method name:
 .Sp
 .I M:System.Object..ctor
 ,
@@ -259,7 +259,7 @@ Refers to a namespace, e.g.
 .I "P:"
 Refers to a property.  If the property is an indexer or takes parameters, 
 the parameter types are appended to the property name and enclosed with
-paranthesis:
+parenthesis:
 .I P:System.String.Length
 ,
 .I P:System.String.Chars(System.Int32)
index 4bf500ffd4a16a81c625ac2829e912449a895def..008fddbfc5c8253582e0ced767c1faf0f6379b55 100644 (file)
@@ -407,7 +407,7 @@ mysql      MySQL AB      MySql.Data.MySqlClient     MySql.Data
 NOTES:
 
 Ngsql is the .Net Data Provider for PosgreSQL.  The
-latest verison can be downloaded from 
+latest version can be downloaded from
 http://npgsql.projects.postgresql.org/
 
 MySql.Data is the MySQL Connector/Net for connecting to MySql databases.
index 1f9c224a2bb3dd4233a2607c98ef814c4e40d5bd..b81912bae54689d5c5ff6d0c2f685748b3bd1b1a 100644 (file)
@@ -1,2 +1,3 @@
 /LICENSE.MSPL -crlf
 /ScalableMonoIcon.svg -crlf
+/winexe.in     crlf=input
index 9d2deb9122f88a1b0759a16c4ba42b6c9272a885..54aa55d1545c99752cfe3e7e1de9bc181fafd8fc 100644 (file)
                                        code ();
                                }
 
-               * Avoid using unecessary open/close braces, vertical space
+               * Avoid using unnecessary open/close braces, vertical space
                  is usually limited:
 
                        good:
@@ -474,4 +474,4 @@ class X : Y {
                 MyHelperClass.cli.cs
                 MyHelperClass.jvm.cs
 
-       By using partial classes.
\ No newline at end of file
+       By using partial classes.
index ae919ca94fb481c00652d29fbe67de1180ee268a..e22eae3e178f473dd09bb49d491bd12578c5a9d0 100644 (file)
@@ -4,8 +4,10 @@ include ../../build/rules.make
 
 LIBRARY = Microsoft.CSharp.dll
 
-LIB_REFS = System.Core Mono.CSharp
+LIB_REFS = System.Core System
 LIB_MCS_FLAGS =
 
+RESX_RESOURCE_STRING = ../../../external/corefx/src/Microsoft.CSharp/src/Resources/Strings.resx
+
 include ../../build/library.make
 
index 41574527162ac270c67acea1781f1f890a86995a..e764b1041be993c46e568bc00db84e8e3859eae4 100644 (file)
   </PropertyGroup>\r
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
   <ItemGroup>\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Binder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\BinderHelper.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpArgumentInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpArgumentInfoFlags.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpBinaryOperationBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpBinaryOperationFlags.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpBinderFlags.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpCallFlags.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpConversionKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpConvertBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpGetIndexBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpGetMemberBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpInvokeBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpInvokeConstructorBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpInvokeMemberBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpIsEventBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpSetIndexBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpSetMemberBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\CSharpUnaryOperationBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Error.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\CController.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\CError.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\CErrorFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\CParameterizedError.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\ErrorCode.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\ErrorFacts.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\ErrorFmt.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\ErrorHandling.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\IErrorSink.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\MessageID.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Errors\UserStringBuilder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\ExpressionTreeCallRewriter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\ICSharpInvokeOrInvokeMemberBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\ResetBindException.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\RuntimeBinderController.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\RuntimeBinderException.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\RuntimeBinderExtensions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\RuntimeBinderInternalCompilerException.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Binding\Better.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Binding\ErrorReporting.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BindingContextBase.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BindingContexts.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BindingFlag.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BinOpArgInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BinOpKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\BinOpSig.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\CandidateFunctionMember.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ConstVal.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ConstValFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Conversion.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Conversions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\COperators.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Declarations\AggregateDeclaration.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Declarations\Declaration.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Declarations\GlobalAttributeDeclaration.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Declarations\NamespaceDeclaration.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExplicitConversion.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExpressionBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExpressionKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRExtensions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExprFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRFLAG.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FileRecord.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FundamentalTypes.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GlobalSymbolContext.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinder.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinderResult.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ImplicitConversion.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\InputFile.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ITypeOrNamespace.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\LangCompiler.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookup.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookupResults.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MetadataToken.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MethodIterator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MethodKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MethodTypeInferrer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\NameGenerator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Nullable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\NullableLift.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Operators.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\OriginalExpressions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\PredefinedAttributes.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\PredefinedMembers.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\SemanticChecker.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\SubstitutionContext.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\AggregateSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\AssemblyQualifiedNamespaceSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\EventSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\FieldSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\IndexerSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\LabelSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\LocalVariableSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\MethodOrPropertySymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\MethodSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\MiscSymFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\NamespaceOrAggregateSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\NamespaceSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\ParentSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\PropertySymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\Scope.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\Symbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymbolKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymbolLoader.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymbolManagerBase.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymbolMask.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymbolTable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\SymFactoryBase.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\TransparentIdentifierMemberSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\TypeParameterSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\UnresolvedAggregateSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Symbols\VariableSymbol.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ArrayIndex.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ArrayInitialization.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ArrayLength.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Assignment.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\BinaryOperator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Block.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\BoundAnonymousFunction.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Call.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Cast.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Class.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\CompoundOperator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Concatenate.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ConditionalOperator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Constant.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Event.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\EXPR.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ExpressionIterator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Field.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\FieldInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\HoistedLocal.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\List.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\LocalVariable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\MemberGroup.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\MethodInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\MethodReference.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\NamedArgumentSpecification.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Property.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\PropertyInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Return.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Statement.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Temporary.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\This.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeArguments.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeOf.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeOrNamespace.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnaryOperator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnboundAnonymousFunction.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedConversion.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedLogicalOperator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Visitors\ExpressionTreeRewriter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Visitors\ExprVisitorBase.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\ZeroInitialize.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\TypeBind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\AggregateType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\ArgumentListType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\ArrayType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\BoundLambdaType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\ErrorType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\MethodGroupType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\NullableType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\NullType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\OpenTypePlaceholderType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\ParameterModifierType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\PointerType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\PredefinedTypes.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\Type.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeArray.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeFactory.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeKind.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeManager.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeParameterType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeTable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Types\VoidType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\UnaOpSig.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\UtilityTypeExtensions.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\WithType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\SpecialNames.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\SymbolTable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\KnownName.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\NameManager.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\Names.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\NameTable.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\Operators.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\PredefinedName.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\PredefinedType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\TokenFacts.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Syntax\TokenKind.cs" />\r
+    <Compile Include="..\..\build\common\Consts.cs" />\r
+    <Compile Include="..\..\build\common\SR.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\Binder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpArgumentInfo.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpArgumentInfoFlags.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpBinaryOperationBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpBinderFlags.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpConvertBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpGetIndexBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpGetMemberBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpInvokeBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpInvokeConstructorBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpInvokeMemberBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpIsEventBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpSetIndexBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpSetMemberBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\CSharpUnaryOperationBinder.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\DynamicContext.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\ErrorPrinter.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\Extensions.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\RuntimeBinderContext.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\RuntimeBinderException.cs" />\r
-    <Compile Include="Microsoft.CSharp.RuntimeBinder\RuntimeBinderInternalCompilerException.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
       <Project>{359142A1-D80F-401E-AA64-7167C9317649}</Project>\r
       <Name>System.Core-net_4_x</Name>\r
     </ProjectReference>\r
-    <ProjectReference Include="../Mono.CSharp/Mono.CSharp-net_4_x.csproj">\r
-      <Project>{BEFCA993-98B4-48E9-8D68-1ACCB1FA7200}</Project>\r
-      <Name>Mono.CSharp-net_4_x</Name>\r
+    <ProjectReference Include="../System/System-net_4_x.csproj">\r
+      <Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>\r
+      <Name>System-net_4_x</Name>\r
     </ProjectReference>\r
   </ItemGroup>\r
   <ItemGroup>\r
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Binder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Binder.cs
deleted file mode 100644 (file)
index c8d5687..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-//
-// Binder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Linq.Expressions;
-using System.Reflection;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       public static class Binder
-       {
-               public static CallSiteBinder BinaryOperation (CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpBinaryOperationBinder (operation, flags, context, argumentInfo);
-               }
-               
-               public static CallSiteBinder Convert (CSharpBinderFlags flags, Type type, Type context)
-               {
-                       return new CSharpConvertBinder (type, context, flags);
-               }
-               
-               public static CallSiteBinder GetIndex (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpGetIndexBinder (context, argumentInfo);
-               }
-               
-               public static CallSiteBinder GetMember (CSharpBinderFlags flags, string name, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpGetMemberBinder (name, context, argumentInfo);
-               }
-               
-               public static CallSiteBinder Invoke (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpInvokeBinder (flags, context, argumentInfo);
-               }
-               
-               public static CallSiteBinder InvokeConstructor (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       // What are flags for here
-                       return new CSharpInvokeConstructorBinder (context, argumentInfo);
-               }
-               
-               public static CallSiteBinder InvokeMember (CSharpBinderFlags flags, string name, IEnumerable<Type> typeArguments, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpInvokeMemberBinder (flags, name, context, typeArguments, argumentInfo);
-               }
-               
-               public static CallSiteBinder IsEvent (CSharpBinderFlags flags, string name, Type context)
-               {
-                       return new CSharpIsEventBinder (name, context);
-               }
-               
-               public static CallSiteBinder SetIndex (CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpSetIndexBinder (flags, context, argumentInfo);
-               }
-               
-               public static CallSiteBinder SetMember (CSharpBinderFlags flags, string name, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpSetMemberBinder (flags, name, context, argumentInfo);
-               }
-               
-               public static CallSiteBinder UnaryOperation (CSharpBinderFlags flags, ExpressionType operation, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       return new CSharpUnaryOperationBinder (operation, flags, context, argumentInfo);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs
deleted file mode 100644 (file)
index 2c54af2..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// CSharpArgumentInfo.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       public sealed class CSharpArgumentInfo
-       {
-               readonly CSharpArgumentInfoFlags flags;
-               readonly string name;
-               
-               CSharpArgumentInfo (CSharpArgumentInfoFlags flags, string name)
-               {
-                       this.flags = flags;
-                       this.name = name;
-               }
-               
-               public static CSharpArgumentInfo Create (CSharpArgumentInfoFlags flags, string name)
-               {
-                       return new CSharpArgumentInfo (flags, name);
-               }
-
-               internal Compiler.Argument.AType ArgumentModifier {
-                       get {
-                               if ((flags & CSharpArgumentInfoFlags.IsRef) != 0)
-                                       return Compiler.Argument.AType.Ref;
-
-                               if ((flags & CSharpArgumentInfoFlags.IsOut) != 0)
-                                       return Compiler.Argument.AType.Out;
-
-                               return Compiler.Argument.AType.None;
-                       }
-               }
-
-               internal static CallInfo CreateCallInfo (IEnumerable<CSharpArgumentInfo> argumentInfo, int skipCount)
-               {
-                       var named = from arg in argumentInfo.Skip (skipCount) where arg.IsNamed select arg.name;
-                       return new CallInfo (Math.Max (0, argumentInfo.Count () - skipCount), named);
-               }
-               
-               internal CSharpArgumentInfoFlags Flags {
-                       get { return flags; }
-               }
-
-               internal bool IsNamed {
-                       get { return (flags & CSharpArgumentInfoFlags.NamedArgument) != 0; }
-               }
-
-               internal string Name {
-                       get { return name; }
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfoFlags.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfoFlags.cs
deleted file mode 100644 (file)
index 9a9ea7e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// CSharpArgumentInfoFlags.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       [Flags]
-       public enum CSharpArgumentInfoFlags
-       {
-               None                            = 0,
-               UseCompileTimeType      = 1,
-               Constant                        = 2,
-               NamedArgument           = 4,
-               IsRef                           = 8,
-               IsOut                           = 16,
-               IsStaticType            = 32
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs
deleted file mode 100644 (file)
index 374eb0d..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// CSharpBinaryOperationBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Runtime.CompilerServices;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpBinaryOperationBinder : BinaryOperationBinder
-       {
-               IList<CSharpArgumentInfo> argumentInfo;
-               readonly CSharpBinderFlags flags;
-               readonly Type context;
-               
-               public CSharpBinaryOperationBinder (ExpressionType operation, CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (operation)
-               {
-                       this.argumentInfo = new ReadOnlyCollectionBuilder<CSharpArgumentInfo> (argumentInfo);
-                       if (this.argumentInfo.Count != 2)
-                               throw new ArgumentException ("Binary operation requires 2 arguments");
-
-                       this.flags = flags;
-                       this.context = context;
-               }
-
-               Compiler.Binary.Operator GetOperator (out bool isCompound)
-               {
-                       isCompound = false;
-                       switch (Operation) {
-                       case ExpressionType.Add:
-                               return Compiler.Binary.Operator.Addition;
-                       case ExpressionType.AddAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.Addition;
-                       case ExpressionType.And:
-                               return (flags & CSharpBinderFlags.BinaryOperationLogical) != 0 ?
-                                       Compiler.Binary.Operator.LogicalAnd : Compiler.Binary.Operator.BitwiseAnd;
-                       case ExpressionType.AndAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.BitwiseAnd;
-                       case ExpressionType.Divide:
-                               return Compiler.Binary.Operator.Division;
-                       case ExpressionType.DivideAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.Division;
-                       case ExpressionType.Equal:
-                               return Compiler.Binary.Operator.Equality;
-                       case ExpressionType.ExclusiveOr:
-                               return Compiler.Binary.Operator.ExclusiveOr;
-                       case ExpressionType.ExclusiveOrAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.ExclusiveOr;
-                       case ExpressionType.GreaterThan:
-                               return Compiler.Binary.Operator.GreaterThan;
-                       case ExpressionType.GreaterThanOrEqual:
-                               return Compiler.Binary.Operator.GreaterThanOrEqual;
-                       case ExpressionType.LeftShift:
-                               return Compiler.Binary.Operator.LeftShift;
-                       case ExpressionType.LeftShiftAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.LeftShift;
-                       case ExpressionType.LessThan:
-                               return Compiler.Binary.Operator.LessThan;
-                       case ExpressionType.LessThanOrEqual:
-                               return Compiler.Binary.Operator.LessThanOrEqual;
-                       case ExpressionType.Modulo:
-                               return Compiler.Binary.Operator.Modulus;
-                       case ExpressionType.ModuloAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.Modulus;
-                       case ExpressionType.Multiply:
-                               return Compiler.Binary.Operator.Multiply;
-                       case ExpressionType.MultiplyAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.Multiply;
-                       case ExpressionType.NotEqual:
-                               return Compiler.Binary.Operator.Inequality;
-                       case ExpressionType.Or:
-                               return (flags & CSharpBinderFlags.BinaryOperationLogical) != 0 ?
-                                       Compiler.Binary.Operator.LogicalOr : Compiler.Binary.Operator.BitwiseOr;
-                       case ExpressionType.OrAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.BitwiseOr;
-                       case ExpressionType.OrElse:
-                               return Compiler.Binary.Operator.LogicalOr;
-                       case ExpressionType.RightShift:
-                               return Compiler.Binary.Operator.RightShift;
-                       case ExpressionType.RightShiftAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.RightShift;
-                       case ExpressionType.Subtract:
-                               return Compiler.Binary.Operator.Subtraction;
-                       case ExpressionType.SubtractAssign:
-                               isCompound = true;
-                               return Compiler.Binary.Operator.Subtraction;
-                       default:
-                               throw new NotImplementedException (Operation.ToString ());
-                       }
-               }
-               
-               public override DynamicMetaObject FallbackBinaryOperation (DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var left = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       var right = ctx.CreateCompilerExpression (argumentInfo [1], arg);
-                       
-                       bool is_compound;
-                       var oper = GetOperator (out is_compound);
-                       Compiler.Expression expr;
-
-                       if (is_compound) {
-                               var target_expr = new Compiler.RuntimeValueExpression (target, ctx.ImportType (target.LimitType));
-                               expr = new Compiler.CompoundAssign (oper, target_expr, right, left);
-                       } else {
-                               expr = new Compiler.Binary (oper, left, right);
-                       }
-
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-                       
-                       if ((flags & CSharpBinderFlags.CheckedContext) != 0)
-                               expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (arg);
-
-                       return binder.Bind (ctx, context);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
deleted file mode 100644 (file)
index ab977fc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// CSharpBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Linq.Expressions;
-using Compiler = Mono.CSharp;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpBinder
-       {
-               static ConstructorInfo binder_exception_ctor;
-               static object resolver = new object ();
-
-               DynamicMetaObjectBinder binder;
-               Compiler.Expression expr;
-               BindingRestrictions restrictions;
-               DynamicMetaObject errorSuggestion;
-
-               public CSharpBinder (DynamicMetaObjectBinder binder, Compiler.Expression expr, DynamicMetaObject errorSuggestion)
-               {
-                       this.binder = binder;
-                       this.expr = expr;
-                       this.restrictions = BindingRestrictions.Empty;
-                       this.errorSuggestion = errorSuggestion;
-               }
-
-               public Compiler.ResolveContext.Options ResolveOptions { get; set; }
-
-               public void AddRestrictions (DynamicMetaObject arg)
-               {
-                       restrictions = restrictions.Merge (CreateRestrictionsOnTarget (arg));
-               }
-
-               public void AddRestrictions (DynamicMetaObject[] args)
-               {
-                       restrictions = restrictions.Merge (CreateRestrictionsOnTarget (args));
-               }
-
-               public DynamicMetaObject Bind (DynamicContext ctx, Type callingType)
-               {
-                       Expression res;
-                       try {
-                               var rc = new Compiler.ResolveContext (new RuntimeBinderContext (ctx, callingType), ResolveOptions);
-
-                               // Static typemanager and internal caches are not thread-safe
-                               lock (resolver) {
-                                       expr = expr.Resolve (rc, Compiler.ResolveFlags.VariableOrValue);
-                               }
-
-                               if (expr == null)
-                                       throw new RuntimeBinderInternalCompilerException ("Expression resolved to null");
-
-                               res = expr.MakeExpression (new Compiler.BuilderContext ());
-                       } catch (RuntimeBinderException e) {
-                               if (errorSuggestion != null)
-                                       return errorSuggestion;
-
-                               res = CreateBinderException (e.Message);
-                       } catch (Exception) {
-                               if (errorSuggestion != null)
-                                       return errorSuggestion;
-
-                               throw;
-                       }
-
-                       return new DynamicMetaObject (res, restrictions);
-               }
-
-               Expression CreateBinderException (string message)
-               {
-                       if (binder_exception_ctor == null)
-                               binder_exception_ctor = typeof (RuntimeBinderException).GetConstructor (new[] { typeof (string) });
-
-                       //
-                       // Uses target type to keep expressions composition working
-                       //
-                       return Expression.Throw (Expression.New (binder_exception_ctor, Expression.Constant (message)), binder.ReturnType);
-               }
-
-               static BindingRestrictions CreateRestrictionsOnTarget (DynamicMetaObject arg)
-               {
-                       return arg.HasValue && arg.Value == null ?
-                               BindingRestrictions.GetInstanceRestriction (arg.Expression, null) :
-                               BindingRestrictions.GetTypeRestriction (arg.Expression, arg.LimitType);
-               }
-
-               public static BindingRestrictions CreateRestrictionsOnTarget (DynamicMetaObject[] args)
-               {
-                       if (args.Length == 0)
-                               return BindingRestrictions.Empty;
-
-                       var res = CreateRestrictionsOnTarget (args[0]);
-                       for (int i = 1; i < args.Length; ++i)
-                               res = res.Merge (CreateRestrictionsOnTarget (args[i]));
-
-                       return res;
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinderFlags.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpBinderFlags.cs
deleted file mode 100644 (file)
index 39ef679..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// CSharpBinderFlags.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       [Flags]
-       public enum CSharpBinderFlags
-       {
-               None                                    = 0,
-               CheckedContext                  = 1,
-               InvokeSimpleName                = 1 << 1,
-               InvokeSpecialName               = 1 << 2,
-               BinaryOperationLogical  = 1 << 3,
-               ConvertExplicit                 = 1 << 4,
-               ConvertArrayIndex               = 1 << 5,
-               ResultIndexed                   = 1 << 6,               
-               ValueFromCompoundAssignment = 1 << 7,
-               ResultDiscarded                 = 1 << 8
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs
deleted file mode 100644 (file)
index 32fa472..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// CSharpConvertBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpConvertBinder : ConvertBinder
-       {
-               readonly CSharpBinderFlags flags;
-               readonly Type context;
-
-               public CSharpConvertBinder (Type type, Type context, CSharpBinderFlags flags)
-                       : base (type, (flags & CSharpBinderFlags.ConvertExplicit) != 0)
-               {
-                       this.flags = flags;
-                       this.context = context;
-               }
-
-               public override DynamicMetaObject FallbackConvert (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var expr = ctx.CreateCompilerExpression (null, target);
-
-                       if (Explicit)
-                               expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (Type), Compiler.Location.Null), expr, Compiler.Location.Null);
-                       else
-                               expr = new Compiler.ImplicitCast (expr, ctx.ImportType (Type), (flags & CSharpBinderFlags.ConvertArrayIndex) != 0);
-
-                       if ((flags & CSharpBinderFlags.CheckedContext) != 0)
-                               expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-
-                       return binder.Bind (ctx, context);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs
deleted file mode 100644 (file)
index 367cc22..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// CSharpGetIndexBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpGetIndexBinder : GetIndexBinder
-       {
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-               
-               public CSharpGetIndexBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1))
-               {
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-                       
-               public override DynamicMetaObject FallbackGetIndex (DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion)
-               {
-                       if (argumentInfo.Count != indexes.Length + 1) {
-                               if (errorSuggestion == null)
-                                       throw new NotImplementedException ();
-
-                               return errorSuggestion;
-                       }
-
-                       var ctx = DynamicContext.Create ();
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       var args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), indexes);
-                       expr = new Compiler.ElementAccess (expr, args, Compiler.Location.Null);
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (indexes);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs
deleted file mode 100644 (file)
index 790ed72..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// CSharpGetMemberBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpGetMemberBinder : GetMemberBinder
-       {
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-               
-               public CSharpGetMemberBinder (string name, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (name, false)
-               {
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-               
-               public override DynamicMetaObject FallbackGetMember (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       expr = new Compiler.MemberAccess (expr, Name);
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs
deleted file mode 100644 (file)
index 1f6b34a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// CSharpInvokeBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpInvokeBinder : InvokeBinder
-       {
-               readonly CSharpBinderFlags flags;
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-               
-               public CSharpInvokeBinder (CSharpBinderFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1))
-               {
-                       this.flags = flags;
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-               
-               public override DynamicMetaObject FallbackInvoke (DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       var c_args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), args);
-                       expr = new Compiler.Invocation (expr, c_args);
-
-                       if ((flags & CSharpBinderFlags.ResultDiscarded) == 0)
-                               expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-                       else
-                               expr = new Compiler.DynamicResultCast (ctx.ImportType (ReturnType), expr);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (args);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeConstructorBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeConstructorBinder.cs
deleted file mode 100644 (file)
index b5f0b9f..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// CSharpInvokeConstructorBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpInvokeConstructorBinder : DynamicMetaObjectBinder
-       {
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-               Type target_return_type;
-
-               public CSharpInvokeConstructorBinder (Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-               {
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-
-               public override DynamicMetaObject Bind (DynamicMetaObject target, DynamicMetaObject[] args)
-               {
-                       var ctx = DynamicContext.Create ();
-
-                       var type = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       target_return_type = type.Type.GetMetaInfo ();
-
-                       var c_args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), args);
-
-                       var binder = new CSharpBinder (
-                               this, new Compiler.New (type, c_args, Compiler.Location.Null), null);
-
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (args);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-
-               public override Type ReturnType {
-                       get {
-                               return target_return_type;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs
deleted file mode 100644 (file)
index 138e314..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-//
-// CSharpInvokeMemberBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-using SLE = System.Linq.Expressions;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpInvokeMemberBinder : InvokeMemberBinder
-       {
-               //
-               // A custom runtime invocation is needed to deal with member invocation which
-               // is not real member invocation but invocation on invocalble member.
-               //
-               // An example:
-               // class C {
-               //              dynamic f;
-               //              void Foo ()
-               //              {
-               //                      dynamic d = new C ();
-               //                      d.f.M ();
-               //              }
-               //
-               // The runtime value of `f' can be a delegate in which case we are invoking result
-               // of member invocation, this is already handled by DoResolveDynamic but we need
-               // more runtime dependencies which require Microsoft.CSharp assembly reference or
-               // a lot of reflection calls
-               //
-               class Invocation : Compiler.Invocation
-               {
-                       sealed class RuntimeDynamicInvocation : Compiler.ShimExpression
-                       {
-                               Invocation invoke;
-
-                               public RuntimeDynamicInvocation (Invocation invoke, Compiler.Expression memberExpr)
-                                       : base (memberExpr)
-                               {
-                                       this.invoke = invoke;
-                               }
-
-                               protected override Compiler.Expression DoResolve (Compiler.ResolveContext rc)
-                               {
-                                       type = expr.Type;
-                                       eclass = Compiler.ExprClass.Value;
-                                       return this;
-                               }
-
-                               //
-                               // Creates an invoke call on invocable expression
-                               //
-                               public override System.Linq.Expressions.Expression MakeExpression (Compiler.BuilderContext ctx)
-                               {
-                                       var invokeBinder = invoke.invokeBinder;
-                                       var binder = Binder.Invoke (invokeBinder.flags, invokeBinder.callingContext, invokeBinder.argumentInfo);
-
-                                       var args = invoke.Arguments;
-                                       var args_expr = new SLE.Expression[invokeBinder.argumentInfo.Count];
-
-                                       var types = new Type [args_expr.Length + 2];
-
-                                       // Required by MakeDynamic
-                                       types[0] = typeof (System.Runtime.CompilerServices.CallSite);
-                                       types[1] = expr.Type.GetMetaInfo ();
-
-                                       args_expr[0] = expr.MakeExpression (ctx);
-
-                                       for (int i = 0; i < args.Count; ++i) {
-                                               args_expr[i + 1] = args[i].Expr.MakeExpression (ctx);
-
-                                               int type_index = i + 2;
-                                               types[type_index] = args[i].Type.GetMetaInfo ();
-                                               if (args[i].IsByRef)
-                                                       types[type_index] = types[type_index].MakeByRefType ();
-                                       }
-
-                                       // Return type goes last
-                                       bool void_result = (invokeBinder.flags & CSharpBinderFlags.ResultDiscarded) != 0;
-                                       types[types.Length - 1] = void_result ? typeof (void) : invokeBinder.ReturnType;
-
-                                       //
-                                       // Much easier to use Expression.Dynamic cannot be used because it ignores ByRef arguments
-                                       // and it always generates either Func or Action and any value type argument is lost
-                                       //
-                                       Type delegateType = SLE.Expression.GetDelegateType (types);
-                                       return SLE.Expression.MakeDynamic (delegateType, binder, args_expr);
-                               }
-                       }
-
-                       readonly CSharpInvokeMemberBinder invokeBinder;
-
-                       public Invocation (Compiler.Expression expr, Compiler.Arguments arguments, CSharpInvokeMemberBinder invokeBinder)
-                               : base (expr, arguments)
-                       {
-                               this.invokeBinder = invokeBinder;
-                       }
-
-                       protected override Compiler.Expression DoResolveDynamic (Compiler.ResolveContext ec, Compiler.Expression memberExpr)
-                       {
-                               return new RuntimeDynamicInvocation (this, memberExpr).Resolve (ec);
-                       }
-               }
-
-               readonly CSharpBinderFlags flags;
-               IList<CSharpArgumentInfo> argumentInfo;
-               IList<Type> typeArguments;
-               Type callingContext;
-               
-               public CSharpInvokeMemberBinder (CSharpBinderFlags flags, string name, Type callingContext, IEnumerable<Type> typeArguments, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (name, false, CSharpArgumentInfo.CreateCallInfo (argumentInfo, 1))
-               {
-                       this.flags = flags;
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-                       this.typeArguments = typeArguments.ToReadOnly ();
-               }
-               
-               public override DynamicMetaObject FallbackInvoke (DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
-               {
-                       var b = new CSharpInvokeBinder (flags, callingContext, argumentInfo);
-                       
-                       // TODO: Is errorSuggestion ever used?
-                       return b.Defer (target, args);
-               }
-               
-               public override DynamicMetaObject FallbackInvokeMember (DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var c_args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), args);
-                       var t_args = typeArguments == null ?
-                               null :
-                               new Compiler.TypeArguments (typeArguments.Select (l => new Compiler.TypeExpression (ctx.ImportType (l), Compiler.Location.Null)).ToArray ());
-
-                       var expr = ctx.CreateCompilerExpression (argumentInfo[0], target);
-
-                       //
-                       // Simple name invocation is actually member access invocation
-                       // to capture original this argument. This  brings problem when
-                       // simple name is resolved as a static invocation and member access
-                       // has to be reduced back to simple name without reporting an error
-                       //
-                       if ((flags & CSharpBinderFlags.InvokeSimpleName) != 0) {
-                               var value = expr as Compiler.RuntimeValueExpression;
-                               if (value != null)
-                                       value.IsSuggestionOnly = true;
-                       }
-
-                       expr = new Compiler.MemberAccess (expr, Name, t_args, Compiler.Location.Null);
-                       expr = new Invocation (expr, c_args, this);
-
-                       if ((flags & CSharpBinderFlags.ResultDiscarded) == 0)
-                               expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-                       else
-                               expr = new Compiler.DynamicResultCast (ctx.ImportType (ReturnType), expr);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (args);
-
-                       if ((flags & CSharpBinderFlags.InvokeSpecialName) != 0)
-                               binder.ResolveOptions |= Compiler.ResolveContext.Options.InvokeSpecialName;
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs
deleted file mode 100644 (file)
index e485e40..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//
-// CSharpIsEventBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpIsEventBinder : DynamicMetaObjectBinder
-       {
-               Type callingContext;
-               string name;
-               
-               public CSharpIsEventBinder (string name, Type callingContext)
-               {
-                       this.name = name;
-                       this.callingContext = callingContext;
-               }
-               
-               public override DynamicMetaObject Bind (DynamicMetaObject target, DynamicMetaObject[] args)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var context_type = ctx.ImportType (callingContext);
-                       var queried_type = ctx.ImportType (target.LimitType);
-                       var rc = new Compiler.ResolveContext (new RuntimeBinderContext (ctx, context_type), 0);
-
-                       var expr = Compiler.Expression.MemberLookup (rc, false, queried_type,
-                               name, 0, Compiler.Expression.MemberLookupRestrictions.ExactArity, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (
-                               this, new Compiler.BoolConstant (ctx.CompilerContext.BuiltinTypes, expr is Compiler.EventExpr, Compiler.Location.Null), null);
-
-                       binder.AddRestrictions (target);
-                       return binder.Bind (ctx, callingContext);
-               }
-
-               public override Type ReturnType {
-                       get {
-                               return typeof (bool);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs
deleted file mode 100644 (file)
index ad2f51a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// CSharpSetIndexBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpSetIndexBinder : SetIndexBinder
-       {
-               readonly CSharpBinderFlags flags;
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-
-               public CSharpSetIndexBinder (CSharpBinderFlags flags, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (CSharpArgumentInfo.CreateCallInfo (argumentInfo, 2))
-               {
-                       this.flags = flags;
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-               
-               public override DynamicMetaObject FallbackSetIndex (DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
-               {
-                       if (argumentInfo.Count != indexes.Length + 2) {
-                               if (errorSuggestion == null)
-                                       throw new NotImplementedException ();
-
-                               return errorSuggestion;
-                       }
-
-                       var ctx = DynamicContext.Create ();
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-                       var args = ctx.CreateCompilerArguments (argumentInfo.Skip (1), indexes);
-                       expr = new Compiler.ElementAccess (expr, args, Compiler.Location.Null);
-
-                       var source = ctx.CreateCompilerExpression (argumentInfo [indexes.Length + 1], value);
-
-                       // Same conversion as in SetMemberBinder
-                       if ((flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0) {
-                               expr = new Compiler.RuntimeExplicitAssign (expr, source);
-                       } else {
-                               expr = new Compiler.SimpleAssign (expr, source);
-                       }
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-
-                       if ((flags & CSharpBinderFlags.CheckedContext) != 0)
-                               expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (value);
-                       binder.AddRestrictions (indexes);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs
deleted file mode 100644 (file)
index aaf2b25..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// CSharpSetMemberBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpSetMemberBinder : SetMemberBinder
-       {
-               readonly CSharpBinderFlags flags;
-               IList<CSharpArgumentInfo> argumentInfo;
-               Type callingContext;
-
-               public CSharpSetMemberBinder (CSharpBinderFlags flags, string name, Type callingContext, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (name, false)
-               {
-                       this.flags = flags;
-                       this.callingContext = callingContext;
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-               }
-               
-               public override DynamicMetaObject FallbackSetMember (DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var source = ctx.CreateCompilerExpression (argumentInfo [1], value);
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-
-                       // Field assignment
-                       expr = new Compiler.MemberAccess (expr, Name);
-
-                       // Compound assignment under dynamic context does not convert result
-                       // expression but when setting member type we need to do explicit
-                       // conversion to ensure type match between member type and dynamic
-                       // expression type
-                       if ((flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0) {
-                               expr = new Compiler.RuntimeExplicitAssign (expr, source);
-                       } else {
-                               expr = new Compiler.SimpleAssign (expr, source);
-                       }
-
-                       expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-
-                       if ((flags & CSharpBinderFlags.CheckedContext) != 0)
-                               expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-                       binder.AddRestrictions (value);
-
-                       return binder.Bind (ctx, callingContext);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs
deleted file mode 100644 (file)
index f625f5f..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// CSharpUnaryOperationBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using System.Linq.Expressions;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class CSharpUnaryOperationBinder : UnaryOperationBinder
-       {
-               IList<CSharpArgumentInfo> argumentInfo;
-               readonly CSharpBinderFlags flags;
-               readonly Type context;
-               
-               public CSharpUnaryOperationBinder (ExpressionType operation, CSharpBinderFlags flags, Type context, IEnumerable<CSharpArgumentInfo> argumentInfo)
-                       : base (operation)
-               {
-                       this.argumentInfo = argumentInfo.ToReadOnly ();
-                       if (this.argumentInfo.Count != 1)
-                               throw new ArgumentException ("Unary operation requires 1 argument");
-
-                       this.flags = flags;
-                       this.context = context;
-               }
-       
-
-               Compiler.Unary.Operator GetOperator ()
-               {
-                       switch (Operation) {
-                       case ExpressionType.Negate:
-                               return Compiler.Unary.Operator.UnaryNegation;
-                       case ExpressionType.Not:
-                               return Compiler.Unary.Operator.LogicalNot;
-                       case ExpressionType.OnesComplement:
-                               return Compiler.Unary.Operator.OnesComplement;
-                       case ExpressionType.UnaryPlus:
-                               return Compiler.Unary.Operator.UnaryPlus;
-                       default:
-                               throw new NotImplementedException (Operation.ToString ());
-                       }
-               }
-               
-               public override DynamicMetaObject FallbackUnaryOperation (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
-               {
-                       var ctx = DynamicContext.Create ();
-                       var expr = ctx.CreateCompilerExpression (argumentInfo [0], target);
-
-                       if (Operation == ExpressionType.IsTrue) {
-                               expr = new Compiler.BooleanExpression (expr);
-                       } else if (Operation == ExpressionType.IsFalse) {
-                               expr = new Compiler.BooleanExpressionFalse (expr);
-                       } else {
-                               if (Operation == ExpressionType.Increment)
-                                       expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreIncrement, expr, Compiler.Location.Null);
-                               else if (Operation == ExpressionType.Decrement)
-                                       expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreDecrement, expr, Compiler.Location.Null);
-                               else
-                                       expr = new Compiler.Unary (GetOperator (), expr, Compiler.Location.Null);
-
-                               expr = new Compiler.Cast (new Compiler.TypeExpression (ctx.ImportType (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);
-
-                               if ((flags & CSharpBinderFlags.CheckedContext) != 0)
-                                       expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
-                       }
-
-                       var binder = new CSharpBinder (this, expr, errorSuggestion);
-                       binder.AddRestrictions (target);
-
-                       return binder.Bind (ctx, context);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs
deleted file mode 100644 (file)
index 9c466c5..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-//
-// DynamicContext.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using Compiler = Mono.CSharp;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class DynamicContext
-       {
-               static DynamicContext dc;
-               static object compiler_initializer = new object ();
-               static object lock_object = new object ();
-
-               readonly Compiler.ModuleContainer module;
-               readonly Compiler.ReflectionImporter importer;
-
-               private DynamicContext (Compiler.ModuleContainer module, Compiler.ReflectionImporter importer)
-               {
-                       this.module = module;
-                       this.importer = importer;
-               }
-
-               public Compiler.CompilerContext CompilerContext {
-                       get {
-                               return module.Compiler;
-                       }
-               }
-
-               public Compiler.ModuleContainer Module {
-                       get {
-                               return module;
-                       }
-               }
-
-               public static DynamicContext Create ()
-               {
-                       if (dc != null)
-                               return dc;
-
-                       lock (compiler_initializer) {
-                               if (dc != null)
-                                       return dc;
-
-                               var settings = new Compiler.CompilerSettings () {
-                                       WarningLevel = 0
-                               };
-
-                               var cc = new Compiler.CompilerContext (settings, ErrorPrinter.Instance) {
-                                       IsRuntimeBinder = true
-                               };
-
-                               //
-                               // Any later loaded assemblies are handled internally by GetAssemblyDefinition
-                               // domain.AssemblyLoad cannot be used as that would be too destructive as we
-                               // would hold all loaded assemblies even if they can be never visited
-                               //
-                               // TODO: Remove this code and rely on GetAssemblyDefinition only
-                               //
-                               var module = new Compiler.ModuleContainer (cc);
-                               module.HasTypesFullyDefined = true;
-                               
-                               // Setup fake assembly, it's used mostly to simplify checks like friend-access
-                               var temp = new Compiler.AssemblyDefinitionDynamic (module, "dynamic");
-                               module.SetDeclaringAssembly (temp);
-
-                               var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) {
-                                       IgnorePrivateMembers = false
-                               };
-
-                               // Import all currently loaded assemblies
-                               // TODO: Rewrite this to populate type cache on-demand, that should greatly
-                               // reduce our start-up cost
-                               var domain = AppDomain.CurrentDomain;
-                               foreach (var a in AppDomain.CurrentDomain.GetAssemblies ()) {
-                                       importer.ImportAssembly (a, module.GlobalRootNamespace);
-                               }
-
-                               cc.BuiltinTypes.CheckDefinitions (module);
-                               module.InitializePredefinedTypes ();
-
-                               dc = new DynamicContext (module, importer);
-                       }
-
-                       return dc;
-               }
-
-               //
-               // Creates mcs expression from dynamic object
-               //
-               public Compiler.Expression CreateCompilerExpression (CSharpArgumentInfo info, DynamicMetaObject value)
-               {
-                       //
-                       // No type details provider, go with runtime type
-                       //
-                       if (info == null) {
-                               if (value.LimitType == typeof (object))
-                                       return new Compiler.NullLiteral (Compiler.Location.Null);
-
-                               return new Compiler.RuntimeValueExpression (value, ImportType (value.RuntimeType));
-                       }
-
-                       //
-                       // Value is known to be a type
-                       //
-                       if ((info.Flags & CSharpArgumentInfoFlags.IsStaticType) != 0)
-                               return new Compiler.TypeExpression (ImportType ((Type) value.Value), Compiler.Location.Null);
-
-                       if (value.Value == null &&
-                               (info.Flags & (CSharpArgumentInfoFlags.IsOut | CSharpArgumentInfoFlags.IsRef | CSharpArgumentInfoFlags.UseCompileTimeType)) == 0 &&
-                               value.LimitType == typeof (object)) {
-                               return new Compiler.NullLiteral (Compiler.Location.Null);
-                       }
-
-                       //
-                       // Use compilation time type when type was known not to be dynamic during compilation
-                       //
-                       Type value_type = (info.Flags & CSharpArgumentInfoFlags.UseCompileTimeType) != 0 ? value.Expression.Type : value.LimitType;
-                       var type = ImportType (value_type);
-
-                       if ((info.Flags & CSharpArgumentInfoFlags.Constant) != 0) {
-                               var c = Compiler.Constant.CreateConstantFromValue (type, value.Value, Compiler.Location.Null);
-                               //
-                               // It can be null for misused Constant flag
-                               //
-                               if (c != null)
-                                       return c;
-                       }
-
-                       return new Compiler.RuntimeValueExpression (value, type);
-               }
-
-               //
-               // Creates mcs arguments from dynamic argument info
-               //
-               public Compiler.Arguments CreateCompilerArguments (IEnumerable<CSharpArgumentInfo> info, DynamicMetaObject[] args)
-               {
-                       var res = new Compiler.Arguments (args.Length);
-                       int pos = 0;
-
-                       // enumerates over args
-                       foreach (var item in info) {
-                               var expr = CreateCompilerExpression (item, args[pos++]);
-                               if (item.IsNamed) {
-                                       res.Add (new Compiler.NamedArgument (item.Name, Compiler.Location.Null, expr, item.ArgumentModifier));
-                               } else {
-                                       res.Add (new Compiler.Argument (expr, item.ArgumentModifier));
-                               }
-
-                               if (pos == args.Length)
-                                       break;
-                       }
-
-                       return res;
-               }
-
-               public Compiler.TypeSpec ImportType (Type type)
-               {
-                       lock (lock_object) {
-                               return importer.ImportType (type);
-                       }
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ErrorPrinter.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/ErrorPrinter.cs
deleted file mode 100644 (file)
index 874953a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// ErrorPrinter.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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 Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       class ErrorPrinter : Compiler.ReportPrinter
-       {
-               public static readonly ErrorPrinter Instance = new ErrorPrinter ();
-
-               private ErrorPrinter ()
-               {
-               }
-
-               public override bool HasRelatedSymbolSupport {
-                       get {
-                               return false;
-                       }
-               }
-
-               public override void Print (Compiler.AbstractMessage msg, bool showFullPath)
-               {
-                       string text;
-                       if (msg.Code == 214) {
-                               text = "Pointers and fixed size buffers cannot be used in a dynamic context";
-                       } else {
-                               text = msg.Text;
-                       }
-
-                       throw new RuntimeBinderException (text);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/Extensions.cs
deleted file mode 100644 (file)
index 9a55598..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// CSharpInvokeMemberBinder.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Dynamic;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       static class Extensions
-       {
-               public static IList<T> ToReadOnly<T> (this IEnumerable<T> col)
-               {
-                       return col == null ? 
-                               null : new ReadOnlyCollectionBuilder<T> (col);
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
deleted file mode 100644 (file)
index e2b38db..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// RuntimeBinderContext.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Generic;
-using Compiler = Mono.CSharp;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       sealed class RuntimeBinderContext : Compiler.IMemberContext
-       {
-               readonly Compiler.ModuleContainer module;
-               readonly Type callingType;
-               readonly DynamicContext ctx;
-               Compiler.TypeSpec callingTypeImported;
-
-               public RuntimeBinderContext (DynamicContext ctx, Compiler.TypeSpec callingType)
-               {
-                       this.ctx = ctx;
-                       this.module = ctx.Module;
-                       this.callingTypeImported = callingType;
-               }
-
-               public RuntimeBinderContext (DynamicContext ctx, Type callingType)
-               {
-                       this.ctx = ctx;
-                       this.module = ctx.Module;
-                       this.callingType = callingType;
-               }
-
-               #region IMemberContext Members
-
-               public Compiler.TypeSpec CurrentType {
-                       get {
-                               //
-                               // Delay importing of calling type to be compatible with .net
-                               // Some libraries are setting it to null which is invalid
-                               // but the NullReferenceException is thrown only when the context
-                               // is used and not during initialization
-                               //
-                               if (callingTypeImported == null && callingType != null)
-                                       callingTypeImported = ctx.ImportType (callingType);
-
-                               return callingTypeImported;
-                       }
-               }
-
-               public Compiler.TypeParameters CurrentTypeParameters {
-                       get { throw new NotImplementedException (); }
-               }
-
-               public Compiler.MemberCore CurrentMemberDefinition {
-                       get {
-                               return null;
-                       }
-               }
-
-               public bool IsObsolete {
-                       get {
-                               // Always true to ignore obsolete attribute checks
-                               return true;
-                       }
-               }
-
-               public bool IsUnsafe {
-                       get {
-                               // Dynamic cannot be used with pointers
-                               return false;
-                       }
-               }
-
-               public bool IsStatic {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public Compiler.ModuleContainer Module {
-                       get {
-                               return module;
-                       }
-               }
-
-               public string GetSignatureForError ()
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public Compiler.ExtensionMethodCandidates LookupExtensionMethod (string name, int arity)
-               {
-                       // No extension method lookup in this context
-                       return null;
-               }
-
-               public Compiler.FullNamedExpression LookupNamespaceOrType (string name, int arity, Mono.CSharp.LookupMode mode, Mono.CSharp.Location loc)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               public Compiler.FullNamedExpression LookupNamespaceAlias (string name)
-               {
-                       // No namespace aliases in this context
-                       return null;
-               }
-
-               #endregion
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderException.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderException.cs
deleted file mode 100644 (file)
index f30f77a..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// RuntimeBinderException.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Runtime.Serialization;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       [Serializable]
-       public class RuntimeBinderException : Exception
-       {
-               public RuntimeBinderException ()
-               {
-               }
-
-               public RuntimeBinderException (string message)
-                       : base (message)
-               {
-               }
-
-               public RuntimeBinderException (string message, Exception innerException)
-                       : base (message, innerException)
-               {
-               }
-
-               protected RuntimeBinderException (SerializationInfo info, StreamingContext context)
-                       : base (info, context)
-               {
-               }
-       }
-}
diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderInternalCompilerException.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/RuntimeBinderInternalCompilerException.cs
deleted file mode 100644 (file)
index 83e3cc2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// RuntimeBinderInternalCompilerException.cs
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2009 Novell, Inc (http://www.novell.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.Runtime.Serialization;
-
-namespace Microsoft.CSharp.RuntimeBinder
-{
-       [Serializable]
-       public class RuntimeBinderInternalCompilerException : Exception
-       {
-               public RuntimeBinderInternalCompilerException ()
-               {
-               }
-
-               public RuntimeBinderInternalCompilerException (string message)
-                       : base (message)
-               {
-               }
-
-               public RuntimeBinderInternalCompilerException (string message, Exception innerException)
-                       : base (message, innerException)
-               {
-               }
-
-               protected RuntimeBinderInternalCompilerException (SerializationInfo info, StreamingContext context)
-                       : base (info, context)
-               {
-               }
-       }
-}
index 3d6d20b5e756f28988a4b1e07db8e5438a1193ab..96568b47086a250a16e207c7412796ff9a4a55a8 100644 (file)
 Assembly/AssemblyInfo.cs
-Microsoft.CSharp.RuntimeBinder/Binder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfo.cs
-Microsoft.CSharp.RuntimeBinder/CSharpArgumentInfoFlags.cs
-Microsoft.CSharp.RuntimeBinder/CSharpBinaryOperationBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpBinderFlags.cs
-Microsoft.CSharp.RuntimeBinder/CSharpConvertBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpGetIndexBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpGetMemberBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpInvokeBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpInvokeConstructorBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpInvokeMemberBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpIsEventBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpSetIndexBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpSetMemberBinder.cs
-Microsoft.CSharp.RuntimeBinder/CSharpUnaryOperationBinder.cs
-Microsoft.CSharp.RuntimeBinder/DynamicContext.cs
-Microsoft.CSharp.RuntimeBinder/Extensions.cs
-Microsoft.CSharp.RuntimeBinder/RuntimeBinderContext.cs
-Microsoft.CSharp.RuntimeBinder/RuntimeBinderException.cs
-Microsoft.CSharp.RuntimeBinder/RuntimeBinderInternalCompilerException.cs
-Microsoft.CSharp.RuntimeBinder/CSharpBinder.cs
-Microsoft.CSharp.RuntimeBinder/ErrorPrinter.cs
+../../build/common/SR.cs
+../../build/common/Consts.cs
+
+corefx/SR.cs
+
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Binder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/BinderHelper.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpArgumentInfo.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpArgumentInfoFlags.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinaryOperationFlags.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpBinderFlags.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpCallFlags.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConversionKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpConvertBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetIndexBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpGetMemberBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeConstructorBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpInvokeMemberBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpIsEventBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetIndexBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpSetMemberBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/CSharpUnaryOperationBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Error.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CController.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CError.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CErrorFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/CParameterizedError.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorCode.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFacts.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorFmt.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/ErrorHandling.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/IErrorSink.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/MessageID.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Errors/UserStringBuilder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ExpressionTreeCallRewriter.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ICSharpInvokeOrInvokeMemberBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ResetBindException.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderController.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderException.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderExtensions.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/RuntimeBinderInternalCompilerException.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/Better.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Binding/ErrorReporting.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContextBase.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingContexts.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BindingFlag.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpArgInfo.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/BinOpSig.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/CandidateFunctionMember.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ConstVal.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ConstValFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversion.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Conversions.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/COperators.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/AggregateDeclaration.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/Declaration.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/GlobalAttributeDeclaration.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Declarations/NamespaceDeclaration.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExplicitConversion.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExpressionKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRFLAG.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FileRecord.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FundamentalTypes.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/InputFile.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ITypeOrNamespace.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookupResults.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MetadataToken.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodIterator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MethodTypeInferrer.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/NameGenerator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Nullable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/NullableLift.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Operators.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/OriginalExpressions.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedAttributes.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/PredefinedMembers.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SemanticChecker.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/SubstitutionContext.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AggregateSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/AssemblyQualifiedNamespaceSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/EventSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/FieldSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/IndexerSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/LabelSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/LocalVariableSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodOrPropertySymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MethodSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/MiscSymFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceOrAggregateSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/NamespaceSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/ParentSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/PropertySymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Scope.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/Symbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolLoader.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolManagerBase.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolMask.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymbolTable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/SymFactoryBase.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TransparentIdentifierMemberSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/TypeParameterSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/UnresolvedAggregateSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Symbols/VariableSymbol.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayIndex.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayInitialization.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ArrayLength.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Assignment.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BinaryOperator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Block.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/BoundAnonymousFunction.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Call.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Cast.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Class.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/CompoundOperator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Concatenate.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ConditionalOperator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Constant.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Event.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/EXPR.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ExpressionIterator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Field.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/FieldInfo.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/HoistedLocal.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/List.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/LocalVariable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MemberGroup.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodInfo.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/MethodReference.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/NamedArgumentSpecification.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Property.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/PropertyInfo.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/This.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOrNamespace.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnaryOperator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExprVisitorBase.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/ZeroInitialize.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/TypeBind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/AggregateType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArgumentListType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ArrayType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/BoundLambdaType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ErrorType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/MethodGroupType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullableType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/NullType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/OpenTypePlaceholderType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/ParameterModifierType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PointerType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/PredefinedTypes.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/Type.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeArray.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeFactory.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeKind.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeManager.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeParameterType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/TypeTable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Types/VoidType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UnaOpSig.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/UtilityTypeExtensions.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/WithType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SpecialNames.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/SymbolTable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/KnownName.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/NameManager.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/Names.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/NameTable.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/Operators.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedName.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/PredefinedType.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/TokenFacts.cs
+../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Syntax/TokenKind.cs
diff --git a/mcs/class/Microsoft.CSharp/corefx/SR.cs b/mcs/class/Microsoft.CSharp/corefx/SR.cs
new file mode 100644 (file)
index 0000000..c4b854b
--- /dev/null
@@ -0,0 +1,134 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string InternalCompilerError = "An unexpected exception occurred while binding a dynamic operation";
+       public const string BindRequireArguments = "Cannot bind call with no calling object";
+       public const string BindCallFailedOverloadResolution = "Overload resolution failed";
+       public const string BindBinaryOperatorRequireTwoArguments = "Binary operators must be invoked with two arguments";
+       public const string BindUnaryOperatorRequireOneArgument = "Unary operators must be invoked with one argument";
+       public const string BindPropertyFailedMethodGroup = "The name '{0}' is bound to a method and cannot be used like a property";
+       public const string BindPropertyFailedEvent = "The event '{0}' can only appear on the left hand side of +";
+       public const string BindInvokeFailedNonDelegate = "Cannot invoke a non-delegate type";
+       public const string BindImplicitConversionRequireOneArgument = "Implicit conversion takes exactly one argument";
+       public const string BindExplicitConversionRequireOneArgument = "Explicit conversion takes exactly one argument";
+       public const string BindBinaryAssignmentRequireTwoArguments = "Binary operators cannot be invoked with one argument";
+       public const string BindBinaryAssignmentFailedNullReference = "Cannot perform member assignment on a null reference";
+       public const string NullReferenceOnMemberException = "Cannot perform runtime binding on a null reference";
+       public const string BindCallToConditionalMethod = "Cannot dynamically invoke method '{0}' because it has a Conditional attribute";
+       public const string BindToVoidMethodButExpectResult = "Cannot implicitly convert type 'void' to 'object'";
+       public const string BadBinaryOps = "Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'";
+       public const string IntDivByZero = "Division by constant zero";
+       public const string BadIndexLHS = "Cannot apply indexing with [] to an expression of type '{0}'";
+       public const string BadIndexCount = "Wrong number of indices inside []; expected '{0}'";
+       public const string BadUnaryOp = "Operator '{0}' cannot be applied to operand of type '{1}'";
+       public const string NoImplicitConv = "Cannot implicitly convert type '{0}' to '{1}'";
+       public const string NoExplicitConv = "Cannot convert type '{0}' to '{1}'";
+       public const string ConstOutOfRange = "Constant value '{0}' cannot be converted to a '{1}'";
+       public const string AmbigBinaryOps = "Operator '{0}' is ambiguous on operands of type '{1}' and '{2}'";
+       public const string AmbigUnaryOp = "Operator '{0}' is ambiguous on an operand of type '{1}'";
+       public const string ValueCantBeNull = "Cannot convert null to '{0}' because it is a non-nullable value type";
+       public const string WrongNestedThis = "Cannot access a non-static member of outer type '{0}' via nested type '{1}'";
+       public const string NoSuchMember = "'{0}' does not contain a definition for '{1}'";
+       public const string ObjectRequired = "An object reference is required for the non-static field, method, or property '{0}'";
+       public const string AmbigCall = "The call is ambiguous between the following methods or properties: '{0}' and '{1}'";
+       public const string BadAccess = "'{0}' is inaccessible due to its protection level";
+       public const string MethDelegateMismatch = "No overload for '{0}' matches delegate '{1}'";
+       public const string AssgLvalueExpected = "The left-hand side of an assignment must be a variable, property or indexer";
+       public const string NoConstructors = "The type '{0}' has no constructors defined";
+       public const string BadDelegateConstructor = "The delegate '{0}' does not have a valid constructor";
+       public const string PropertyLacksGet = "The property or indexer '{0}' cannot be used in this context because it lacks the get accessor";
+       public const string ObjectProhibited = "Member '{0}' cannot be accessed with an instance reference; qualify it with a type name instead";
+       public const string AssgReadonly = "A readonly field cannot be assigned to (except in a constructor or a variable initializer)";
+       public const string RefReadonly = "A readonly field cannot be passed ref or out (except in a constructor)";
+       public const string AssgReadonlyStatic = "A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)";
+       public const string RefReadonlyStatic = "A static readonly field cannot be passed ref or out (except in a static constructor)";
+       public const string AssgReadonlyProp = "Property or indexer '{0}' cannot be assigned to -- it is read only";
+       public const string AbstractBaseCall = "Cannot call an abstract base member: '{0}'";
+       public const string RefProperty = "A property or indexer may not be passed as an out or ref parameter";
+       public const string ManagedAddr = "Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}')";
+       public const string FixedNotNeeded = "You cannot use the fixed statement to take the address of an already fixed expression";
+       public const string UnsafeNeeded = "Dynamic calls cannot be used in conjunction with pointers";
+       public const string BadBoolOp = "In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type as the type of its 2 parameters";
+       public const string MustHaveOpTF = "The type ('{0}') must contain declarations of operator true and operator false";
+       public const string CheckedOverflow = "The operation overflows at compile time in checked mode";
+       public const string ConstOutOfRangeChecked = "Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override)";
+       public const string AmbigMember = "Ambiguity between '{0}' and '{1}'";
+       public const string SizeofUnsafe = "'{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)";
+       public const string FieldInitRefNonstatic = "A field initializer cannot reference the non-static field, method, or property '{0}'";
+       public const string CallingFinalizeDepracated = "Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.";
+       public const string CallingBaseFinalizeDeprecated = "Do not directly call your base class Finalize method. It is called automatically from your destructor.";
+       public const string BadCastInFixed = "The right hand side of a fixed statement assignment may not be a cast expression";
+       public const string NoImplicitConvCast = "Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?)";
+       public const string InaccessibleGetter = "The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible";
+       public const string InaccessibleSetter = "The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible";
+       public const string BadArity = "Using the generic {1} '{0}' requires '{2}' type arguments";
+       public const string BadTypeArgument = "The type '{0}' may not be used as a type argument";
+       public const string TypeArgsNotAllowed = "The {1} '{0}' cannot be used with type arguments";
+       public const string HasNoTypeVars = "The non-generic {1} '{0}' cannot be used with type arguments";
+       public const string NewConstraintNotSatisfied = "'{2}' must be a non-abstract type with a public parameterless constructor in order to use it as parameter '{1}' in the generic type or method '{0}'";
+       public const string GenericConstraintNotSatisfiedRefType = "The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no implicit reference conversion from '{3}' to '{1}'.";
+       public const string GenericConstraintNotSatisfiedNullableEnum = "The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'.";
+       public const string GenericConstraintNotSatisfiedNullableInterface = "The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. The nullable type '{3}' does not satisfy the constraint of '{1}'. Nullable types can not satisfy any interface constraints.";
+       public const string GenericConstraintNotSatisfiedTyVar = "The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion or type parameter conversion from '{3}' to '{1}'.";
+       public const string GenericConstraintNotSatisfiedValType = "The type '{3}' cannot be used as type parameter '{2}' in the generic type or method '{0}'. There is no boxing conversion from '{3}' to '{1}'.";
+       public const string TypeVarCantBeNull = "Cannot convert null to type parameter '{0}' because it could be a non-nullable value type. Consider using 'default({0})' instead.";
+       public const string BadRetType = "'{1} {0}' has the wrong return type";
+       public const string CantInferMethTypeArgs = "The type arguments for method '{0}' cannot be inferred from the usage. Try specifying the type arguments explicitly.";
+       public const string MethGrpToNonDel = "Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method?";
+       public const string RefConstraintNotSatisfied = "The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}'";
+       public const string ValConstraintNotSatisfied = "The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}'";
+       public const string CircularConstraint = "Circular constraint dependency involving '{0}' and '{1}'";
+       public const string BaseConstraintConflict = "Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'";
+       public const string ConWithValCon = "Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}'";
+       public const string AmbigUDConv = "Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}'";
+       public const string PredefinedTypeNotFound = "Predefined type '{0}' is not defined or imported";
+       public const string PredefinedTypeBadType = "Predefined type '{0}' is declared incorrectly";
+       public const string BindToBogus = "'{0}' is not supported by the language";
+       public const string CantCallSpecialMethod = "'{0}': cannot explicitly call operator or accessor";
+       public const string BogusType = "'{0}' is a type not supported by the language";
+       public const string MissingPredefinedMember = "Missing compiler required member '{0}.{1}'";
+       public const string LiteralDoubleCast = "Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type";
+       public const string UnifyingInterfaceInstantiations = "'{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions";
+       public const string ConvertToStaticClass = "Cannot convert to static type '{0}'";
+       public const string GenericArgIsStaticClass = "'{0}': static types cannot be used as type arguments";
+       public const string PartialMethodToDelegate = "Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration";
+       public const string IncrementLvalueExpected = "The operand of an increment or decrement operator must be a variable, property or indexer";
+       public const string NoSuchMemberOrExtension = "'{0}' does not contain a definition for '{1}' and no extension method '{1}' accepting a first argument of type '{0}' could be found (are you missing a using directive or an assembly reference?)";
+       public const string ValueTypeExtDelegate = "Extension methods '{0}' defined on value type '{1}' cannot be used to create delegates";
+       public const string BadArgCount = "No overload for method '{0}' takes '{1}' arguments";
+       public const string BadArgTypes = "The best overloaded method match for '{0}' has some invalid arguments";
+       public const string BadArgType = "Argument '{0}': cannot convert from '{1}' to '{2}'";
+       public const string RefLvalueExpected = "A ref or out argument must be an assignable variable";
+       public const string BadProtectedAccess = "Cannot access protected member '{0}' via a qualifier of type '{1}'; the qualifier must be of type '{2}' (or derived from it)";
+       public const string BindToBogusProp2 = "Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor methods '{1}' or '{2}'";
+       public const string BindToBogusProp1 = "Property, indexer, or event '{0}' is not supported by the language; try directly calling accessor method '{1}'";
+       public const string BadDelArgCount = "Delegate '{0}' does not take '{1}' arguments";
+       public const string BadDelArgTypes = "Delegate '{0}' has some invalid arguments";
+       public const string AssgReadonlyLocal = "Cannot assign to '{0}' because it is read-only";
+       public const string RefReadonlyLocal = "Cannot pass '{0}' as a ref or out argument because it is read-only";
+       public const string ReturnNotLValue = "Cannot modify the return value of '{0}' because it is not a variable";
+       public const string BadArgExtraRef = "Argument '{0}' should not be passed with the '{1}' keyword";
+       public const string BadArgRef = "Argument '{0}' must be passed with the '{1}' keyword";
+       public const string AssgReadonly2 = "Members of readonly field '{0}' cannot be modified (except in a constructor or a variable initializer)";
+       public const string RefReadonly2 = "Members of readonly field '{0}' cannot be passed ref or out (except in a constructor)";
+       public const string AssgReadonlyStatic2 = "Fields of static readonly field '{0}' cannot be assigned to (except in a static constructor or a variable initializer)";
+       public const string RefReadonlyStatic2 = "Fields of static readonly field '{0}' cannot be passed ref or out (except in a static constructor)";
+       public const string AssgReadonlyLocalCause = "Cannot assign to '{0}' because it is a '{1}'";
+       public const string RefReadonlyLocalCause = "Cannot pass '{0}' as a ref or out argument because it is a '{1}'";
+       public const string ThisStructNotInAnonMeth = "Anonymous methods, lambda expressions, and query expressions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression or query expression and using the local instead.";
+       public const string DelegateOnNullable = "Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>'";
+       public const string BadCtorArgCount = "'{0}' does not contain a constructor that takes '{1}' arguments";
+       public const string BadExtensionArgTypes = "'{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments";
+       public const string BadInstanceArgType = "Instance argument: cannot convert from '{0}' to '{1}'";
+       public const string BadArgTypesForCollectionAdd = "The best overloaded Add method '{0}' for the collection initializer has some invalid arguments";
+       public const string InitializerAddHasParamModifiers = "The best overloaded method match '{0}' for the collection initializer element cannot be used. Collection initializer 'Add' methods cannot have ref or out parameters.";
+       public const string NonInvocableMemberCalled = "Non-invocable member '{0}' cannot be used like a method.";
+       public const string NamedArgumentSpecificationBeforeFixedArgument = "Named argument specifications must appear after all fixed arguments have been specified";
+       public const string BadNamedArgument = "The best overload for '{0}' does not have a parameter named '{1}'";
+       public const string BadNamedArgumentForDelegateInvoke = "The delegate '{0}' does not have a parameter named '{1}'";
+       public const string DuplicateNamedArgument = "Named argument '{0}' cannot be specified multiple times";
+       public const string NamedArgumentUsedInPositional = "Named argument '{0}' specifies a parameter for which a positional argument has already been given";
+}
index eaec4ddcd40395077c61ecfdfeba017c20e532b6..bcf9c8dc840837d91b897beb213bcc4e2b3e9ee0 100644 (file)
     <Compile Include="..\..\mcs\typespec.cs" />\r
     <Compile Include="..\..\mcs\visit.cs" />\r
     <Compile Include="..\..\tools\monop\outline.cs" />\r
+    <Compile Include="aot.cs" />\r
     <Compile Include="Assembly\AssemblyInfo.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
index 0bbd93782bad9ef8544de3ababc6b5860cc69dcb..2bd1a5a5f4197764209bc897f79422b68546c904 100644 (file)
@@ -1,3 +1,5 @@
+Assembly/AssemblyInfo.cs
+aot.cs
 ../../mcs/anonymous.cs
 ../../mcs/argument.cs
 ../../mcs/assign.cs
@@ -55,4 +57,3 @@
 ../../build/common/Consts.cs
 ../../tools/monop/outline.cs
 ../../mcs/cs-parser.cs
-Assembly/AssemblyInfo.cs
diff --git a/mcs/class/Mono.CSharp/aot.cs b/mcs/class/Mono.CSharp/aot.cs
new file mode 100644 (file)
index 0000000..844d761
--- /dev/null
@@ -0,0 +1,105 @@
+//
+// aot.cs: AOT System.Reflection.Emit extensions to simplify mcs compilation
+//
+// Authors:
+//     Marek Safar  <marek.safar@gmail.com>
+//
+// Copyright (C) 2014 Xamarin Inc (http://www.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.
+//
+
+#if FULL_AOT_RUNTIME
+
+namespace System.Reflection.Emit
+{
+       static class AssemblyBuilderExtensions
+       {
+               public static void AddResourceFile (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static ModuleBuilder DefineDynamicModule (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static void DefineVersionInfoResource (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static void DefineUnmanagedResource (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static void Save (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static void SetEntryPoint (this AssemblyBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+       }
+
+       static class ConstructorBuilderExtensions
+       {
+               public static void AddDeclarativeSecurity (this ConstructorBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+       }
+
+       static class MethodBuilderExtensions
+       {
+               public static void AddDeclarativeSecurity (this MethodBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+       }
+
+       static class ModuleBuilderExtensions
+       {
+               public static void DefineManifestResource (this ModuleBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+       }
+
+       static class TypeBuilderExtensions
+       {
+               public static void AddDeclarativeSecurity (this TypeBuilder builder, params object[] args)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public static Type CreateType (this TypeBuilder builder)
+               {
+                       throw new NotSupportedException ();
+               }
+       }
+}
+#endif
diff --git a/mcs/class/Mono.CSharp/monotouch.cs b/mcs/class/Mono.CSharp/monotouch.cs
deleted file mode 100644 (file)
index 06feb3c..0000000
+++ /dev/null
@@ -1,824 +0,0 @@
-//
-// monotouch.cs: iOS System.Reflection.Emit API needed to simplify mcs compilation
-//
-// Authors:
-//     Marek Safar  <marek.safar@gmail.com>
-//
-// Copyright (C) 2014 Xamarin Inc (http://www.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 System.Reflection.Emit
-{
-       public class TypeBuilder : Type
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of Type
-
-               public override Type GetInterface (string name, bool ignoreCase)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type[] GetInterfaces ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type GetElementType ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override EventInfo[] GetEvents (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo GetField (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldInfo[] GetFields (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MemberInfo[] GetMembers (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MethodInfo[] GetMethods (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type GetNestedType (string name, BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type[] GetNestedTypes (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override PropertyInfo[] GetProperties (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override TypeAttributes GetAttributeFlagsImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool HasElementTypeImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsArrayImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsByRefImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsCOMObjectImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsPointerImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               protected override bool IsPrimitiveImpl ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Assembly Assembly {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string AssemblyQualifiedName {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type BaseType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string FullName {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Guid GUID {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Module Module {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Namespace {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type UnderlyingSystemType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public void AddInterfaceImplementation (Type interfaceType)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void AddDeclarativeSecurity (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }       
-
-               public void SetParent (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public Type CreateType()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ConstructorBuilder DefineConstructor (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public MethodBuilder DefineMethod (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public TypeBuilder DefineNestedType (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public PropertyBuilder DefineProperty (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public EventBuilder DefineEvent (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public FieldBuilder DefineField (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public MethodBuilder DefineMethodOverride (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public static ConstructorInfo GetConstructor (Type type, ConstructorInfo constructor)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public static FieldInfo GetField (Type type, FieldInfo field)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public static MethodInfo GetMethod (Type type, MethodInfo method)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class MethodBuilder : MethodBase
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type DeclaringType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override MemberTypes MemberType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type ReflectedType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of MethodBase
-
-               public override MethodImplAttributes GetMethodImplementationFlags ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ParameterInfo[] GetParameters ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, System.Globalization.CultureInfo culture)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override RuntimeMethodHandle MethodHandle {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override MethodAttributes Attributes {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public void AddDeclarativeSecurity (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ParameterBuilder DefineParameter (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public MethodToken GetToken()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ILGenerator GetILGenerator ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetImplementationFlags (MethodImplAttributes attributes)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetParameters (params Type[] parameterTypes)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetReturnType (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class AssemblyBuilder : Assembly
-       {
-               public void AddResourceFile (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void DefineVersionInfoResource (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ModuleBuilder DefineDynamicModule (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void DefineUnmanagedResource (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void Save (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetEntryPoint (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class ConstructorBuilder : MethodBase
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type DeclaringType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override MemberTypes MemberType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type ReflectedType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of MethodBase
-
-               public override MethodImplAttributes GetMethodImplementationFlags ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ParameterInfo[] GetParameters ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, System.Globalization.CultureInfo culture)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override RuntimeMethodHandle MethodHandle {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override MethodAttributes Attributes {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public void AddDeclarativeSecurity (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ParameterBuilder DefineParameter (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }               
-
-               public MethodToken GetToken()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public ILGenerator GetILGenerator ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetImplementationFlags (MethodImplAttributes attributes)
-               {
-                       throw new NotSupportedException ();
-               }       
-       }
-
-       public class ModuleBuilder : Module
-       {
-               public void DefineManifestResource (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public TypeBuilder DefineType (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public MethodToken GetToken()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public MethodInfo GetArrayMethod (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class PropertyBuilder : PropertyInfo
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type DeclaringType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type ReflectedType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of PropertyInfo
-
-               public override MethodInfo[] GetAccessors (bool nonPublic)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MethodInfo GetGetMethod (bool nonPublic)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override ParameterInfo[] GetIndexParameters ()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override MethodInfo GetSetMethod (bool nonPublic)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object GetValue (object obj, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override PropertyAttributes Attributes {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override bool CanRead {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override bool CanWrite {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type PropertyType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public MethodToken GetToken()
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetGetMethod (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetSetMethod (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class FieldBuilder : FieldInfo
-       {
-               #region implemented abstract members of MemberInfo
-
-               public override bool IsDefined (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override object[] GetCustomAttributes (Type attributeType, bool inherit)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override Type DeclaringType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override string Name {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type ReflectedType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               #region implemented abstract members of FieldInfo
-
-               public override object GetValue (object obj)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, System.Globalization.CultureInfo culture)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public override FieldAttributes Attributes {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override RuntimeFieldHandle FieldHandle {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               public override Type FieldType {
-                       get {
-                               throw new NotSupportedException ();
-                       }
-               }
-
-               #endregion
-
-               public void SetConstant (object arg)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-       public class EventBuilder
-       {
-               public void SetAddOnMethod (MethodBuilder mdBuilder)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetRemoveOnMethod (MethodBuilder mdBuilder)
-               {
-                       throw new NotSupportedException ();
-               }
-
-               public void SetCustomAttribute (params object[] args)
-               {
-                       throw new NotSupportedException ();
-               }
-       }
-
-}
\ No newline at end of file
diff --git a/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 083e61a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include testing_aot_full_Mono.CSharp.dll.sources
diff --git a/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 083e61a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include testing_aot_full_Mono.CSharp.dll.sources
diff --git a/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 083e61a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include testing_aot_full_Mono.CSharp.dll.sources
diff --git a/mcs/class/Mono.CSharp/orbis_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/orbis_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 394cd48..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include monotouch_Mono.CSharp.dll.sources
diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 4c30fc6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#include Mono.CSharp.dll.sources
-../corlib/System.Reflection.Emit/PEFileKinds.cs
-../corlib/System.Reflection.Emit/MethodToken.cs
-monotouch.cs
diff --git a/mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources
deleted file mode 100644 (file)
index 4c30fc6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#include Mono.CSharp.dll.sources
-../corlib/System.Reflection.Emit/PEFileKinds.cs
-../corlib/System.Reflection.Emit/MethodToken.cs
-monotouch.cs
index 45b2db176875cbf3a4dc9fc0811ae180b64a71d3..cff394bbcfa5666c232901f8914095c780de5744 100644 (file)
@@ -221,7 +221,7 @@ namespace Mono.Data.Sqlite
         case SQLiteDateFormats.UnixEpoch:\r
           return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString();\r
         default:\r
-          return dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture);\r
+          return dateValue.ToString(_datetimeFormats[19], CultureInfo.InvariantCulture);\r
       }\r
     }\r
 \r
index 15339454b8246054c6e0e5e751c86ca98e2ce0d9..969346d0fd454cc4d3e6f1371d03776d4f0a5009 100644 (file)
@@ -63,6 +63,38 @@ namespace MonoTests.Mono.Data.Sqlite
                        }
                }
 
+               [Test]
+               public void DateTimeConvert_UTC ()
+               {
+                       using (var connection = new SqliteConnection ($"Data Source={_databasePath};DateTimeKind=Utc")) {
+                               connection.Open ();
+
+                               using (var cmd = connection.CreateCommand ()) {
+                                       cmd.CommandText = "CREATE TABLE OnlyDates (Date1 DATETIME)";
+                                       cmd.CommandType = CommandType.Text;
+                                       cmd.ExecuteNonQuery();
+                               }
+
+                               var datetest = DateTime.UtcNow;
+
+                               var sqlInsert = "INSERT INTO TestTable (ID, Modified) VALUES (@id, @mod)";
+                               using (var cmd = connection.CreateCommand ()) {
+                                       cmd.CommandText = $"INSERT INTO OnlyDates (Date1) VALUES (@param1);";
+                                       cmd.CommandType = CommandType.Text;
+                                       cmd.Parameters.AddWithValue ("@param1", datetest);
+                                       cmd.ExecuteNonQuery();
+                               }
+
+                               using (var cmd = connection.CreateCommand ()) {
+                                       cmd.CommandText = $"SELECT Date1 FROM OnlyDates;";
+                                       cmd.CommandType = CommandType.Text;
+                                       object objRetrieved = cmd.ExecuteScalar ();
+                                       var dateRetrieved = Convert.ToDateTime (objRetrieved);
+                                       Assert.AreEqual (DateTimeKind.Unspecified, dateRetrieved.Kind);
+                               }
+                       }
+               }
+
                [Test]
                public void DateTimeConvert ()
                {
index efebe9ad5a9acc314ec75efbb1ffda5a9fb1ba7f..421c04da2bfd3b360a1fd5f2c9b17adfde0b221e 100644 (file)
@@ -134,7 +134,7 @@ testing.
                                        code ();
                                }
 
-               * Avoid using unecessary open/close braces, vertical space
+               * Avoid using unnecessary open/close braces, vertical space
                  is usually limited:
 
                        good:
index fac304161e6addedd37c2bc419987e84fdc324dd..19cd7e6be5df1d47f777be791aff7bdd0971a375 100644 (file)
@@ -90,7 +90,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\DelegateHelpers.netstandard.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\HoistedLocals.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\ILGen.cs" />\r
-    <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\KeyedQueue.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\KeyedStack.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\LabelInfo.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Linq.Expressions\src\System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs" />\r
index 7336284054710a8c125652ea245673b3e70a1aba..27d916c49d552f573fbea9fbcaf3835ea125e6b9 100644 (file)
@@ -13,7 +13,7 @@
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/CompilerScope.Storage.cs
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/CompilerScope.cs
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs
-../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/KeyedQueue.cs
+../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/KeyedStack.cs
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LabelInfo.cs
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs
 ../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Binary.cs
index b257d924a0a0e65f60022a80bd5b2d90718f5f1e..b50eb0df32b76be53421a064e605950032eb5de2 100644 (file)
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbCommand.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DBCommandBuilder.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbConnection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbConnectionPoolKey.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbConnectionStringBuilder.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbDataAdapter.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbDataReader.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbDataReaderExtensions.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbDataRecord.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbDataSourceEnumerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbEnumerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbMetaDataColumnNames.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbParameter.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbParameterCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbProviderFactory.CreatePermission.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbProviderFactory.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbProviderSpecificTypePropertyAttribute.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DBSchemaRow.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DBSchemaTable.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DbTransaction.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DecimalStorage.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\DoubleStorage.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\FieldNameLookup.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\Groupbybehavior.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\IDbColumnSchemaGenerator.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\identifiercase.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\Int16Storage.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\Int32Storage.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\Int64Storage.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\MultipartIdentifier.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\NameValuePair.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\ObjectStorage.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\RowUpdatedEventArgs.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\Common\RowUpdatingEventArgs.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\StatementCompletedEventArgs.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\StatementCompletedEventHandler.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\StatementType.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\StrongTypingException.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\UniqueConstraint.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\UpdateRowSource.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Data\updatestatus.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Xml\XmlDataDocument.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Xml\XmlDataImplementation.cs" />\r
     <Compile Include="..\..\..\external\corefx\src\System.Data.Common\src\System\Xml\XPathNodePointer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\Common\ActivityCorrelator.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\OperationAbortedException.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPoolGroupProviderInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbConnectionPoolProviderInfo.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\DbReferenceCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\ProviderBase\TimeoutTimer.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\ApplicationIntent.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlError.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlErrorCollection.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Data.SqlClient\src\System\Data\SqlClient\SqlInfoMessageEvent.cs" />\r
+    <Compile Include="..\..\..\external\corefx\src\System.Private.Xml\src\Misc\HResults.cs" />\r
     <Compile Include="..\..\build\common\AssemblyRef.cs" />\r
     <Compile Include="..\..\build\common\Consts.cs" />\r
     <Compile Include="..\..\build\common\Locale.cs" />\r
     <Compile Include="..\referencesource\System.Data\bid\inc\cs\bidPrivateBase.cs" />\r
     <Compile Include="..\referencesource\System.Data\Microsoft\SqlServer\Server\SqlTriggerContext.cs" />\r
     <Compile Include="..\referencesource\System.Data\Misc\ExternDll.cs" />\r
-    <Compile Include="..\referencesource\System.Data\Misc\HResults.cs" />\r
     <Compile Include="..\referencesource\System.Data\Misc\PrivilegedConfigurationManager.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\CodeGen\datacache.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\CodeGen\StrongTypingException.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\ActivityCorrelator.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\AdapterUtil.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DbConnectionOptions.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\DbConnectionPoolKey.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DBConnectionString.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\DbConnectionStringBuilder.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DbConnectionStringCommon.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DBDataPermission.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DBDataPermissionAttribute.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\DbDataReader.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DbProviderConfigurationHandler.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DbProviderFactories.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\DbProviderFactoriesConfigurationHandler.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\DbProviderFactory.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\FieldNameLookup.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\GreenMethods.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\HandlerBase.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\MultipartIdentifier.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\Common\NameValuePair.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\NameValuePermission.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\NativeMethods.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Common\SafeNativeMethods.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\OleDb\PropertyInfoSet.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\OleDb\RowBinding.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\OleDb\SafeHandles.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\OperationAbortedException.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbBuffer.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionClosed.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionFactory.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolAuthenticationContextKey.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolCounters.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolGroup.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolGroupProviderInfo.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolIdentity.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolOptions.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbConnectionPoolProviderInfo.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbMetaDataFactory.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\DbReferenceCollection.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\TimeoutTimer.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\ProviderBase\WrappedIUnknown.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Sql\IBinarySerialize.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Sql\invalidudtexception.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Sql\SqlUserDefinedAggregateAttribute.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Sql\SqlUserDefinedTypeAttribute.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\Sql\TriggerAction.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\ApplicationIntent.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\LocalDBAPI.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlClientEncryptionType.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlClientPermission.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlConnectionString.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlConnectionStringBuilder.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlError.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlErrorCollection.cs" />\r
-    <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlInfoMessageEvent.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\SqlUtil.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\TdsEnums.cs" />\r
     <Compile Include="..\referencesource\System.Data\System\Data\SqlClient\TdsParserStaticMethods.cs" />\r
index 4ef6dc6b9c06702aed2719548535246b91ec3a26..24f91f3bef67b61465ba24629462d3c5ddb49ee7 100644 (file)
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbCommand.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DBCommandBuilder.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnection.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnectionPoolKey.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataReader.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataReaderExtensions.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataRecord.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbDataSourceEnumerator.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbEnumerator.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbMetaDataColumnNames.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbParameter.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbParameterCollection.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbProviderFactory.CreatePermission.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbProviderFactory.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbProviderSpecificTypePropertyAttribute.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DBSchemaRow.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DBSchemaTable.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DbTransaction.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DecimalStorage.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/DoubleStorage.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/FieldNameLookup.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Groupbybehavior.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/IDbColumnSchemaGenerator.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/identifiercase.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int16Storage.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int32Storage.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/Int64Storage.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/MultipartIdentifier.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/Common/NameValuePair.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/ObjectStorage.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/RowUpdatedEventArgs.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/Common/RowUpdatingEventArgs.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/StatementCompletedEventArgs.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/StatementCompletedEventHandler.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/StatementType.cs
+../../../external/corefx/src/System.Data.Common/src/System/Data/StrongTypingException.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/UniqueConstraint.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/UpdateRowSource.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Data/updatestatus.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Xml/RegionIterator.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Xml/TreeIterator.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Xml/XmlBoundElement.cs
+../../../external/corefx/src/System.Data.Common/src/System/Xml/XmlDataDocument.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Xml/XmlDataImplementation.cs
 ../../../external/corefx/src/System.Data.Common/src/System/Xml/XPathNodePointer.cs
-../../../external/corefx/src/System.Data.Common/src/System/Xml/XmlDataDocument.cs
-
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/Common/ActivityCorrelator.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/OperationAbortedException.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolProviderInfo.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbReferenceCollection.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/TimeoutTimer.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/ApplicationIntent.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlError.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlErrorCollection.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInfoMessageEvent.cs
+../../../external/corefx/src/System.Private.Xml/src/Misc/HResults.cs
 ../referencesource/System.Data/Microsoft/SqlServer/Server/SqlTriggerContext.cs
 ../referencesource/System.Data/Misc/ExternDll.cs
-../referencesource/System.Data/Misc/HResults.cs
 ../referencesource/System.Data/System/Data/CodeGen/StrongTypingException.cs
-../referencesource/System.Data/System/Data/Common/ActivityCorrelator.cs
 ../referencesource/System.Data/System/Data/Common/AdapterUtil.cs
 ../referencesource/System.Data/System/Data/Common/DbConnectionOptions.cs
-../referencesource/System.Data/System/Data/Common/DbConnectionPoolKey.cs
 ../referencesource/System.Data/System/Data/Common/DBConnectionString.cs
-../referencesource/System.Data/System/Data/Common/DbConnectionStringBuilder.cs
 ../referencesource/System.Data/System/Data/Common/DbConnectionStringCommon.cs
 ../referencesource/System.Data/System/Data/Common/DBDataPermission.cs
 ../referencesource/System.Data/System/Data/Common/DBDataPermissionAttribute.cs
-../referencesource/System.Data/System/Data/Common/DbDataReader.cs
-../referencesource/System.Data/System/Data/Common/DbProviderFactory.cs
-../referencesource/System.Data/System/Data/Common/FieldNameLookup.cs
 ../referencesource/System.Data/System/Data/Common/GreenMethods.cs
-../referencesource/System.Data/System/Data/Common/MultipartIdentifier.cs
-../referencesource/System.Data/System/Data/Common/NameValuePair.cs
 ../referencesource/System.Data/System/Data/Common/NameValuePermission.cs
 ../referencesource/System.Data/System/Data/Common/SQLTypes/SqlXmlStorage.cs
+../referencesource/System.Data/System/Data/DataSet.cs
 ../referencesource/System.Data/System/Data/OleDb/OleDbType.cs
 ../referencesource/System.Data/System/Data/OleDb/PropertyAttributes.cs
-../referencesource/System.Data/System/Data/OperationAbortedException.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolAuthenticationContext.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolAuthenticationContextKey.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolOptions.cs
-../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolProviderInfo.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbMetaDataFactory.cs
-../referencesource/System.Data/System/Data/ProviderBase/DbReferenceCollection.cs
-../referencesource/System.Data/System/Data/ProviderBase/TimeoutTimer.cs
 ../referencesource/System.Data/System/Data/ProviderBase/WrappedIUnknown.cs
 ../referencesource/System.Data/System/Data/Sql/IBinarySerialize.cs
 ../referencesource/System.Data/System/Data/Sql/invalidudtexception.cs
 ../referencesource/System.Data/System/Data/Sql/SqlUserDefinedAggregateAttribute.cs
 ../referencesource/System.Data/System/Data/Sql/SqlUserDefinedTypeAttribute.cs
 ../referencesource/System.Data/System/Data/Sql/TriggerAction.cs
-../referencesource/System.Data/System/Data/SqlClient/ApplicationIntent.cs
 ../referencesource/System.Data/System/Data/SqlClient/LocalDBAPI.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlClientEncryptionType.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlClientPermission.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlConnectionString.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlConnectionStringBuilder.cs
-../referencesource/System.Data/System/Data/SqlClient/SqlError.cs
-../referencesource/System.Data/System/Data/SqlClient/SqlErrorCollection.cs
-../referencesource/System.Data/System/Data/SqlClient/SqlInfoMessageEvent.cs
 ../referencesource/System.Data/System/Data/SqlClient/SqlUtil.cs
 ../referencesource/System.Data/System/Data/SqlClient/TdsEnums.cs
-../referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs
-../referencesource/System.Data/System/Data/DataSet.cs
\ No newline at end of file
+../referencesource/System.Data/System/Data/SqlClient/TdsParserStaticMethods.cs
\ No newline at end of file
index fd236c73f6b9f058f6891a15cee7ccfc8960a7cf..4977214850bd9c481c04f58cc818691a9bc1bb9b 100644 (file)
@@ -160,7 +160,7 @@ System.Data.Common/DbConnectionStringBuilderHelper.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolCounters.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPool.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs
-../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroupProviderInfo.cs
+../../../external/corefx/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPoolGroupProviderInfo.cs
 ../referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
 # ../referencesource/System.Data/System/Data/ProviderBase/DbParameterCollectionHelper.cs
 # ../referencesource/System.Data/System/Data/ProviderBase/DbParameterHelper.cs
diff --git a/mcs/class/System.Numerics.Vectors/SR.cs b/mcs/class/System.Numerics.Vectors/SR.cs
deleted file mode 100644 (file)
index 6c04e22..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// This file was generated by resx2sr tool
-//
-
-partial class SR
-{
-       public const string Arg_ArgumentOutOfRangeException = "Index was out of bounds:";
-       public const string Arg_ElementsInSourceIsGreaterThanDestination = "Number of elements in source vector is greater than the destination array";
-       public const string Arg_MultiDimArrayNotSupported = "Only one-dimensional arrays are supported";
-       public const string Arg_NullArgumentNullRef = "The method was called with a null array argument.";
-       public const string Arg_RegisterLengthOfRangeException = "length must be less than";
-       public const string Arg_TypeNotSupported = "Specified type is not supported";
-       public const string Reflection_MethodNotSupported = "Vector<T>.Count cannot be called via reflection when intrinsics are enabled.";
-}
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 a5f261e85ca657317de65d24332b724e836b28b6..74524d655fd6ff961b88a57caeb632be687a868b 100644 (file)
@@ -2,11 +2,11 @@
 ../../build/common/SR.cs
 Assembly/AssemblyInfo.cs
 Assembly/TypeForwarders.cs
-SR.cs
+corefx/SR.cs
 
 ../../../external/corefx/src/Common/src/System/Numerics/Hashing/HashHelpers.cs
 ../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/ConstantHelper.cs
-../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics//JitIntrinsicAttribute.cs
-../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics//Register.cs
-../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics//Vector_Operations.cs
-../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics//Vector.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/JitIntrinsicAttribute.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Register.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector_Operations.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector.cs
diff --git a/mcs/class/System.Numerics.Vectors/corefx/SR.cs b/mcs/class/System.Numerics.Vectors/corefx/SR.cs
new file mode 100644 (file)
index 0000000..def5b09
--- /dev/null
@@ -0,0 +1,11 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string Arg_ArgumentOutOfRangeException = "Index was out of bounds:";
+       public const string Arg_ElementsInSourceIsGreaterThanDestination = "Number of elements in source vector is greater than the destination array";
+       public const string Arg_NullArgumentNullRef = "The method was called with a null array argument.";
+       public const string Arg_TypeNotSupported = "Specified type is not supported";
+}
index bc470e1b6e77c43d72f201970bbb3b488f6c8ab3..19d1e56a543b4ee70e00fe383e04279dc8dd0da3 100644 (file)
@@ -4,10 +4,12 @@ include ../../build/rules.make
 
 LIBRARY = System.Numerics.dll
 LIB_REFS = System
-LIB_MCS_FLAGS = /unsafe -nowarn:414 -nowarn:436
+LIB_MCS_FLAGS = /unsafe
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
-TXT_RESOURCE_STRINGS = ../referencesource/System.Numerics/System.Numerics.txt
+RESX_RESOURCE_STRING = \
+       ../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx \
+       ../../../external/corefx/src/System.Numerics.Vectors/src/Resources/Strings.resx
 
 EXTRA_DISTFILES =
 
diff --git a/mcs/class/System.Numerics/ReferenceSources/SR.cs b/mcs/class/System.Numerics/ReferenceSources/SR.cs
deleted file mode 100644 (file)
index 3b4d7bd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// This file was generated by txt2sr tool
-//
-
-partial class SR
-{
-       public const string Argument_InvalidNumberStyles = "An undefined NumberStyles value is being used.";
-       public const string Argument_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 Argument_MustBeBigInt = "The parameter must be a BigInteger.";
-       public const string Format_InvalidFormatSpecifier = "Format specifier was invalid.";
-       public const string Format_TooLarge = "The value is too large to be represented by this format specifier.";
-       public const string ArgumentOutOfRange_MustBeNonNeg = "The number must be greater than or equal to zero.";
-       public const string Overflow_BigIntInfinity = "BigInteger cannot represent infinity.";
-       public const string Overflow_NotANumber = "The value is not a number.";
-       public const string Overflow_ParseBigInteger = "The value could not be parsed.";
-       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_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 Overflow_Decimal = "Value was either too large or too small for a Decimal.";
-}
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 9d03ee139172caa2c596fbed4e193c308134f950..1e56c801e93eb413f4a195e33b821d990f065615 100644 (file)
@@ -1,21 +1,34 @@
+../../build/common/Consts.cs
 ../../build/common/SR.cs
 Assembly/AssemblyInfo.cs
-ReferenceSources/SR.cs
-../referencesource/System.Numerics/System/Numerics/BigInteger.cs
-../referencesource/System.Numerics/System/Numerics/BigIntegerBuilder.cs
-../referencesource/System.Numerics/System/Numerics/BigNumber.cs
-../referencesource/System.Numerics/System/Numerics/Complex.cs
-../referencesource/System.Numerics/System/Numerics/NumericsHelpers.cs
-../referencesource/System.Numerics/System/Numerics/HashCodeHelper.cs
-../referencesource/System.Numerics/System/Numerics/JITIntrinsicAttribute.cs
-../referencesource/System.Numerics/System/Numerics/Matrix3x2.cs
-../referencesource/System.Numerics/System/Numerics/Matrix4x4.cs
-../referencesource/System.Numerics/System/Numerics/Plane.cs
-../referencesource/System.Numerics/System/Numerics/Quaternion.cs
-../referencesource/System.Numerics/System/Numerics/Vector2.cs
-../referencesource/System.Numerics/System/Numerics/Vector2_Intrinsics.cs
-../referencesource/System.Numerics/System/Numerics/Vector3.cs
-../referencesource/System.Numerics/System/Numerics/Vector3_Intrinsics.cs
-../referencesource/System.Numerics/System/Numerics/Vector4.cs
-../referencesource/System.Numerics/System/Numerics/Vector4_Intrinsics.cs
-../referencesource/System.Numerics/System/Numerics/Vector_Operations.cs
+corefx/SR.cs
+corefx/Vector.cs
+
+../../../external/corefx/src/Common/src/System/Globalization/FormatProvider.Number.cs
+../../../external/corefx/src/Common/src/System/Numerics/Hashing/HashHelpers.cs
+
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.BigInteger.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Globalization/FormatProvider.NumberBuffer.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.AddSub.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.BitsBuffer.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.DivRem.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.FastReducer.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.GcdInv.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.PowMod.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.SquMul.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/BigNumber.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/Complex.cs
+../../../external/corefx/src/System.Runtime.Numerics/src/System/Numerics/NumericsHelpers.cs
+
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/JitIntrinsicAttribute.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Matrix3x2.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Matrix4x4.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Plane.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Quaternion.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector2.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector2_Intrinsics.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector3.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector3_Intrinsics.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector4.cs
+../../../external/corefx/src/System.Numerics.Vectors/src/System/Numerics/Vector4_Intrinsics.cs
diff --git a/mcs/class/System.Numerics/corefx/SR.cs b/mcs/class/System.Numerics/corefx/SR.cs
new file mode 100644 (file)
index 0000000..e4590b7
--- /dev/null
@@ -0,0 +1,25 @@
+//
+// This file was generated by resx2sr tool
+//
+
+partial class SR
+{
+       public const string Argument_BadFormatSpecifier = "Format specifier was invalid.";
+       public const string Argument_InvalidNumberStyles = "An undefined NumberStyles value is being used.";
+       public const string Argument_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 Argument_MustBeBigInt = "The parameter must be a BigInteger.";
+       public const string Format_TooLarge = "The value is too large to be represented by this format specifier.";
+       public const string ArgumentOutOfRange_MustBeNonNeg = "The number must be greater than or equal to zero.";
+       public const string Overflow_BigIntInfinity = "BigInteger cannot represent infinity.";
+       public const string Overflow_NotANumber = "The value is not a number.";
+       public const string Overflow_ParseBigInteger = "The value could not be parsed.";
+       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_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 Overflow_Decimal = "Value was either too large or too small for a Decimal.";
+       public const string Arg_ArgumentOutOfRangeException = "Index was out of bounds:";
+       public const string Arg_ElementsInSourceIsGreaterThanDestination = "Number of elements in source vector is greater than the destination array";
+       public const string Arg_NullArgumentNullRef = "The method was called with a null array argument.";
+       public const string Arg_TypeNotSupported = "Specified type is not supported";
+}
diff --git a/mcs/class/System.Numerics/corefx/Vector.cs b/mcs/class/System.Numerics/corefx/Vector.cs
new file mode 100644 (file)
index 0000000..de085ba
--- /dev/null
@@ -0,0 +1,12 @@
+namespace System.Numerics
+{
+       static class Vector
+       {
+               [JitIntrinsic]
+               public static bool IsHardwareAccelerated {
+                       get {
+                               return false;
+                       }
+               }
+       }
+}
\ No newline at end of file
index 1a7d41de48d6b5f4c38838283c41fa5d55f73142..2fdeb9969656bcd1bf22f81cebb0487603ef7f46 100644 (file)
@@ -1,5 +1,5 @@
 // This is a copy of external/referencesource/System.Runtime.Caching/Resources/R.Designer.cs
-// This verison does not use ResourceManager, instead it uses hard coded strings.
+// This version does not use ResourceManager, instead it uses hard coded strings.
 // This should be removed once Mono has access to .NET resources.
 
 namespace System.Runtime.Caching.Resources {
index 23554997cb6a1f6bbc10ffebbdc6f1a9e587e2c3..19dcfaee7342b48ab5ba0a6cfd14a97457224dd9 100644 (file)
@@ -14,6 +14,9 @@ RESOURCE_FILES = \
        resources/Question.wav
 endif
 
+RESX_RESOURCE_STRING = \
+       ../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx
+
 TEST_RESOURCES = \
        Test/System/test-uri-props.txt \
        Test/System/test-uri-props-manual.txt \
index 171360d9052ed685b4dbe768b6b6e200a47c62b9..cacc4936713bee9763ce770c887752488e901b85 100644 (file)
@@ -104,34 +104,6 @@ partial class SR
        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.";
index 5db7246a4bd45ba8a60c47dc69427edb2d94f7c6..cb3827785af4dab4ced082075e03b608d27e1861 100644 (file)
@@ -1139,13 +1139,15 @@ namespace MonoTests.System.Diagnostics
                                Assert.Ignore ("accessing parent pid, only available on unix");
 
                        using (Process process = Process.GetProcessById (getppid ()))
+                       using (ManualResetEvent mre = new ManualResetEvent (false))
                        {
                                Assert.IsFalse (process.WaitForExit (10), "#1");
                                Assert.IsFalse (process.HasExited, "#2");
                                Assert.Throws<InvalidOperationException>(delegate { int exitCode = process.ExitCode; }, "#3");
 
-                               process.Exited += (s, e) => Assert.Fail ("#4");
+                               process.Exited += (s, e) => mre.Set ();
                                process.EnableRaisingEvents = true;
+                               Assert.IsFalse (mre.WaitOne (100), "#4");
 
                                Assert.IsFalse (process.WaitForExit (10), "#5");
                                Assert.IsFalse (process.HasExited, "#6");
index bce47bcbf0dfc43890e39c8e81e064005e49a0ec..6e82f9d6db81626de695abee6c8d6a34496b8425 100755 (executable)
@@ -4541,10 +4541,8 @@ namespace MonoTests.System.Net.Sockets
                                        mSent.Set ();
                                }, clientSocket);
 
-                               if (!mSent.WaitOne (1500))
-                                       throw new TimeoutException ();
-                               if (!mReceived.WaitOne (1500))
-                                       throw new TimeoutException ();
+                               Assert.IsTrue (mSent.WaitOne (5000), "#1");
+                               Assert.IsTrue (mReceived.WaitOne (5000), "#2");
                        } finally {
                                if (File.Exists (temp))
                                        File.Delete (temp);
@@ -4677,9 +4675,6 @@ namespace MonoTests.System.Net.Sockets
                }
 
                [Test] // Covers https://bugzilla.xamarin.com/show_bug.cgi?id=52549
-#if FEATURE_NO_BSD_SOCKETS
-               [ExpectedException (typeof (PlatformNotSupportedException))]
-#endif
                public void SocketMismatchProtocol ()
                {
                        try {
index cf4418e8d7a1865d0506c65d243c3926e59f53ff..b19688cf44cddcd6f2c9ada44d5259c8253967e0 100644 (file)
@@ -159,7 +159,11 @@ namespace MonoTests.System.Net.WebSockets
                [Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
                public void CloseAsyncTest ()
                {
-                       Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
+                       if (!socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000)) {
+                               Assert.Inconclusive (socket.State.ToString ());
+                               return;
+                       }
+
                        Assert.AreEqual (WebSocketState.Open, socket.State);
 
                        Assert.IsTrue (socket.CloseAsync (WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).Wait (5000));
index 771d5d1fb6ae4cf35c3e05db8b41a44cb6175435..05654f49edd95980b5085014ece3423d5509c8a6 100644 (file)
@@ -336,10 +336,20 @@ namespace MonoTests.System.Net
                        DownloadFile (new ServerDownload (true));
                }
 
-               void DownloadFile (ServerDownload sp)
+               [Test]
+#if FEATURE_NO_BSD_SOCKETS
+               [ExpectedException (typeof (PlatformNotSupportedException))]
+#endif
+               public void DownloadFileNonLatinChars ()
+               {
+                       string filename = "\u0411\u0430\u0448\u043DRowan-\u041F\u0435\u0441\u043D\u043F\u0440\u043E\u043C\u043E\u043D\u0430\u0445\u0430\u0422\u0435\u043E\u0434\u043E\u0440\u0443\u0441\u0430\u0438\u0437\u0413\u0430\u043C\u043C\u0435\u043B\u044C\u043D\u0430.mp3";
+                       DownloadFile (new ServerDownload (null, null, filename, false), "ftp://{0}:{1}/" + filename);
+               }
+
+               void DownloadFile (ServerDownload sp, string uriTemplate = "ftp://{0}:{1}/file.txt")
                {
                        sp.Start ();
-                       string uri = String.Format ("ftp://{0}:{1}/file.txt", EncloseIPv6 (sp.IPAddress), sp.Port);
+                       string uri = String.Format (uriTemplate, EncloseIPv6 (sp.IPAddress), sp.Port);
                        try {
                                FtpWebRequest ftp = (FtpWebRequest) WebRequest.Create (uri);
                                ftp.KeepAlive = false;
@@ -370,7 +380,7 @@ namespace MonoTests.System.Net
                {
                        // Some embedded FTP servers in Industrial Automation Hardware report
                        // the PWD using backslashes, but allow forward slashes for CWD.
-                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", false));
+                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, false));
                }
 
                [Test]
@@ -381,7 +391,7 @@ namespace MonoTests.System.Net
                {
                        // Some embedded FTP servers in Industrial Automation Hardware report
                        // the PWD using backslashes, but allow forward slashes for CWD.
-                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", true));
+                       DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/", null, true));
                }
 
                [Test]
@@ -580,18 +590,19 @@ namespace MonoTests.System.Net
 
                class ServerDownload : FtpServer {
 
-                       string Pwd, Cwd;
+                       string Pwd, Cwd, Filename;
 
                        public ServerDownload (bool ipv6)
-                               : this (null, null, ipv6)
+                               : this (null, null, null, ipv6)
                        {
                        }
 
-                       public ServerDownload (string pwd, string cwd, bool ipv6)
+                       public ServerDownload (string pwd, string cwd, string filename, bool ipv6)
                                : base (ipv6)
                        {
                                Pwd = pwd ?? "/home/someuser";
                                Cwd = cwd ?? "/home/someuser/";
+                               Filename = filename ?? "file.txt";
                        }
 
                        protected override void Run ()
@@ -620,8 +631,8 @@ namespace MonoTests.System.Net
                                writer.Flush ();
 
                                str = reader.ReadLine ();
-                               if (str != "RETR file.txt") {
-                                       Where = "RETR - " + str;
+                               if (str != $"RETR {Filename}") {
+                                       Where = $"RETR - got: {str}, expected: RETR {Filename}";
                                        client.Close ();
                                        return;
                                }
index 0efb5c416616ff5afe66dca900605ad7dfb2d037..63ca1a082a287fa62c8336e7b5a5ab24a26cc782 100644 (file)
@@ -354,9 +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
@@ -924,8 +921,13 @@ ReferenceSources/Win32Exception.cs
 
 ../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs
 
+corefx/SR.cs
+
 ../../../external/corefx/src/System.Runtime.Extensions/src/System/CodeDom/Compiler/IndentedTextWriter.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.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
diff --git a/mcs/class/System/corefx/SR.cs b/mcs/class/System/corefx/SR.cs
new file mode 100644 (file)
index 0000000..892f011
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// 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.";
+}
index 59ef32f147fd6f9c8ecade952d86e5a3403592ff..6e1e9ef1264ab13c08957d9d6938eeed71c9497a 100644 (file)
@@ -76,8 +76,6 @@ using System.Runtime.InteropServices;
 [assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
 [assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
 
-[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")]
-
 [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
 [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")]
 
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 adb9998e66ef4a999312c29926c33e762c4b8e3c..762dad80fd402117bf211eecb5528ad5902f89dd 100644 (file)
@@ -22,7 +22,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if !FULL_AOT_RUNTIME || IOS_REFLECTION
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
@@ -35,5 +34,3 @@ namespace System.Reflection.Emit {
                WindowApplication = 3
        }
 }
-
-#endif
index 960ecf6e7b857595371308d71456e4c2fe0dad93..3bd11264b1a8fd04c929d3e03b624fb743621c0b 100644 (file)
@@ -98,17 +98,16 @@ namespace System.Threading
 
                private void DoCallBack (object timedOut)
                {
-                       if (_callback != null) {
-                               try {
-                                       _callback (_state, (bool)timedOut); 
-                               } catch {}
-                       }
-
-                       lock (this) 
-                       {
-                               _callsInProcess--;
-                               if (_unregistered && _callsInProcess == 0 && _finalEvent != null)
-                                       NativeEventCalls.SetEvent (_finalEvent.SafeWaitHandle);
+                       try {
+                               if (_callback != null)
+                                       _callback (_state, (bool)timedOut);
+                       } finally {
+                               lock (this)
+                               {
+                                       _callsInProcess--;
+                                       if (_unregistered && _callsInProcess == 0 && _finalEvent != null)
+                                               NativeEventCalls.SetEvent (_finalEvent.SafeWaitHandle);
+                               }
                        }
                }
 
index 8f6e0aa098e40b238d2738503705207086c3eb80..d2565a3c209a771fa2ad03c1a5b423c87ea06d9c 100644 (file)
@@ -1290,6 +1290,34 @@ namespace System
                        }
                }
 
+               public static void Reverse<T>(T[] array)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException (nameof (array));
+
+                       Reverse (array, 0, array.Length);
+               }
+
+               public static void Reverse<T>(T[] array, int index, int length)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException (nameof (array));
+                       if (index < 0 || length < 0)
+                               throw new ArgumentOutOfRangeException ((index < 0 ? nameof (index) : nameof (length)));
+                       if (array.Length - index < length)
+                               throw new ArgumentException ();
+
+                       int i = index;
+                       int j = index + length - 1;
+                       while (i < j) {
+                               T temp = array [i];
+                               array [i] = array [j];
+                               array [j] = temp;
+                               i++;
+                               j--;
+                       }
+               }
+
                [ReliabilityContractAttribute (Consistency.MayCorruptInstance, Cer.MayFail)]
                public static void Sort (Array array)
                {
@@ -3130,6 +3158,30 @@ namespace System
                        return new ReadOnlyCollection<T> (array);
                }
 
+               public static void Fill<T> (T[] array, T value)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException (nameof (array));
+
+                       for (int i = 0; i < array.Length; i++)
+                               array [i] = value;
+               }
+
+               public static void Fill<T> (T[] array, T value, int startIndex, int count)
+               {
+                       if (array == null)
+                               throw new ArgumentNullException (nameof (array));
+
+                       if (startIndex < 0 || startIndex > array.Length)
+                               throw new ArgumentOutOfRangeException (nameof (startIndex));
+
+                       if (count < 0 || startIndex > array.Length - count)
+                               throw new ArgumentOutOfRangeException (nameof (count));
+
+                       for (int i = startIndex; i < startIndex + count; i++)
+                               array [i] = value;
+               }
+
                public static T Find<T> (T [] array, Predicate<T> match)
                {
                        if (array == null)
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.";
+}
index 6a88936752923e87171375cabcde77b2ab193aad..7a7b21675c78b75258d96c474126e676d3c89a41 100644 (file)
@@ -9,5 +9,9 @@ namespace System.Diagnostics.Private
                public static void Assert (bool condition, string message)
                {
                }
+
+               public static void Fail (string message)
+               {
+               }
        }
 }
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 d6faf256138acae5d82f61e2c00af59494b0f65f..dd7ac01ff3fc438e0e2485ec9bad5c9756e39bf0 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
@@ -1646,7 +1638,6 @@ ReferenceSources/Type.cs
 ../referencesource/mscorlib/microsoft/win32/safehandles/win32safehandles.cs
 
 corert/Debug.cs
-corert/SR.cs
 
 ../../../external/corert/src/Common/src/System/Numerics/Hashing/HashHelpers.cs
 
@@ -1660,3 +1651,13 @@ corert/SR.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
 
+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 62eb1dcc3f870757e03d70d408281fbd5f2dad9e..7fcf6f07ab366112bb4c983199863ae276f13591 100644 (file)
@@ -13,6 +13,7 @@ namespace System.Data {
     using System.Data;
     using System.Runtime.Serialization;
 
+#if !COREFX
     /// <devdoc>
     ///    <para>DEV: The exception that is throwing from strong typed DataSet when user access to DBNull value.</para>
     /// </devdoc>
@@ -39,7 +40,7 @@ namespace System.Data {
             HResult = HResults.StrongTyping;
         }
     }
-
+#endif
 
     /// <devdoc>
     ///    <para>DEV: The exception that is throwing in generating strong typed DataSet when name conflict happens.</para>
index 1e5ea43e2710b9e2f6698d8b679b66e4c28040a4..32bc1e964e2ce57e1305e48a1772c2add589af41 100644 (file)
@@ -55,6 +55,8 @@ namespace System.Data.Common {
         // The resource Framework.txt will ensure proper string text based on the appropriate
         // locale.
 
+        public const CompareOptions DefaultCompareOptions = CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase;
+
         static internal Task<T> CreatedTaskWithException<T>(Exception ex) {
             TaskCompletionSource<T> completion = new TaskCompletionSource<T>();
             completion.SetException(ex);
@@ -77,27 +79,9 @@ namespace System.Data.Common {
             }
         }
 
-        // NOTE: Initializing a Task in SQL CLR requires the "UNSAFE" permission set (http://msdn.microsoft.com/en-us/library/ms172338.aspx)
-        // Therefore we are lazily initializing these Tasks to avoid forcing customers to use the "UNSAFE" set when they are actually using no Async features (See Dev11 Bug #193253)
-        static private Task<bool> _trueTask = null;
-        static internal Task<bool> TrueTask {
-            get {
-                if (_trueTask == null) {
-                    _trueTask = Task.FromResult<bool>(true);
-                }
-                return _trueTask;
-            }
-        }
+        static internal Task<bool> s_trueTask = Task.FromResult<bool>(true);
 
-        static private Task<bool> _falseTask = null;
-        static internal Task<bool> FalseTask {
-            get {
-                if (_falseTask == null) {
-                    _falseTask = Task.FromResult<bool>(false);
-                }
-                return _falseTask;
-            }
-        }
+        static internal Task<bool> s_falseTask = Task.FromResult<bool>(true);
         
         [BidMethod] // this method accepts BID format as an argument, this attribute allows FXCopBid rule to validate calls to it
         static private void TraceException(
index ed7b7b4c5d1c02ff0fba43ea712a1a476c508c9a..e2e362e7a24bdd10327ec3eb06d224930d01df11 100644 (file)
@@ -86,7 +86,7 @@ namespace System.Data.Common {
             _encryptedUsersConnectionString = connectionOptions.UsersConnectionString(false);
             _hasPassword = connectionOptions.HasPasswordKeyword;
             _parsetable = connectionOptions.Parsetable;
-            _keychain = connectionOptions.KeyChain;
+            _keychain = connectionOptions._keyChain;
 
             // we do not want to serialize out user password unless directed so by "persist security info=true"
             // otherwise all instances of user's password will be replaced with "*"
index 11257cc6dea9b8de67dbe9f4e2c387041bb40660..6f283876b38dc2f30734294825f5937e3869e781 100644 (file)
@@ -107,7 +107,7 @@ namespace System.Data.Common {
 
         private readonly string        _usersConnectionString;
         private readonly Hashtable     _parsetable;
-        internal readonly NameValuePair KeyChain;
+        internal readonly NameValuePair _keyChain;
         internal readonly bool HasPasswordKeyword;
         internal readonly bool HasUserIdKeyword;
 
@@ -143,7 +143,7 @@ namespace System.Data.Common {
 
             // first pass on parsing, initial syntax check
             if (0 < _usersConnectionString.Length) {
-                KeyChain = ParseInternal(_parsetable, _usersConnectionString, true, synonyms, UseOdbcRules);
+                _keyChain = ParseInternal(_parsetable, _usersConnectionString, true, synonyms, UseOdbcRules);
                 HasPasswordKeyword = (_parsetable.ContainsKey(KEY.Password) || _parsetable.ContainsKey(SYNONYM.Pwd));
                 HasUserIdKeyword = (_parsetable.ContainsKey(KEY.User_ID) || _parsetable.ContainsKey(SYNONYM.UID));
             }
@@ -155,7 +155,7 @@ namespace System.Data.Common {
             HasUserIdKeyword = connectionOptions.HasUserIdKeyword;
             UseOdbcRules = connectionOptions.UseOdbcRules;
             _parsetable = connectionOptions._parsetable;
-            KeyChain = connectionOptions.KeyChain;
+            _keyChain = connectionOptions._keyChain;
         }
 
 
@@ -201,7 +201,7 @@ namespace System.Data.Common {
         }
 
         public bool IsEmpty {
-            get { return (null == KeyChain); }
+            get { return (null == _keyChain); }
         }
 
         internal Hashtable Parsetable {
@@ -439,7 +439,7 @@ namespace System.Data.Common {
             int copyPosition = 0;
             bool expanded = false;
 
-            for(NameValuePair current = KeyChain; null != current; current = current.Next) {
+            for(NameValuePair current = _keyChain; null != current; current = current.Next) {
                 value = current.Value;
 
                 // remove duplicate keyswords from connectionstring
@@ -517,7 +517,7 @@ namespace System.Data.Common {
             int copyPosition = 0;
 
             StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
-            for(NameValuePair current = KeyChain; null != current; current = current.Next) {
+            for(NameValuePair current = _keyChain; null != current; current = current.Next) {
                 if ((current.Name == keyword) && (current.Value == this[keyword])) {
                     // only replace the parse end-result value instead of all values
                     // so that when duplicate-keywords occur other original values remain in place
@@ -929,7 +929,7 @@ namespace System.Data.Common {
             int copyPosition = 0;
             NameValuePair head = null, tail = null, next = null;
             StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
-            for(NameValuePair current = KeyChain; null != current; current = current.Next) {
+            for(NameValuePair current = _keyChain; null != current; current = current.Next) {
                 if ((KEY.Password != current.Name) && (SYNONYM.Pwd != current.Name)) {
                     builder.Append(_usersConnectionString, copyPosition, current.Length);
                     if (fakePassword) {
index c95844c82a82efbecd9aba0a91827f07157dfdc3..9646eb88b49a320cae96980114160abb2fc7f1eb 100644 (file)
@@ -262,7 +262,7 @@ internal static partial class Bid
     [BidMethod]
     [BidArgumentType(typeof(string))] // format string should have a string spec (%ls) for an Activity ID argument as last
     internal static void CorrelationTrace(string fmtPrintfW, System.Int32 a1) {
-        if ((modFlags & System.Data.Common.ActivityCorrelator.CorrelationTracePoints) != 0
+        if ((modFlags & Bid.ApiGroup.Correlation) != 0
             && (modFlags & Bid.ApiGroup.Trace) != 0 && modID != NoData) {
             System.Data.Common.ActivityCorrelator.ActivityId actId = System.Data.Common.ActivityCorrelator.Next();
             NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, actId.ToString());
@@ -273,7 +273,7 @@ internal static partial class Bid
     [BidArgumentType(typeof(string))] // format string should have a string spec (%ls) for an Activity ID argument as last
     internal static void CorrelationTrace(string fmtPrintfW)
     {
-        if ((modFlags & System.Data.Common.ActivityCorrelator.CorrelationTracePoints) != 0
+        if ((modFlags & Bid.ApiGroup.Correlation) != 0
             && (modFlags & Bid.ApiGroup.Trace) != 0 && modID != NoData) {
             System.Data.Common.ActivityCorrelator.ActivityId actId = System.Data.Common.ActivityCorrelator.Next();
             NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, actId.ToString());
@@ -283,7 +283,7 @@ internal static partial class Bid
     [BidMethod]
     [BidArgumentType(typeof(string))] // format string should have a string spec (%ls) for an Activity ID argument as last
     internal static void CorrelationTrace(string fmtPrintfW, System.Int32 a1, System.Int32 a2) {
-        if ((modFlags & System.Data.Common.ActivityCorrelator.CorrelationTracePoints) != 0
+        if ((modFlags & Bid.ApiGroup.Correlation) != 0
             && (modFlags & Bid.ApiGroup.Trace) != 0 && modID != NoData) {
             System.Data.Common.ActivityCorrelator.ActivityId actId = System.Data.Common.ActivityCorrelator.Next();
             NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, a1, a2, actId.ToString());
index eb8d46d665f2ecc7389528bf84f1f2e211424909..2a88477ebb7106342eac3e23b62d255ecd892b31 100644 (file)
@@ -227,6 +227,22 @@ namespace System.Collections.Generic {
             _array[_size] = default(T);     // Free memory quicker.
             return item;
         }
+
+#if MONO
+        public bool TryPop(out T result)
+        {
+            if (_size == 0)
+            {
+                result = default(T);
+                return false;
+            }
+
+            _version++;
+            result = _array[--_size];
+            _array[_size] = default(T);     // Free memory quicker.
+            return true;
+        }
+#endif
     
         // Pushes an item to the top of the stack.
         // 
index e5d0b1f173584fe1676d1379efa1df8a35346731..fe79b444e36e6600d1a1b227e831fe5a3d278c1b 100644 (file)
@@ -1443,7 +1443,11 @@ namespace Mono.CSharp
                                        targs.Arguments = new TypeSpec[hoisted_tparams.Length];
                                        for (int i = 0; i < hoisted_tparams.Length; ++i) {
                                                var tp = hoisted_tparams[i];
-                                               var local_tp = new TypeParameter (tp, null, new MemberName (tp.Name, Location), null);
+                                               var tp_name = tp.Name;
+#if DEBUG
+                                               tp_name += "_Proxy";
+#endif
+                                               var local_tp = new TypeParameter (tp, null, new MemberName (tp_name, Location), null);
                                                tparams.Add (local_tp);
 
                                                targs.Add (new SimpleName (tp.Name, Location));
@@ -1459,6 +1463,12 @@ namespace Mono.CSharp
                                        var mutator = new TypeParameterMutator (hoisted_tparams, tparams);
                                        return_type = mutator.Mutate (return_type);
                                        local_param_types = mutator.Mutate (local_param_types);
+
+                                       var inflator = new TypeParameterInflator (this, null, hoisted_tparams, targs.Arguments);
+                                       for (int i = 0; i < hoisted_tparams.Length; ++i) {
+                                               var tp_spec = (TypeParameterSpec) targs.Arguments [i];
+                                               tp_spec.InflateConstraints (inflator, tp_spec);
+                                       }
                                } else {
                                        member_name = new MemberName (name);
                                }
@@ -1471,7 +1481,7 @@ namespace Mono.CSharp
                                        base_parameters[i].Resolve (this, i);
                                }
 
-                               var cloned_params = ParametersCompiled.CreateFullyResolved (base_parameters, method.Parameters.Types);
+                               var cloned_params = ParametersCompiled.CreateFullyResolved (base_parameters, local_param_types);
                                if (method.Parameters.HasArglist) {
                                        cloned_params.FixedParameters[0] = new Parameter (null, "__arglist", Parameter.Modifier.NONE, null, Location);
                                        cloned_params.Types[0] = Module.PredefinedTypes.RuntimeArgumentHandle.Resolve ();
index d5ba75c12813af9d07e4b3182134f82cc3e557f9..c580a8a7291562eeeb31b519ece86ec395d146b7 100644 (file)
@@ -1070,7 +1070,10 @@ namespace Mono.CSharp
                                        var ie = new InstanceEmitter (instance_copy, IsAddressCall (instance_copy, call_op, method.DeclaringType));
 
                                        if (Arguments == null) {
-                                               ie.EmitLoad (ec, true);
+                                               if (ConditionalAccess)
+                                                       ie.Emit (ec, true);
+                                               else
+                                                       ie.EmitLoad (ec, true);
                                        }
                                } else if (!InstanceExpressionOnStack) {
                                        var ie = new InstanceEmitter (InstanceExpression, IsAddressCall (InstanceExpression, call_op, method.DeclaringType));
index 8475a9e489428c0d98d91267b7b40954a54be3c2..5dff5e73d79361861f97b7d05bbd45432db84ac4 100644 (file)
@@ -3352,6 +3352,8 @@ namespace Mono.CSharp {
                                // introduce redundant storey but with `this' only but it's tricky to avoid
                                // at this stage as we don't know what expressions follow base
                                //
+                               // TODO: It's needed only when the method with base call is moved to a storey
+                               //
                                if (rc.CurrentAnonymousMethod != null) {
                                        if (targs == null && method.IsGeneric) {
                                                targs = method.TypeArguments;
index fdf5b81f92c38a4ef8dba73e5c202a990383eec3..8ddef4f36947b630ee655efd11adbe80fa385b5c 100644 (file)
@@ -428,13 +428,13 @@ namespace Mono.CSharp {
                public TypeParameter (TypeParameterSpec spec, TypeSpec parentSpec, MemberName name, Attributes attrs)
                        : base (null, name, attrs)
                {
-                       this.spec = new TypeParameterSpec (parentSpec, spec.DeclaredPosition, spec.MemberDefinition, spec.SpecialConstraint, spec.Variance, null) {
+                       this.spec = new TypeParameterSpec (parentSpec, spec.DeclaredPosition, this, spec.SpecialConstraint, spec.Variance, null) {
                                BaseType = spec.BaseType,
                                InterfacesDefined = spec.InterfacesDefined,
                                TypeArguments = spec.TypeArguments
                        };
                }
-               
+
                #region Properties
 
                public override AttributeTargets AttributeTargets {
@@ -2162,6 +2162,10 @@ namespace Mono.CSharp {
                                return this;
 
                        var mutated = (InflatedTypeSpec) MemberwiseClone ();
+#if DEBUG
+                       mutated.ID += 1000000;
+#endif
+
                        if (decl != DeclaringType) {
                                // Gets back MethodInfo in case of metaInfo was inflated
                                //mutated.info = MemberCache.GetMember<TypeSpec> (DeclaringType.GetDefinition (), this).info;
index d3b0f86d8164bd2338d66fe6ca7a8df689bf07cc..48f5f09c7047e903979cd61343b77948d945e162 100644 (file)
@@ -373,8 +373,13 @@ namespace Mono.CSharp {
                                        var entry_pm = entry as IParametersMember;
                                        if (entry_pm != null) {
                                                entry_param = entry_pm.Parameters;
-                                               if (!TypeSpecComparer.Override.IsEqual (entry_param, member_param))
-                                                       continue;
+                                               if (entry.DeclaringType != member.DeclaringType) {
+                                                       if (!TypeSpecComparer.Override.IsEqual (entry_param, member_param))
+                                                               continue;
+                                               } else {
+                                                       if (!TypeSpecComparer.Equals (entry_param.Types, member_param.Types))
+                                                               continue;
+                                               }
                                        }
                                }
 
index 5cce6a10361339e95669211d7dceaa38065f5afd..c2b993564e2b354b066ca651e60f816da3707d00 100644 (file)
@@ -444,6 +444,10 @@ namespace Mono.CSharp {
                        return ms;
                }
 
+#if DEBUG
+               int counter = 100000;
+#endif
+
                public MethodSpec MakeGenericMethod (IMemberContext context, params TypeSpec[] targs)
                {
                        if (targs == null)
@@ -465,6 +469,10 @@ namespace Mono.CSharp {
                        inflated.constraints = TypeParameterSpec.InflateConstraints (inflator, constraints ?? GenericDefinition.TypeParameters);
                        inflated.state |= StateFlags.PendingMakeMethod;
 
+#if DEBUG
+                       inflated.ID += counter;
+                       counter += 100000;
+#endif
                        //                      if (inflated.parent == null)
                        //                              inflated.parent = parent;
 
@@ -1867,6 +1875,7 @@ namespace Mono.CSharp {
                        if (debug_builder == null)
                                return;
 
+#if !FULL_AOT_RUNTIME
                        var token = ConstructorBuilder.GetToken ();
                        int t = token.Token;
 #if STATIC
@@ -1875,6 +1884,7 @@ namespace Mono.CSharp {
 #endif
 
                        debug_builder.DefineMethod (file, t);
+#endif
                }
 
                #region IMethodData Members
@@ -2197,6 +2207,7 @@ namespace Mono.CSharp {
                        if (debug_builder == null)
                                return;
 
+#if !FULL_AOT_RUNTIME
                        var token = builder.GetToken ();
                        int t = token.Token;
 #if STATIC
@@ -2205,6 +2216,7 @@ namespace Mono.CSharp {
 #endif
 
                        debug_builder.DefineMethod (file, t);
+#endif
                }
        }
 
index fbb060f52960da9af8218171c9cf6991e8b102cc..4f67eb3240f38407e24a36fc3c384b3f60714489 100644 (file)
@@ -1301,7 +1301,7 @@ namespace Mono.CSharp {
                                                // Special case hoisted return value (happens in try/finally scenario)
                                                //
                                                if (ec.TryFinallyUnwind != null) {
-                                                       exit_label = TryFinally.EmitRedirectedReturn (ec, async_body);
+                                                       exit_label = TryFinally.EmitRedirectedReturn (ec, async_body, unwind_protect);
                                                }
 
                                                var async_return = (IAssignMethod)storey.HoistedReturnValue;
@@ -1311,7 +1311,7 @@ namespace Mono.CSharp {
                                                expr.Emit (ec);
 
                                                if (ec.TryFinallyUnwind != null)
-                                                       exit_label = TryFinally.EmitRedirectedReturn (ec, async_body);
+                                                       exit_label = TryFinally.EmitRedirectedReturn (ec, async_body, unwind_protect);
                                        }
 
                                        ec.Emit (OpCodes.Leave, exit_label);
@@ -1460,7 +1460,7 @@ namespace Mono.CSharp {
 
                        if (ec.TryFinallyUnwind != null && IsLeavingFinally (label.Block)) {
                                var async_body = (AsyncInitializer) ec.CurrentAnonymousMethod;
-                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, label.Block);
+                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, label.Block, unwind_protect);
                        }
 
                        ec.Emit (unwind_protect ? OpCodes.Leave : OpCodes.Br, l);
@@ -1867,7 +1867,7 @@ namespace Mono.CSharp {
 
                        if (ec.TryFinallyUnwind != null) {
                                var async_body = (AsyncInitializer) ec.CurrentAnonymousMethod;
-                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, enclosing_loop.Statement as Block);
+                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, enclosing_loop.Statement as Block, unwind_protect);
                        }
 
                        ec.Emit (unwind_protect ? OpCodes.Leave : OpCodes.Br, l);
@@ -1915,7 +1915,7 @@ namespace Mono.CSharp {
 
                        if (ec.TryFinallyUnwind != null) {
                                var async_body = (AsyncInitializer) ec.CurrentAnonymousMethod;
-                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, enclosing_loop.Statement as Block);
+                               l = TryFinally.EmitRedirectedJump (ec, async_body, l, enclosing_loop.Statement as Block, unwind_protect);
                        }
 
                        ec.Emit (unwind_protect ? OpCodes.Leave : OpCodes.Br, l);
@@ -6997,7 +6997,7 @@ namespace Mono.CSharp {
        {
                ExplicitBlock fini;
                List<DefiniteAssignmentBitSet> try_exit_dat;
-               List<Label> redirected_jumps;
+               List<Tuple<Label, bool>> redirected_jumps;
                Label? start_fin_label;
 
                public TryFinally (Statement stmt, ExplicitBlock fini, Location loc)
@@ -7123,7 +7123,7 @@ namespace Mono.CSharp {
                        return false;
                }
 
-               public static Label EmitRedirectedJump (EmitContext ec, AsyncInitializer initializer, Label label, Block labelBlock)
+               public static Label EmitRedirectedJump (EmitContext ec, AsyncInitializer initializer, Label label, Block labelBlock, bool unwindProtect)
                {
                        int idx;
                        if (labelBlock != null) {
@@ -7143,7 +7143,7 @@ namespace Mono.CSharp {
                                if (labelBlock != null && !fin.IsParentBlock (labelBlock))
                                        break;
 
-                               fin.EmitRedirectedExit (ec, label, initializer, set_return_state);
+                               fin.EmitRedirectedExit (ec, label, initializer, set_return_state, unwindProtect);
                                set_return_state = false;
 
                                if (fin.start_fin_label == null) {
@@ -7156,26 +7156,26 @@ namespace Mono.CSharp {
                        return label;
                }
 
-               public static Label EmitRedirectedReturn (EmitContext ec, AsyncInitializer initializer)
+               public static Label EmitRedirectedReturn (EmitContext ec, AsyncInitializer initializer, bool unwindProtect)
                {
-                       return EmitRedirectedJump (ec, initializer, initializer.BodyEnd, null);
+                       return EmitRedirectedJump (ec, initializer, initializer.BodyEnd, null, unwindProtect);
                }
 
-               void EmitRedirectedExit (EmitContext ec, Label label, AsyncInitializer initializer, bool setReturnState)
+               void EmitRedirectedExit (EmitContext ec, Label label, AsyncInitializer initializer, bool setReturnState, bool unwindProtect)
                {
                        if (redirected_jumps == null) {
-                               redirected_jumps = new List<Label> ();
+                               redirected_jumps = new List<Tuple<Label, bool>> ();
 
                                // Add fallthrough label
-                               redirected_jumps.Add (ec.DefineLabel ());
+                               redirected_jumps.Add (Tuple.Create (ec.DefineLabel (), false));
 
                                if (setReturnState)
                                        initializer.HoistedReturnState = ec.GetTemporaryField (ec.Module.Compiler.BuiltinTypes.Int, true);
                        }
 
-                       int index = redirected_jumps.IndexOf (label);
+                       int index = redirected_jumps.FindIndex (l => l.Item1 == label);
                        if (index < 0) {
-                               redirected_jumps.Add (label);
+                               redirected_jumps.Add (Tuple.Create (label, unwindProtect));
                                index = redirected_jumps.Count - 1;
                        }
 
@@ -7199,10 +7199,34 @@ namespace Mono.CSharp {
 
                        var initializer = (AsyncInitializer)ec.CurrentAnonymousMethod;
                        initializer.HoistedReturnState.EmitLoad (ec);
-                       ec.Emit (OpCodes.Switch, redirected_jumps.ToArray ());
+
+                       var jumps_table = new Label [redirected_jumps.Count];
+                       List<Tuple<Label, Label>> leave_redirect = null;
+                       for (int i = 0; i < jumps_table.Length; ++i) {
+                               var val = redirected_jumps [i];
+
+                               if (val.Item2) {
+                                       if (leave_redirect == null)
+                                               leave_redirect = new List<Tuple<Label, Label>> ();
+                                       var label = ec.DefineLabel ();
+                                       leave_redirect.Add (Tuple.Create (label, val.Item1));
+                                       jumps_table [i] = label;
+                               } else {
+                                       jumps_table [i] = val.Item1;
+                               }
+                       }
+
+                       ec.Emit (OpCodes.Switch, jumps_table);
+
+                       if (leave_redirect != null) {
+                               foreach (var entry in leave_redirect) {
+                                       ec.MarkLabel (entry.Item1);
+                                       ec.Emit (OpCodes.Leave, entry.Item2);
+                               }
+                       }
 
                        // Mark fallthrough label
-                       ec.MarkLabel (redirected_jumps [0]);
+                       ec.MarkLabel (jumps_table [0]);
                }
 
                protected override bool DoFlowAnalysis (FlowAnalysisContext fc)
index f09a598caf316290ea4852c5ab69334206dd0981..e0dfde276fba9a93e35fabefc6859b9e9f16b459 100644 (file)
@@ -207,11 +207,14 @@ class Tester : DynamicObjectMock
                }
        }
 
-       static FieldInfo flags = typeof (CSharpArgumentInfo).GetField ("flags", BindingFlags.NonPublic | BindingFlags.Instance);
+       static PropertyInfo flags = typeof (CSharpArgumentInfo).GetProperty ("Flags", BindingFlags.NonPublic | BindingFlags.Instance);
 
        static void AssertArgument (CallSiteBinder obj, CSharpArgumentInfo[] expected, string name)
        {
-               var ai = obj.GetType ().GetField ("argumentInfo", BindingFlags.NonPublic | BindingFlags.Instance);
+               var ai = obj.GetType ().GetField ("_argumentInfo", BindingFlags.NonPublic | BindingFlags.Instance);
+               if (ai == null)
+                       throw new ApplicationException ("Could not find 'argumentInfo' private field on " + obj.GetType ());
+
                IList<CSharpArgumentInfo> values = (IList<CSharpArgumentInfo>) ai.GetValue (obj);
                if (values.Count != expected.Length)
                        throw new ApplicationException (name + ": Array length does not match " + values.Count + " != " + expected.Length);
index 42433a3e9cdb64e7a0656020c14bcc1c20e131b4..9039c1f09002342be383d112e1e43f964ffee5c7 100644 (file)
@@ -66,7 +66,7 @@ public class Test
 
                if (Disposable.Counter != 1)
                        return false;
-
+/*
                try {
                        using (dynamic u = new Disposable ()) {
                                u.VV ();
@@ -79,7 +79,7 @@ public class Test
                using (dynamic u = new Disposable ()) {
                        u.Test ();
                }
-
+*/
                return true;
        }
 
index f64fdc0b53c2afa1e247eaee8f0739dd7615ab60..c01a0fae71b21f738ea359eb178e8072826c8707 100644 (file)
@@ -40,6 +40,7 @@ public class Test
                a[4] ^= b;
                
                dynamic d = 1;
+/*
                b = byte.MaxValue;
                try {
                        checked {
@@ -50,7 +51,7 @@ public class Test
                }
                        
                b += d;
-               
+*/
                try {
                        checked {
                                a.Byte += 100;
index a7ee0ef60afa5ad270ba610721609ccbac0c1da4..2cba37f3e8f32417a72aef55721f2934eac6f0ff 100644 (file)
@@ -23,7 +23,7 @@ class Tester
                        () => {
                                dynamic d = 1;
                                d ();
-                       }, "Cannot invoke a non-delegate type `int'");
+                       }, "Cannot invoke a non-delegate type");
        }
        
        void Using_1 ()
@@ -31,7 +31,7 @@ class Tester
                AssertError (
                        () => {
                                using (dynamic d = 1) { }
-                       }, "Cannot implicitly convert type `int' to `System.IDisposable'");
+                       }, "Cannot implicitly convert type 'int' to 'System.IDisposable'");
        }
        
        void Unsafe_1 ()
@@ -39,7 +39,7 @@ class Tester
                dynamic d = 1;
                AssertError (
                        () => Helper.Foo (d),
-                       "Pointers and fixed size buffers cannot be used in a dynamic context");
+                       "Dynamic calls cannot be used in conjunction with pointers");
        }
        
        void NullableConversion ()
@@ -50,7 +50,7 @@ class Tester
                                dynamic b = false;
                                byte? b2 = null;
                                b &= b2;
-                       }, "Operator `&=' cannot be applied to operands of type `bool' and `byte?'");
+                       }, "Operator '&=' cannot be applied to operands of type 'bool' and 'byte?'");
        }
        
 #pragma warning restore 169
index 58578fe3b50ab5351a159c1babe4262593ee6f06..b0c186b8ebe77a5c871e1dfd9b773c1f6fdaae82 100644 (file)
@@ -34,7 +34,7 @@ public class Test
                        d.Foo ();
                        return 1;
                } catch (RuntimeBinderException e) {
-                       if (e.Message != "`A.N.Foo()' is inaccessible due to its protection level")
+                       if (e.Message != "'object' does not contain a definition for 'Foo'")
                                return 2;
                }
                
@@ -42,7 +42,7 @@ public class Test
                        var x = d.Property;
                        return 3;
                } catch (RuntimeBinderException e) {
-                       if (e.Message != "`A.N.Property.get' is inaccessible due to its protection level")
+                       if (e.Message != "'object' does not contain a definition for 'Property'")
                                return 4;
                }
 
@@ -50,7 +50,7 @@ public class Test
                        var x = d [4];
                        return 5;
                } catch (RuntimeBinderException e) {
-                       if (e.Message != "`A.N.this[int]' is inaccessible due to its protection level")
+                       if (e.Message != "Cannot apply indexing with [] to an expression of type 'object'")
                                return 6;
                }
 
index dea56ec61efc0932d51eec86219ad44962a3a50d..0417292753ed3c6a6e02347766d9b00bf04465a2 100644 (file)
@@ -19,7 +19,7 @@ public class Test
                try {
                        getter.Target (getter, new C ());
                } catch (RuntimeBinderException e) {
-                       if (e.Message == "`C' does not contain a definition for `n'")
+                       if (e.Message == "'C' does not contain a definition for 'n'")
                                return 0;
 
                        return 2;
index b08555808a2011b40f1a1dbea436fab9e9154e93..cd610bf123ae74ffa87f4150ad8b7a2c4d5476ad 100644 (file)
@@ -16,7 +16,7 @@ public class Test
                        d.Value = (object)"value";
                        return 1;
                } catch (RuntimeBinderException e) {
-                       if (e.Message != "Cannot implicitly convert type `object' to `string'. An explicit conversion exists (are you missing a cast?)")
+                       if (e.Message != "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)")
                                return 2;
                }
                
diff --git a/mcs/tests/gtest-645-lib.cs b/mcs/tests/gtest-645-lib.cs
new file mode 100644 (file)
index 0000000..24c31d7
--- /dev/null
@@ -0,0 +1,10 @@
+// Compiler options: -target:library
+
+namespace SeparateAssembly
+{
+       public interface IGenericAction<T1, T2>
+       {
+               void AddAction(IGenericAction<T1, T2> action);
+               void AddAction(IGenericAction<T2, T1> action);
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-645.cs b/mcs/tests/gtest-645.cs
new file mode 100644 (file)
index 0000000..5ed87ba
--- /dev/null
@@ -0,0 +1,17 @@
+// Compiler options: -r:gtest-645-lib.dll
+
+using System;
+using SeparateAssembly;
+
+class Program
+{
+       public static void Main()
+       {
+       }
+
+       public static void AddChildButton<T1, T2>(IGenericAction<T1, T2> action)
+       {
+               IGenericAction<T2, T1> childAction = null;
+               action.AddAction (childAction);
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-anon-178.cs b/mcs/tests/test-anon-178.cs
new file mode 100644 (file)
index 0000000..278bdbe
--- /dev/null
@@ -0,0 +1,31 @@
+using System;
+
+public abstract class BaseClass<T>
+{
+}
+
+public class DerivedClass : BaseClass<int>
+{
+}
+
+public abstract class CA
+{
+       [Obsolete]
+       public virtual void Foo<T, U> (U args) where T : BaseClass<U>, new()
+       {
+       }
+}
+
+public class CB : CA
+{
+       public CB ()
+       {
+               int x = 4;
+               Action<int> pp = r => base.Foo<DerivedClass, int> (x);
+       }
+
+       public static void Main ()
+       {
+               new CB ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-async-90.cs b/mcs/tests/test-async-90.cs
new file mode 100644 (file)
index 0000000..8b1adc6
--- /dev/null
@@ -0,0 +1,35 @@
+using System.Threading.Tasks;
+
+static class Y
+{
+    public static string ExCall (this X x)
+    {
+        return null;
+    }
+}
+
+class X
+{
+    static X Test (object o)
+    {
+        return null;
+    }
+
+    X Prop { get; set;}
+
+    X Call ()
+    {
+        return null;
+    }
+
+    public static void Main ()
+    {
+        var x = new X ();
+        x.Test ().Wait ();
+    }
+
+    async Task Test ()
+    {
+        var x = X.Test (await Task.FromResult (1))?.Prop?.ExCall ();
+    }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-async-91.cs b/mcs/tests/test-async-91.cs
new file mode 100644 (file)
index 0000000..405da3c
--- /dev/null
@@ -0,0 +1,38 @@
+using System;
+using System.Threading.Tasks;
+
+class C : IDisposable
+{
+       public void Dispose ()
+       {
+               Console.WriteLine ("Disposed");
+               TestClass.Passed++;
+       }
+}
+
+public class TestClass
+{
+       public static int Passed;
+
+       public static async Task Test ()
+       {
+               using (var device_resource = new C ()) {
+                       try {
+                               Console.WriteLine ("aa");
+                               return;
+                       } finally {
+                               await Task.Delay (0);
+                       }
+               }
+       }
+
+       public static int Main()
+       {
+               Test ().Wait ();
+               if (Passed != 1)
+                       return 1;
+
+               Console.WriteLine ("PASSED");
+               return 0;
+       }
+}
\ No newline at end of file
index 058f365c1bda16a7d491ddfe2fc87b16ab2477bf..661f426ec6adcfa6daa8dc88c1f6c96edbb2f634 100644 (file)
         <size>99</size>
       </method>
       <method name="Void AssertArgument(System.Runtime.CompilerServices.CallSiteBinder, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo[], System.String)" attrs="145">
-        <size>172</size>
+        <size>206</size>
       </method>
       <method name="Void BinaryAdd_1(System.Object, DynamicObjectMock)" attrs="129">
         <size>124</size>
         <size>235</size>
       </method>
       <method name="Boolean UsingTest()" attrs="129">
-        <size>619</size>
+        <size>222</size>
       </method>
       <method name="Int32 Main()" attrs="150">
         <size>99</size>
         <size>2</size>
       </method>
       <method name="Int32 Main()" attrs="150">
-        <size>3609</size>
+        <size>3273</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>39</size>
       </method>
     </type>
   </test>
+  <test name="gtest-645.cs">
+    <type name="Program">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Void AddChildButton[T1,T2](SeparateAssembly.IGenericAction`2[T1,T2])" attrs="150">
+        <size>11</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-anontype-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="150">
       </method>
     </type>
   </test>
+  <test name="test-anon-178.cs">
+    <type name="BaseClass`1[T]">
+      <method name="Void .ctor()" attrs="6276">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="DerivedClass">
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="CA">
+      <method name="Void Foo[T,U](U)" attrs="454">
+        <size>2</size>
+      </method>
+      <method name="Void .ctor()" attrs="6276">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="CB">
+      <method name="Void Main()" attrs="150">
+        <size>8</size>
+      </method>
+      <method name="Void &lt;Foo&gt;__BaseCallProxy0[T,U](U)" attrs="129">
+        <size>8</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>41</size>
+      </method>
+    </type>
+    <type name="CB+&lt;CB&gt;c__AnonStorey0">
+      <method name="Void &lt;&gt;m__0(Int32)" attrs="131">
+        <size>18</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-anon-18.cs">
     <type name="A">
       <method name="Void Invoke()" attrs="454">
     </type>
     <type name="Test+&lt;TestFinallyWithReturn&gt;c__async1">
       <method name="Void MoveNext()" attrs="486">
-        <size>377</size>
+        <size>382</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;TestFinallyWithReturnNoValue&gt;c__async2">
       <method name="Void MoveNext()" attrs="486">
-        <size>347</size>
+        <size>352</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;TestFinallyWithGoto&gt;c__async3">
       <method name="Void MoveNext()" attrs="486">
-        <size>370</size>
+        <size>375</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;TestFinallyWithGotoAndReturn&gt;c__async4">
       <method name="Void MoveNext()" attrs="486">
-        <size>407</size>
+        <size>417</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;TestNestedReturn&gt;c__async1">
       <method name="Void MoveNext()" attrs="486">
-        <size>845</size>
+        <size>855</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;TestNestedGoto&gt;c__async2">
       <method name="Void MoveNext()" attrs="486">
-        <size>848</size>
+        <size>858</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;BreakTest&gt;c__async1">
       <method name="Void MoveNext()" attrs="486">
-        <size>898</size>
+        <size>903</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="Test+&lt;ContinueTest&gt;c__async2">
       <method name="Void MoveNext()" attrs="486">
-        <size>898</size>
+        <size>903</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
     </type>
     <type name="X+&lt;Test&gt;c__async0">
       <method name="Void MoveNext()" attrs="486">
-        <size>269</size>
+        <size>274</size>
       </method>
       <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
         <size>13</size>
       </method>
     </type>
   </test>
+  <test name="test-async-90.cs">
+    <type name="Y">
+      <method name="System.String ExCall(X)" attrs="150">
+        <size>10</size>
+      </method>
+    </type>
+    <type name="X">
+      <method name="X Test(System.Object)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="X get_Prop()" attrs="2177">
+        <size>14</size>
+      </method>
+      <method name="Void set_Prop(X)" attrs="2177">
+        <size>8</size>
+      </method>
+      <method name="X Call()" attrs="129">
+        <size>10</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>19</size>
+      </method>
+      <method name="System.Threading.Tasks.Task Test()" attrs="129">
+        <size>33</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="X+&lt;Test&gt;c__async0">
+      <method name="Void MoveNext()" attrs="486">
+        <size>290</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-async-91.cs">
+    <type name="C">
+      <method name="Void Dispose()" attrs="486">
+        <size>24</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="TestClass">
+      <method name="System.Threading.Tasks.Task Test()" attrs="150">
+        <size>33</size>
+      </method>
+      <method name="Int32 Main()" attrs="150">
+        <size>48</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="TestClass+&lt;Test&gt;c__async0">
+      <method name="Void MoveNext()" attrs="486">
+        <size>309</size>
+      </method>
+      <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+        <size>13</size>
+      </method>
+    </type>
+  </test>
   <test name="test-cls-00.cs">
     <type name="CLSCLass_6">
       <method name="Void add_Disposed(Delegate)" attrs="2182">
index 31764d0efac7e6113a3689c233918c2aed052786..a92e407162ad6077daff692cbe4323b33ee4a675 100644 (file)
 
                <type fullname="System.Collections.Generic.ICollection`1" />
                <type fullname="System.Collections.Generic.IEnumerable`1" />
+               <type fullname="System.Collections.Generic.IEnumerator`1" />
+               <type fullname="System.Collections.Generic.IReadOnlyList`1" />
+               <type fullname="System.Collections.Generic.IReadOnlyCollection`1" />
+
                <type fullname="System.Collections.Generic.IList`1" />
                <type fullname="System.Collections.Generic.GenericEqualityComparer`1">
                        <method name=".ctor" />
index e81574d27879487030f093450c810ded1a3fb12b..3fe5475097d1c05a094dc63ac97b30a1becf3fa4 100644 (file)
@@ -82,12 +82,13 @@ namespace Mono.XBuild.CommandLine {
                                        throw;
                                }
 
-                               ShowDeprecationNotice ();
                                show_stacktrace = (parameters.LoggerVerbosity == LoggerVerbosity.Detailed ||
                                        parameters.LoggerVerbosity == LoggerVerbosity.Diagnostic);
                                
-                               if (!parameters.NoLogo)
+                               if (!parameters.NoLogo) {
+                                       ShowDeprecationNotice ();
                                        ErrorUtilities.ShowVersion (false);
+                               }
                                
                                engine  = Engine.GlobalEngine;
                                if (!String.IsNullOrEmpty (parameters.ToolsVersion)) {
@@ -175,13 +176,11 @@ namespace Mono.XBuild.CommandLine {
 
                void ShowDeprecationNotice ()
                {
-                       if (parameters.LoggerVerbosity != LoggerVerbosity.Minimal && parameters.LoggerVerbosity != LoggerVerbosity.Quiet) {
-                               Console.ForegroundColor = ConsoleColor.DarkRed;
-                               Console.WriteLine ();
-                               Console.WriteLine (">>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<");
-                               Console.WriteLine ();
-                               Console.ResetColor ();
-                       }
+                       Console.ForegroundColor = ConsoleColor.DarkRed;
+                       Console.WriteLine ();
+                       Console.WriteLine (">>>> xbuild tool is deprecated and will be removed in future updates, use msbuild instead <<<<");
+                       Console.WriteLine ();
+                       Console.ResetColor ();
                }
        }
 
index d187f28780a3a5bf81e3271768e0f615cb56a0e2..599651b1368b78f6c6770ff5742d1c6d83495c81 100644 (file)
@@ -2027,6 +2027,7 @@ main (int argc, char *argv [])
 
        CHECKED_MONO_INIT ();
        mono_counters_init ();
+       mono_tls_init_runtime_keys ();
        memset (&ticallbacks, 0, sizeof (ticallbacks));
        ticallbacks.thread_state_init = thread_state_init;
 #ifndef HOST_WIN32
index 819ce65616e9a93d8628e0b5a39c55ce0b0a06de..312c66a115669aaeee76b7b2e89e36a648c2b07b 100644 (file)
@@ -268,7 +268,7 @@ mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoT
        MonoAppDomain *ad;
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_portability_helpers_init ();
        
@@ -393,7 +393,7 @@ mono_context_init_checked (MonoDomain *domain, MonoError *error)
        MonoClass *klass;
        MonoAppContext *context;
 
-       mono_error_init (error);
+       error_init (error);
 
        klass = mono_class_load_from_name (mono_defaults.corlib, "System.Runtime.Remoting.Contexts", "Context");
        context = (MonoAppContext *) mono_object_new_pinned (domain, klass, error);
@@ -478,7 +478,7 @@ MonoDomain *
 mono_domain_create_appdomain_checked (char *friendly_name, char *configuration_file, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *result = NULL;
 
        MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
@@ -531,7 +531,7 @@ copy_app_domain_setup (MonoDomain *domain, MonoAppDomainSetupHandle setup, MonoE
        MonoClass *ads_class;
        MonoAppDomainSetupHandle result = MONO_HANDLE_NEW (MonoAppDomainSetup, NULL);
 
-       mono_error_init (error);
+       error_init (error);
 
        caller_domain = mono_domain_get ();
        ads_class = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
@@ -595,7 +595,7 @@ mono_domain_create_appdomain_internal (char *friendly_name, MonoAppDomainSetupHa
        MonoClass *adclass;
        MonoDomain *data;
 
-       mono_error_init (error);
+       error_init (error);
 
        adclass = mono_class_get_appdomain_class ();
 
@@ -717,7 +717,7 @@ mono_domain_try_type_resolve_checked (MonoDomain *domain, char *name, MonoObject
        MonoReflectionAssembly *ret;
        void *params [1];
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (domain != NULL && ((name != NULL) || (tb != NULL)));
 
@@ -782,7 +782,7 @@ mono_domain_set (MonoDomain *domain, gboolean force)
 MonoObjectHandle
 ves_icall_System_AppDomain_GetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (MONO_HANDLE_IS_NULL (name)) {
                mono_error_set_argument_null (error, "name", "");
@@ -830,7 +830,7 @@ ves_icall_System_AppDomain_GetData (MonoAppDomainHandle ad, MonoStringHandle nam
 void
 ves_icall_System_AppDomain_SetData (MonoAppDomainHandle ad, MonoStringHandle name, MonoObjectHandle data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (MONO_HANDLE_IS_NULL (name)) {
                mono_error_set_argument_null (error, "name", "");
@@ -851,7 +851,7 @@ ves_icall_System_AppDomain_SetData (MonoAppDomainHandle ad, MonoStringHandle nam
 MonoAppDomainSetupHandle
 ves_icall_System_AppDomain_getSetup (MonoAppDomainHandle ad, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        g_assert (!MONO_HANDLE_IS_NULL (ad));
        MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data);
        g_assert (domain);
@@ -862,7 +862,7 @@ ves_icall_System_AppDomain_getSetup (MonoAppDomainHandle ad, MonoError *error)
 MonoStringHandle
 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomainHandle ad, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        g_assert (!MONO_HANDLE_IS_NULL (ad));
        MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data);
        g_assert (domain);
@@ -873,7 +873,7 @@ ves_icall_System_AppDomain_getFriendlyName (MonoAppDomainHandle ad, MonoError *e
 MonoAppDomainHandle
 ves_icall_System_AppDomain_getCurDomain (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *add = mono_domain_get ();
 
        return MONO_HANDLE_NEW (MonoAppDomain, add->domain);
@@ -882,7 +882,7 @@ ves_icall_System_AppDomain_getCurDomain (MonoError *error)
 MonoAppDomainHandle
 ves_icall_System_AppDomain_getRootDomain (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *root = mono_get_root_domain ();
 
        return MONO_HANDLE_NEW (MonoAppDomain, root->domain);
@@ -1038,7 +1038,7 @@ mono_domain_set_options_from_config (MonoDomain *domain)
 MonoAppDomainHandle
 ves_icall_System_AppDomain_createDomain (MonoStringHandle friendly_name, MonoAppDomainSetupHandle setup, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAppDomainHandle ad = MONO_HANDLE_NEW (MonoAppDomain, NULL);
 
 #ifdef DISABLE_APPDOMAINS
@@ -1058,7 +1058,7 @@ static gboolean
 add_assembly_to_array (MonoDomain *domain, MonoArrayHandle dest, int dest_idx, MonoAssembly* assm, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionAssemblyHandle assm_obj = mono_assembly_get_object_handle (domain, assm, error);
        if (!is_ok (error))
                goto leave;
@@ -1070,7 +1070,7 @@ leave:
 MonoArrayHandle
 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomainHandle ad, MonoBoolean refonly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data);
        MonoAssembly* ass;
        GSList *tmp;
@@ -1111,7 +1111,7 @@ MonoAssembly*
 mono_try_assembly_resolve (MonoDomain *domain, const char *fname_raw, MonoAssembly *requesting, gboolean refonly, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoAssembly *result = NULL;
        MonoStringHandle fname = mono_string_new_handle (domain, fname_raw, error);
        if (!is_ok (error))
@@ -1129,7 +1129,7 @@ mono_try_assembly_resolve_handle (MonoDomain *domain, MonoStringHandle fname, Mo
        MonoBoolean isrefonly;
        gpointer params [3];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_runtime_get_no_exec ())
                return ret;
@@ -1455,7 +1455,7 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name)
 char *
 mono_make_shadow_copy (const char *filename, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return (char *) filename;
 }
 #else
@@ -1530,7 +1530,7 @@ get_shadow_assembly_location_base (MonoDomain *domain, MonoError *error)
        char *userdir;
        char *location;
 
-       mono_error_init (error);
+       error_init (error);
        
        setup = domain->setup;
        if (setup->cache_path != NULL && setup->application_name != NULL) {
@@ -1574,7 +1574,7 @@ get_shadow_assembly_location (const char *filename, MonoError *error)
        char *location, *tmploc;
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error);
+       error_init (error);
        
        hash = get_cstring_hash (bname);
        hash2 = get_cstring_hash (dirname);
@@ -1759,7 +1759,7 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror)
        char *shadow_dir;
        gint32 copy_error;
 
-       mono_error_init (oerror);
+       error_init (oerror);
 
        set_domain_search_path (domain);
 
@@ -2036,7 +2036,7 @@ mono_domain_assembly_search (MonoAssemblyName *aname,
 MonoReflectionAssemblyHandle
 ves_icall_System_Reflection_Assembly_LoadFrom (MonoStringHandle fname, MonoBoolean refOnly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get ();
        char *name, *filename;
        MonoImageOpenStatus status = MONO_IMAGE_OK;
@@ -2078,7 +2078,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad,
                                            MonoBoolean refonly,
                                            MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAssembly *ass;
        MonoReflectionAssemblyHandle refass = MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE);
        MonoDomain *domain = MONO_HANDLE_GETVAL(ad, data);
@@ -2130,7 +2130,7 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad,
 MonoReflectionAssemblyHandle
 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomainHandle ad, MonoStringHandle assRef, MonoObjectHandle evidence, MonoBoolean refOnly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_GETVAL (ad, data);
        MonoImageOpenStatus status = MONO_IMAGE_OK;
        MonoAssembly *ass;
@@ -2191,7 +2191,7 @@ fail:
 void
 ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain * domain = mono_domain_get_by_id (domain_id);
 
        if (NULL == domain) {
@@ -2223,7 +2223,7 @@ ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error)
 gboolean
 ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get_by_id (domain_id);
 
        if (!domain)
@@ -2243,7 +2243,7 @@ ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomainHandle ad,
                                            MonoReflectionAssemblyHandle refass, MonoArrayHandle args,
                                            MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoImage *image;
        MonoMethod *method;
 
@@ -2276,7 +2276,7 @@ ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad)
 MonoAppDomainHandle
 ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomainHandle ad, MonoError* error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *old_domain = mono_domain_get ();
 
        if (!mono_domain_set (MONO_HANDLE_GETVAL (ad, data), FALSE)) {
@@ -2304,14 +2304,14 @@ ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid, MonoError *er
 void
 ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomainHandle ad, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_thread_push_appdomain_ref (MONO_HANDLE_GETVAL (ad, data));
 }
 
 void
 ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get_by_id (domain_id);
 
        if (!domain) {
@@ -2329,7 +2329,7 @@ ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id, MonoErro
 void
 ves_icall_System_AppDomain_InternalPopDomainRef (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_thread_pop_appdomain_ref ();
 }
 
@@ -2358,7 +2358,7 @@ ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc)
 MonoStringHandle
 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoStringHandle newguid, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain* mono_root_domain = mono_get_root_domain ();
        mono_domain_lock (mono_root_domain);
        if (process_guid_set) {
index 33300ffe884fa100278bc414205957f47bf19dbb..1766d1d51763c8f8392d790d7c0fe40674fe0c00 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,9 +138,9 @@ 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},
@@ -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
 
@@ -1889,7 +1902,7 @@ has_reference_assembly_attribute_iterator (MonoImage *image, guint32 typeref_sco
 gboolean
 mono_assembly_has_reference_assembly_attribute (MonoAssembly *assembly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * This might be called during assembly loading, so do everything using the low-level
@@ -3261,7 +3274,7 @@ static MonoAssembly*
 prevent_reference_assembly_from_running (MonoAssembly* candidate, gboolean refonly)
 {
        MonoError refasm_error;
-       mono_error_init (&refasm_error);
+       error_init (&refasm_error);
        if (candidate && !refonly && mono_assembly_has_reference_assembly_attribute (candidate, &refasm_error)) {
                candidate = NULL;
        }
index dcfd310f6490ebdd894c863b32e8c65d6ff52f6d..f0fa3579f72bcfd9b456132a305819cc8cc5e075 100644 (file)
@@ -617,6 +617,12 @@ mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits)
                return (gpointer)GC_make_descriptor ((GC_bitmap)bitmap, numbits);
 }
 
+void*
+mono_gc_make_vector_descr (void)
+{
+       return NULL;
+}
+
 void*
 mono_gc_make_root_descr_all_refs (int numbits)
 {
index fca116671a0423462d91d432e61316430e363828..0d0952b0c9ff467bb054e8eec296a6571915db12 100644 (file)
@@ -204,7 +204,7 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError
        MonoClass *res = NULL;
        MonoImage *module;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_verify_typeref_row (image, (type_token & 0xffffff) - 1, error))
                return NULL;
@@ -693,7 +693,7 @@ is_valid_generic_argument (MonoType *type)
 static MonoType*
 inflate_generic_type (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        switch (type->type) {
        case MONO_TYPE_MVAR: {
@@ -849,7 +849,7 @@ MonoType*
 mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error)
 {
        MonoType *inflated = NULL;
-       mono_error_init (error);
+       error_init (error);
 
        if (context)
                inflated = inflate_generic_type (image, type, context, error);
@@ -921,7 +921,7 @@ mono_class_inflate_generic_type_no_copy (MonoImage *image, MonoType *type, MonoG
 {
        MonoType *inflated = NULL; 
 
-       mono_error_init (error);
+       error_init (error);
        if (context) {
                inflated = inflate_generic_type (image, type, context, error);
                return_val_if_nok (error, NULL);
@@ -961,7 +961,7 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat
        MonoGenericInst *method_inst = NULL;
        MonoGenericContext res = { NULL, NULL };
 
-       mono_error_init (error);
+       error_init (error);
 
        if (context->class_inst) {
                class_inst = mono_metadata_inflate_generic_inst (context->class_inst, inflate_with, error);
@@ -1033,7 +1033,7 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
        MonoMethodSignature *sig;
        MonoGenericContext tmp_context;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* The `method' has already been instantiated before => we need to peel out the instantiation and create a new context */
        while (method->is_inflated) {
@@ -1285,7 +1285,7 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error)
 
        g_assert (klass->enumtype);
 
-       mono_error_init (error);
+       error_init (error);
 
        container = mono_class_try_get_generic_container (klass);
        if (mono_class_is_ginst (klass)) {
@@ -1494,7 +1494,7 @@ mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoCla
 {
        if (mono_class_has_failure (caused_by)) {
                MonoError cause_error;
-               mono_error_init (&cause_error);
+               error_init (&cause_error);
                mono_error_set_for_class_failure (&cause_error, caused_by);
                mono_class_set_type_load_failure (klass, "%s, due to: %s", msg, mono_error_get_message (&cause_error));
                mono_error_cleanup (&cause_error);
@@ -1860,7 +1860,7 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
                                        mono_class_setup_fields (field_class);
                                        if (mono_class_has_failure (field_class)) {
                                                MonoError field_error;
-                                               mono_error_init (&field_error);
+                                               error_init (&field_error);
                                                mono_error_set_for_class_failure (&field_error, field_class);
                                                mono_class_set_type_load_failure (klass, "Could not set up field '%s' due to: %s", field->name, mono_error_get_message (&field_error));
                                                mono_error_cleanup (&field_error);
@@ -2700,7 +2700,7 @@ mono_class_setup_events (MonoClass *klass)
                        MonoEvent *event = &events [i];
                        MonoEvent *gevent = &ginfo->events [i];
 
-                       mono_error_init (&error); //since we do conditional calls, we must ensure the default value is ok
+                       error_init (&error); //since we do conditional calls, we must ensure the default value is ok
 
                        event->parent = klass;
                        event->name = gevent->name;
@@ -5472,7 +5472,7 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError
        guint32 field_last, method_last;
        guint32 nesting_tokeen;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_metadata_token_table (type_token) != MONO_TABLE_TYPEDEF || tidx > tt->rows) {
                mono_error_set_bad_image (error, image, "Invalid typedef token %x", type_token);
@@ -6523,7 +6523,7 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
        if (eclass->byval_arg.type == MONO_TYPE_TYPEDBYREF || eclass->byval_arg.type == MONO_TYPE_VOID) {
                /*Arrays of those two types are invalid.*/
                MonoError prepared_error;
-               mono_error_init (&prepared_error);
+               error_init (&prepared_error);
                mono_error_set_invalid_program (&prepared_error, "Arrays of void or System.TypedReference types are invalid.");
                mono_class_set_failure (klass, mono_error_box (&prepared_error, klass->image));
                mono_error_cleanup (&prepared_error);
@@ -7209,7 +7209,7 @@ mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_toke
 {
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
        klass = mono_class_get_checked (image, type_token, error);
 
        if (klass && context && mono_metadata_token_table (type_token) == MONO_TABLE_TYPESPEC)
@@ -7230,7 +7230,7 @@ mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error)
 {
        MonoClass *klass = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                int table = mono_metadata_token_table (type_token);
@@ -7286,7 +7286,7 @@ mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext
        MonoType *type = NULL;
        gboolean inflated = FALSE;
 
-       mono_error_init (error);
+       error_init (error);
 
        //FIXME: this will not fix the very issue for which mono_type_get_full exists -but how to do it then?
        if (image_is_dynamic (image)) {
@@ -7529,7 +7529,7 @@ mono_class_from_name_case_checked (MonoImage *image, const char *name_space, con
        const char *nspace;
        guint32 i, visib;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                guint32 token = 0;
@@ -7611,7 +7611,7 @@ search_modules (MonoImage *image, const char *name_space, const char *name, Mono
        MonoClass *klass;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* 
         * The EXPORTEDTYPES table only contains public types, so have to search the
@@ -7647,7 +7647,7 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons
        char *nested;
        char buf [1024];
 
-       mono_error_init (error);
+       error_init (error);
 
        // Checking visited images avoids stack overflows when cyclic references exist.
        if (g_hash_table_lookup (visited_images, image))
@@ -8581,7 +8581,7 @@ gpointer
 mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class,
              MonoGenericContext *context, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                MonoClass *tmp_handle_class;
@@ -8671,7 +8671,7 @@ gpointer
 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error)
 {
        MonoClass *handle_class;
-       mono_error_init (error);
+       error_init (error);
        return mono_reflection_lookup_dynamic_token (image, token, TRUE, &handle_class, context, error);
 }
 
@@ -9384,7 +9384,7 @@ mono_field_get_type (MonoClassField *field)
 MonoType*
 mono_field_get_type_checked (MonoClassField *field, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (!field->type)
                mono_field_resolve_type (field, error);
        return field->type;
@@ -9793,7 +9793,7 @@ mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...)
        if (mono_class_has_failure (klass))
                return FALSE;
        
-       mono_error_init (&prepare_error);
+       error_init (&prepare_error);
        
        va_start (args, fmt);
        mono_error_vset_type_load_class (&prepare_error, klass, fmt, args);
@@ -9868,7 +9868,7 @@ mono_class_get_exception_for_failure (MonoClass *klass)
        if (!mono_class_has_failure (klass))
                return NULL;
        MonoError unboxed_error;
-       mono_error_init (&unboxed_error);
+       error_init (&unboxed_error);
        mono_error_set_for_class_failure (&unboxed_error, klass);
        return mono_error_convert_to_exception (&unboxed_error);
 }
@@ -10416,7 +10416,7 @@ mono_class_setup_interfaces (MonoClass *klass, MonoError *error)
        int i, interface_count;
        MonoClass **interfaces;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (klass->interfaces_inited)
                return;
@@ -10477,7 +10477,7 @@ mono_field_resolve_type (MonoClassField *field, MonoError *error)
        MonoType *ftype;
        int field_idx = field - klass->fields;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (gtd) {
                MonoClassField *gfield = &gtd->fields [field_idx];
index b587e25fa41615ac04ba133c6c1a74047d200567..b830214e8838eea0f63b3ea4125a41fe65b53a8e 100644 (file)
@@ -517,7 +517,7 @@ cominterop_get_interface_checked (MonoComObject* obj, MonoClass* ic, MonoError *
        g_assert (ic);
        g_assert (MONO_CLASS_IS_INTERFACE (ic));
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_cominterop_lock ();
        if (obj->itf_hash)
@@ -1522,7 +1522,7 @@ static gboolean cominterop_can_support_dispatch (MonoClass* klass)
 static void*
 cominterop_get_idispatch_for_object (MonoObject* object, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (!object)
                return NULL;
 
@@ -1942,7 +1942,7 @@ cominterop_get_ccw_checked (MonoObject* object, MonoClass* itf, MonoError *error
        GList *ccw_list, *ccw_list_item;
        MonoCustomAttrInfo *cinfo = NULL;
 
-       mono_error_init (error);
+       error_init (error);
        
        if (!object)
                return NULL;
@@ -2446,7 +2446,7 @@ static const IID MONO_IID_IMarshal = {0x3, 0x0, 0x0, {0xC0, 0x0, 0x0, 0x0, 0x0,
 static int
 cominterop_ccw_getfreethreadedmarshaler (MonoCCW* ccw, MonoObject* object, gpointer* ppv, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 #ifdef HOST_WIN32
        if (!ccw->free_marshaler) {
                int ret = 0;
@@ -2817,7 +2817,7 @@ mono_string_from_bstr_checked (gpointer bstr, MonoError *error)
 {
        MonoString * res = NULL;
        
-       mono_error_init (error);
+       error_init (error);
 
        if (!bstr)
                return NULL;
@@ -3586,7 +3586,7 @@ MonoString *
 mono_string_from_bstr_checked (gpointer bstr, MonoError *error)
 {
        MonoString *res = NULL;
-       mono_error_init (error);
+       error_init (error);
        if (!bstr)
                return NULL;
 #ifdef HOST_WIN32
index 938ef80b171f844072f7f031150e9fcb2c9d2a72..542bc95ed22e0364b89531c0b705d63dd23b151e 100644 (file)
@@ -16,7 +16,7 @@ MonoBoolean
 ves_icall_System_ConsoleDriver_Isatty (HANDLE handle)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("Console");
 
@@ -32,7 +32,7 @@ MonoBoolean
 ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean want_echo)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("Console");
 
@@ -48,7 +48,7 @@ MonoBoolean
 ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("Console");
 
@@ -64,7 +64,7 @@ gint32
 ves_icall_System_ConsoleDriver_InternalKeyAvailable (gint32 timeout)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("Console");
 
@@ -80,7 +80,7 @@ MonoBoolean
 ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardown, MonoArray **control_chars, int **size)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("Console");
 
index 864b846303935d16e0f081507b3ab58052e564ec..889315f06531e409d02ea705a7726a96a9de430e 100644 (file)
@@ -187,7 +187,7 @@ load_cattr_enum_type (MonoImage *image, const char *p, const char **end, MonoErr
        MonoType *t;
        int slen = mono_metadata_decode_value (p, &p);
 
-       mono_error_init (error);
+       error_init (error);
 
        n = (char *)g_memdup (p, slen + 1);
        n [slen] = 0;
@@ -205,7 +205,7 @@ load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char **end
        int slen, type = t->type;
        MonoClass *tklass = t->data.klass;
 
-       mono_error_init (error);
+       error_init (error);
 
 handle_enum:
        switch (type) {
@@ -447,7 +447,7 @@ handle_type:
 static MonoObject*
 load_cattr_value_boxed (MonoDomain *domain, MonoImage *image, MonoType *t, const char* p, const char** end, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        gboolean is_ref = type_is_reference (t);
 
@@ -473,7 +473,7 @@ create_cattr_typed_arg (MonoType *t, MonoObject *val, MonoError *error)
        MonoObject *retval;
        void *params [2], *unboxed;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!ctor)
                ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_typed_argument_class (), ".ctor", 2);
@@ -499,7 +499,7 @@ create_cattr_named_arg (void *minfo, MonoObject *typedarg, MonoError *error)
        MonoObject *retval;
        void *unboxed, *params [2];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!ctor)
                ctor = mono_class_get_method_from_name (mono_class_get_custom_attribute_named_argument_class (), ".ctor", 2);
@@ -578,7 +578,7 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu
        void **params = NULL;
        MonoMethodSignature *sig;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_class_init (method->klass);
 
@@ -759,7 +759,7 @@ mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *meth
        *named_args = NULL;
        *named_arg_info = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_verify_cattr_content (image, method, data, len, NULL)) {
                mono_error_set_generic_error (error, "System.Reflection", "CustomAttributeFormatException", "Binary format of the specified custom attribute was invalid.");
@@ -888,7 +888,7 @@ reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, Mono
        CattrNamedArg *arginfo = NULL;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        *ctor_args = NULL;
        *named_args = NULL;
@@ -970,7 +970,7 @@ create_custom_attr_data_handle (MonoImage *image, MonoCustomAttrEntry *cattr, Mo
        MonoDomain *domain;
        void *params [4];
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (image->assembly);
 
@@ -1015,7 +1015,7 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_
        MonoObject *attr;
        int i, n;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (i = 0; i < cinfo->num_attrs; ++i) {
                MonoCustomAttrEntry *centry = &cinfo->attrs[i];
@@ -1072,7 +1072,7 @@ mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo, MonoError *error)
        MonoObject *attr;
        int i;
        
-       mono_error_init (error);
+       error_init (error);
        result = mono_array_new_checked (mono_domain_get (), mono_defaults.customattribute_data_class, cinfo->num_attrs, error);
        return_val_if_nok (error, NULL);
        for (i = 0; i < cinfo->num_attrs; ++i) {
@@ -1112,7 +1112,7 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
        const char *data;
        MonoCustomAttrEntry* attr;
 
-       mono_error_init (error);
+       error_init (error);
 
        ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
 
@@ -1152,7 +1152,7 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig
                        g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x due to: %s", image->name, mtoken, mono_error_get_message (error));
                        if (ignore_missing) {
                                mono_error_cleanup (error);
-                               mono_error_init (error);
+                               error_init (error);
                        } else {
                                g_list_free (list);
                                g_free (ainfo);
@@ -1190,7 +1190,7 @@ mono_custom_attrs_from_method_checked (MonoMethod *method, MonoError *error)
 {
        guint32 idx;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * An instantiated method has the same cattrs as the generic method definition.
@@ -1228,7 +1228,7 @@ mono_custom_attrs_from_class_checked (MonoClass *klass, MonoError *error)
 {
        guint32 idx;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_class_is_ginst (klass))
                klass = mono_class_get_generic_class (klass)->container_class;
@@ -1262,7 +1262,7 @@ mono_custom_attrs_from_assembly_checked (MonoAssembly *assembly, gboolean ignore
 {
        guint32 idx;
        
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (assembly->image))
                return lookup_custom_attr (assembly->image, assembly);
@@ -1346,7 +1346,7 @@ MonoCustomAttrInfo*
 mono_custom_attrs_from_field_checked (MonoClass *klass, MonoClassField *field, MonoError *error)
 {
        guint32 idx;
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (klass->image)) {
                field = mono_metadata_get_corresponding_field_from_generic_type_definition (field);
@@ -1395,7 +1395,7 @@ mono_custom_attrs_from_param_checked (MonoMethod *method, guint32 param, MonoErr
        MonoImage *image;
        MonoReflectionMethodAux *aux;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * An instantiated method has the same cattrs as the generic method definition.
@@ -1486,7 +1486,7 @@ mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_k
 
        g_assert (attr_klass != NULL);
 
-       mono_error_init (error);
+       error_init (error);
 
        for (i = 0; i < ainfo->num_attrs; ++i) {
                centry = &ainfo->attrs[i];
@@ -1538,7 +1538,7 @@ mono_reflection_get_custom_attrs_info_checked (MonoObject *obj, MonoError *error
        MonoClass *klass;
        MonoCustomAttrInfo *cinfo = NULL;
        
-       mono_error_init (error);
+       error_init (error);
 
        klass = obj->vtable->klass;
        if (klass == mono_defaults.runtimetype_class) {
@@ -1650,7 +1650,7 @@ mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass
        MonoArray *result;
        MonoCustomAttrInfo *cinfo;
 
-       mono_error_init (error);
+       error_init (error);
 
        cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
        return_val_if_nok (error, NULL);
@@ -1716,7 +1716,7 @@ mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error
        MonoArray *result;
        MonoCustomAttrInfo *cinfo;
 
-       mono_error_init (error);
+       error_init (error);
 
        cinfo = mono_reflection_get_custom_attrs_info_checked (obj, error);
        return_val_if_nok (error, NULL);
index 810d41197919ce7d0700169d2d080fced5c6db26..0785369e0c65662c1e35da8696d3ab2ecf47789c 100644 (file)
@@ -494,6 +494,8 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        mono_counters_register ("Max code space allocated in a domain", MONO_COUNTER_INT|MONO_COUNTER_JIT, &max_domain_code_alloc);
        mono_counters_register ("Total code space allocated", MONO_COUNTER_INT|MONO_COUNTER_JIT, &total_domain_code_alloc);
 
+       mono_counters_register ("Max HashTable Chain Length", MONO_COUNTER_INT|MONO_COUNTER_METADATA, &mono_g_hash_table_max_chain_length);
+
        mono_gc_base_init ();
        mono_thread_info_attach (&dummy);
 
index 8ee2e59993af58efa2418fd11722c19cf5aee2b2..eb91e637d4bac6204368cd8f332c8fe1aaab2c36 100644 (file)
@@ -256,7 +256,7 @@ mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean
        MonoObject *obj;
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
        
        obj = lookup_dyn_token (assembly, token);
        if (!obj) {
@@ -277,7 +277,7 @@ mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean
 gpointer
 mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return NULL;
 }
 #endif /* DISABLE_REFLECTION_EMIT */
index 6cf6370e0401f23a04f1d96ab331ac8f3014a49d..3b62211ef3ed2524ad1e6785e2ca9fdbb399959c 100644 (file)
@@ -76,7 +76,7 @@ mono_dynstream_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        char *name = mono_string_to_utf8_checked (str, error);
        return_val_if_nok (error, -1);
        guint32 idx;
index baaa2af993a468c4cc8eed506c3d82e3c419bb79..e6158463a5ae59c2378745bbcd645bf4ccce698d 100644 (file)
@@ -208,7 +208,7 @@ mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name
 {
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
        klass = mono_class_load_from_name (image, name_space, name);
 
        return create_exception_two_strings (klass, a1, a2, error);
@@ -269,7 +269,7 @@ mono_exception_from_token_two_strings_checked (MonoImage *image, guint32 token,
 {
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
 
        klass = mono_class_get_checked (image, token, error);
        mono_error_assert_ok (error); /* FIXME handle the error. */
@@ -867,7 +867,7 @@ mono_get_exception_reflection_type_load_checked (MonoArrayHandle types, MonoArra
        MonoMethod *method;
        gpointer iter;
 
-       mono_error_init (error);
+       error_init (error);
 
        klass = mono_class_load_from_name (mono_get_corlib (), "System.Reflection", "ReflectionTypeLoadException");
 
@@ -1017,7 +1017,7 @@ ves_icall_Mono_Runtime_GetNativeStackTrace (MonoExceptionHandle exc, MonoError *
 {
        char *trace;
        MonoStringHandle res;
-       mono_error_init (error);
+       error_init (error);
 
        if (!exc) {
                mono_error_set_argument_null (error, "exception", "");
index 38aa44de6caf0297dd75eb7ecc4432458312ce4c..f71f0bc9f4a667052760a35b79296e6047badfd1 100644 (file)
@@ -168,8 +168,6 @@ void mono_gc_wbarrier_set_root (gpointer ptr, MonoObject *value);
        mono_gc_wbarrier_set_root (&((s)->fieldname), (MonoObject*)value); \
 } while (0)
 
-void  mono_gc_finalize_threadpool_threads (void);
-
 /* fast allocation support */
 
 typedef enum {
index bf53c0f126b18873869bc018cc674cbb2fa057b6..7402096d704dfd5bf71ba5d1ac5d7b8801152365 100644 (file)
@@ -68,7 +68,6 @@ static MonoCoopMutex finalizer_mutex;
 static MonoCoopMutex reference_queue_mutex;
 
 static GSList *domains_to_finalize;
-static MonoMList *threads_to_finalize;
 
 static gboolean finalizer_thread_exited;
 /* Uses finalizer_mutex */
@@ -157,18 +156,6 @@ coop_cond_timedwait_alertable (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32
        return res;
 }
 
-static gboolean
-add_thread_to_finalize (MonoInternalThread *thread, MonoError *error)
-{
-       mono_error_init (error);
-       mono_finalizer_lock ();
-       if (!threads_to_finalize)
-               MONO_GC_REGISTER_ROOT_SINGLE (threads_to_finalize, MONO_ROOT_SOURCE_FINALIZER_QUEUE, "finalizable threads list");
-       threads_to_finalize = mono_mlist_append_checked (threads_to_finalize, (MonoObject*)thread, error);
-       mono_finalizer_unlock ();
-       return is_ok (error);
-}
-
 /* 
  * actually, we might want to queue the finalize requests in a separate thread,
  * but we need to be careful about the execution domain of the thread...
@@ -241,15 +228,6 @@ mono_gc_run_finalize (void *obj, void *data)
                if (mono_gc_is_finalizer_internal_thread (t))
                        /* Avoid finalizing ourselves */
                        return;
-
-               if (t->threadpool_thread && finalizing_root_domain) {
-                       /* Don't finalize threadpool threads when
-                          shutting down - they're finalized when the
-                          threadpool shuts down. */
-                       if (!add_thread_to_finalize (t, &error))
-                               goto unhandled_error;
-                       return;
-               }
        }
 
        if (o->vtable->klass->image == mono_defaults.corlib && !strcmp (o->vtable->klass->name, "DynamicMethod") && finalizing_root_domain) {
@@ -344,22 +322,6 @@ unhandled_error:
        mono_domain_set_internal (caller_domain);
 }
 
-void
-mono_gc_finalize_threadpool_threads (void)
-{
-       while (threads_to_finalize) {
-               MonoInternalThread *thread = (MonoInternalThread*) mono_mlist_get_data (threads_to_finalize);
-
-               /* Force finalization of the thread. */
-               thread->threadpool_thread = FALSE;
-               mono_object_register_finalizer ((MonoObject*)thread);
-
-               mono_gc_run_finalize (thread, NULL);
-
-               threads_to_finalize = mono_mlist_next (threads_to_finalize);
-       }
-}
-
 gpointer
 mono_gc_out_of_memory (size_t size)
 {
@@ -555,11 +517,6 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                goto done;
        }
 
-       if (domain == mono_get_root_domain ()) {
-               mono_threadpool_cleanup ();
-               mono_gc_finalize_threadpool_threads ();
-       }
-
 done:
        if (InterlockedDecrement (&req->ref) == 0) {
                mono_coop_sem_destroy (&req->done);
index f43e22f5d39ff47fc302bcafec9d7d9be1c04c1b..7867984e28ff8dc29723a44b21c84eae71df31d9 100644 (file)
@@ -30,7 +30,7 @@ MonoArray *
 mono_icall_get_logical_drives (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetLogicalDriveStrings");
 
@@ -46,7 +46,7 @@ void
 mono_icall_broadcast_setting_change (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("SendMessageTimeout");
 
@@ -62,7 +62,7 @@ guint32
 mono_icall_drive_info_get_drive_type (MonoString *root_path_name)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetDriveType");
 
@@ -76,7 +76,7 @@ gint32
 mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("WaitForInputIdle");
 
index 4b56f40534580723c95cc798dbaf9b8d2e636d49..6f76a3250a9e96b5cd2bb5664d5885cf0e4aa80b 100644 (file)
@@ -130,7 +130,7 @@ is_generic_parameter (MonoType *type)
 static void
 mono_class_init_checked (MonoClass *klass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_class_init (klass))
                mono_error_set_for_class_failure (error, klass);
@@ -232,7 +232,7 @@ ves_icall_System_Array_SetValueImpl (MonoArray *arr, MonoObject *value, guint32
        gint64 i64 = 0;
        gdouble r64 = 0;
 
-       mono_error_init (&error);
+       error_init (&error);
 
        if (value)
                vc = value->vtable->klass;
@@ -844,7 +844,7 @@ ves_icall_System_Array_SetGenericValueImpl (MonoArray *arr, guint32 pos, gpointe
 ICALL_EXPORT void
 ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoArrayHandle array, MonoClassField *field_handle, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoClass *klass = mono_handle_class (array);
        guint32 size = mono_array_element_size (klass);
@@ -1216,7 +1216,7 @@ ves_icall_System_ValueType_Equals (MonoObject *this_obj, MonoObject *that, MonoA
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_System_Object_GetType (MonoObjectHandle obj, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (obj);
        MonoClass *klass = mono_handle_class (obj);
 #ifndef DISABLE_REMOTING
@@ -1313,7 +1313,7 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoAsse
        gboolean type_resolve = FALSE;
        MonoImage *rootimage = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * We must compute the calling assembly as type loading must happen under a metadata context.
@@ -1402,7 +1402,7 @@ ves_icall_System_Type_internal_from_name (MonoStringHandle name,
                                          MonoBoolean ignoreCase,
                                          MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoTypeNameParse info;
        gboolean parsedOk;
        MonoAssembly *caller_assembly;
@@ -1460,7 +1460,7 @@ leave:
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_System_Type_internal_from_handle (MonoType *handle, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get (); 
 
        return mono_type_get_object_handle (domain, handle, error);
@@ -1518,7 +1518,7 @@ typedef enum {
 ICALL_EXPORT guint32
 ves_icall_type_GetTypeCodeInternal (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        int t = type->type;
 
@@ -1612,7 +1612,7 @@ mono_type_get_underlying_type_ignore_byref (MonoType *type)
 ICALL_EXPORT guint32
 ves_icall_RuntimeTypeHandle_type_is_assignable_from (MonoReflectionTypeHandle ref_type, MonoReflectionTypeHandle ref_c, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (!MONO_HANDLE_IS_NULL (ref_type));
        
@@ -1652,7 +1652,7 @@ ves_icall_RuntimeTypeHandle_type_is_assignable_from (MonoReflectionTypeHandle re
 ICALL_EXPORT guint32
 ves_icall_RuntimeTypeHandle_IsInstanceOfType (MonoReflectionTypeHandle ref_type, MonoObjectHandle obj, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
        mono_class_init_checked (klass, error);
@@ -1665,7 +1665,7 @@ ves_icall_RuntimeTypeHandle_IsInstanceOfType (MonoReflectionTypeHandle ref_type,
 ICALL_EXPORT guint32
 ves_icall_RuntimeTypeHandle_GetAttributes (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
        return mono_class_get_flags (klass);
@@ -1674,7 +1674,7 @@ ves_icall_RuntimeTypeHandle_GetAttributes (MonoReflectionTypeHandle ref_type, Mo
 ICALL_EXPORT MonoReflectionMarshalAsAttributeHandle
 ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionFieldHandle field_h, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (field_h);
        MonoClassField *field = MONO_HANDLE_GETVAL (field_h, field);
        MonoClass *klass = field->parent;
@@ -1710,7 +1710,7 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
 
        g_assert (handle);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!type) {
                klass = handle->parent;
@@ -1734,7 +1734,7 @@ ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *hand
 
        g_assert (handle);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!type) {
                klass = handle->parent;
@@ -1754,7 +1754,7 @@ ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *hand
 ICALL_EXPORT MonoReflectionPropertyHandle
 ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass;
 
        g_assert (handle);
@@ -1776,7 +1776,7 @@ ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionFieldHandle field_h, MonoBoolean optional, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClassField *field = MONO_HANDLE_GETVAL (field_h, field);
 
        MonoType *type = mono_field_get_type_checked (field, error);
@@ -1838,7 +1838,7 @@ ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info (MonoMethod *method, MonoReflectionMethodHandle member, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get (); 
 
        MonoReflectionTypeHandle reftype = MONO_HANDLE_NEW (MonoReflectionType, NULL);
@@ -1852,7 +1852,7 @@ ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info (MonoMethod *metho
 ICALL_EXPORT MonoReflectionMarshalAsAttributeHandle
 ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get (); 
        MonoReflectionMarshalAsAttributeHandle res = MONO_HANDLE_NEW (MonoReflectionMarshalAsAttribute, NULL);
 
@@ -1886,7 +1886,7 @@ ves_icall_MonoField_GetFieldOffset (MonoReflectionField *field)
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_MonoField_GetParentType (MonoReflectionFieldHandle field, MonoBoolean declaring, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (field);
        MonoClass *parent;
 
@@ -2152,7 +2152,7 @@ ves_icall_MonoField_GetRawConstantValue (MonoReflectionField *rfield)
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_MonoField_ResolveType (MonoReflectionFieldHandle ref_field, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_field);
        MonoClassField *field = MONO_HANDLE_GETVAL (ref_field, field);
        MonoType *type = mono_field_get_type_checked (field, error);
@@ -2377,7 +2377,7 @@ get_interfaces_hash (gconstpointer v1)
 ICALL_EXPORT MonoArrayHandle
 ves_icall_RuntimeType_GetInterfaces (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
 
@@ -2437,7 +2437,7 @@ static gboolean
 set_interface_map_data_method_object (MonoDomain *domain, MonoMethod *method, MonoClass *iclass, int ioffset, MonoClass *klass, MonoArrayHandle targets, MonoArrayHandle methods, int i, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionMethodHandle member = mono_method_get_object_handle (domain, method, iclass, error);
        if (!is_ok (error))
                goto leave;
@@ -2457,7 +2457,7 @@ leave:
 ICALL_EXPORT void
 ves_icall_RuntimeType_GetInterfaceMapData (MonoReflectionTypeHandle ref_type, MonoReflectionTypeHandle ref_iface, MonoArrayHandleOut targets, MonoArrayHandleOut methods, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
        MonoType *iface = MONO_HANDLE_GETVAL (ref_iface, type);
@@ -2498,7 +2498,7 @@ ves_icall_RuntimeType_GetInterfaceMapData (MonoReflectionTypeHandle ref_type, Mo
 ICALL_EXPORT void
 ves_icall_RuntimeType_GetPacking (MonoReflectionTypeHandle ref_type, guint32 *packing, guint32 *size, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
 
@@ -2518,7 +2518,7 @@ ves_icall_RuntimeType_GetPacking (MonoReflectionTypeHandle ref_type, guint32 *pa
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeTypeHandle_GetElementType (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
@@ -2547,7 +2547,7 @@ ves_icall_RuntimeTypeHandle_GetElementType (MonoReflectionTypeHandle ref_type, M
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeTypeHandle_GetBaseType (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
@@ -2565,7 +2565,7 @@ ves_icall_RuntimeTypeHandle_GetBaseType (MonoReflectionTypeHandle ref_type, Mono
 ICALL_EXPORT MonoBoolean
 ves_icall_RuntimeTypeHandle_IsPointer (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        return type->type == MONO_TYPE_PTR;
 }
@@ -2573,7 +2573,7 @@ ves_icall_RuntimeTypeHandle_IsPointer (MonoReflectionTypeHandle ref_type, MonoEr
 ICALL_EXPORT MonoBoolean
 ves_icall_RuntimeTypeHandle_IsPrimitive (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        return (!type->byref && (((type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8)) || (type->type == MONO_TYPE_I) || (type->type == MONO_TYPE_U)));
 }
@@ -2581,7 +2581,7 @@ ves_icall_RuntimeTypeHandle_IsPrimitive (MonoReflectionTypeHandle ref_type, Mono
 ICALL_EXPORT MonoBoolean
 ves_icall_RuntimeTypeHandle_IsByRef (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        return type->byref;
 }
@@ -2589,7 +2589,7 @@ ves_icall_RuntimeTypeHandle_IsByRef (MonoReflectionTypeHandle ref_type, MonoErro
 ICALL_EXPORT MonoBoolean
 ves_icall_RuntimeTypeHandle_IsComObject (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
        mono_class_init_checked (klass, error);
@@ -2602,14 +2602,14 @@ ves_icall_RuntimeTypeHandle_IsComObject (MonoReflectionTypeHandle ref_type, Mono
 ICALL_EXPORT guint32
 ves_icall_reflection_get_token (MonoObjectHandle obj, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return mono_reflection_get_token_checked (obj, error);
 }
 
 ICALL_EXPORT MonoReflectionModuleHandle
 ves_icall_RuntimeTypeHandle_GetModule (MonoReflectionTypeHandle type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (type);
        MonoType *t = MONO_HANDLE_GETVAL (type, type);
        MonoClass *klass = mono_class_from_mono_type (t);
@@ -2619,7 +2619,7 @@ ves_icall_RuntimeTypeHandle_GetModule (MonoReflectionTypeHandle type, MonoError
 ICALL_EXPORT MonoReflectionAssemblyHandle
 ves_icall_RuntimeTypeHandle_GetAssembly (MonoReflectionTypeHandle type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get (); 
        MonoType *t = MONO_HANDLE_GETVAL (type, type);
        MonoClass *klass = mono_class_from_mono_type (t);
@@ -2629,7 +2629,7 @@ ves_icall_RuntimeTypeHandle_GetAssembly (MonoReflectionTypeHandle type, MonoErro
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeType_get_DeclaringType (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get ();
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass;
@@ -2689,7 +2689,7 @@ ves_icall_RuntimeType_get_Namespace (MonoReflectionTypeHandle type, MonoError *e
 ICALL_EXPORT gint32
 ves_icall_RuntimeTypeHandle_GetArrayRank (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        if (type->type != MONO_TYPE_ARRAY && type->type != MONO_TYPE_SZARRAY) {
@@ -2712,7 +2712,7 @@ static gboolean
 set_type_object_in_array (MonoDomain *domain, MonoType *type, MonoArrayHandle dest, int i, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, type, error);
        if (!is_ok (error))
                goto leave;
@@ -2726,7 +2726,7 @@ leave:
 ICALL_EXPORT MonoArrayHandle
 ves_icall_RuntimeType_GetGenericArguments (MonoReflectionTypeHandle ref_type, MonoBoolean runtimeTypeArray, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
 
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
@@ -2763,7 +2763,7 @@ leave:
 ICALL_EXPORT gboolean
 ves_icall_RuntimeTypeHandle_IsGenericTypeDefinition (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (!IS_MONOTYPE (MONO_HANDLE_RAW(ref_type)))
                return FALSE;
@@ -2779,7 +2779,7 @@ ves_icall_RuntimeTypeHandle_IsGenericTypeDefinition (MonoReflectionTypeHandle re
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeTypeHandle_GetGenericTypeDefinition_impl (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        MonoReflectionTypeHandle ret = MONO_HANDLE_NEW (MonoReflectionType, NULL);
@@ -2815,7 +2815,7 @@ leave:
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeType_MakeGenericType (MonoReflectionTypeHandle reftype, MonoArrayHandle type_array, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (reftype);
 
        g_assert (IS_MONOTYPE_HANDLE (reftype));
@@ -2853,7 +2853,7 @@ ves_icall_RuntimeType_MakeGenericType (MonoReflectionTypeHandle reftype, MonoArr
 ICALL_EXPORT gboolean
 ves_icall_RuntimeTypeHandle_HasInstantiation (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass;
 
        if (!IS_MONOTYPE (MONO_HANDLE_RAW (ref_type)))
@@ -2870,7 +2870,7 @@ ves_icall_RuntimeTypeHandle_HasInstantiation (MonoReflectionTypeHandle ref_type,
 ICALL_EXPORT gint32
 ves_icall_RuntimeType_GetGenericParameterPosition (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (!IS_MONOTYPE_HANDLE (ref_type))
                return -1;
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
@@ -2883,7 +2883,7 @@ ves_icall_RuntimeType_GetGenericParameterPosition (MonoReflectionTypeHandle ref_
 ICALL_EXPORT MonoGenericParamInfo *
 ves_icall_RuntimeTypeHandle_GetGenericParameterInfo (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        return mono_generic_param_info (type->data.generic_param);
 }
@@ -2900,7 +2900,7 @@ ves_icall_RuntimeType_GetCorrespondingInflatedMethod (MonoReflectionTypeHandle r
                                                      MonoReflectionMethodHandle generic,
                                                      MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -2928,7 +2928,7 @@ ves_icall_RuntimeType_GetCorrespondingInflatedMethod (MonoReflectionTypeHandle r
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_RuntimeType_get_DeclaringMethod (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoReflectionMethodHandle ret = MONO_HANDLE_NEW (MonoReflectionMethod, NULL);
 
@@ -2952,7 +2952,7 @@ leave:
 ICALL_EXPORT MonoBoolean
 ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_error_set_not_implemented (error, "%s", "");
        return FALSE;
 }
@@ -2960,7 +2960,7 @@ ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime (MonoError *error)
 ICALL_EXPORT MonoBoolean
 ves_icall_System_RuntimeType_IsWindowsRuntimeObjectType (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_error_set_not_implemented (error, "%s", "");
        return FALSE;
 }
@@ -2980,7 +2980,7 @@ ves_icall_MonoMethod_GetPInvoke (MonoReflectionMethodHandle ref_method, int* fla
        const char *import = NULL;
        const char *scope = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                MonoReflectionMethodAux *method_aux = 
@@ -3015,7 +3015,7 @@ ves_icall_MonoMethod_GetPInvoke (MonoReflectionMethodHandle ref_method, int* fla
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_MonoMethod_GetGenericMethodDefinition (MonoReflectionMethodHandle ref_method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *method = MONO_HANDLE_GETVAL (ref_method, method);
 
        if (method->is_generic)
@@ -3076,7 +3076,7 @@ static gboolean
 set_array_generic_argument_handle_inflated (MonoDomain *domain, MonoGenericInst *inst, int i, MonoArrayHandle arr, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, inst->type_argv [i], error);
        if (!is_ok (error))
                goto leave;
@@ -3089,7 +3089,7 @@ static gboolean
 set_array_generic_argument_handle_gparam (MonoDomain *domain, MonoGenericContainer *container, int i, MonoArrayHandle arr, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoGenericParam *param = mono_generic_container_get_param (container, i);
        MonoClass *pklass = mono_class_from_generic_parameter_internal (param);
        MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &pklass->byval_arg, error);
@@ -3103,7 +3103,7 @@ leave:
 ICALL_EXPORT MonoArrayHandle
 ves_icall_MonoMethod_GetGenericArguments (MonoReflectionMethodHandle ref_method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_method);
        MonoMethod *method = MONO_HANDLE_GETVAL (ref_method, method);
 
@@ -3665,7 +3665,7 @@ ves_icall_System_Enum_get_hashcode (MonoObject *eobj)
 static void
 get_enum_field (MonoDomain *domain, MonoArrayHandle names, MonoArrayHandle values, int base_type, MonoClassField *field, guint* j, guint64 *previous_value, gboolean *sorted, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        HANDLE_FUNCTION_ENTER();
        guint64 field_value;
        const char *p;
@@ -3709,7 +3709,7 @@ ves_icall_System_Enum_GetEnumValuesAndNames (MonoReflectionTypeHandle type, Mono
        guint64 previous_value = 0;
        gboolean sorted = TRUE;
 
-       mono_error_init (error);
+       error_init (error);
        mono_class_init_checked (enumc, error);
        return_val_if_nok (error, FALSE);
 
@@ -3759,7 +3759,7 @@ enum {
 ICALL_EXPORT GPtrArray*
 ves_icall_RuntimeType_GetFields_native (MonoReflectionTypeHandle ref_type, char *utf8_name, guint32 bflags, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        if (type->byref) {
@@ -3855,7 +3855,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla
 
        array = g_ptr_array_new ();
        startklass = klass;
-       mono_error_init (error);
+       error_init (error);
 
        if (name != NULL)
                compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
@@ -3952,7 +3952,7 @@ loader_error:
 ICALL_EXPORT GPtrArray*
 ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionTypeHandle ref_type, const char *mname, guint32 bflags, MonoBoolean ignore_case, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -3966,7 +3966,7 @@ ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionTypeHandle ref_type
 ICALL_EXPORT GPtrArray*
 ves_icall_RuntimeType_GetConstructors_native (MonoReflectionTypeHandle ref_type, guint32 bflags, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        if (type->byref) {
                return g_ptr_array_new ();
@@ -4083,7 +4083,7 @@ property_accessor_nonpublic (MonoMethod* accessor, gboolean start_klass)
 ICALL_EXPORT GPtrArray*
 ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionTypeHandle ref_type, gchar *propname, guint32 bflags, MonoBoolean ignore_case, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
 
@@ -4189,7 +4189,7 @@ event_equal (MonoEvent *event1, MonoEvent *event2)
 ICALL_EXPORT GPtrArray*
 ves_icall_RuntimeType_GetEvents_native (MonoReflectionTypeHandle ref_type, char *utf8_name, guint32 bflags, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        if (type->byref) {
@@ -4281,7 +4281,7 @@ failure:
 ICALL_EXPORT GPtrArray *
 ves_icall_RuntimeType_GetNestedTypes_native (MonoReflectionTypeHandle ref_type, char *str, guint32 bflags, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        if (type->byref) {
@@ -4331,7 +4331,7 @@ static MonoType*
 get_type_from_module_builder_module (MonoArrayHandle modules, int i, MonoTypeNameParse *info, MonoBoolean ignoreCase, gboolean *type_resolve, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = NULL;
        MonoReflectionModuleBuilderHandle mb = MONO_HANDLE_NEW (MonoReflectionModuleBuilder, NULL);
        MONO_HANDLE_ARRAY_GETREF (mb, modules, i);
@@ -4344,7 +4344,7 @@ static MonoType*
 get_type_from_module_builder_loaded_modules (MonoArrayHandle loaded_modules, int i, MonoTypeNameParse *info, MonoBoolean ignoreCase, gboolean *type_resolve, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = NULL;
        MonoReflectionModuleHandle mod = MONO_HANDLE_NEW (MonoReflectionModule, NULL);
        MONO_HANDLE_ARRAY_GETREF (mod, loaded_modules, i);
@@ -4356,7 +4356,7 @@ get_type_from_module_builder_loaded_modules (MonoArrayHandle loaded_modules, int
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssemblyHandle assembly_h, MonoReflectionModuleHandle module, MonoStringHandle name, MonoBoolean throwOnError, MonoBoolean ignoreCase, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoTypeNameParse info;
        gboolean type_resolve;
@@ -4522,7 +4522,7 @@ replace_shadow_path (MonoDomain *domain, gchar *dirname, gchar **filename)
 ICALL_EXPORT MonoStringHandle
 ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssemblyHandle assembly, MonoBoolean escaped, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly);
        MonoAssembly *mass = MONO_HANDLE_GETVAL (assembly, assembly);
        gchar *absolute;
@@ -4564,7 +4564,7 @@ ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssemblyHandle
 ICALL_EXPORT MonoBoolean
 ves_icall_System_Reflection_Assembly_get_global_assembly_cache (MonoReflectionAssemblyHandle assembly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAssembly *mass = MONO_HANDLE_GETVAL (assembly,assembly);
 
        return mass->in_gac;
@@ -4602,7 +4602,7 @@ ves_icall_System_Reflection_Assembly_get_location (MonoReflectionAssemblyHandle
 ICALL_EXPORT MonoBoolean
 ves_icall_System_Reflection_Assembly_get_ReflectionOnly (MonoReflectionAssemblyHandle assembly_h, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        return assembly->ref_only;
 }
@@ -4619,7 +4619,7 @@ ves_icall_System_Reflection_Assembly_InternalImageRuntimeVersion (MonoReflection
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_System_Reflection_Assembly_get_EntryPoint (MonoReflectionAssemblyHandle assembly_h, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly_h);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoMethod *method;
@@ -4641,7 +4641,7 @@ leave:
 ICALL_EXPORT MonoReflectionModuleHandle
 ves_icall_System_Reflection_Assembly_GetManifestModuleInternal (MonoReflectionAssemblyHandle assembly, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly);
        MonoAssembly *a = MONO_HANDLE_GETVAL (assembly, assembly);
        return mono_module_get_object_handle (domain, a->image, error);
@@ -4651,7 +4651,7 @@ static gboolean
 add_manifest_resource_name_to_array (MonoDomain *domain, MonoImage *image, MonoTableInfo *table, int i, MonoArrayHandle dest, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        const char *val = mono_metadata_string_heap (image, mono_metadata_decode_row_col (table, i, MONO_MANIFEST_NAME));
        MonoStringHandle str = mono_string_new_handle (domain, val, error);
        if (!is_ok (error))
@@ -4664,7 +4664,7 @@ leave:
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_Assembly_GetManifestResourceNames (MonoReflectionAssemblyHandle assembly_h, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly_h);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoTableInfo *table = &assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
@@ -4696,7 +4696,7 @@ ves_icall_System_Reflection_Assembly_GetAotId (MonoError *error)
 static MonoAssemblyName*
 create_referenced_assembly_name (MonoDomain *domain, MonoImage *image, MonoTableInfo *t, int i, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAssemblyName *aname = g_new0 (MonoAssemblyName, 1);
 
        mono_assembly_get_assemblyref (image, i, aname);
@@ -4719,7 +4719,7 @@ create_referenced_assembly_name (MonoDomain *domain, MonoImage *image, MonoTable
 ICALL_EXPORT GPtrArray*
 ves_icall_System_Reflection_Assembly_InternalGetReferencedAssemblies (MonoReflectionAssemblyHandle assembly, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly);
        MonoAssembly *ass = MONO_HANDLE_GETVAL(assembly, assembly);
        MonoImage *image = ass->image;
@@ -4758,7 +4758,7 @@ g_concat_dir_and_file (const char *dir, const char *file)
 ICALL_EXPORT void *
 ves_icall_System_Reflection_Assembly_GetManifestResourceInternal (MonoReflectionAssemblyHandle assembly_h, MonoStringHandle name, gint32 *size, MonoReflectionModuleHandleOut ref_module, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly_h);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoTableInfo *table = &assembly->image->tables [MONO_TABLE_MANIFESTRESOURCE];
@@ -4887,7 +4887,7 @@ leave:
 ICALL_EXPORT gboolean
 ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (MonoReflectionAssemblyHandle assembly_h, MonoStringHandle name, MonoManifestResourceInfoHandle info_h, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return get_manifest_resource_info_internal (assembly_h, name, info_h, error);
 }
 
@@ -4895,7 +4895,7 @@ static gboolean
 add_filename_to_files_array (MonoDomain *domain, MonoAssembly * assembly, MonoTableInfo *table, int i, MonoArrayHandle dest, int dest_idx, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER();
-       mono_error_init (error);
+       error_init (error);
        const char *val = mono_metadata_string_heap (assembly->image, mono_metadata_decode_row_col (table, i, MONO_FILE_NAME));
        char *n = g_concat_dir_and_file (assembly->basedir, val);
        MonoStringHandle str = mono_string_new_handle (domain, n, error);
@@ -4910,7 +4910,7 @@ leave:
 ICALL_EXPORT MonoObjectHandle
 ves_icall_System_Reflection_Assembly_GetFilesInternal (MonoReflectionAssemblyHandle assembly_h, MonoStringHandle name, MonoBoolean resource_modules, MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly_h);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoTableInfo *table = &assembly->image->tables [MONO_TABLE_FILE];
@@ -4965,7 +4965,7 @@ static gboolean
 add_module_to_modules_array (MonoDomain *domain, MonoArrayHandle dest, int *dest_idx, MonoImage* module, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        if (module) {
                MonoReflectionModuleHandle rm = mono_module_get_object_handle (domain, module, error);
                if (!is_ok (error))
@@ -4983,7 +4983,7 @@ static gboolean
 add_file_to_modules_array (MonoDomain *domain, MonoArrayHandle dest, int dest_idx, MonoImage *image, MonoTableInfo *table, int table_idx,  MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
 
        guint32 cols [MONO_FILE_SIZE];
        mono_metadata_decode_row (table, table_idx, cols, MONO_FILE_SIZE);
@@ -5014,7 +5014,7 @@ leave:
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssemblyHandle assembly_h, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get();
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoClass *klass;
@@ -5067,7 +5067,7 @@ fail:
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_GetCurrentMethod (MonoError *error) 
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoMethod *m = mono_method_get_last_managed ();
 
@@ -5124,7 +5124,7 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (MonoMethod *method, MonoType *type, MonoBoolean generic_check, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass;
        if (type && generic_check) {
                klass = mono_class_from_mono_type (type);
@@ -5146,14 +5146,14 @@ ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (M
 ICALL_EXPORT MonoReflectionMethodBodyHandle
 ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal (MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return mono_method_body_get_object_handle (mono_domain_get (), method, error);
 }
 
 ICALL_EXPORT MonoReflectionAssemblyHandle
 ves_icall_System_Reflection_Assembly_GetExecutingAssembly (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoMethod *dest = NULL;
        mono_stack_walk_no_il (get_executing, &dest);
@@ -5165,7 +5165,7 @@ ves_icall_System_Reflection_Assembly_GetExecutingAssembly (MonoError *error)
 ICALL_EXPORT MonoReflectionAssemblyHandle
 ves_icall_System_Reflection_Assembly_GetEntryAssembly (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain* domain = mono_domain_get ();
 
@@ -5178,7 +5178,7 @@ ves_icall_System_Reflection_Assembly_GetEntryAssembly (MonoError *error)
 ICALL_EXPORT MonoReflectionAssemblyHandle
 ves_icall_System_Reflection_Assembly_GetCallingAssembly (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *m;
        MonoMethod *dest;
 
@@ -5230,7 +5230,7 @@ ves_icall_System_RuntimeType_getFullName (MonoReflectionTypeHandle object, gbool
 ICALL_EXPORT int
 vell_icall_RuntimeType_get_core_clr_security_level (MonoReflectionTypeHandle rfield, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (rfield, type);
        MonoClass *klass = mono_class_from_mono_type (type);
 
@@ -5250,7 +5250,7 @@ ves_icall_MonoField_get_core_clr_security_level (MonoReflectionField *rfield)
 ICALL_EXPORT int
 ves_icall_MonoMethod_get_core_clr_security_level (MonoReflectionMethodHandle rfield, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *method = MONO_HANDLE_GETVAL (rfield, method);
        return mono_security_core_clr_method_level (method, TRUE);
 }
@@ -5258,7 +5258,7 @@ ves_icall_MonoMethod_get_core_clr_security_level (MonoReflectionMethodHandle rfi
 ICALL_EXPORT MonoStringHandle
 ves_icall_System_Reflection_Assembly_get_fullName (MonoReflectionAssemblyHandle assembly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (assembly);
        MonoAssembly *mass = MONO_HANDLE_GETVAL (assembly, assembly);
        gchar *name;
@@ -5285,7 +5285,7 @@ ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoStringHandle f
        MonoImage *image;
        char *dirname;
 
-       mono_error_init (error);
+       error_init (error);
 
        filename = mono_string_handle_to_utf8 (fname, error);
        return_if_nok (error);
@@ -5337,7 +5337,7 @@ ICALL_EXPORT MonoBoolean
 ves_icall_System_Reflection_Assembly_LoadPermissions (MonoReflectionAssemblyHandle assembly_h,
                                                      char **minimum, guint32 *minLength, char **optional, guint32 *optLength, char **refused, guint32 *refLength, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly);
        MonoBoolean result = FALSE;
        MonoDeclSecurityEntry entry;
@@ -5382,7 +5382,7 @@ mono_module_type_is_visible (MonoTableInfo *tdef, MonoImage *image, int type)
 static void
 image_get_type (MonoDomain *domain, MonoImage *image, MonoTableInfo *tdef, int table_idx, int count, MonoArrayHandle res, MonoArrayHandle exceptions, MonoBoolean exportedOnly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        HANDLE_FUNCTION_ENTER ();
        MonoError klass_error;
        MonoClass *klass = mono_class_get_checked (image, table_idx | MONO_TOKEN_TYPE_DEF, &klass_error);
@@ -5405,7 +5405,7 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArrayHandleOut
        MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
        int i, count;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* we start the count from 1 because we skip the special type <Module> */
        if (exportedOnly) {
@@ -5437,7 +5437,7 @@ static void
 append_module_types (MonoDomain *domain, MonoArrayHandleOut res, MonoArrayHandleOut exceptions, MonoImage *image, MonoBoolean exportedOnly, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoArrayHandle ex2 = MONO_HANDLE_NEW (MonoArray, NULL);
        MonoArrayHandle res2 = mono_module_get_types (domain, image, ex2, exportedOnly, error);
        if (!is_ok (error))
@@ -5475,7 +5475,7 @@ set_class_failure_in_array (MonoArrayHandle exl, int i, MonoClass *klass)
 {
        HANDLE_FUNCTION_ENTER ();
        MonoError unboxed_error;
-       mono_error_init (&unboxed_error);
+       error_init (&unboxed_error);
        mono_error_set_for_class_failure (&unboxed_error, klass);
 
        MonoExceptionHandle exc = MONO_HANDLE_NEW (MonoException, mono_error_convert_to_exception (&unboxed_error));
@@ -5668,7 +5668,7 @@ ves_icall_System_Reflection_Module_GetMDStreamVersion (MonoImage *image, MonoErr
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModuleHandle module, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoImage *image = MONO_HANDLE_GETVAL (module, image);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (module);
@@ -5760,7 +5760,7 @@ static MonoType*
 module_resolve_type_token (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *result = NULL;
        MonoClass *klass;
        int table = mono_metadata_token_table (token);
@@ -5821,7 +5821,7 @@ static MonoMethod*
 module_resolve_method_token (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *method = NULL;
        int table = mono_metadata_token_table (token);
        int index = mono_metadata_token_index (token);
@@ -5920,7 +5920,7 @@ module_resolve_field_token (MonoImage *image, guint32 token, MonoArrayHandle typ
        MonoGenericContext context;
        MonoClassField *field = NULL;
 
-       mono_error_init (error);
+       error_init (error);
        *resolve_error = ResolveTokenError_Other;
 
        /* Validate token */
@@ -5976,7 +5976,7 @@ ves_icall_System_Reflection_Module_ResolveMemberToken (MonoImage *image, guint32
 {
        int table = mono_metadata_token_table (token);
 
-       mono_error_init (merror);
+       error_init (merror);
        *error = ResolveTokenError_Other;
 
        switch (table) {
@@ -6034,7 +6034,7 @@ ves_icall_System_Reflection_Module_ResolveMemberToken (MonoImage *image, guint32
 ICALL_EXPORT MonoArrayHandle
 ves_icall_System_Reflection_Module_ResolveSignature (MonoImage *image, guint32 token, MonoResolveTokenError *resolve_error, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        int table = mono_metadata_token_table (token);
        int idx = mono_metadata_token_index (token);
        MonoTableInfo *tables = image->tables;
@@ -6071,7 +6071,7 @@ ves_icall_System_Reflection_Module_ResolveSignature (MonoImage *image, guint32 t
 ICALL_EXPORT MonoBoolean
 ves_icall_RuntimeTypeHandle_IsArray (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        MonoBoolean res = !type->byref && (type->type == MONO_TYPE_ARRAY || type->type == MONO_TYPE_SZARRAY);
@@ -6084,7 +6084,7 @@ check_for_invalid_type (MonoClass *klass, MonoError *error)
 {
        char *name;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (klass->byval_arg.type != MONO_TYPE_TYPEDBYREF)
                return;
@@ -6095,7 +6095,7 @@ check_for_invalid_type (MonoClass *klass, MonoError *error)
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeType_make_array_type (MonoReflectionTypeHandle ref_type, int rank, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -6116,7 +6116,7 @@ ves_icall_RuntimeType_make_array_type (MonoReflectionTypeHandle ref_type, int ra
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeType_make_byref_type (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
 
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -6135,7 +6135,7 @@ ves_icall_RuntimeType_make_byref_type (MonoReflectionTypeHandle ref_type, MonoEr
 ICALL_EXPORT MonoReflectionTypeHandle
 ves_icall_RuntimeType_MakePointerType (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -6344,7 +6344,7 @@ ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, Mo
 ICALL_EXPORT MonoObjectHandle
 ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObjectHandle this_obj, MonoStringHandle class_name, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (this_obj);
        MonoRealProxyHandle rp = MONO_HANDLE_CAST (MonoRealProxy, this_obj);
 
@@ -7180,7 +7180,7 @@ ves_icall_System_Web_Util_ICalls_get_machine_install_dir (void)
 ICALL_EXPORT gboolean
 ves_icall_get_resources_ptr (MonoReflectionAssemblyHandle assembly, gpointer *result, gint32 *size, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoPEResourceDataEntry *entry;
        MonoImage *image;
 
@@ -7245,7 +7245,7 @@ ves_icall_System_Diagnostics_DefaultTraceListener_WriteWindowsDebugString (MonoS
 ICALL_EXPORT MonoObjectHandle
 ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionTypeHandle ref_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (ref_type);
        MonoType *type = MONO_HANDLE_GETVAL (ref_type, type);
        MonoClass *klass = mono_class_from_mono_type (type);
@@ -7264,7 +7264,7 @@ ves_icall_System_Activator_CreateInstanceInternal (MonoReflectionTypeHandle ref_
 ICALL_EXPORT MonoReflectionMethodHandle
 ves_icall_MonoMethod_get_base_method (MonoReflectionMethodHandle m, gboolean definition, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *method = MONO_HANDLE_GETVAL (m, method);
 
        MonoMethod *base = mono_method_get_base_method (method, definition, error);
@@ -7278,7 +7278,7 @@ ves_icall_MonoMethod_get_base_method (MonoReflectionMethodHandle m, gboolean def
 ICALL_EXPORT MonoStringHandle
 ves_icall_MonoMethod_get_name (MonoReflectionMethodHandle m, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *method = MONO_HANDLE_GETVAL (m, method);
 
        MonoStringHandle s = mono_string_new_handle (MONO_HANDLE_DOMAIN (m), method->name, error);
@@ -7456,7 +7456,7 @@ prelink_method (MonoMethod *method, MonoError *error)
 {
        const char *exc_class, *exc_arg;
 
-       mono_error_init (error);
+       error_init (error);
        if (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
                return;
        mono_lookup_pinvoke_call (method, &exc_class, &exc_arg);
@@ -7517,7 +7517,7 @@ static gboolean
 add_modifier_to_array (MonoDomain *domain, MonoImage *image, MonoCustomMod *modifier, MonoArrayHandle dest, int dest_idx, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass = mono_class_get_checked (image, modifier->token, error);
        if (!is_ok (error))
                goto leave;
@@ -7541,7 +7541,7 @@ type_array_from_modifiers (MonoImage *image, MonoType *type, int optional, MonoE
        int i, count = 0;
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error);
+       error_init (error);
        for (i = 0; i < type->num_mods; ++i) {
                if ((optional && !type->modifiers [i].required) || (!optional && type->modifiers [i].required))
                        count++;
@@ -7568,7 +7568,7 @@ fail:
 ICALL_EXPORT MonoArrayHandle
 ves_icall_ParameterInfo_GetTypeModifiers (MonoReflectionParameterHandle param, MonoBoolean optional, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionTypeHandle rt = MONO_HANDLE_NEW (MonoReflectionType, NULL);
        MONO_HANDLE_GET (rt, param, ClassImpl);
        MonoType *type = MONO_HANDLE_GETVAL (rt, type);
@@ -7622,7 +7622,7 @@ get_property_type (MonoProperty *prop)
 ICALL_EXPORT MonoArrayHandle
 ves_icall_MonoPropertyInfo_GetTypeModifiers (MonoReflectionPropertyHandle property, MonoBoolean optional, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoProperty *prop = MONO_HANDLE_GETVAL (property, property);
        MonoClass *klass = MONO_HANDLE_GETVAL (property, klass);
        MonoType *type = get_property_type (prop);
@@ -7747,7 +7747,7 @@ ves_icall_Mono_Runtime_GetDisplayName (MonoError *error)
        char *info;
        MonoStringHandle display_name;
 
-       mono_error_init (error);
+       error_init (error);
        info = mono_get_runtime_callbacks ()->get_runtime_build_info ();
        display_name = mono_string_new_handle (mono_domain_get (), info, error);
        g_free (info);
@@ -8542,7 +8542,7 @@ mono_create_icall_signature (const char *sigstr)
        res = mono_metadata_signature_alloc (corlib, len - 1);
        res->pinvoke = 1;
 
-#ifdef HOST_WIN32
+#ifdef TARGET_WIN32
        /* 
         * Under windows, the default pinvoke calling convention is STDCALL but
         * we need CDECL.
index c9b9081966c9182897420a3c508a90d92b3458e1..f494a57f1471849533476a95b434211e00746ea7 100644 (file)
@@ -691,7 +691,7 @@ mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error)
        GList *list_iter, *valid_modules = NULL;
        MonoImageOpenStatus status;
 
-       mono_error_init (error);
+       error_init (error);
 
        if ((image->module_count == 0) || (idx > image->module_count || idx <= 0))
                return NULL;
@@ -2347,7 +2347,7 @@ mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError
        const char *fname;
        guint32 fname_id;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (fileidx < 1 || fileidx > t->rows)
                return NULL;
index 0309ce8404e1593cd2f88e5b84af17ac0a61c4f7..a2d671c6839bb359f7af9aafc8c98b9a8bfea4db 100644 (file)
@@ -185,7 +185,7 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
        const char *ptr;
        guint32 idx = mono_metadata_token_index (token);
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], idx-1, cols, MONO_MEMBERREF_SIZE);
        nindex = cols [MONO_MEMBERREF_CLASS] >> MONO_MEMBERREF_PARENT_BITS;
@@ -274,7 +274,7 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk
        guint32 type;
        MonoClassField *field;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                MonoClassField *result;
@@ -360,7 +360,7 @@ find_method_in_class (MonoClass *klass, const char *name, const char *qname, con
        int i;
 
        /* Search directly in the metadata to avoid calling setup_methods () */
-       mono_error_init (error);
+       error_init (error);
 
        /* FIXME: !mono_class_is_ginst (from_class) condition causes test failures. */
        if (klass->type_token && !image_is_dynamic (klass->image) && !klass->methods && !klass->rank && klass == from_class && !mono_class_is_ginst (from_class)) {
@@ -448,7 +448,7 @@ find_method (MonoClass *in_class, MonoClass *ic, const char* name, MonoMethodSig
        MonoMethod *result = NULL;
        MonoClass *initial_class = in_class;
 
-       mono_error_init (error);
+       error_init (error);
        is_interface = MONO_CLASS_IS_INTERFACE (in_class);
 
        if (ic) {
@@ -530,7 +530,7 @@ inflate_generic_signature_checked (MonoImage *image, MonoMethodSignature *sig, M
        gboolean is_open;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        if (!context)
                return sig;
 
@@ -608,7 +608,7 @@ inflate_generic_header (MonoMethodHeader *header, MonoGenericContext *context, M
 
        res->is_transient = TRUE;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (int i = 0; i < header->num_locals; ++i) {
                res->locals [i] = mono_class_inflate_generic_type_checked (header->locals [i], context, error);
@@ -655,7 +655,7 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32
        MonoMethodSignature *sig;
        const char *ptr;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* !table is for wrappers: we should really assign their own token to them */
        if (!table || table == MONO_TABLE_METHOD)
@@ -776,7 +776,7 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp
        MonoMethodSignature *sig;
        const char *ptr;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], idx-1, cols, 3);
        nindex = cols [MONO_MEMBERREF_CLASS] >> MONO_MEMBERREF_PARENT_BITS;
@@ -905,7 +905,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i
        guint32 cols [MONO_METHODSPEC_SIZE];
        guint32 token, nindex, param_count;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_metadata_decode_row (&tables [MONO_TABLE_METHODSPEC], idx - 1, cols, MONO_METHODSPEC_SIZE);
        token = cols [MONO_METHODSPEC_METHOD];
@@ -1594,7 +1594,7 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
        const char *sig = NULL;
        guint32 cols [MONO_TYPEDEF_SIZE];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (image)) {
                MonoClass *handle_class;
@@ -1735,7 +1735,7 @@ mono_get_method_checked (MonoImage *image, guint32 token, MonoClass *klass, Mono
 
        /* We do everything inside the lock to prevent creation races */
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_image_lock (image);
 
@@ -1791,7 +1791,7 @@ get_method_constrained (MonoImage *image, MonoMethod *method, MonoClass *constra
        MonoGenericContext *method_context = NULL;
        MonoMethodSignature *sig, *original_sig;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_class_init (constrained_class);
        original_sig = sig = mono_method_signature_checked (method, error);
@@ -1873,7 +1873,7 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra
 MonoMethod *
 mono_get_method_constrained_checked (MonoImage *image, guint32 token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        *cil_method = mono_get_method_from_token (image, token, NULL, context, NULL, error);
        if (!*cil_method)
@@ -2345,7 +2345,7 @@ mono_method_signature_checked (MonoMethod *m, MonoError *error)
 
        /* We need memory barriers below because of the double-checked locking pattern */ 
 
-       mono_error_init (error);
+       error_init (error);
 
        if (m->signature)
                return m->signature;
@@ -2436,7 +2436,7 @@ mono_method_signature_checked (MonoMethod *m, MonoError *error)
        }
        if (m->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
                signature->pinvoke = 1;
-#ifdef HOST_WIN32
+#ifdef TARGET_WIN32
                /*
                 * On Windows the default pinvoke calling convention is STDCALL but
                 * we need CDECL since this is actually an icall.
@@ -2534,7 +2534,7 @@ mono_method_get_header_checked (MonoMethod *method, MonoError *error)
        gpointer loc;
        MonoGenericContainer *container;
 
-       mono_error_init (error);
+       error_init (error);
        img = method->klass->image;
 
        if ((method->flags & METHOD_ATTRIBUTE_ABSTRACT) || (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) || (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
index 2adb0d606506d3fa505533a18d21067d8cb0e45e..113fe1f2136b731aaf260dcff8c54a5492e9e02d 100644 (file)
@@ -97,7 +97,7 @@ create_group_sizes_array (const gint *gs, gint ml, MonoError *error)
        MonoArray *ret;
        int i, len = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (i = 0; i < ml; i++) {
                if (gs [i] == -1)
@@ -122,7 +122,7 @@ create_names_array_idx (const guint16 *names, int ml, MonoError *error)
        MonoDomain *domain;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (names == NULL)
                return NULL;
@@ -145,7 +145,7 @@ create_names_array_idx_dynamic (const guint16 *names, int ml, MonoError *error)
        MonoDomain *domain;
        int i, len = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (names == NULL)
                return NULL;
@@ -329,7 +329,7 @@ construct_culture (MonoCultureInfo *this_obj, const CultureInfoEntry *ci, MonoEr
 {
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error);
+       error_init (error);
 
        this_obj->lcid = ci->lcid;
        MONO_OBJECT_SETREF (this_obj, name, mono_string_new (domain, idx2string (ci->name)));
index 6020bf50eb45f2a18f5fe5295728ccbee8d9572d..1545e1e19ba69a31d6f7055a8f65920a7766b950 100644 (file)
@@ -242,6 +242,14 @@ register_icall (gpointer func, const char *name, const char *sigstr, gboolean no
        mono_register_jit_icall (func, name, sig, no_wrapper);
 }
 
+static void
+register_icall_no_wrapper (gpointer func, const char *name, const char *sigstr)
+{
+       MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
+
+       mono_register_jit_icall (func, name, sig, TRUE);
+}
+
 MonoMethodSignature*
 mono_signature_no_pinvoke (MonoMethod *method)
 {
@@ -335,7 +343,7 @@ mono_marshal_init (void)
                register_icall (mono_string_to_byvalstr, "mono_string_to_byvalstr", "void ptr ptr int32", FALSE);
                register_icall (mono_string_to_byvalwstr, "mono_string_to_byvalwstr", "void ptr ptr int32", FALSE);
                register_icall (g_free, "g_free", "void ptr", FALSE);
-               register_icall (mono_object_isinst_icall, "mono_object_isinst_icall", "object object ptr", FALSE);
+               register_icall_no_wrapper (mono_object_isinst_icall, "mono_object_isinst_icall", "object object ptr");
                register_icall (mono_struct_delete_old, "mono_struct_delete_old", "void ptr ptr", FALSE);
                register_icall (mono_delegate_begin_invoke, "mono_delegate_begin_invoke", "object object ptr", FALSE);
                register_icall (mono_delegate_end_invoke, "mono_delegate_end_invoke", "object object ptr", FALSE);
@@ -426,7 +434,9 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate)
                target_handle = mono_gchandle_new_weakref (delegate->target, FALSE);
        }
 
-       wrapper = mono_marshal_get_managed_wrapper (method, klass, target_handle);
+       wrapper = mono_marshal_get_managed_wrapper (method, klass, target_handle, &error);
+       if (!is_ok (&error))
+               goto fail;
 
        delegate->delegate_trampoline = mono_compile_method_checked (wrapper, &error);
        if (!is_ok (&error))
@@ -8659,9 +8669,8 @@ mono_marshal_set_callconv_from_modopt (MonoMethod *method, MonoMethodSignature *
  * If target_handle==0, the wrapper info will be a WrapperInfo structure.
  */
 MonoMethod *
-mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t target_handle)
+mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t target_handle, MonoError *error)
 {
-       MonoError error;
        MonoMethodSignature *sig, *csig, *invoke_sig;
        MonoMethodBuilder *mb;
        MonoMethod *res, *invoke;
@@ -8672,7 +8681,12 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
        EmitMarshalContext m;
 
        g_assert (method != NULL);
-       g_assert (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL));
+       error_init (error);
+
+       if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+               mono_error_set_invalid_program (error, "Failed because method (%s) marked PInvokeCallback (managed method) and extern (unmanaged) simultaneously.", mono_method_full_name (method, TRUE));
+               return NULL;
+       }
 
        /* 
         * FIXME: Should cache the method+delegate type pair, since the same method
@@ -8726,8 +8740,8 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
                 * contents of the attribute without constructing it, as that might not be
                 * possible when running in cross-compiling mode.
                 */
-               cinfo = mono_custom_attrs_from_class_checked (delegate_klass, &error);
-               mono_error_assert_ok (&error);
+               cinfo = mono_custom_attrs_from_class_checked (delegate_klass, error);
+               mono_error_assert_ok (error);
                attr = NULL;
                if (cinfo) {
                        for (i = 0; i < cinfo->num_attrs; ++i) {
@@ -9696,7 +9710,8 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_byte (mb, CEE_RET);
                break;
 
-       case STELEMREF_COMPLEX:
+       case STELEMREF_COMPLEX: {
+               int b_fast;
                /*
                <ldelema (bound check)>
                if (!value)
@@ -9712,6 +9727,7 @@ get_virtual_stelemref_wrapper (int kind)
                */
 
                aklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
+               vklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                array_slot_addr = mono_mb_add_local (mb, &mono_defaults.object_class->this_arg);
 
 #if 0
@@ -9740,6 +9756,13 @@ get_virtual_stelemref_wrapper (int kind)
 
                /* aklass = array->vtable->klass->element_class */
                load_array_class (mb, aklass);
+               /* vklass = value->vtable->klass */
+               load_value_class (mb, vklass);
+
+               /* fastpath */
+               mono_mb_emit_ldloc (mb, vklass);
+               mono_mb_emit_ldloc (mb, aklass);
+               b_fast = mono_mb_emit_branch (mb, CEE_BEQ);
 
                /*if (mono_object_isinst (value, aklass)) */
                mono_mb_emit_ldarg (mb, 2);
@@ -9749,6 +9772,7 @@ get_virtual_stelemref_wrapper (int kind)
 
                /* do_store: */
                mono_mb_patch_branch (mb, b1);
+               mono_mb_patch_branch (mb, b_fast);
                mono_mb_emit_ldloc (mb, array_slot_addr);
                mono_mb_emit_ldarg (mb, 2);
                mono_mb_emit_byte (mb, CEE_STIND_REF);
@@ -9759,7 +9783,7 @@ get_virtual_stelemref_wrapper (int kind)
 
                mono_mb_emit_exception (mb, "ArrayTypeMismatchException", NULL);
                break;
-
+       }
        case STELEMREF_SEALED_CLASS:
                /*
                <ldelema (bound check)>
@@ -9782,7 +9806,6 @@ get_virtual_stelemref_wrapper (int kind)
                vklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
                array_slot_addr = mono_mb_add_local (mb, &mono_defaults.object_class->this_arg);
 
-
                /* ldelema (implicit bound check) */
                load_array_element_address (mb);
                mono_mb_emit_stloc (mb, array_slot_addr);
@@ -9814,7 +9837,9 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_exception (mb, "ArrayTypeMismatchException", NULL);
                break;
 
-       case STELEMREF_CLASS:
+       case STELEMREF_CLASS: {
+               int b_fast;
+
                /*
                the method:
                <ldelema (bound check)>
@@ -9855,6 +9880,11 @@ get_virtual_stelemref_wrapper (int kind)
                /* vklass = value->vtable->klass */
                load_value_class (mb, vklass);
 
+               /* fastpath */
+               mono_mb_emit_ldloc (mb, vklass);
+               mono_mb_emit_ldloc (mb, aklass);
+               b_fast = mono_mb_emit_branch (mb, CEE_BEQ);
+
                /*if (mono_object_isinst (value, aklass)) */
                mono_mb_emit_ldarg (mb, 2);
                mono_mb_emit_ldloc (mb, aklass);
@@ -9892,6 +9922,7 @@ get_virtual_stelemref_wrapper (int kind)
 
                /* do_store: */
                mono_mb_patch_branch (mb, b1);
+               mono_mb_patch_branch (mb, b_fast);
                mono_mb_emit_ldloc (mb, array_slot_addr);
                mono_mb_emit_ldarg (mb, 2);
                mono_mb_emit_byte (mb, CEE_STIND_REF);
@@ -9904,7 +9935,7 @@ get_virtual_stelemref_wrapper (int kind)
 
                mono_mb_emit_exception (mb, "ArrayTypeMismatchException", NULL);
                break;
-
+       }
        case STELEMREF_INTERFACE:
                /*Mono *klass;
                MonoVTable *vt;
@@ -10550,7 +10581,7 @@ mono_marshal_alloc (gulong size, MonoError *error)
 {
        gpointer res;
 
-       mono_error_init (error);
+       error_init (error);
 
        res = mono_marshal_alloc_co_task_mem (size);
        if (!res)
@@ -10733,7 +10764,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr,
 {
        MonoError error;
        MonoString *result = NULL;
-       mono_error_init (&error);
+       error_init (&error);
        if (ptr == NULL)
                mono_error_set_argument_null (&error, "ptr", "");
        else
@@ -10772,7 +10803,7 @@ ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *pt
        MonoString *res = NULL;
        MonoDomain *domain = mono_domain_get (); 
 
-       mono_error_init (&error);
+       error_init (&error);
 
        if (ptr == NULL) {
                res = NULL;
@@ -10853,7 +10884,7 @@ ptr_to_structure (gpointer src, MonoObject *dst, MonoError *error)
        MonoMethod *method;
        gpointer pa [2];
 
-       mono_error_init (error);
+       error_init (error);
 
        method = mono_marshal_get_ptr_to_struct (dst->vtable->klass);
 
@@ -12081,7 +12112,7 @@ mono_icall_start (HandleStackMark *stackmark, MonoError *error)
        MonoThreadInfo *info = mono_thread_info_current ();
 
        mono_stack_mark_init (info, stackmark);
-       mono_error_init (error);
+       error_init (error);
        return info;
 }
 
@@ -12089,5 +12120,6 @@ static void
 mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *error)
 {
        mono_stack_mark_pop (info, stackmark);
-       mono_error_set_pending_exception (error);
+       if (G_UNLIKELY (!is_ok (error)))
+               mono_error_set_pending_exception (error);
 }
index e00661b1b593604f318b93cd47064c7fab2362fa..4b1c185f876011751b95773b1a031527dd3342ad 100644 (file)
@@ -330,7 +330,7 @@ MonoMethodSignature*
 mono_marshal_get_string_ctor_signature (MonoMethod *method);
 
 MonoMethod *
-mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc);
+mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc, MonoError *exernal_error);
 
 gpointer
 mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type);
index 9b4ca91bc753965ceaba0e55cf9b8f096af0ee08..554f5157d967a90980b8ce481548c0c3e9474736 100644 (file)
@@ -4055,7 +4055,7 @@ mono_verifier_verify_method_signature (MonoImage *image, guint32 offset, MonoErr
 {
        VerifyContext ctx;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_is_enabled_for_image (image))
                return TRUE;
@@ -4245,7 +4245,7 @@ mono_verifier_verify_typeref_row (MonoImage *image, guint32 row, MonoError *erro
        MonoTableInfo *table = &image->tables [MONO_TABLE_TYPEREF];
        guint32 data [MONO_TYPEREF_SIZE];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_is_enabled_for_image (image))
                return TRUE;
@@ -4288,7 +4288,7 @@ mono_verifier_verify_methodimpl_row (MonoImage *image, guint32 row, MonoError *e
        MonoTableInfo *table = &image->tables [MONO_TABLE_METHODIMPL];
        guint32 data [MONO_METHODIMPL_SIZE];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_is_enabled_for_image (image))
                return TRUE;
@@ -4371,7 +4371,7 @@ mono_verifier_verify_method_header (MonoImage *image, guint32 offset, GSList **e
 gboolean
 mono_verifier_verify_method_signature (MonoImage *image, guint32 offset, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
@@ -4421,14 +4421,14 @@ mono_verifier_is_sig_compatible (MonoImage *image, MonoMethod *method, MonoMetho
 gboolean
 mono_verifier_verify_typeref_row (MonoImage *image, guint32 row, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
 gboolean
 mono_verifier_verify_methodimpl_row (MonoImage *image, guint32 row, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
index 3d76585b5cfbfac2be79b19cc743d94abd1b6d17..545b917177bf45472e6df6c8d7eacc5d344cedd1 100644 (file)
@@ -1701,7 +1701,7 @@ mono_metadata_parse_type_internal (MonoImage *m, MonoGenericContainer *container
        int count = 0; // Number of mod arguments
        gboolean found;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * According to the spec, custom modifiers should come before the byref
@@ -1944,7 +1944,7 @@ MonoMethodSignature*
 mono_metadata_parse_signature_checked (MonoImage *image, guint32 token, MonoError *error)
 {
 
-       mono_error_init (error);
+       error_init (error);
        MonoTableInfo *tables = image->tables;
        guint32 idx = mono_metadata_token_index (token);
        guint32 sig;
@@ -2121,7 +2121,7 @@ mono_metadata_parse_method_signature_full (MonoImage *m, MonoGenericContainer *c
        guint32 gen_param_count = 0;
        gboolean is_open = FALSE;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (*ptr & 0x10)
                gen_param_count = 1;
@@ -3135,7 +3135,7 @@ mono_metadata_inflate_generic_inst (MonoGenericInst *ginst, MonoGenericContext *
        MonoGenericInst *nginst = NULL;
        int i, count = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!ginst->is_open)
                return ginst;
@@ -3167,7 +3167,7 @@ mono_metadata_parse_generic_inst (MonoImage *m, MonoGenericContainer *container,
        MonoGenericInst *ginst;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        type_argv = g_new0 (MonoType*, count);
 
        for (i = 0; i < count; i++) {
@@ -3198,7 +3198,7 @@ do_mono_metadata_parse_generic_class (MonoType *type, MonoImage *m, MonoGenericC
        MonoType *gtype;
        int count;
 
-       mono_error_init (error);
+       error_init (error);
 
        // XXX how about transient?
        gtype = mono_metadata_parse_type_checked (m, NULL, 0, FALSE, ptr, &ptr, error);
@@ -3294,7 +3294,7 @@ mono_metadata_parse_generic_param (MonoImage *m, MonoGenericContainer *generic_c
        if (rptr)
                *rptr = ptr;
 
-       mono_error_init (error);
+       error_init (error);
 
        generic_container = select_container (generic_container, type);
        if (!generic_container) {
@@ -3368,7 +3368,7 @@ mono_metadata_get_shared_type (MonoType *type)
 static gboolean
 compare_type_literals (MonoImage *image, int class_type, int type_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        /* byval_arg.type can be zero if we're decoding a type that references a class been loading.
         * See mcs/test/gtest-440. and #650936.
@@ -3418,7 +3418,7 @@ compare_type_literals (MonoImage *image, int class_type, int type_type, MonoErro
 static gboolean
 verify_var_type_and_container (MonoImage *image, int var_type, MonoGenericContainer *container, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (var_type == MONO_TYPE_MVAR) {
                if (!container->is_method) { //MVAR and a method container
                        mono_error_set_bad_image (error, image, "MVAR parsed in a context without a method container");
@@ -3459,7 +3459,7 @@ static gboolean
 do_mono_metadata_parse_type (MonoType *type, MonoImage *m, MonoGenericContainer *container,
                                                         gboolean transient, const char *ptr, const char **rptr, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        type->type = (MonoTypeEnum)mono_metadata_decode_value (ptr, &ptr);
        
@@ -3628,7 +3628,7 @@ parse_section_data (MonoImage *m, int *num_clauses, const unsigned char *ptr, Mo
        guint32 sect_data_len;
        MonoExceptionClause* clauses = NULL;
 
-       mono_error_init (error);
+       error_init (error);
        
        while (1) {
                /* align on 32-bit boundary */
@@ -3796,7 +3796,7 @@ mono_metadata_parse_mh_full (MonoImage *m, MonoGenericContainer *container, cons
        MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];
        guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!ptr) {
                mono_error_set_bad_image (error, m, "Method header with null pointer");
@@ -4334,7 +4334,7 @@ mono_metadata_interfaces_from_typedef_full (MonoImage *meta, guint32 index, Mono
        *interfaces = NULL;
        *count = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!tdef->base)
                return TRUE;
@@ -5690,7 +5690,7 @@ mono_type_create_from_typespec_checked (MonoImage *image, guint32 type_spec, Mon
        const char *ptr;
        MonoType *type, *type2;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_image_lock (image);
        type = (MonoType *)g_hash_table_lookup (image->typespec_cache, GUINT_TO_POINTER (type_spec));
@@ -6068,7 +6068,7 @@ method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *co
        MonoMethod *result = NULL;
        guint32 idx = tok >> MONO_METHODDEFORREF_BITS;
 
-       mono_error_init (error);
+       error_init (error);
 
        switch (tok & MONO_METHODDEFORREF_MASK) {
        case MONO_METHODDEFORREF_METHODDEF:
@@ -6211,7 +6211,7 @@ get_constraints (MonoImage *image, int owner, MonoClass ***constraints, MonoGene
        GSList *cons = NULL, *tmp;
        MonoGenericContext *context = &container->context;
 
-       mono_error_init (error);
+       error_init (error);
 
        *constraints = NULL;
        found = 0;
@@ -6303,7 +6303,7 @@ mono_metadata_load_generic_param_constraints_checked (MonoImage *image, guint32
 {
 
        guint32 start_row, i, owner;
-       mono_error_init (error);
+       error_init (error);
 
        if (! (start_row = mono_metadata_get_generic_param_row (image, token, &owner)))
                return TRUE;
@@ -6714,7 +6714,8 @@ mono_signature_explicit_this (MonoMethodSignature *sig)
 guint
 mono_aligned_addr_hash (gconstpointer ptr)
 {
-       return GPOINTER_TO_UINT (ptr) >> 3;
+       /* Same hashing we use for objects */
+       return (GPOINTER_TO_UINT (ptr) >> 3) * 2654435761u;
 }
 
 /*
index 5ccb938df9b03a0f8dfb9a77c6a8accb80e9c2f0..1241ea2c134757c2306748754912bd7691cadd50 100644 (file)
@@ -240,7 +240,7 @@ bb_split (MonoSimpleBasicBlock *first, MonoSimpleBasicBlock *hint, MonoSimpleBas
 {
        MonoSimpleBasicBlock *res, *bb = first;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (bb_idx_is_contained (hint, target)) {
                first = hint;
@@ -338,7 +338,7 @@ bb_formation_il_pass (const unsigned char *start, const unsigned char *end, Mono
        MonoSimpleBasicBlock *branch, *next, *current;
        const MonoOpcode *opcode;
 
-       mono_error_init (error);
+       error_init (error);
 
        current = bb;
 
@@ -469,7 +469,7 @@ bb_formation_eh_pass (MonoMethodHeader *header, MonoSimpleBasicBlock *bb, MonoSi
        int i;
        int end = header->code_size;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*We must split at all points to verify for targets in the middle of an instruction*/
        for (i = 0; i < header->num_clauses; ++i) {
@@ -527,7 +527,7 @@ mono_basic_block_split (MonoMethod *method, MonoError *error, MonoMethodHeader *
        MonoSimpleBasicBlock *bb, *root;
        const unsigned char *start, *end;
 
-       mono_error_init (error);
+       error_init (error);
 
        start = header->code;
        end = start + header->code_size;
index 00f7afab0ccea8eb71d5cb11bdc7adef687aa1a4..9c6cdb44101c6479dfbc36381aefc2252a7fb074 100644 (file)
@@ -34,6 +34,8 @@
 #include <mono/utils/checked-build.h>
 #include <mono/utils/mono-threads-coop.h>
 
+int mono_g_hash_table_max_chain_length;
+
 #ifdef HAVE_BOEHM_GC
 #define mg_new0(type,n)  ((type *) GC_MALLOC(sizeof(type) * (n)))
 #define mg_new(type,n)   ((type *) GC_MALLOC(sizeof(type) * (n)))
 #define mg_free(x)       g_free(x)
 #endif
 
-typedef struct _Slot Slot;
-
-struct _Slot {
-       MonoObject *key;
-       MonoObject *value;
-       Slot    *next;
-};
-
-static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
-
 struct _MonoGHashTable {
        GHashFunc      hash_func;
        GEqualFunc     key_equal_func;
 
-       Slot **table;
+       MonoObject **keys;
+       MonoObject **values;
        int   table_size;
        int   in_use;
-       int   threshold;
-       int   last_rehash;
        GDestroyNotify value_destroy_func, key_destroy_func;
        MonoGHashGCType gc_type;
        MonoGCRootSource source;
        const char *msg;
 };
 
-#ifdef HAVE_SGEN_GC
-static MonoGCDescriptor table_hash_descr = MONO_GC_DESCRIPTOR_NULL;
-
-static void mono_g_hash_mark (void *addr, MonoGCMarkFunc mark_func, void *gc_data);
-#endif
-
-static Slot*
-new_slot (MonoGHashTable *hash)
-{
-       return mg_new (Slot, 1);
-}
-
-static void
-free_slot (MonoGHashTable *hash, Slot *slot)
-{
-       mg_free (slot);
-}
-
 #if UNUSED
 static gboolean
 test_prime (int x)
@@ -107,7 +80,7 @@ static int
 calc_prime (int x)
 {
        int i;
-       
+
        for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
                if (test_prime (i))
                        return i;
@@ -116,15 +89,67 @@ calc_prime (int x)
 }
 #endif
 
+#define HASH_TABLE_MAX_LOAD_FACTOR 0.7f
+/* We didn't really do compaction before, keep it lenient for now */
+#define HASH_TABLE_MIN_LOAD_FACTOR 0.05f
+/* We triple the table size at rehash time, similar with previous implementation */
+#define HASH_TABLE_RESIZE_RATIO 3
+
+static inline void mono_g_hash_table_key_store (MonoGHashTable *hash, int slot, MonoObject* key)
+{
+       MonoObject **key_addr = &hash->keys [slot];
+       if (hash->gc_type & MONO_HASH_KEY_GC)
+               mono_gc_wbarrier_generic_store (key_addr, key);
+       else
+               *key_addr = key;
+}
+
+static inline void mono_g_hash_table_value_store (MonoGHashTable *hash, int slot, MonoObject* value)
+{
+       MonoObject **value_addr = &hash->values [slot];
+       if (hash->gc_type & MONO_HASH_VALUE_GC)
+               mono_gc_wbarrier_generic_store (value_addr, value);
+       else
+               *value_addr = value;
+}
+
+/* Returns position of key or of an empty slot for it */
+static inline int mono_g_hash_table_find_slot (MonoGHashTable *hash, const MonoObject *key)
+{
+       guint start = ((*hash->hash_func) (key)) % hash->table_size;
+       guint i = start;
+
+       if (hash->key_equal_func) {
+               GEqualFunc equal = hash->key_equal_func;
+
+               while (hash->keys [i] && !(*equal) (hash->keys [i], key)) {
+                       i++;
+                       if (i == hash->table_size)
+                               i = 0;
+               }
+       } else {
+               while (hash->keys [i] && hash->keys [i] != key) {
+                       i++;
+                       if (i == hash->table_size)
+                               i = 0;
+               }
+       }
+
+       if (i > start && (i - start) > mono_g_hash_table_max_chain_length)
+               mono_g_hash_table_max_chain_length = i - start;
+       else if (i < start && (hash->table_size - (start - i)) > mono_g_hash_table_max_chain_length)
+               mono_g_hash_table_max_chain_length = hash->table_size - (start - i);
+       return i;
+}
+
+
 MonoGHashTable *
 mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg)
 {
        MonoGHashTable *hash;
 
-       if (hash_func == NULL)
+       if (!hash_func)
                hash_func = g_direct_hash;
-       if (key_equal_func == NULL)
-               key_equal_func = g_direct_equal;
 
 #ifdef HAVE_SGEN_GC
        hash = mg_new0 (MonoGHashTable, 1);
@@ -136,8 +161,8 @@ mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, Mono
        hash->key_equal_func = key_equal_func;
 
        hash->table_size = g_spaced_primes_closest (1);
-       hash->table = mg_new0 (Slot *, hash->table_size);
-       hash->last_rehash = hash->table_size;
+       hash->keys = mg_new0 (MonoObject*, hash->table_size);
+       hash->values = mg_new0 (MonoObject*, hash->table_size);
 
        hash->gc_type = type;
        hash->source = source;
@@ -147,13 +172,10 @@ mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, Mono
                g_error ("wrong type for gc hashtable");
 
 #ifdef HAVE_SGEN_GC
-       /*
-        * We use a user defined marking function to avoid having to register a GC root for
-        * each hash node.
-        */
-       if (!table_hash_descr)
-               table_hash_descr = mono_gc_make_root_descr_user (mono_g_hash_mark);
-       mono_gc_register_root_wbarrier ((char*)hash, sizeof (MonoGHashTable), table_hash_descr, source, msg);
+       if (hash->gc_type & MONO_HASH_KEY_GC)
+               mono_gc_register_root_wbarrier ((char*)hash->keys, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->msg);
+       if (hash->gc_type & MONO_HASH_VALUE_GC)
+               mono_gc_register_root_wbarrier ((char*)hash->values, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->msg);
 #endif
 
        return hash;
@@ -162,7 +184,8 @@ mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, Mono
 typedef struct {
        MonoGHashTable *hash;
        int new_size;
-       Slot **table;
+       MonoObject **keys;
+       MonoObject **values;
 } RehashData;
 
 static void*
@@ -171,28 +194,24 @@ do_rehash (void *_data)
        RehashData *data = (RehashData *)_data;
        MonoGHashTable *hash = data->hash;
        int current_size, i;
-       Slot **table;
+       MonoObject **old_keys;
+       MonoObject **old_values;
 
-       /* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
-       hash->last_rehash = hash->table_size;
        current_size = hash->table_size;
        hash->table_size = data->new_size;
-       /* printf ("New size: %d\n", hash->table_size); */
-       table = hash->table;
-       hash->table = data->table;
-
-       for (i = 0; i < current_size; i++){
-               Slot *s, *next;
-
-               for (s = table [i]; s != NULL; s = next){
-                       guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
-                       next = s->next;
-
-                       s->next = hash->table [hashcode];
-                       hash->table [hashcode] = s;
+       old_keys = hash->keys;
+       old_values = hash->values;
+       hash->keys = data->keys;
+       hash->values = data->values;
+
+       for (i = 0; i < current_size; i++) {
+               if (old_keys [i]) {
+                       int slot = mono_g_hash_table_find_slot (hash, old_keys [i]);
+                       mono_g_hash_table_key_store (hash, slot, old_keys [i]);
+                       mono_g_hash_table_value_store (hash, slot, old_values [i]);
                }
        }
-       return table;
+       return NULL;
 }
 
 static void
@@ -200,35 +219,48 @@ rehash (MonoGHashTable *hash)
 {
        MONO_REQ_GC_UNSAFE_MODE; //we must run in unsafe mode to make rehash safe
 
-       int diff = ABS (hash->last_rehash - hash->in_use);
        RehashData data;
-       void *old_table G_GNUC_UNUSED; /* unused on Boehm */
-
-       /* These are the factors to play with to change the rehashing strategy */
-       /* I played with them with a large range, and could not really get */
-       /* something that was too good, maybe the tests are not that great */
-       if (!(diff * 0.75 > hash->table_size * 2))
-               return;
+       void *old_keys G_GNUC_UNUSED = hash->keys; /* unused on Boehm */
+       void *old_values G_GNUC_UNUSED = hash->values; /* unused on Boehm */
 
        data.hash = hash;
-       data.new_size = g_spaced_primes_closest (hash->in_use);
-       data.table = mg_new0 (Slot *, data.new_size);
+       /*
+        * Rehash to a size that can fit the current elements. Rehash relative to in_use
+        * to allow also for compaction.
+        */
+       data.new_size = g_spaced_primes_closest (hash->in_use / HASH_TABLE_MAX_LOAD_FACTOR * HASH_TABLE_RESIZE_RATIO);
+       data.keys = mg_new0 (MonoObject*, data.new_size);
+       data.values = mg_new0 (MonoObject*, data.new_size);
+
+#ifdef HAVE_SGEN_GC
+       if (hash->gc_type & MONO_HASH_KEY_GC)
+               mono_gc_register_root_wbarrier ((char*)data.keys, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->msg);
+       if (hash->gc_type & MONO_HASH_VALUE_GC)
+               mono_gc_register_root_wbarrier ((char*)data.values, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->msg);
+#endif
 
        if (!mono_threads_is_coop_enabled ()) {
-               old_table = mono_gc_invoke_with_gc_lock (do_rehash, &data);
+               mono_gc_invoke_with_gc_lock (do_rehash, &data);
        } else {
                /* We cannot be preempted */
-               old_table = do_rehash (&data);
+               do_rehash (&data);
        }
 
-       mg_free (old_table);
+#ifdef HAVE_SGEN_GC
+       if (hash->gc_type & MONO_HASH_KEY_GC)
+               mono_gc_deregister_root ((char*)old_keys);
+       if (hash->gc_type & MONO_HASH_VALUE_GC)
+               mono_gc_deregister_root ((char*)old_values);
+#endif
+       mg_free (old_keys);
+       mg_free (old_values);
 }
 
 guint
 mono_g_hash_table_size (MonoGHashTable *hash)
 {
        g_return_val_if_fail (hash != NULL, 0);
-       
+
        return hash->in_use;
 }
 
@@ -236,7 +268,7 @@ gpointer
 mono_g_hash_table_lookup (MonoGHashTable *hash, gconstpointer key)
 {
        gpointer orig_key, value;
-       
+
        if (mono_g_hash_table_lookup_extended (hash, key, &orig_key, &value))
                return value;
        else
@@ -246,22 +278,18 @@ mono_g_hash_table_lookup (MonoGHashTable *hash, gconstpointer key)
 gboolean
 mono_g_hash_table_lookup_extended (MonoGHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
 {
-       GEqualFunc equal;
-       Slot *s;
-       guint hashcode;
-       
+       int slot;
+
        g_return_val_if_fail (hash != NULL, FALSE);
-       equal = hash->key_equal_func;
-
-       hashcode = ((*hash->hash_func) (key)) % hash->table_size;
-       
-       for (s = hash->table [hashcode]; s != NULL; s = s->next){
-               if ((*equal)(s->key, key)){
-                       *orig_key = s->key;
-                       *value = s->value;
-                       return TRUE;
-               }
+
+       slot = mono_g_hash_table_find_slot (hash, key);
+
+       if (hash->keys [slot]) {
+               *orig_key = hash->keys [slot];
+               *value = hash->values [slot];
+               return TRUE;
        }
+
        return FALSE;
 }
 
@@ -269,15 +297,13 @@ void
 mono_g_hash_table_foreach (MonoGHashTable *hash, GHFunc func, gpointer user_data)
 {
        int i;
-       
+
        g_return_if_fail (hash != NULL);
        g_return_if_fail (func != NULL);
 
-       for (i = 0; i < hash->table_size; i++){
-               Slot *s;
-
-               for (s = hash->table [i]; s != NULL; s = s->next)
-                       (*func)(s->key, s->value, user_data);
+       for (i = 0; i < hash->table_size; i++) {
+               if (hash->keys [i])
+                       (*func)(hash->keys [i], hash->values [i], user_data);
        }
 }
 
@@ -285,16 +311,13 @@ gpointer
 mono_g_hash_table_find (MonoGHashTable *hash, GHRFunc predicate, gpointer user_data)
 {
        int i;
-       
+
        g_return_val_if_fail (hash != NULL, NULL);
        g_return_val_if_fail (predicate != NULL, NULL);
 
-       for (i = 0; i < hash->table_size; i++){
-               Slot *s;
-
-               for (s = hash->table [i]; s != NULL; s = s->next)
-                       if ((*predicate)(s->key, s->value, user_data))
-                               return s->value;
+       for (i = 0; i < hash->table_size; i++) {
+               if (hash->keys [i] && (*predicate)(hash->keys [i], hash->values [i], user_data))
+                       return hash->values [i];
        }
        return NULL;
 }
@@ -302,32 +325,53 @@ mono_g_hash_table_find (MonoGHashTable *hash, GHRFunc predicate, gpointer user_d
 gboolean
 mono_g_hash_table_remove (MonoGHashTable *hash, gconstpointer key)
 {
-       GEqualFunc equal;
-       Slot *s, *last;
-       guint hashcode;
-       
+       int slot, last_clear_slot;
+
        g_return_val_if_fail (hash != NULL, FALSE);
-       equal = hash->key_equal_func;
-
-       hashcode = ((*hash->hash_func)(key)) % hash->table_size;
-       last = NULL;
-       for (s = hash->table [hashcode]; s != NULL; s = s->next){
-               if ((*equal)(s->key, key)){
-                       if (hash->key_destroy_func != NULL)
-                               (*hash->key_destroy_func)(s->key);
-                       if (hash->value_destroy_func != NULL)
-                               (*hash->value_destroy_func)(s->value);
-                       if (last == NULL)
-                               hash->table [hashcode] = s->next;
-                       else
-                               last->next = s->next;
-                       free_slot (hash, s);
-                       hash->in_use--;
-                       return TRUE;
+       slot = mono_g_hash_table_find_slot (hash, key);
+
+       if (!hash->keys [slot])
+               return FALSE;
+
+       if (hash->key_destroy_func)
+               (*hash->key_destroy_func)(hash->keys [slot]);
+       hash->keys [slot] = NULL;
+       if (hash->value_destroy_func)
+               (*hash->value_destroy_func)(hash->values [slot]);
+       hash->values [slot] = NULL;
+       hash->in_use--;
+
+       /*
+        * When we insert in the hashtable, if the required position is occupied we
+        * consecutively try out following positions. In order to be able to find
+        * if a key exists or not in the array (without traversing the entire hash)
+        * we maintain the constraint that there can be no free slots between two
+        * entries that are hashed to the same position. This means that, at search
+        * time, when we encounter a free slot we can stop looking for collissions.
+        * Similarly, at remove time, we need to shift all following slots to their
+        * normal slot, until we reach an empty slot.
+        */
+       last_clear_slot = slot;
+       slot = (slot + 1) % hash->table_size;
+       while (hash->keys [slot]) {
+               guint hashcode = ((*hash->hash_func)(hash->keys [slot])) % hash->table_size;
+               /*
+                * We try to move the current element to last_clear_slot, but only if
+                * it brings it closer to its normal position (hashcode)
+                */
+               if ((last_clear_slot < slot && (hashcode > slot || hashcode <= last_clear_slot)) ||
+                               (last_clear_slot > slot && (hashcode > slot && hashcode <= last_clear_slot))) {
+                       mono_g_hash_table_key_store (hash, last_clear_slot, hash->keys [slot]);
+                       mono_g_hash_table_value_store (hash, last_clear_slot, hash->values [slot]);
+                       hash->keys [slot] = NULL;
+                       hash->values [slot] = NULL;
+                       last_clear_slot = slot;
                }
-               last = s;
+               slot++;
+               if (slot == hash->table_size)
+                       slot = 0;
        }
-       return FALSE;
+       return TRUE;
 }
 
 guint
@@ -335,40 +379,19 @@ mono_g_hash_table_foreach_remove (MonoGHashTable *hash, GHRFunc func, gpointer u
 {
        int i;
        int count = 0;
-       
+
        g_return_val_if_fail (hash != NULL, 0);
        g_return_val_if_fail (func != NULL, 0);
 
-       for (i = 0; i < hash->table_size; i++){
-               Slot *s, *last;
-
-               last = NULL;
-               for (s = hash->table [i]; s != NULL; ){
-                       if ((*func)(s->key, s->value, user_data)){
-                               Slot *n;
-
-                               if (hash->key_destroy_func != NULL)
-                                       (*hash->key_destroy_func)(s->key);
-                               if (hash->value_destroy_func != NULL)
-                                       (*hash->value_destroy_func)(s->value);
-                               if (last == NULL){
-                                       hash->table [i] = s->next;
-                                       n = s->next;
-                               } else  {
-                                       last->next = s->next;
-                                       n = last->next;
-                               }
-                               free_slot (hash, s);
-                               hash->in_use--;
-                               count++;
-                               s = n;
-                       } else {
-                               last = s;
-                               s = s->next;
-                       }
+       for (i = 0; i < hash->table_size; i++) {
+               if (hash->keys [i] && (*func)(hash->keys [i], hash->values [i], user_data)) {
+                       mono_g_hash_table_remove (hash, hash->keys [i]);
+                       count++;
+                       /* Retry current slot in case the removal shifted elements */
+                       i--;
                }
        }
-       if (count > 0)
+       if (hash->in_use < hash->table_size * HASH_TABLE_MIN_LOAD_FACTOR)
                rehash (hash);
        return count;
 }
@@ -377,27 +400,26 @@ void
 mono_g_hash_table_destroy (MonoGHashTable *hash)
 {
        int i;
-       
+
        g_return_if_fail (hash != NULL);
 
 #ifdef HAVE_SGEN_GC
-       mono_gc_deregister_root ((char*)hash);
+       if (hash->gc_type & MONO_HASH_KEY_GC)
+               mono_gc_deregister_root ((char*)hash->keys);
+       if (hash->gc_type & MONO_HASH_VALUE_GC)
+               mono_gc_deregister_root ((char*)hash->values);
 #endif
 
-       for (i = 0; i < hash->table_size; i++){
-               Slot *s, *next;
-
-               for (s = hash->table [i]; s != NULL; s = next){
-                       next = s->next;
-                       
-                       if (hash->key_destroy_func != NULL)
-                               (*hash->key_destroy_func)(s->key);
-                       if (hash->value_destroy_func != NULL)
-                               (*hash->value_destroy_func)(s->value);
-                       free_slot (hash, s);
+       for (i = 0; i < hash->table_size; i++) {
+               if (hash->keys [i]) {
+                       if (hash->key_destroy_func)
+                               (*hash->key_destroy_func)(hash->keys [i]);
+                       if (hash->value_destroy_func)
+                               (*hash->value_destroy_func)(hash->values [i]);
                }
        }
-       mg_free (hash->table);
+       mg_free (hash->keys);
+       mg_free (hash->values);
 #ifdef HAVE_SGEN_GC
        mg_free (hash);
 #else
@@ -408,36 +430,28 @@ mono_g_hash_table_destroy (MonoGHashTable *hash)
 static void
 mono_g_hash_table_insert_replace (MonoGHashTable *hash, gpointer key, gpointer value, gboolean replace)
 {
-       guint hashcode;
-       Slot *s;
-       GEqualFunc equal;
-       
+       int slot;
        g_return_if_fail (hash != NULL);
 
-       equal = hash->key_equal_func;
-       if (hash->in_use >= hash->threshold)
+       if (hash->in_use > (hash->table_size * HASH_TABLE_MAX_LOAD_FACTOR))
                rehash (hash);
 
-       hashcode = ((*hash->hash_func) (key)) % hash->table_size;
-       for (s = hash->table [hashcode]; s != NULL; s = s->next){
-               if ((*equal) (s->key, key)){
-                       if (replace){
-                               if (hash->key_destroy_func != NULL)
-                                       (*hash->key_destroy_func)(s->key);
-                               s->key = (MonoObject *)key;
-                       }
-                       if (hash->value_destroy_func != NULL)
-                               (*hash->value_destroy_func) (s->value);
-                       s->value = (MonoObject *)value;
-                       return;
+       slot = mono_g_hash_table_find_slot (hash, key);
+
+       if (hash->keys [slot]) {
+               if (replace) {
+                       if (hash->key_destroy_func)
+                               (*hash->key_destroy_func)(hash->keys [slot]);
+                       mono_g_hash_table_key_store (hash, slot, (MonoObject*)key);
                }
+               if (hash->value_destroy_func)
+                       (*hash->value_destroy_func) (hash->values [slot]);
+               mono_g_hash_table_value_store (hash, slot, (MonoObject*)value);
+       } else {
+               mono_g_hash_table_key_store (hash, slot, (MonoObject*)key);
+               mono_g_hash_table_value_store (hash, slot, (MonoObject*)value);
+               hash->in_use++;
        }
-       s = new_slot (hash);
-       s->key = (MonoObject *)key;
-       s->value = (MonoObject *)value;
-       s->next = hash->table [hashcode];
-       hash->table [hashcode] = s;
-       hash->in_use++;
 }
 
 void
@@ -453,56 +467,28 @@ mono_g_hash_table_replace(MonoGHashTable *h, gpointer k, gpointer v)
 }
 
 void
-mono_g_hash_table_print_stats (MonoGHashTable *table)
+mono_g_hash_table_print_stats (MonoGHashTable *hash)
 {
-       int i, chain_size, max_chain_size;
-       Slot *node;
-
-       max_chain_size = 0;
-       for (i = 0; i < table->table_size; i++) {
-               chain_size = 0;
-               for (node = table->table [i]; node; node = node->next)
-                       chain_size ++;
-               max_chain_size = MAX(max_chain_size, chain_size);
-       }
-
-       printf ("Size: %d Table Size: %d Max Chain Length: %d\n", table->in_use, table->table_size, max_chain_size);
-}
-
-#ifdef HAVE_SGEN_GC
-
-/* GC marker function */
-static void
-mono_g_hash_mark (void *addr, MonoGCMarkFunc mark_func, void *gc_data)
-{
-       MonoGHashTable *table = (MonoGHashTable*)addr;
-       Slot *node;
-       int i;
-
-       if (table->gc_type == MONO_HASH_KEY_GC) {
-               for (i = 0; i < table->table_size; i++) {
-                       for (node = table->table [i]; node; node = node->next) {
-                               if (node->key)
-                                       mark_func (&node->key, gc_data);
-                       }
-               }
-       } else if (table->gc_type == MONO_HASH_VALUE_GC) {
-               for (i = 0; i < table->table_size; i++) {
-                       for (node = table->table [i]; node; node = node->next) {
-                               if (node->value)
-                                       mark_func (&node->value, gc_data);
-                       }
+       int i = 0, chain_size = 0, max_chain_size = 0;
+       gboolean wrapped_around = FALSE;
+
+       while (TRUE) {
+               if (hash->keys [i]) {
+                       chain_size++;
+               } else {
+                       max_chain_size = MAX(max_chain_size, chain_size);
+                       chain_size = 0;
+                       if (wrapped_around)
+                               break;
                }
-       } else if (table->gc_type == MONO_HASH_KEY_VALUE_GC) {
-               for (i = 0; i < table->table_size; i++) {
-                       for (node = table->table [i]; node; node = node->next) {
-                               if (node->key)
-                                       mark_func (&node->key, gc_data);
-                               if (node->value)
-                                       mark_func (&node->value, gc_data);
-                       }
+
+               if (i == (hash->table_size - 1)) {
+                       wrapped_around = TRUE;
+                       i = 0;
+               } else {
+                       i++;
                }
        }
+       /* Rehash to a size that can fit the current elements */
+       printf ("Size: %d Table Size: %d Max Chain Length: %d\n", hash->in_use, hash->table_size, max_chain_size);
 }
-       
-#endif
index 60c3328a238782269a18de0e1c9bf04ddef6aa52..dca17694f8eab15a9ae3022b6d49ba112046aa49 100644 (file)
@@ -21,6 +21,8 @@ typedef enum {
        MONO_HASH_KEY_VALUE_GC = MONO_HASH_KEY_GC | MONO_HASH_VALUE_GC,
 } MonoGHashGCType;
 
+extern int mono_g_hash_table_max_chain_length;
+
 typedef struct _MonoGHashTable MonoGHashTable;
 
 MONO_API MonoGHashTable *mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg);
index 42d646444b136658a5a5fc76a87ebf5a89d8828d..657a21348dc8829ec9fe6e635292728495b5f9a7 100644 (file)
@@ -65,7 +65,7 @@ mono_mlist_alloc (MonoObject *data)
 MonoMList*
 mono_mlist_alloc_checked (MonoObject *data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMList* res;
        if (!monolist_item_vtable) {
                MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoListItem");
@@ -197,7 +197,7 @@ mono_mlist_prepend (MonoMList* list, MonoObject *data)
 MonoMList*
 mono_mlist_prepend_checked (MonoMList* list, MonoObject *data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMList* res = mono_mlist_alloc_checked (data, error);
        return_val_if_nok (error, NULL);
 
@@ -238,7 +238,7 @@ mono_mlist_append (MonoMList* list, MonoObject *data)
 MonoMList*
 mono_mlist_append_checked (MonoMList* list, MonoObject *data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMList* res = mono_mlist_alloc_checked (data, error);
        return_val_if_nok (error, NULL);
 
index 57c01f411e33ffb0ec34c3f0b04b436de297680b..8c370a9bacfc4bdce4d68498f481ec23ab7c0434 100644 (file)
@@ -1295,7 +1295,7 @@ custom_get_impl (SharedCategory *cat, MonoString *counter, MonoString* instance,
        SharedInstance* inst;
        char *name;
 
-       mono_error_init (error);
+       error_init (error);
        scounter = find_custom_counter (cat, counter);
        if (!scounter)
                return NULL;
@@ -1689,7 +1689,7 @@ get_string_array (void **array, int count, gboolean is_process, MonoError *error
 {
        int i;
        MonoDomain *domain = mono_domain_get ();
-       mono_error_init (error);
+       error_init (error);
        MonoArray * res = mono_array_new_checked (mono_domain_get (), mono_get_string_class (), count, error);
        return_val_if_nok (error, NULL);
        for (i = 0; i < count; ++i) {
@@ -1714,7 +1714,7 @@ get_string_array_of_strings (void **array, int count, MonoError *error)
 {
        int i;
        MonoDomain *domain = mono_domain_get ();
-       mono_error_init (error);
+       error_init (error);
        MonoArray * res = mono_array_new_checked (mono_domain_get (), mono_get_string_class (), count, error);
        return_val_if_nok (error, NULL);
        for (i = 0; i < count; ++i) {
@@ -1732,7 +1732,7 @@ get_mono_instances (MonoError *error)
        int res;
        void **buf = NULL;
        MonoArray *array;
-       mono_error_init (error);
+       error_init (error);
        do {
                count *= 2;
                g_free (buf);
@@ -1750,7 +1750,7 @@ get_cpu_instances (MonoError *error)
        void **buf = NULL;
        int i, count;
        MonoArray *array;
-       mono_error_init (error);
+       error_init (error);
        count = mono_cpu_count () + 1; /* +1 for "_Total" */
        buf = g_new (void*, count);
        for (i = 0; i < count; ++i)
@@ -1767,7 +1767,7 @@ get_processes_instances (MonoError *error)
        MonoArray *array;
        int count = 0;
        void **buf = mono_process_list (&count);
-       mono_error_init (error);
+       error_init (error);
        if (!buf)
                return get_string_array (NULL, 0, FALSE, error);
        array = get_string_array (buf, count, TRUE, error);
@@ -1780,7 +1780,7 @@ get_networkinterface_instances (MonoError *error)
 {
        MonoArray *array;
        int count = 0;
-       mono_error_init (error);
+       error_init (error);
        void **buf = mono_networkinterface_list (&count);
        if (!buf)
                return get_string_array_of_strings (NULL, 0, error);
@@ -1793,7 +1793,7 @@ static MonoArray*
 get_custom_instances (MonoString *category, MonoError *error)
 {
        SharedCategory *scat;
-       mono_error_init (error);
+       error_init (error);
        scat = find_custom_category (category);
        if (scat) {
                GSList *list = get_custom_instances_list (scat);
index 01549b8d3fc91347f8070f9c15c87bb2f7be990b..bd1ebe9b3644e12c924ecf7fdf652e058e963ed8 100644 (file)
@@ -16,7 +16,7 @@ gpointer
 ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("OpenThreadToken, OpenProcessToken");
 
@@ -32,7 +32,7 @@ MonoArray*
 ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetTokenInformation");
 
@@ -48,7 +48,7 @@ gpointer
 ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("DuplicateToken");
 
@@ -64,7 +64,7 @@ gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("ImpersonateLoggedOnUser");
 
@@ -80,7 +80,7 @@ gboolean
 ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("RevertToSelf");
 
@@ -96,7 +96,7 @@ gint32
 mono_security_win_get_token_name (gpointer token, gunichar2 ** uniname)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetTokenInformation");
 
@@ -112,7 +112,7 @@ gboolean
 mono_security_win_is_machine_protected (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
 
@@ -128,7 +128,7 @@ gboolean
 mono_security_win_is_user_protected (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetNamedSecurityInfo, LocalFree");
 
@@ -144,7 +144,7 @@ gboolean
 mono_security_win_protect_machine (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree, FreeSid");
 
@@ -160,7 +160,7 @@ gboolean
 mono_security_win_protect_user (gunichar2 *path)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("BuildTrusteeWithSid, SetEntriesInAcl, SetNamedSecurityInfo, LocalFree");
 
index f6d088dd0c7b11b50d6bc20bfc73bc6bfdc875fc..63807a5ac8fdd999be398a52975549a1ac43e5f2 100644 (file)
@@ -111,7 +111,7 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token
        gunichar2 *uniname = NULL;
        gint32 size = 0;
 
-       mono_error_init (&error);
+       error_init (&error);
 
        size = mono_security_win_get_token_name (token, &uniname);
 
index a1d3c9d0e4fe22e880944a855475c09b7ad09a00..0d770f70cdc0906290840eeb398892843cfcdfb4 100644 (file)
@@ -226,7 +226,7 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token
        gunichar2 *uniname = NULL;
        gint32 size = 0;
 
-       mono_error_init (&error);
+       error_init (&error);
 
        size = internal_get_token_name (token, &uniname);
 
@@ -551,7 +551,7 @@ ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString
 MonoBoolean
 ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssemblyHandle refass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (MONO_HANDLE_IS_NULL (refass))
                return FALSE;
        MonoAssembly *assembly = MONO_HANDLE_GETVAL (refass, assembly);
@@ -587,7 +587,7 @@ void invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolea
        MonoMethod *method;
        void *params [2];
 
-       mono_error_init (error);
+       error_init (error);
        
        if (system_security_assembly == NULL) {
                system_security_assembly = mono_image_loaded ("System.Security");
index 9ea87bd844c51a3efaf775a8b159251b1271fc2f..4ee7dd7c9c4f9ea7f327c0ffe7d81a5dcb3e1107 100644 (file)
@@ -164,6 +164,12 @@ mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits)
        return NULL;
 }
 
+void*
+mono_gc_make_vector_descr (void)
+{
+       return NULL;
+}
+
 void*
 mono_gc_make_root_descr_all_refs (int numbits)
 {
index b1492101b44025f1fc6c3ce08d39d5dd0abcf80b..b3ce33d12642a64502897a015d4184896039593e 100644 (file)
@@ -113,7 +113,7 @@ mono_runtime_object_init_checked (MonoObject *this_obj, MonoError *error)
        MonoMethod *method = NULL;
        MonoClass *klass = this_obj->vtable->klass;
 
-       mono_error_init (error);
+       error_init (error);
        method = mono_class_get_method_from_name (klass, ".ctor", 0);
        if (!method)
                g_error ("Could not lookup zero argument constructor for class %s", mono_type_get_full_name (klass));
@@ -358,7 +358,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
        MonoDomain *last_domain = NULL;
        MonoException * pending_tae = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (vtable->initialized)
                return TRUE;
@@ -477,7 +477,7 @@ mono_runtime_class_init_full (MonoVTable *vtable, MonoError *error)
                else
                        mono_error_cleanup (error);
 
-               mono_error_init (error);
+               error_init (error);
 
                /* If the initialization failed, mark the class as unusable. */
                /* Avoid infinite loops */
@@ -665,7 +665,7 @@ mono_compile_method_checked (MonoMethod *method, MonoError *error)
 
        MONO_REQ_GC_NEUTRAL_MODE
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (callbacks.compile_method);
        res = callbacks.compile_method (method, error);
@@ -679,7 +679,7 @@ mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gbo
 
        MONO_REQ_GC_NEUTRAL_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        res = callbacks.create_jump_trampoline (domain, method, add_sync_wrapper, error);
        return res;
 }
@@ -1778,7 +1778,7 @@ mono_class_vtable_full (MonoDomain *domain, MonoClass *klass, MonoError *error)
 
        MonoClassRuntimeInfo *runtime_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (klass);
 
@@ -1856,7 +1856,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
        gpointer iter;
        gpointer *interface_offsets;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_loader_lock (); /*FIXME mono_class_init acquires it*/
        mono_domain_lock (domain);
@@ -2214,7 +2214,7 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
        int bcsize;
 #endif
 
-       mono_error_init (error);
+       error_init (error);
 
        vt = mono_class_vtable (domain, klass);
        g_assert (vt); /*FIXME property handle failure*/
@@ -2523,7 +2523,7 @@ mono_remote_class (MonoDomain *domain, MonoStringHandle class_name, MonoClass *p
        gpointer* key, *mp_key;
        char *name;
        
-       mono_error_init (error);
+       error_init (error);
 
        key = create_remote_class_key (NULL, proxy_class);
        
@@ -2632,7 +2632,7 @@ mono_remote_class_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mon
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_loader_lock (); /*FIXME mono_class_from_mono_type and mono_class_proxy_vtable take it*/
        mono_domain_lock (domain);
@@ -2686,7 +2686,7 @@ mono_upgrade_remote_class (MonoDomain *domain, MonoObjectHandle proxy_object, Mo
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoTransparentProxyHandle tproxy = MONO_HANDLE_CAST (MonoTransparentProxy, proxy_object);
        MonoRemoteClass *remote_class = MONO_HANDLE_GETVAL (tproxy, remote_class);
@@ -2754,7 +2754,7 @@ mono_object_get_virtual_method (MonoObject *obj_raw, MonoMethod *method)
 MonoMethod*
 mono_object_handle_get_virtual_method (MonoObjectHandle obj, MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        gboolean is_proxy = FALSE;
        MonoClass *klass = mono_handle_class (obj);
@@ -2769,7 +2769,7 @@ mono_object_handle_get_virtual_method (MonoObjectHandle obj, MonoMethod *method,
 static MonoMethod*
 class_get_virtual_method (MonoClass *klass, MonoMethod *method, gboolean is_proxy, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
 
        if (!is_proxy && ((method->flags & METHOD_ATTRIBUTE_FINAL) || !(method->flags & METHOD_ATTRIBUTE_VIRTUAL)))
@@ -2842,7 +2842,7 @@ do_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **ex
 
        g_assert (callbacks.runtime_invoke);
 
-       mono_error_init (error);
+       error_init (error);
        
        if (mono_profiler_get_events () & MONO_PROFILE_METHOD_EVENTS)
                mono_profiler_method_start_invoke (method);
@@ -3343,7 +3343,7 @@ mono_field_get_value_object_checked (MonoDomain *domain, MonoClassField *field,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoObject *o;
        MonoClass *klass;
@@ -3488,7 +3488,7 @@ mono_get_constant_value_from_blob (MonoDomain* domain, MonoTypeEnum type, const
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        int retval = 0;
        const char *p = blob;
        mono_metadata_decode_blob_size (p, &p);
@@ -3539,7 +3539,7 @@ get_default_field_value (MonoDomain* domain, MonoClassField *field, void *value,
        MonoTypeEnum def_type;
        const char* data;
 
-       mono_error_init (error);
+       error_init (error);
        
        data = mono_class_get_field_default_value (field, &def_type);
        mono_get_constant_value_from_blob (domain, def_type, data, value, error);
@@ -3552,7 +3552,7 @@ mono_field_static_get_value_for_thread (MonoInternalThread *thread, MonoVTable *
 
        void *src;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_return_if_fail (field->type->attrs & FIELD_ATTRIBUTE_STATIC);
        
@@ -3674,7 +3674,7 @@ mono_property_set_value_checked (MonoProperty *prop, void *obj, void **params, M
 
        MonoObject *exc;
 
-       mono_error_init (error);
+       error_init (error);
        do_runtime_invoke (prop->set, obj, params, &exc, error);
        if (exc != NULL && is_ok (error))
                mono_error_set_exception_instance (error, (MonoException*)exc);
@@ -3797,7 +3797,7 @@ mono_nullable_box (guint8 *buf, MonoClass *klass, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoClass *param_class = klass->cast_class;
 
        mono_class_setup_fields (klass);
@@ -3938,7 +3938,7 @@ mono_runtime_delegate_try_invoke (MonoObject *delegate, void **params, MonoObjec
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *im;
        MonoClass *klass = delegate->vtable->klass;
        MonoObject *o;
@@ -3970,7 +3970,7 @@ mono_runtime_delegate_try_invoke (MonoObject *delegate, void **params, MonoObjec
 MonoObject*
 mono_runtime_delegate_invoke_checked (MonoObject *delegate, void **params, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return mono_runtime_delegate_try_invoke (delegate, params, NULL, error);
 }
 
@@ -4006,7 +4006,7 @@ mono_runtime_get_main_args_checked (MonoError *error)
        int i;
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error);
+       error_init (error);
 
        res = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, num_main_args, error);
        return_val_if_nok (error, NULL);
@@ -4215,7 +4215,7 @@ int
 mono_runtime_run_main_checked (MonoMethod *method, int argc, char* argv[],
                               MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoArray *args = prepare_run_main (method, argc, argv);
        return mono_runtime_exec_main_checked (method, args, error);
 }
@@ -4329,7 +4329,7 @@ make_transparent_proxy (MonoObject *obj, MonoError *error)
        MonoReflectionType *reflection_type;
        MonoTransparentProxy *transparent_proxy;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!get_proxy_method)
                get_proxy_method = mono_class_get_method_from_name (mono_defaults.real_proxy_class, "GetTransparentProxy", 0);
@@ -4373,7 +4373,7 @@ mono_object_xdomain_representation (MonoObject *obj, MonoDomain *target_domain,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoObject *deserialized = NULL;
 
 #ifndef DISABLE_REMOTING
@@ -4408,7 +4408,7 @@ create_unhandled_exception_eventargs (MonoObject *exc, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass;
        gpointer args [2];
        MonoMethod *method = NULL;
@@ -4659,7 +4659,7 @@ do_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error)
        gpointer pa [1];
        int rval;
 
-       mono_error_init (error);
+       error_init (error);
        g_assert (args);
 
        pa [0] = args;
@@ -4766,7 +4766,7 @@ mono_runtime_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
 int
 mono_runtime_exec_main_checked (MonoMethod *method, MonoArray *args, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        prepare_thread_to_exec_main (mono_object_domain (args), method);
        return do_exec_main_checked (method, args, error);
 }
@@ -4803,7 +4803,7 @@ invoke_array_extract_argument (MonoArray *params, int i, MonoType *t, gboolean*
 {
        MonoType *t_orig = t;
        gpointer result = NULL;
-       mono_error_init (error);
+       error_init (error);
                again:
                        switch (t->type) {
                        case MONO_TYPE_U1:
@@ -4984,7 +4984,7 @@ MonoObject*
 mono_runtime_invoke_array_checked (MonoMethod *method, void *obj, MonoArray *params,
                                   MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return mono_runtime_try_invoke_array (method, obj, params, NULL, error);
 }
 
@@ -5033,7 +5033,7 @@ mono_runtime_try_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoMethodSignature *sig = mono_method_signature (method);
        gpointer *pa = NULL;
@@ -5229,7 +5229,7 @@ mono_object_new_pinned (MonoDomain *domain, MonoClass *klass, MonoError *error)
 
        MonoVTable *vtable;
 
-       mono_error_init (error);
+       error_init (error);
 
        vtable = mono_class_vtable (domain, klass);
        g_assert (vtable); /* FIXME don't swallow the error */
@@ -5268,7 +5268,7 @@ mono_object_new_specific_checked (MonoVTable *vtable, MonoError *error)
 
        MonoObject *o;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* check for is_com_object for COM Interop */
        if (mono_vtable_is_remote (vtable) || mono_class_is_com_object (vtable->klass))
@@ -5362,7 +5362,7 @@ mono_object_new_alloc_specific_checked (MonoVTable *vtable, MonoError *error)
 
        MonoObject *o;
 
-       mono_error_init (error);
+       error_init (error);
 
        o = (MonoObject *)mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
 
@@ -5423,7 +5423,7 @@ mono_object_new_fast_checked (MonoVTable *vtable, MonoError *error)
 
        MonoObject *o;
 
-       mono_error_init (error);
+       error_init (error);
 
        o = mono_gc_alloc_obj (vtable, vtable->klass->instance_size);
 
@@ -5450,7 +5450,7 @@ mono_object_new_mature (MonoVTable *vtable, MonoError *error)
 
        MonoObject *o;
 
-       mono_error_init (error);
+       error_init (error);
 
        o = mono_gc_alloc_mature (vtable, vtable->klass->instance_size);
 
@@ -5554,7 +5554,7 @@ mono_object_clone_checked (MonoObject *obj, MonoError *error)
        MonoObject *o;
        int size;
 
-       mono_error_init (error);
+       error_init (error);
 
        size = obj->vtable->klass->instance_size;
 
@@ -5635,7 +5635,7 @@ mono_array_clone_in_domain (MonoDomain *domain, MonoArrayHandle array_handle, Mo
        uintptr_t size = 0;
        MonoClass *klass = mono_handle_class (array_handle);
 
-       mono_error_init (error);
+       error_init (error);
 
        /* Pin source array here - if bounds is non-NULL, it's a pointer into the object data */
        uint32_t src_handle = mono_gchandle_from_handle (MONO_HANDLE_CAST (MonoObject, array_handle), TRUE);
@@ -5704,7 +5704,7 @@ mono_array_clone_checked (MonoArray *array_raw, MonoError *error)
        MONO_REQ_GC_UNSAFE_MODE;
        HANDLE_FUNCTION_ENTER ();
        /* FIXME: callers of mono_array_clone_checked should use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoArray, array);
        MonoArrayHandle result = mono_array_clone_in_domain (MONO_HANDLE_DOMAIN (array), array, error);
        HANDLE_FUNCTION_RETURN_OBJ (result);
@@ -5781,7 +5781,7 @@ mono_array_new_full_checked (MonoDomain *domain, MonoClass *array_class, uintptr
        MonoVTable *vtable;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!array_class->inited)
                mono_class_init (array_class);
@@ -5896,7 +5896,7 @@ mono_array_new_checked (MonoDomain *domain, MonoClass *eclass, uintptr_t n, Mono
 {
        MonoClass *ac;
 
-       mono_error_init (error);
+       error_init (error);
 
        ac = mono_array_class_get (eclass, 1);
        g_assert (ac);
@@ -5943,7 +5943,7 @@ mono_array_new_specific_checked (MonoVTable *vtable, uintptr_t n, MonoError *err
        MonoObject *o;
        uintptr_t byte_len;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (G_UNLIKELY (n > MONO_ARRAY_MAX_INDEX)) {
                mono_error_set_generic_error (error, "System", "OverflowException", "");
@@ -6035,7 +6035,7 @@ mono_string_new_utf16_checked (MonoDomain *domain, const guint16 *text, gint32 l
 
        MonoString *s;
        
-       mono_error_init (error);
+       error_init (error);
        
        s = mono_string_new_size_checked (domain, len, error);
        if (s != NULL)
@@ -6078,7 +6078,7 @@ mono_string_new_utf32_checked (MonoDomain *domain, const mono_unichar4 *text, gi
        GError *gerror = NULL;
        glong items_written;
        
-       mono_error_init (error);
+       error_init (error);
        utf16_output = g_ucs4_to_utf16 (text, len, NULL, &items_written, &gerror);
        
        if (gerror)
@@ -6138,7 +6138,7 @@ mono_string_new_size_checked (MonoDomain *domain, gint32 len, MonoError *error)
        MonoVTable *vtable;
        size_t size;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* check for overflow */
        if (len < 0 || len > ((SIZE_MAX - G_STRUCT_OFFSET (MonoString, chars) - 8) / 2)) {
@@ -6194,7 +6194,7 @@ mono_string_new_len_checked (MonoDomain *domain, const char *text, guint length,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        GError *eg_error = NULL;
        MonoString *o = NULL;
@@ -6252,7 +6252,7 @@ mono_string_new_checked (MonoDomain *domain, const char *text, MonoError *error)
     glong items_written;
     int l;
 
-    mono_error_init (error);
+    error_init (error);
 
     l = strlen (text);
    
@@ -6346,7 +6346,7 @@ mono_value_box_checked (MonoDomain *domain, MonoClass *klass, gpointer value, Mo
        int size;
        MonoVTable *vtable;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (klass->valuetype);
        if (mono_class_is_nullable (klass))
@@ -6544,7 +6544,7 @@ mono_object_isinst_checked (MonoObject *obj_raw, MonoClass *klass, MonoError *er
        MONO_REQ_GC_UNSAFE_MODE;
 
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoObject, obj);
        MonoObjectHandle result = mono_object_handle_isinst (obj, klass, error);
        HANDLE_FUNCTION_RETURN_OBJ (result);
@@ -6562,7 +6562,7 @@ mono_object_isinst_checked (MonoObject *obj_raw, MonoClass *klass, MonoError *er
 MonoObjectHandle
 mono_object_handle_isinst (MonoObjectHandle obj, MonoClass *klass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        
        if (!klass->inited)
                mono_class_init (klass);
@@ -6594,7 +6594,7 @@ mono_object_isinst_mbyref (MonoObject *obj_raw, MonoClass *klass)
 MonoObjectHandle
 mono_object_handle_isinst_mbyref (MonoObjectHandle obj, MonoClass *klass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoObjectHandle result = MONO_HANDLE_NEW (MonoObject, NULL);
 
@@ -6726,7 +6726,7 @@ mono_string_get_pinned (MonoString *str, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* We only need to make a pinned version of a string if this is a moving GC */
        if (!mono_gc_is_moving ())
@@ -6753,7 +6753,7 @@ mono_string_is_interned_lookup (MonoString *str, int insert, MonoError *error)
        MonoString *s, *res;
        MonoDomain *domain;
        
-       mono_error_init (error);
+       error_init (error);
 
        domain = ((MonoObject *)str)->vtable->domain;
        ldstr_table = domain->ldstr_table;
@@ -6845,7 +6845,7 @@ mono_string_intern_checked (MonoString *str, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        return mono_string_is_interned_lookup (str, TRUE, error);
 }
@@ -6883,7 +6883,7 @@ MonoString*
 mono_ldstr_checked (MonoDomain *domain, MonoImage *image, guint32 idx, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
-       mono_error_init (error);
+       error_init (error);
 
        if (image->dynamic) {
                MonoString *str = (MonoString *)mono_lookup_dynamic_token (image, MONO_TOKEN_STRING | idx, NULL, error);
@@ -6910,7 +6910,7 @@ mono_ldstr_metadata_sig (MonoDomain *domain, const char* sig, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        const char *str = sig;
        MonoString *o, *interned;
        size_t len2;
@@ -6965,7 +6965,7 @@ mono_ldstr_utf8 (MonoImage *image, guint32 idx, MonoError *error)
        char *as;
        GError *gerror = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_verifier_verify_string_signature (image, idx, NULL))
                return NULL; /*FIXME we should probably be raising an exception here*/
@@ -7034,7 +7034,7 @@ mono_string_to_utf8_checked (MonoString *s, MonoError *error)
        char *as;
        GError *gerror = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (s == NULL)
                return NULL;
@@ -7222,7 +7222,7 @@ mono_string_from_utf16_checked (gunichar2 *data, MonoError *error)
 
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get ();
        int len = 0;
 
@@ -7265,7 +7265,7 @@ mono_string_from_utf32_checked (mono_unichar4 *data, MonoError *error)
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoString* result = NULL;
        mono_unichar2 *utf16_output = NULL;
        GError *gerror = NULL;
@@ -7409,7 +7409,7 @@ mono_wait_handle_new (MonoDomain *domain, HANDLE handle, MonoError *error)
        gpointer params [1];
        static MonoMethod *handle_set;
 
-       mono_error_init (error);
+       error_init (error);
        res = (MonoWaitHandle *)mono_object_new_checked (domain, mono_defaults.manualresetevent_class, error);
        return_val_if_nok (error, NULL);
 
@@ -7448,7 +7448,7 @@ mono_runtime_capture_context (MonoDomain *domain, MonoError *error)
 
        RuntimeInvokeFunction runtime_invoke;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!domain->capture_context_runtime_invoke || !domain->capture_context_method) {
                MonoMethod *method = mono_get_context_capture_method ();
@@ -7484,7 +7484,7 @@ mono_async_result_new (MonoDomain *domain, HANDLE handle, MonoObject *state, gpo
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoAsyncResult *res = (MonoAsyncResult *)mono_object_new_checked (domain, mono_defaults.asyncresult_class, error);
        return_val_if_nok (error, NULL);
        MonoObject *context = mono_runtime_capture_context (domain, error);
@@ -7554,7 +7554,7 @@ ves_icall_System_Runtime_Remoting_Messaging_AsyncResult_Invoke (MonoAsyncResult
                if (wait_event != NULL)
                        mono_w32event_set (wait_event);
 
-               mono_error_init (&error); //the else branch would leave it in an undefined state
+               error_init (&error); //the else branch would leave it in an undefined state
                if (ac->cb_method)
                        mono_runtime_invoke_checked (ac->cb_method, ac->cb_target, (gpointer*) &ares, &error);
 
@@ -7583,7 +7583,7 @@ mono_message_init (MonoDomain *domain,
                g_assert (init_message_method != NULL);
        }
 
-       mono_error_init (error);
+       error_init (error);
        /* FIXME set domain instead? */
        g_assert (domain == mono_domain_get ());
        
@@ -7622,7 +7622,7 @@ mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg, MonoObject
 
        g_assert (exc);
 
-       mono_error_init (error);
+       error_init (error);
 
        /*static MonoObject *(*invoke) (gpointer, gpointer, MonoObject **, MonoArray **) = NULL;*/
 
@@ -7654,7 +7654,7 @@ mono_message_invoke (MonoObject *target, MonoMethodMessage *msg,
        MONO_REQ_GC_UNSAFE_MODE;
 
        static MonoClass *object_array_klass;
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain; 
        MonoMethod *method;
@@ -7784,7 +7784,7 @@ mono_object_to_string (MonoObject *obj, MonoObject **exc)
 MonoString *
 mono_object_to_string_checked (MonoObject *obj, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        void *target;
        MonoMethod *method = prepare_to_string_method (obj, &target);
        return (MonoString*) mono_runtime_invoke_checked (method, target, NULL, error);
@@ -7804,7 +7804,7 @@ MonoString *
 mono_object_try_to_string (MonoObject *obj, MonoObject **exc, MonoError *error)
 {
        g_assert (exc);
-       mono_error_init (error);
+       error_init (error);
        void *target;
        MonoMethod *method = prepare_to_string_method (obj, &target);
        return (MonoString*) mono_runtime_try_invoke (method, target, NULL, exc, error);
@@ -7906,7 +7906,7 @@ mono_delegate_ctor_with_method (MonoObject *this_obj, MonoObject *target, gpoint
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoDelegate *delegate = (MonoDelegate *)this_obj;
 
        g_assert (this_obj);
@@ -7923,6 +7923,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);
@@ -7954,7 +7957,7 @@ mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr, Mon
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = mono_domain_get ();
        MonoJitInfo *ji;
        MonoMethod *method = NULL;
@@ -7991,7 +7994,7 @@ mono_method_call_message_new (MonoMethod *method, gpointer *params, MonoMethod *
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain = mono_domain_get ();
        MonoMethodSignature *sig = mono_method_signature (method);
@@ -8055,7 +8058,7 @@ mono_method_return_message_restore (MonoMethod *method, gpointer *params, MonoAr
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoMethodSignature *sig = mono_method_signature (method);
        int i, j, type, size, out_len;
@@ -8149,7 +8152,7 @@ mono_load_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoClas
 
        static MonoMethod *getter = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain = mono_domain_get ();
        MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
@@ -8246,7 +8249,7 @@ mono_load_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mono
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        static MonoMethod *tp_load = NULL;
 
@@ -8308,7 +8311,7 @@ mono_store_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoCla
        
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDomain *domain = mono_domain_get ();
        MonoClass *field_class;
@@ -8362,7 +8365,7 @@ mono_store_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mon
 
        static MonoMethod *tp_store = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
@@ -8495,7 +8498,7 @@ mono_glist_to_array (GList *list, MonoClass *eclass, MonoError *error)
        MonoArray *res;
        int len, i;
 
-       mono_error_init (error);
+       error_init (error);
        if (!list)
                return NULL;
 
index a880ec9330068672aeae59a614df7bf7759d6041..5902d17378a1e47726cc60166c258926bb6816c2 100644 (file)
@@ -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 e82a44353dc1936be2ecc2ef749112259006feba..cba372954533a1914c19525d476232028ff45e49 100644 (file)
@@ -109,7 +109,7 @@ typedef MonoObjectHandle (*ReflectionCacheConstructFunc_handle) (MonoDomain*, Mo
 static inline MonoObjectHandle
 check_or_construct_handle (MonoDomain *domain, MonoClass *klass, gpointer item, gpointer user_data, MonoError *error, ReflectionCacheConstructFunc_handle construct)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoObjectHandle obj = check_object_handle (domain, klass, item);
        if (!MONO_HANDLE_IS_NULL (obj))
                return obj;
index 1ddb08757a35cf6ad594485318d1edbe172b5bb9..43843be4a5a676a9f8f34808588688bbbf81f150 100644 (file)
@@ -165,7 +165,10 @@ reflected_equal (gconstpointer a, gconstpointer b)
 guint
 reflected_hash (gconstpointer a) {
        const ReflectedEntry *ea = (const ReflectedEntry *)a;
-       return mono_aligned_addr_hash (ea->item);
+       /* Combine hashes for item and refclass. Identical to boost's hash_combine */
+       guint seed = mono_aligned_addr_hash (ea->item) + 0x9e3779b9;
+       seed ^= mono_aligned_addr_hash (ea->refclass) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+       return seed;
 }
 
 
@@ -229,7 +232,7 @@ mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
 static MonoReflectionAssemblyHandle
 assembly_object_construct (MonoDomain *domain, MonoClass *unused_klass, MonoAssembly *assembly, gpointer user_data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionAssemblyHandle res = MONO_HANDLE_NEW (MonoReflectionAssembly, mono_object_new_checked (domain, mono_class_get_mono_assembly_class (), error));
        return_val_if_nok (error, MONO_HANDLE_CAST (MonoReflectionAssembly, NULL_HANDLE));
        MONO_HANDLE_SETVAL (res, assembly, MonoAssembly*, assembly);
@@ -246,7 +249,7 @@ assembly_object_construct (MonoDomain *domain, MonoClass *unused_klass, MonoAsse
 MonoReflectionAssemblyHandle
 mono_assembly_get_object_handle (MonoDomain *domain, MonoAssembly *assembly, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionAssemblyHandle, assembly, NULL, assembly_object_construct, NULL);
 }
 
@@ -265,7 +268,7 @@ module_object_construct (MonoDomain *domain, MonoClass *unused_klass, MonoImage
 {
        char* basename;
        
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionModuleHandle res = MONO_HANDLE_NEW (MonoReflectionModule, mono_object_new_checked (domain, mono_class_get_mono_module_class (), error));
        if (!is_ok (error))
                goto fail;
@@ -312,7 +315,7 @@ fail:
 MonoReflectionModuleHandle
 mono_module_get_object_handle (MonoDomain *domain, MonoImage *image, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionModuleHandle, image, NULL, module_object_construct, NULL);
 }
 
@@ -335,7 +338,7 @@ mono_module_file_get_object_handle (MonoDomain *domain, MonoImage *image, int ta
        guint32 i, name_idx;
        const char *val;
        
-       mono_error_init (error);
+       error_init (error);
 
        MonoReflectionModuleHandle res = MONO_HANDLE_NEW (MonoReflectionModule, mono_object_new_checked (domain, mono_class_get_mono_module_class (), error));
        if (!is_ok (error))
@@ -445,7 +448,7 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err
        MonoReflectionType *res;
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (type != NULL);
        klass = mono_class_from_mono_type (type);
@@ -579,7 +582,7 @@ mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refcl
 static MonoReflectionMethodHandle
 method_object_construct (MonoDomain *domain, MonoClass *refclass, MonoMethod *method, gpointer user_data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        g_assert (refclass != NULL);
        /*
         * We use the same C representation for methods and constructors, but the type 
@@ -587,7 +590,7 @@ method_object_construct (MonoDomain *domain, MonoClass *refclass, MonoMethod *me
         */
        MonoClass *klass;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (*method->name == '.' && (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)) {
                klass = mono_class_get_mono_cmethod_class ();
@@ -625,7 +628,7 @@ fail:
 MonoReflectionMethodHandle
 mono_method_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (!refclass)
                refclass = method->klass;
 
@@ -696,7 +699,7 @@ mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *fie
 static MonoReflectionFieldHandle
 field_object_construct (MonoDomain *domain, MonoClass *klass, MonoClassField *field, gpointer user_data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoReflectionFieldHandle res = MONO_HANDLE_NEW (MonoReflectionField, mono_object_new_checked (domain, mono_class_get_mono_field_class (), error));
        if (!is_ok (error))
@@ -734,7 +737,7 @@ fail:
 MonoReflectionFieldHandle
 mono_field_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionFieldHandle, field, klass, field_object_construct, NULL);
 }
 
@@ -779,7 +782,7 @@ mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *pr
 static MonoReflectionPropertyHandle
 property_object_construct (MonoDomain *domain, MonoClass *klass, MonoProperty *property, gpointer user_data, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        MonoReflectionPropertyHandle res = MONO_HANDLE_NEW (MonoReflectionProperty, mono_object_new_checked (domain, mono_class_get_mono_property_class (), error));
        if (!is_ok (error))
@@ -848,7 +851,7 @@ static MonoReflectionEventHandle
 event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event, gpointer user_data, MonoError *error)
 {
 
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionMonoEventHandle mono_event = MONO_HANDLE_NEW (MonoReflectionMonoEvent, mono_object_new_checked (domain, mono_class_get_mono_event_class (), error));
        if (!is_ok (error))
                return MONO_HANDLE_CAST (MonoReflectionEvent, NULL_HANDLE);
@@ -870,7 +873,7 @@ event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event,
 MonoReflectionEventHandle
 mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionEventHandle, event, klass, event_object_construct, NULL);
 }
 
@@ -909,7 +912,7 @@ get_dbnull_object (MonoDomain *domain, MonoError *error)
 {
        static MonoClassField *dbnull_value_field = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!dbnull_value_field) {
                MonoClass *dbnull_klass;
@@ -925,7 +928,7 @@ get_dbnull_object (MonoDomain *domain, MonoError *error)
 static MonoObjectHandle
 get_dbnull (MonoDomain *domain, MonoObjectHandle dbnull, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (MONO_HANDLE_IS_NULL (dbnull))
                MONO_HANDLE_ASSIGN (dbnull, get_dbnull_object (domain, error));
        return dbnull;
@@ -943,7 +946,7 @@ static gboolean
 add_parameter_object_to_array (MonoDomain *domain, MonoMethod *method, MonoObjectHandle member, int idx, const char *name, MonoType *sig_param, guint32 blob_type_enum, const char *blob, MonoMarshalSpec *mspec, MonoObjectHandle missing, MonoObjectHandle dbnull, MonoArrayHandle dest,  MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionParameterHandle param = MONO_HANDLE_NEW (MonoReflectionParameter, mono_object_new_checked (domain, mono_class_get_mono_parameter_info_class (), error));
        if (!is_ok (error))
                goto leave;
@@ -1030,7 +1033,7 @@ param_objects_construct (MonoDomain *domain, MonoClass *refclass, MonoMethodSign
        MonoMarshalSpec **mspecs = NULL;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        
        MonoReflectionMethodHandle member = mono_method_get_object_handle (domain, method, refclass, error);
        if (!is_ok (error))
@@ -1096,7 +1099,7 @@ leave:
 MonoArrayHandle
 mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        /* side-effect: sets method->signature non-NULL on success */
        MonoMethodSignature *sig = mono_method_signature_checked (method, error);
@@ -1133,7 +1136,7 @@ static gboolean
 add_local_var_info_to_array (MonoDomain *domain, MonoMethodHeader *header, int idx, MonoArrayHandle dest, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionLocalVariableInfoHandle info = MONO_HANDLE_NEW (MonoReflectionLocalVariableInfo, mono_object_new_checked (domain, mono_class_get_local_variable_info_class (), error));
        if (!is_ok (error))
                goto leave;
@@ -1157,7 +1160,7 @@ static gboolean
 add_exception_handling_clause_to_array (MonoDomain *domain, MonoMethodHeader *header, int idx, MonoArrayHandle dest, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionExceptionHandlingClauseHandle info = MONO_HANDLE_NEW (MonoReflectionExceptionHandlingClause, mono_object_new_checked (domain, mono_class_get_exception_handling_clause_class (), error));
        if (!is_ok (error))
                goto leave;
@@ -1210,7 +1213,7 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM
        unsigned char format, flags;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* for compatibility with .net */
        if (method_is_dynamic (method)) {
@@ -1308,7 +1311,7 @@ fail:
 MonoReflectionMethodBodyHandle
 mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethodBodyHandle, method, NULL, method_body_object_construct, NULL);
 }
 
@@ -1406,7 +1409,7 @@ mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob,
        MonoObject *object;
        MonoType *basetype = type;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!blob)
                return NULL;
@@ -1841,7 +1844,7 @@ _mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image,
        MonoType *type;
        MonoImage *rootimage = image;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (info->assembly.name) {
                MonoAssembly *assembly = mono_assembly_loaded (&info->assembly);
@@ -1866,7 +1869,7 @@ _mono_reflection_get_type_from_info (MonoTypeNameParse *info, MonoImage *image,
        if (type == NULL && !info->assembly.name && image != mono_defaults.corlib) {
                /* ignore the error and try again */
                mono_error_cleanup (error);
-               mono_error_init (error);
+               error_init (error);
                image = mono_defaults.corlib;
                type = mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, &type_resolve, error);
        }
@@ -1887,7 +1890,7 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
        int modval;
        gboolean bounded = FALSE;
        
-       mono_error_init (error);
+       error_init (error);
        if (!image)
                image = mono_defaults.corlib;
 
@@ -2041,7 +2044,7 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig
  */
 MonoType*
 mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) {
-       mono_error_init (error);
+       error_init (error);
        return mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, type_resolve, error);
 }
 
@@ -2050,7 +2053,7 @@ static MonoType*
 module_builder_array_get_type (MonoArrayHandle module_builders, int i, MonoImage *rootimage, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = NULL;
        MonoReflectionModuleBuilderHandle mb = MONO_HANDLE_NEW (MonoReflectionModuleBuilder, NULL);
        MONO_HANDLE_ARRAY_GETREF (mb, module_builders, i);
@@ -2063,7 +2066,7 @@ static MonoType*
 module_array_get_type (MonoArrayHandle modules, int i, MonoImage *rootimage, MonoTypeNameParse *info, gboolean ignorecase, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *type = NULL;
        MonoReflectionModuleHandle mod = MONO_HANDLE_NEW (MonoReflectionModule, NULL);
        MONO_HANDLE_ARRAY_GETREF (mod, modules, i);
@@ -2079,7 +2082,7 @@ mono_reflection_get_type_internal_dynamic (MonoImage *rootimage, MonoAssembly *a
        MonoType *type = NULL;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        g_assert (assembly_is_dynamic (assembly));
        MonoReflectionAssemblyBuilderHandle abuilder = MONO_HANDLE_CAST (MonoReflectionAssemblyBuilder, mono_assembly_get_object_handle (((MonoDynamicAssembly*)assembly)->domain, assembly, error));
        if (!is_ok (error))
@@ -2125,7 +2128,7 @@ mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image,
        GString *fullName;
        GList *mod;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (image && image_is_dynamic (image))
                type = mono_reflection_get_type_internal_dynamic (rootimage, image->assembly, info, ignorecase, error);
@@ -2232,7 +2235,7 @@ mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError
        MonoTypeNameParse info;
        char *tmp;
 
-       mono_error_init (error);
+       error_init (error);
        /* Make a copy since parse_type modifies its argument */
        tmp = g_strdup (name);
        
@@ -2281,7 +2284,7 @@ mono_reflection_get_token_checked (MonoObjectHandle obj, MonoError *error)
 {
        guint32 token = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoClass *klass = mono_handle_class (obj);
 
@@ -2380,7 +2383,7 @@ mono_reflection_bind_generic_parameters (MonoReflectionTypeHandle reftype, int t
        gboolean is_dynamic = FALSE;
        MonoClass *geninst;
 
-       mono_error_init (error);
+       error_init (error);
        
        mono_loader_lock ();
 
@@ -2446,7 +2449,7 @@ static MonoGenericInst*
 generic_inst_from_type_array_handle (MonoArrayHandle types, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoGenericInst *ginst = NULL;
        int count = mono_array_handle_length (types);
        MonoType **type_argv = g_new0 (MonoType *, count);
@@ -2471,7 +2474,7 @@ reflection_bind_generic_method_parameters (MonoMethod *method, MonoArrayHandle t
        MonoMethod *inflated;
        MonoGenericContext tmp_context;
 
-       mono_error_init (error);
+       error_init (error);
 
        klass = method->klass;
 
@@ -2504,7 +2507,7 @@ reflection_bind_generic_method_parameters (MonoMethod *method, MonoArrayHandle t
 MonoReflectionMethodHandle
 ves_icall_MonoMethod_MakeGenericMethod_impl (MonoReflectionMethodHandle rmethod, MonoArrayHandle types, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        g_assert (0 != strcmp (mono_handle_class (rmethod)->name, "MethodBuilder"));
 
        MonoMethod *method = MONO_HANDLE_GETVAL (rmethod, method);
@@ -2959,7 +2962,7 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono
        void *params [1];
        static MonoMethod *method = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (method == NULL) {
                method = mono_class_get_method_from_name (mono_class_get_type_builder_class (), "IsAssignableTo", 1);
index b85e950ab55e18c39cb8361edc3edaeef7154cca..ecc5f94248485b893960e154aeda2b7b1d1a6d61 100644 (file)
@@ -413,7 +413,7 @@ mono_remoting_wrapper (MonoMethod *method, gpointer *params)
                goto fail;
 
        if (exc) {
-               mono_error_init (&error);
+               error_init (&error);
                mono_error_set_exception_instance (&error, (MonoException *)exc);
                goto fail;
        }
@@ -1917,7 +1917,7 @@ static gboolean
 xdomain_copy_array_element_inplace (MonoArrayHandle arr, int i, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoObjectHandle item = MONO_HANDLE_NEW (MonoObject, NULL);
        MONO_HANDLE_ARRAY_GETREF (item, arr, i);
        
@@ -1940,7 +1940,7 @@ leave:
 MonoObjectHandle
 mono_marshal_xdomain_copy_value_handle (MonoObjectHandle val, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoObjectHandle result = MONO_HANDLE_NEW (MonoObject, NULL);
        if (MONO_HANDLE_IS_NULL (val))
                goto leave;
index 4e6e08c2b3ec778a3842f87c84dc773d984bf343..df6643672e986ef898e953da9df44e256bcec00a 100644 (file)
@@ -109,9 +109,6 @@ mono_runtime_try_shutdown (void)
 
        mono_runtime_set_shutting_down ();
 
-       /* This will kill the tp threads which cannot be suspended */
-       mono_threadpool_cleanup ();
-
        /*TODO move the follow to here:
        mono_thread_suspend_all_other_threads (); OR  mono_thread_wait_all_other_threads
 
index fab9cb946b013e0441ed99896a543656a8b47b48..4c93932b868549c9ecd9c6921d571fbf15a3dc4d 100644 (file)
@@ -631,7 +631,7 @@ get_method_access_exception (const char *format, MonoMethod *caller, MonoMethod
 gboolean
 mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *caller = get_reflection_caller ();
        /* CoreCLR restrictions applies to Transparent code/caller */
        if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
@@ -672,7 +672,7 @@ mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field, Mo
 gboolean
 mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoMethod *caller = get_reflection_caller ();
        /* CoreCLR restrictions applies to Transparent code/caller */
        if (mono_security_core_clr_method_level (caller, TRUE) != MONO_SECURITY_CORE_CLR_TRANSPARENT)
@@ -748,7 +748,7 @@ mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, MonoError *
 {
        MonoMethod *caller;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* note: mscorlib creates delegates to avoid reflection (optimization), we ignore those cases */
        if (can_avoid_corlib_reflection_delegate_optimization (method))
@@ -1061,21 +1061,21 @@ mono_security_core_clr_require_elevated_permissions (void)
 gboolean
 mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
 gboolean
 mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
 gboolean
 mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return TRUE;
 }
 
index fc82365a9336dee1c36930c1b2305d2e7e335b49..1964c55b064373fa05d69c01e5e3221f3cd6e8c3 100644 (file)
@@ -1051,7 +1051,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
 {
        int p_var, size_var, real_size_var, thread_var G_GNUC_UNUSED;
        gboolean slowpath = variant == MANAGED_ALLOCATOR_SLOW_PATH;
-       guint32 slowpath_branch, max_size_branch;
+       guint32 fastpath_branch, max_size_branch, no_oom_branch;
        MonoMethodBuilder *mb;
        MonoMethod *res;
        MonoMethodSignature *csig;
@@ -1318,7 +1318,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
        /* if (G_LIKELY (new_next < tlab_temp_end)) */
        mono_mb_emit_ldloc (mb, new_next_var);
        EMIT_TLS_ACCESS_TEMP_END (mb, thread_var);
-       slowpath_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BLT_UN_S);
+       fastpath_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BLT_UN_S);
 
        /* Slowpath */
        if (atype != ATYPE_SMALL)
@@ -1353,10 +1353,17 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
        } else {
                g_assert_not_reached ();
        }
+
+       /* if (ret == NULL) throw OOM; */
+       mono_mb_emit_byte (mb, CEE_DUP);
+       no_oom_branch = mono_mb_emit_branch (mb, CEE_BRTRUE);
+       mono_mb_emit_exception (mb, "OutOfMemoryException", NULL);
+
+       mono_mb_patch_branch (mb, no_oom_branch);
        mono_mb_emit_byte (mb, CEE_RET);
 
        /* Fastpath */
-       mono_mb_patch_short_branch (mb, slowpath_branch);
+       mono_mb_patch_short_branch (mb, fastpath_branch);
 
        /* FIXME: Memory barrier */
 
@@ -1566,67 +1573,6 @@ sgen_has_managed_allocator (void)
        return FALSE;
 }
 
-/*
- * Cardtable scanning
- */
-
-#define MWORD_MASK (sizeof (mword) - 1)
-
-static inline int
-find_card_offset (mword card)
-{
-/*XXX Use assembly as this generates some pretty bad code */
-#if defined(__i386__) && defined(__GNUC__)
-       return  (__builtin_ffs (card) - 1) / 8;
-#elif defined(__x86_64__) && defined(__GNUC__)
-       return (__builtin_ffsll (card) - 1) / 8;
-#elif defined(__s390x__)
-       return (__builtin_ffsll (GUINT64_TO_LE(card)) - 1) / 8;
-#else
-       int i;
-       guint8 *ptr = (guint8 *) &card;
-       for (i = 0; i < sizeof (mword); ++i) {
-               if (ptr[i])
-                       return i;
-       }
-       return 0;
-#endif
-}
-
-static guint8*
-find_next_card (guint8 *card_data, guint8 *end)
-{
-       mword *cards, *cards_end;
-       mword card;
-
-       while ((((mword)card_data) & MWORD_MASK) && card_data < end) {
-               if (*card_data)
-                       return card_data;
-               ++card_data;
-       }
-
-       if (card_data == end)
-               return end;
-
-       cards = (mword*)card_data;
-       cards_end = (mword*)((mword)end & ~MWORD_MASK);
-       while (cards < cards_end) {
-               card = *cards;
-               if (card)
-                       return (guint8*)cards + find_card_offset (card);
-               ++cards;
-       }
-
-       card_data = (guint8*)cards_end;
-       while (card_data < end) {
-               if (*card_data)
-                       return card_data;
-               ++card_data;
-       }
-
-       return end;
-}
-
 #define ARRAY_OBJ_INDEX(ptr,array,elem_size) (((char*)(ptr) - ((char*)(array) + G_STRUCT_OFFSET (MonoArray, vector))) / (elem_size))
 
 gboolean
@@ -1683,8 +1629,8 @@ sgen_client_cardtable_scan_object (GCObject *obj, guint8 *cards, ScanCopyContext
 LOOP_HEAD:
 #endif
 
-               card_data = find_next_card (card_data, card_data_end);
-               for (; card_data < card_data_end; card_data = find_next_card (card_data + 1, card_data_end)) {
+               card_data = sgen_find_next_card (card_data, card_data_end);
+               for (; card_data < card_data_end; card_data = sgen_find_next_card (card_data + 1, card_data_end)) {
                        size_t index;
                        size_t idx = (card_data - card_base) + extra_idx;
                        char *start = (char*)(obj_start + idx * CARD_SIZE_IN_BYTES);
@@ -2000,6 +1946,15 @@ precisely_report_roots_from (GCRootReport *report, void** start_root, void** end
                }
                break;
        }
+       case ROOT_DESC_VECTOR: {
+               void **p;
+
+               for (p = start_root; p < end_root; p++) {
+                       if (*p)
+                               add_profile_gc_root (report, *p, MONO_PROFILE_GC_ROOT_OTHER, 0);
+               }
+               break;
+       }
        case ROOT_DESC_USER: {
                MonoGCRootMarkFunc marker = (MonoGCRootMarkFunc)sgen_get_user_descriptor_func (desc);
                root_report = report;
index 143ece00c1d110bd2facb8ba9a52e799dc1c37fb..97e6d57fa52156742e972a8de1b74820f7a6e43c 100644 (file)
@@ -236,7 +236,7 @@ encode_reflection_type (MonoDynamicImage *assembly, MonoReflectionTypeHandle typ
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!type) {
                sigbuffer_add_value (buf, MONO_TYPE_VOID);
@@ -252,7 +252,7 @@ static void
 encode_reflection_type_raw (MonoDynamicImage *assembly, MonoReflectionType* type_raw, SigBuffer *buf, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER (); /* FIXME callers of encode_reflection_type_raw should use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoReflectionType, type);
        encode_reflection_type (assembly, type, buf, error);
        HANDLE_FUNCTION_RETURN ();
@@ -267,7 +267,7 @@ encode_custom_modifiers (MonoDynamicImage *assembly, MonoArrayHandle modreq, Mon
 
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!MONO_HANDLE_IS_NULL (modreq)) {
                for (i = 0; i < mono_array_handle_length (modreq); ++i) {
@@ -295,7 +295,7 @@ static void
 encode_custom_modifiers_raw (MonoDynamicImage *assembly, MonoArray *modreq_raw, MonoArray *modopt_raw, SigBuffer *buf, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER (); /* FIXME callers of encode_custom_modifiers_raw should use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoArray, modreq);
        MONO_HANDLE_DCL (MonoArray, modopt);
        encode_custom_modifiers (assembly, modreq, modopt, buf, error);
@@ -354,7 +354,7 @@ mono_dynimage_encode_method_builder_signature (MonoDynamicImage *assembly, Refle
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        /*
         * FIXME: reuse code from method_encode_signature().
@@ -424,7 +424,7 @@ mono_dynimage_encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *il
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDynamicTable *table;
        guint32 *values;
@@ -623,7 +623,7 @@ mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflection
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        SigBuffer buf;
        guint32 idx;
@@ -858,7 +858,7 @@ static gboolean
 encode_sighelper_arg (MonoDynamicImage *assembly, int i, MonoArrayHandle helper_arguments, MonoArrayHandle helper_modreqs, MonoArrayHandle helper_modopts, SigBuffer* buf, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER();
-       mono_error_init (error);
+       error_init (error);
        MonoArrayHandle modreqs = MONO_HANDLE_NEW (MonoArray, NULL);
        MonoArrayHandle modopts = MONO_HANDLE_NEW (MonoArray, NULL);
 
@@ -886,7 +886,7 @@ mono_dynimage_encode_reflection_sighelper (MonoDynamicImage *assembly, MonoRefle
        guint32 nargs;
        guint32 i, idx;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!assembly->save)
                return 0;
@@ -957,7 +957,7 @@ reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig, MonoErro
        MonoArray *result;
        SigBuffer buf;
 
-       mono_error_init (error);
+       error_init (error);
 
        sigbuffer_init (&buf, 32);
 
@@ -991,7 +991,7 @@ reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig, MonoErro
        MonoArray *result;
        SigBuffer buf;
 
-       mono_error_init (error);
+       error_init (error);
 
        sigbuffer_init (&buf, 32);
 
@@ -1029,7 +1029,7 @@ mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflecti
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        char *str;
        SigBuffer buf;
@@ -1127,7 +1127,7 @@ mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoRe
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        SigBuffer buf;
        guint32 nparams = 0;
index 20d9e47a4a3945453e3fdd0d96653f273a3722c2..f1cddf7cac594ab95114ec4feeb3782b95b4b2d8 100644 (file)
@@ -180,7 +180,7 @@ static guint32
 image_create_token_raw  (MonoDynamicImage *assembly, MonoObject* obj_raw, gboolean create_methodspec, gboolean register_token, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER (); /* FIXME callers of image_create_token_raw should use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoObject, obj);
        guint32 result = mono_image_create_token (assembly, obj, create_methodspec, register_token, error);
        HANDLE_FUNCTION_RETURN_VAL (result);
@@ -203,7 +203,7 @@ mono_image_add_cattrs (MonoDynamicImage *assembly, guint32 idx, guint32 type, Mo
        char blob_size [6];
        char *p = blob_size;
        
-       mono_error_init (error);
+       error_init (error);
 
        /* it is legal to pass a NULL cattrs: we avoid to use the if in a lot of places */
        if (!cattrs)
@@ -329,7 +329,7 @@ method_encode_code (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb, Mon
        guint32 header_size = 12;
        MonoArray *code;
 
-       mono_error_init (error);
+       error_init (error);
 
        if ((mb->attrs & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT)) ||
                        (mb->iattrs & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)))
@@ -491,7 +491,7 @@ mono_image_basic_method (ReflectionMethodBuilder *mb, MonoDynamicImage *assembly
        guint32 *values;
        guint i, count;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* room in this table is already allocated */
        table = &assembly->tables [MONO_TABLE_METHOD];
@@ -579,7 +579,7 @@ mono_image_add_methodimpl (MonoDynamicImage *assembly, MonoReflectionMethodBuild
        MonoReflectionMethod *m;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mb->override_methods)
                return TRUE;
@@ -624,7 +624,7 @@ mono_image_get_method_info (MonoReflectionMethodBuilder *mb, MonoDynamicImage *a
        ReflectionMethodBuilder rmb;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_reflection_methodbuilder_from_method_builder (&rmb, mb, error) ||
            !mono_image_basic_method (&rmb, assembly, error))
@@ -701,7 +701,7 @@ mono_image_get_field_info (MonoReflectionFieldBuilder *fb, MonoDynamicImage *ass
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDynamicTable *table;
        guint32 *values;
@@ -772,7 +772,7 @@ mono_image_get_property_info (MonoReflectionPropertyBuilder *pb, MonoDynamicImag
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDynamicTable *table;
        guint32 *values;
@@ -898,7 +898,7 @@ encode_constraints (MonoReflectionGenericParam *gparam, guint32 owner, MonoDynam
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoDynamicTable *table;
        guint32 num_constraints, i;
@@ -971,7 +971,7 @@ write_generic_param_entry (MonoDynamicImage *assembly, GenericParamTableEntry *e
        guint32 *values;
        guint32 table_idx;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_GENERICPARAM];
        table_idx = table->next_idx ++;
@@ -1028,7 +1028,7 @@ static gboolean
 params_add_cattrs (MonoDynamicImage *assembly, MonoArray *pinfo, MonoError *error) {
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        if (!pinfo)
                return TRUE;
        for (i = 0; i < mono_array_length (pinfo); ++i) {
@@ -1047,7 +1047,7 @@ static gboolean
 type_add_cattrs (MonoDynamicImage *assembly, MonoReflectionTypeBuilder *tb, MonoError *error) {
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        
        if (!mono_image_add_cattrs (assembly, tb->table_idx, MONO_CUSTOM_ATTR_TYPEDEF, tb->cattrs, error))
                return FALSE;
@@ -1110,7 +1110,7 @@ module_add_cattrs (MonoDynamicImage *assembly, MonoReflectionModuleBuilder *modu
 {
        int i;
        
-       mono_error_init (error);
+       error_init (error);
 
        if (!mono_image_add_cattrs (assembly, moduleb->table_idx, MONO_CUSTOM_ATTR_MODULE, moduleb->cattrs, error))
                return FALSE;
@@ -1152,7 +1152,7 @@ mono_image_fill_file_table (MonoDomain *domain, MonoReflectionModule *module, Mo
        char *b = blob_size;
        char *dir, *path;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_FILE];
        table->rows++;
@@ -1185,7 +1185,7 @@ mono_image_fill_module_table (MonoDomain *domain, MonoReflectionModuleBuilder *m
        MonoDynamicTable *table;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_MODULE];
        mb->table_idx = table->next_idx ++;
@@ -1247,7 +1247,7 @@ mono_image_fill_export_table (MonoDomain *domain, MonoReflectionTypeBuilder *tb,
        MonoClass *klass;
        guint32 idx, i;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoType *t = mono_reflection_type_get_handle ((MonoReflectionType*)tb, error);
        return_if_nok (error);
@@ -1479,7 +1479,7 @@ build_compressed_metadata (MonoDynamicImage *assembly, MonoError *error)
        unsigned char *p;
        struct StreamDesc stream_desc [5];
 
-       mono_error_init (error);
+       error_init (error);
 
        qsort (assembly->gen_params->pdata, assembly->gen_params->len, sizeof (gpointer), compare_genericparam);
        for (i = 0; i < assembly->gen_params->len; i++) {
@@ -1855,7 +1855,7 @@ assembly_add_resource_manifest (MonoReflectionModuleBuilder *mb, MonoDynamicImag
        MonoDynamicTable *table;
        guint32 *values;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_MANIFESTRESOURCE];
        table->rows++;
@@ -1881,7 +1881,7 @@ assembly_add_resource (MonoReflectionModuleBuilder *mb, MonoDynamicImage *assemb
        char *name, *sname;
        guint32 idx, offset;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (rsrc->filename) {
                name = mono_string_to_utf8_checked (rsrc->filename, error);
@@ -1941,7 +1941,7 @@ set_version_from_string (MonoString *version, guint32 *values, MonoError *error)
        gchar *ver, *p, *str;
        guint32 i;
        
-       mono_error_init (error);
+       error_init (error);
 
        values [MONO_ASSEMBLY_MAJOR_VERSION] = 0;
        values [MONO_ASSEMBLY_MINOR_VERSION] = 0;
@@ -2015,7 +2015,7 @@ mono_image_emit_manifest (MonoReflectionModuleBuilder *moduleb, MonoError *error
        int i;
        guint32 module_index;
 
-       mono_error_init (error);
+       error_init (error);
 
        assemblyb = moduleb->assemblyb;
        assembly = moduleb->dynamic_image;
@@ -2107,7 +2107,7 @@ mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, Mon
        int i, is_object = 0, is_system = 0;
        char *n;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_TYPEDEF];
        values = table->values + tb->table_idx * MONO_TYPEDEF_SIZE;
@@ -2298,7 +2298,7 @@ mono_image_build_metadata (MonoReflectionModuleBuilder *moduleb, MonoError *erro
        guint32 *values;
        int i, j;
 
-       mono_error_init (error);
+       error_init (error);
 
        assemblyb = moduleb->assemblyb;
        assembly = moduleb->dynamic_image;
@@ -2776,7 +2776,7 @@ mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file, MonoErro
                0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        };
 
-       mono_error_init (error);
+       error_init (error);
 
        assemblyb = mb->assemblyb;
 
index fbde1f1cc0fd3e00e6281d61ab0b514512a03609..67800081470c54d52c447db3a41b6474c09dda64 100644 (file)
@@ -90,7 +90,7 @@ string_to_utf8_image_raw (MonoImage *image, MonoString *s_raw, MonoError *error)
        /* FIXME all callers to string_to_utf8_image_raw should use handles */
        HANDLE_FUNCTION_ENTER ();
        char* result = NULL;
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoString, s);
        result = mono_string_to_utf8_image (image, s, error);
        HANDLE_FUNCTION_RETURN_VAL (result);
@@ -296,7 +296,7 @@ method_encode_clauses (MonoImage *image, MonoDynamicImage *assembly, MonoReflect
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoExceptionClause *clauses;
        MonoExceptionClause *clause;
@@ -454,7 +454,7 @@ mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb,
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       mono_error_init (error);
+       error_init (error);
        memset (rmb, 0, sizeof (ReflectionMethodBuilder));
 
        rmb->ilgen = mb->ilgen;
@@ -501,7 +501,7 @@ mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, M
 
        const char *name = mb->attrs & METHOD_ATTRIBUTE_STATIC ? ".cctor": ".ctor";
 
-       mono_error_init (error);
+       error_init (error);
 
        memset (rmb, 0, sizeof (ReflectionMethodBuilder));
 
@@ -848,7 +848,7 @@ mono_image_get_sighelper_token (MonoDynamicImage *assembly, MonoReflectionSigHel
        MonoDynamicTable *table;
        guint32 *values;
 
-       mono_error_init (error);
+       error_init (error);
 
        table = &assembly->tables [MONO_TABLE_STANDALONESIG];
        idx = table->next_idx ++;
@@ -898,7 +898,7 @@ mono_image_get_array_token (MonoDynamicImage *assembly, MonoReflectionArrayMetho
        MonoMethodSignature *sig = NULL;
        char *name = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoArrayHandle parameters = MONO_HANDLE_NEW_GET (MonoArray, m, parameters);
        guint32 nparams = mono_array_handle_length (parameters);
@@ -1066,7 +1066,7 @@ mono_image_create_method_token (MonoDynamicImage *assembly, MonoObjectHandle obj
 {
        guint32 token = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoClass *klass = mono_handle_class (obj);
        if (strcmp (klass->name, "MonoMethod") == 0 || strcmp (klass->name, "MonoCMethod") == 0) {
@@ -1107,7 +1107,7 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
 {
        guint32 token = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        MonoClass *klass = mono_handle_class (obj);
 
@@ -1303,7 +1303,7 @@ register_module (MonoDomain *domain, MonoReflectionModuleBuilderHandle res, Mono
 static gboolean
 image_module_basic_init (MonoReflectionModuleBuilderHandle moduleb, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoDomain *domain = MONO_HANDLE_DOMAIN (moduleb);
        MonoDynamicImage *image = MONO_HANDLE_GETVAL (moduleb, dynamic_image);
        MonoReflectionAssemblyBuilderHandle ab = MONO_HANDLE_NEW (MonoReflectionAssemblyBuilder, NULL);
@@ -1351,7 +1351,7 @@ image_module_basic_init (MonoReflectionModuleBuilderHandle moduleb, MonoError *e
 static gboolean
 mono_image_module_basic_init (MonoReflectionModuleBuilderHandle moduleb, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return image_module_basic_init (moduleb, error);
 }
 
@@ -1379,7 +1379,7 @@ MonoType*
 mono_type_array_get_and_resolve (MonoArrayHandle array, int idx, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER();
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionTypeHandle t = MONO_HANDLE_NEW (MonoReflectionType, NULL);
        MONO_HANDLE_ARRAY_GETREF (t, array, idx);
        MonoType *result = mono_reflection_type_handle_mono_type (t, error);
@@ -1466,7 +1466,7 @@ mono_reflection_type_get_underlying_system_type (MonoReflectionTypeHandle t, Mon
        static MonoMethod *method_get_underlying_system_type = NULL;
        HANDLE_FUNCTION_ENTER ();
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!method_get_underlying_system_type)
                method_get_underlying_system_type = mono_class_get_method_from_name (mono_defaults.systemtype_class, "get_UnderlyingSystemType", 0);
@@ -1487,7 +1487,7 @@ MonoType*
 mono_reflection_type_get_handle (MonoReflectionType* ref_raw, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoReflectionType, ref);
        MonoType *result = mono_reflection_type_handle_mono_type (ref, error);
        HANDLE_FUNCTION_RETURN_VAL (result);
@@ -1539,7 +1539,7 @@ static MonoType*
 reflection_param_handle_mono_type (MonoReflectionGenericParamHandle ref_gparam, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoType *result = NULL;
 
 
@@ -1596,7 +1596,7 @@ static MonoType*
 mono_type_array_get_and_resolve_raw (MonoArray* array_raw, int idx, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER(); /* FIXME callers of mono_type_array_get_and_resolve_raw should use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoArray, array);
        MonoType *result = mono_type_array_get_and_resolve (array, idx, error);
        HANDLE_FUNCTION_RETURN_VAL (result);
@@ -1606,7 +1606,7 @@ MonoType*
 mono_reflection_type_handle_mono_type (MonoReflectionTypeHandle ref, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
 
        MonoType* result = NULL;
 
@@ -1694,7 +1694,7 @@ parameters_to_signature (MonoImage *image, MonoArrayHandle parameters, MonoError
        MonoMethodSignature *sig;
        int count, i;
 
-       mono_error_init (error);
+       error_init (error);
 
        count = MONO_HANDLE_IS_NULL (parameters) ? 0 : mono_array_handle_length (parameters);
 
@@ -1718,7 +1718,7 @@ static MonoMethodSignature*
 ctor_builder_to_signature (MonoImage *image, MonoReflectionCtorBuilderHandle ctor, MonoError *error) {
        MonoMethodSignature *sig;
 
-       mono_error_init (error);
+       error_init (error);
 
        sig = parameters_to_signature (image, MONO_HANDLE_NEW_GET (MonoArray, ctor, parameters), error);
        return_val_if_nok (error, NULL);
@@ -1741,7 +1741,7 @@ static MonoMethodSignature*
 method_builder_to_signature (MonoImage *image, MonoReflectionMethodBuilderHandle method, MonoError *error) {
        MonoMethodSignature *sig;
 
-       mono_error_init (error);
+       error_init (error);
 
        sig = parameters_to_signature (image, MONO_HANDLE_NEW_GET(MonoArray, method, parameters), error);
        return_val_if_nok (error, NULL);
@@ -1766,7 +1766,7 @@ dynamic_method_to_signature (MonoReflectionDynamicMethodHandle method, MonoError
        HANDLE_FUNCTION_ENTER ();
        MonoMethodSignature *sig = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        sig = parameters_to_signature (NULL, MONO_HANDLE_NEW_GET (MonoArray, method, parameters), error);
        if (!is_ok (error))
@@ -1791,7 +1791,7 @@ leave:
 static void
 get_prop_name_and_type (MonoObject *prop, char **name, MonoType **type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass = mono_object_class (prop);
        if (strcmp (klass->name, "PropertyBuilder") == 0) {
                MonoReflectionPropertyBuilder *pb = (MonoReflectionPropertyBuilder *)prop;
@@ -1811,7 +1811,7 @@ get_prop_name_and_type (MonoObject *prop, char **name, MonoType **type, MonoErro
 static void
 get_field_name_and_type (MonoObject *field, char **name, MonoType **type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass = mono_object_class (field);
        if (strcmp (klass->name, "FieldBuilder") == 0) {
                MonoReflectionFieldBuilder *fb = (MonoReflectionFieldBuilder *)field;
@@ -1923,7 +1923,7 @@ encode_cattr_value (MonoAssembly *assembly, char *buffer, char *p, char **retbuf
 {
        MonoTypeEnum simple_type;
        
-       mono_error_init (error);
+       error_init (error);
        if ((p-buffer) + 10 >= *buflen) {
                char *newbuf;
                *buflen *= 2;
@@ -2177,7 +2177,7 @@ encode_named_val (MonoReflectionAssembly *assembly, char *buffer, char *p, char
 {
        int len;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* Preallocate a large enough buffer */
        if (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype) {
@@ -2259,7 +2259,7 @@ mono_reflection_get_custom_attrs_blob_checked (MonoReflectionAssembly *assembly,
        char *buffer, *p;
        guint32 buflen, i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
                /* sig is freed later so allocate it in the heap */
@@ -2351,7 +2351,7 @@ static gboolean
 reflection_setup_internal_class (MonoReflectionTypeBuilderHandle ref_tb, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
 
        mono_loader_lock ();
 
@@ -2493,7 +2493,7 @@ reflection_create_generic_class (MonoReflectionTypeBuilderHandle ref_tb, MonoErr
 {
        HANDLE_FUNCTION_ENTER ();
 
-       mono_error_init (error);
+       error_init (error);
 
        reflection_setup_internal_class (ref_tb, error);
        if (!is_ok (error))
@@ -2548,7 +2548,7 @@ mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly,
 {
        MonoMarshalSpec *res;
 
-       mono_error_init (error);
+       error_init (error);
 
        res = image_g_new0 (image, MonoMarshalSpec, 1);
        res->native = (MonoMarshalNative)minfo->type;
@@ -2604,7 +2604,7 @@ MonoReflectionMarshalAsAttributeHandle
 mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
                                                        MonoMarshalSpec *spec, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        
        MonoReflectionMarshalAsAttributeHandle minfo = MONO_HANDLE_NEW (MonoReflectionMarshalAsAttribute, mono_object_new_checked (domain, mono_class_get_marshal_as_attribute_class (), error));
        if (!is_ok (error))
@@ -2676,7 +2676,7 @@ reflection_methodbuilder_to_mono_method (MonoClass *klass,
        gboolean dynamic;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
        /*
         * Methods created using a MethodBuilder should have their memory allocated
         * inside the image mempool, while dynamic methods should have their memory
@@ -2976,7 +2976,7 @@ methodbuilder_to_mono_method (MonoClass *klass, MonoReflectionMethodBuilderHandl
        ReflectionMethodBuilder rmb;
        MonoMethodSignature *sig;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_loader_lock ();
 
@@ -3004,7 +3004,7 @@ static MonoMethod*
 methodbuilder_to_mono_method_raw (MonoClass *klass, MonoReflectionMethodBuilder* mb_raw, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER (); /* FIXME change callers of methodbuilder_to_mono_method_raw to use handles */
-       mono_error_init (error);
+       error_init (error);
        MONO_HANDLE_DCL (MonoReflectionMethodBuilder, mb);
        MonoMethod *result = methodbuilder_to_mono_method (klass, mb, error);
        HANDLE_FUNCTION_RETURN_VAL (result);
@@ -3032,7 +3032,7 @@ fix_partial_generic_class (MonoClass *klass, MonoError *error)
        MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (klass->wastypebuilder)
                return TRUE;
@@ -3121,7 +3121,7 @@ ensure_generic_class_runtime_vtable (MonoClass *klass, MonoError *error)
 {
        MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!ensure_runtime_vtable (gklass, error))
                return FALSE;
@@ -3143,7 +3143,7 @@ ensure_runtime_vtable (MonoClass *klass, MonoError *error)
        MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info_raw (klass); /* FIXME use handles */
        int i, num, j;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!image_is_dynamic (klass->image) || (!tb && !mono_class_is_ginst (klass)) || klass->wastypebuilder)
                return TRUE;
@@ -3222,7 +3222,7 @@ ensure_runtime_vtable (MonoClass *klass, MonoError *error)
 static MonoMethod*
 mono_reflection_method_get_handle (MonoObject *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        MonoClass *klass = mono_object_class (method);
        if (is_sr_mono_method (klass)) {
                MonoReflectionMethod *sr_method = (MonoReflectionMethod*)method;
@@ -3252,7 +3252,7 @@ mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides
        int i, j, onum;
        MonoReflectionMethod *m;
 
-       mono_error_init (error);
+       error_init (error);
        *overrides = NULL;
        *num_overrides = 0;
 
@@ -3324,7 +3324,7 @@ typebuilder_setup_fields (MonoClass *klass, MonoError *error)
        int fcount = tb->num_fields;
        mono_class_set_field_count (klass, fcount);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (tb->class_size) {
                packing_size = tb->packing_size;
@@ -3399,7 +3399,7 @@ typebuilder_setup_properties (MonoClass *klass, MonoError *error)
        MonoClassPropertyInfo *info;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        info = mono_class_get_property_info (klass);
        if (!info) {
@@ -3453,7 +3453,7 @@ typebuilder_setup_events (MonoClass *klass, MonoError *error)
        MonoClassEventInfo *info;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        info = mono_class_alloc0 (klass, sizeof (MonoClassEventInfo));
        mono_class_set_event_info (klass, info);
@@ -3529,7 +3529,7 @@ remove_instantiations_of_and_ensure_contents (gpointer key,
 MonoReflectionTypeHandle
 ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilderHandle ref_tb, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        reflection_create_generic_class (ref_tb, error);
        mono_error_assert_ok (error);
@@ -3704,7 +3704,7 @@ reflection_create_dynamic_method (MonoReflectionDynamicMethodHandle ref_mb, Mono
        GSList *l;
        int i;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_runtime_is_shutting_down ()) {
                mono_error_set_generic_error (error, "System", "InvalidOperationException", "");
@@ -3843,7 +3843,7 @@ mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32
        MonoMethodSignature *sig;
        g_assert (image_is_dynamic (image));
 
-       mono_error_init (error);
+       error_init (error);
 
        sig = (MonoMethodSignature *)g_hash_table_lookup (((MonoDynamicImage*)image)->vararg_aux_hash, GUINT_TO_POINTER (token));
        if (sig)
@@ -3863,7 +3863,7 @@ mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32
 static void
 ensure_complete_type (MonoClass *klass, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        if (image_is_dynamic (klass->image) && !klass->wastypebuilder && mono_class_has_ref_info (klass)) {
                MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mono_class_get_ref_info_raw (klass); /* FIXME use handles */
@@ -3892,7 +3892,7 @@ mono_reflection_resolve_object (MonoImage *image, MonoObject *obj, MonoClass **h
        MonoClass *oklass = obj->vtable->klass;
        gpointer result = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (strcmp (oklass->name, "String") == 0) {
                result = mono_string_intern_checked ((MonoString*)obj, error);
@@ -4120,7 +4120,7 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
 void
 mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        *overrides = NULL;
        *num_overrides = 0;
 }
@@ -4135,13 +4135,13 @@ ves_icall_TypeBuilder_create_runtime_class (MonoReflectionTypeBuilderHandle tb,
 void 
 ves_icall_DynamicMethod_create_dynamic_method (MonoReflectionDynamicMethodHandle mb, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 }
 
 MonoType*
 mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (!ref)
                return NULL;
        return ref->type;
@@ -4150,7 +4150,7 @@ mono_reflection_type_get_handle (MonoReflectionType* ref, MonoError *error)
 MonoType*
 mono_reflection_type_handle_mono_type (MonoReflectionTypeHandle ref, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (MONO_HANDLE_IS_NULL (ref))
                return NULL;
        return MONO_HANDLE_GETVAL (ref, type);
@@ -4169,7 +4169,7 @@ mono_sre_generic_param_table_entry_free (GenericParamTableEntry *entry)
 gint32
 ves_icall_ModuleBuilder_getToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, gboolean create_open_instance, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (MONO_HANDLE_IS_NULL (obj)) {
                mono_error_set_argument_null (error, "obj", "");
                return 0;
@@ -4183,7 +4183,7 @@ ves_icall_ModuleBuilder_getMethodToken (MonoReflectionModuleBuilderHandle mb,
                                        MonoArrayHandle opt_param_types,
                                        MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        if (MONO_HANDLE_IS_NULL (method)) {
                mono_error_set_argument_null (error, "method", "");
                return 0;
@@ -4211,7 +4211,7 @@ ves_icall_ModuleBuilder_build_metadata (MonoReflectionModuleBuilder *mb)
 void
 ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, guint32 token, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_dynamic_image_register_token (MONO_HANDLE_GETVAL (mb, dynamic_image), token, obj);
 }
 
@@ -4254,7 +4254,7 @@ ves_icall_EnumBuilder_setup_enum_type (MonoReflectionType *enumtype,
 void
 ves_icall_ModuleBuilder_basic_init (MonoReflectionModuleBuilderHandle moduleb, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        mono_image_module_basic_init (moduleb, error);
 }
 
index ace9a00bf6a8adb9bd83bcf6944f01bf84cfb882..4f4fa7b1559c202ec6d0ef11435e43504759831c 100644 (file)
@@ -306,6 +306,12 @@ wait_callback (gint fd, gint events, gpointer user_data)
        }
 }
 
+static void
+selector_thread_interrupt (gpointer unused)
+{
+       selector_thread_wakeup ();
+}
+
 static gsize WINAPI
 selector_thread (gpointer data)
 {
@@ -319,11 +325,15 @@ selector_thread (gpointer data)
                return 0;
        }
 
-       states = mono_g_hash_table_new_type (g_direct_hash, g_direct_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREAD_POOL, "i/o thread pool states table");
+       states = mono_g_hash_table_new_type (g_direct_hash, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREAD_POOL, "i/o thread pool states table");
 
-       for (;;) {
+       while (!mono_runtime_is_shutting_down ()) {
                gint i, j;
                gint res;
+               gboolean interrupted = FALSE;
+
+               if (mono_thread_interruption_checkpoint ())
+                       continue;
 
                mono_coop_mutex_lock (&threadpool_io->updates_lock);
 
@@ -422,10 +432,15 @@ selector_thread (gpointer data)
 
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_THREADPOOL, "io threadpool: wai");
 
-               res = threadpool_io->backend.event_wait (wait_callback, states);
+               mono_thread_info_install_interrupt (selector_thread_interrupt, NULL, &interrupted);
+               if (interrupted)
+                       continue;
 
-               if (res == -1 || mono_runtime_is_shutting_down ())
+               res = threadpool_io->backend.event_wait (wait_callback, states);
+               if (res == -1)
                        break;
+
+               mono_thread_info_uninstall_interrupt (&interrupted);
        }
 
        mono_g_hash_table_destroy (states);
@@ -548,13 +563,7 @@ initialize (void)
 static void
 cleanup (void)
 {
-       /* we make the assumption along the code that we are
-        * cleaning up only if the runtime is shutting down */
-       g_assert (mono_runtime_is_shutting_down ());
-
-       selector_thread_wakeup ();
-       while (io_selector_running)
-               mono_thread_info_usleep (1000);
+       // FIXME destroy everything
 }
 
 void
index a0cdd9a2170229d1d83e5777dd0187d36073e6f0..5fc716a74e73e87999bc0e124fdb9a19b64f1c9f 100644 (file)
@@ -124,18 +124,14 @@ typedef union {
        gint64 as_gint64;
 } ThreadPoolWorkerCounter;
 
-typedef MonoInternalThread ThreadPoolWorkerThread;
-
 typedef struct {
        MonoRefCount ref;
 
        ThreadPoolWorkerCounter counters;
 
-       GPtrArray *threads; // ThreadPoolWorkerThread* []
-       MonoCoopMutex threads_lock; /* protect access to working_threads and parked_threads */
+       MonoCoopMutex parked_threads_lock;
        gint32 parked_threads_count;
        MonoCoopCond parked_threads_cond;
-       MonoCoopCond threads_exit_cond;
 
        ThreadPoolWorkItem *work_items; // ThreadPoolWorkItem []
        gint32 work_items_count;
@@ -221,8 +217,7 @@ rand_next (gpointer *handle, guint32 min, guint32 max)
 static void
 destroy (gpointer data)
 {
-#if 0
-       mono_coop_mutex_destroy (&worker.threads_lock);
+       mono_coop_mutex_destroy (&worker.parked_threads_lock);
        mono_coop_cond_destroy (&worker.parked_threads_cond);
 
        mono_coop_mutex_destroy (&worker.work_items_lock);
@@ -232,7 +227,6 @@ destroy (gpointer data)
        mono_coop_mutex_destroy (&worker.heuristic_lock);
 
        g_free (worker.cpu_usage_state);
-#endif
 }
 
 void
@@ -245,11 +239,9 @@ mono_threadpool_worker_init (void)
 
        mono_refcount_init (&worker, destroy);
 
-       worker.threads = g_ptr_array_new ();
-       mono_coop_mutex_init (&worker.threads_lock);
+       mono_coop_mutex_init (&worker.parked_threads_lock);
        worker.parked_threads_count = 0;
        mono_coop_cond_init (&worker.parked_threads_cond);
-       mono_coop_cond_init (&worker.threads_exit_cond);
 
        /* worker.work_items_size is inited to 0 */
        mono_coop_mutex_init (&worker.work_items_lock);
@@ -316,43 +308,6 @@ mono_threadpool_worker_init (void)
 void
 mono_threadpool_worker_cleanup (void)
 {
-       MonoInternalThread *current;
-
-       /* we make the assumption along the code that we are
-        * cleaning up only if the runtime is shutting down */
-       g_assert (mono_runtime_is_shutting_down ());
-
-       current = mono_thread_internal_current ();
-
-       while (worker.monitor_status != MONITOR_STATUS_NOT_RUNNING)
-               mono_thread_info_sleep (1, NULL);
-
-       mono_coop_mutex_lock (&worker.threads_lock);
-
-       /* unpark all worker.parked_threads */
-       mono_coop_cond_broadcast (&worker.parked_threads_cond);
-
-#if 0
-       for (;;) {
-               ThreadPoolWorkerCounter counter;
-
-               counter = COUNTER_READ ();
-               if (counter._.starting + counter._.working + counter._.parked == 0)
-                       break;
-
-               if (counter._.starting + counter._.working + counter._.parked == 1) {
-                       if (worker.threads->len == 1 && g_ptr_array_index (worker.threads, 0) == current) {
-                               /* We are waiting on ourselves */
-                               break;
-                       }
-               }
-
-               mono_coop_cond_wait (&worker.threads_exit_cond, &worker.threads_lock);
-       }
-#endif
-
-       mono_coop_mutex_unlock (&worker.threads_lock);
-
        mono_refcount_dec (&worker);
 }
 
@@ -441,17 +396,33 @@ static void worker_request (void);
 void
 mono_threadpool_worker_enqueue (MonoThreadPoolWorkerCallback callback, gpointer data)
 {
+       if (!mono_refcount_tryinc (&worker))
+               return;
+
        work_item_push (callback, data);
 
        worker_request ();
+
+       mono_refcount_dec (&worker);
 }
 
 static void
 worker_wait_interrupt (gpointer unused)
 {
-       mono_coop_mutex_lock (&worker.threads_lock);
-       mono_coop_cond_signal (&worker.parked_threads_cond);
-       mono_coop_mutex_unlock (&worker.threads_lock);
+       /* If the runtime is not shutting down, we are not using this mechanism to wake up a unparked thread, and if the
+        * runtime is shutting down, then we need to wake up ALL the threads.
+        * It might be a bit wasteful, but I witnessed shutdown hang where the main thread would abort and then wait for all
+        * background threads to exit (see mono_thread_manage). This would go wrong because not all threadpool threads would
+        * be unparked. It would end up getting unstucked because of the timeout, but that would delay shutdown by 5-60s. */
+       if (!mono_runtime_is_shutting_down ())
+               return;
+
+       if (!mono_refcount_tryinc (&worker))
+               return;
+
+       mono_coop_mutex_lock (&worker.parked_threads_lock);
+       mono_coop_cond_broadcast (&worker.parked_threads_cond);
+       mono_coop_mutex_unlock (&worker.parked_threads_lock);
 
        mono_refcount_dec (&worker);
 }
@@ -461,15 +432,15 @@ static gboolean
 worker_park (void)
 {
        gboolean timeout = FALSE;
+       gboolean interrupted = FALSE;
 
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking", mono_native_thread_id_get ());
+       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking", mono_native_thread_id_get ());
 
-       mono_coop_mutex_lock (&worker.threads_lock);
+       mono_coop_mutex_lock (&worker.parked_threads_lock);
 
        if (!mono_runtime_is_shutting_down ()) {
                static gpointer rand_handle = NULL;
                MonoInternalThread *thread;
-               gboolean interrupted = FALSE;
                ThreadPoolWorkerCounter counter;
 
                if (!rand_handle)
@@ -486,19 +457,14 @@ worker_park (void)
 
                worker.parked_threads_count += 1;
 
-               mono_refcount_inc (&worker);
                mono_thread_info_install_interrupt (worker_wait_interrupt, NULL, &interrupted);
-               if (interrupted) {
-                       mono_refcount_dec (&worker);
+               if (interrupted)
                        goto done;
-               }
 
-               if (mono_coop_cond_timedwait (&worker.parked_threads_cond, &worker.threads_lock, rand_next (&rand_handle, 5 * 1000, 60 * 1000)) != 0)
+               if (mono_coop_cond_timedwait (&worker.parked_threads_cond, &worker.parked_threads_lock, rand_next (&rand_handle, 5 * 1000, 60 * 1000)) != 0)
                        timeout = TRUE;
 
                mono_thread_info_uninstall_interrupt (&interrupted);
-               if (!interrupted)
-                       mono_refcount_dec (&worker);
 
 done:
                worker.parked_threads_count -= 1;
@@ -509,9 +475,10 @@ done:
                });
        }
 
-       mono_coop_mutex_unlock (&worker.threads_lock);
+       mono_coop_mutex_unlock (&worker.parked_threads_lock);
 
-       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s", mono_native_thread_id_get (), timeout ? "yes" : "no");
+       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
+               mono_native_thread_id_get (), timeout ? "yes" : "no", interrupted ? "yes" : "no");
 
        return timeout;
 }
@@ -523,12 +490,12 @@ worker_try_unpark (void)
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", mono_native_thread_id_get ());
 
-       mono_coop_mutex_lock (&worker.threads_lock);
+       mono_coop_mutex_lock (&worker.parked_threads_lock);
        if (worker.parked_threads_count > 0) {
                mono_coop_cond_signal (&worker.parked_threads_cond);
                res = TRUE;
        }
-       mono_coop_mutex_unlock (&worker.threads_lock);
+       mono_coop_mutex_unlock (&worker.parked_threads_lock);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker, success? %s", mono_native_thread_id_get (), res ? "yes" : "no");
 
@@ -543,6 +510,9 @@ worker_thread (gpointer unused)
 
        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting", mono_native_thread_id_get ());
 
+       if (!mono_refcount_tryinc (&worker))
+               return 0;
+
        COUNTER_ATOMIC (counter, {
                counter._.starting --;
                counter._.working ++;
@@ -551,10 +521,6 @@ worker_thread (gpointer unused)
        thread = mono_thread_internal_current ();
        g_assert (thread);
 
-       mono_coop_mutex_lock (&worker.threads_lock);
-       g_ptr_array_add (worker.threads, thread);
-       mono_coop_mutex_unlock (&worker.threads_lock);
-
        while (!mono_runtime_is_shutting_down ()) {
                ThreadPoolWorkItem work_item;
 
@@ -577,18 +543,10 @@ worker_thread (gpointer unused)
                work_item.callback (work_item.data);
        }
 
-       mono_coop_mutex_lock (&worker.threads_lock);
-
        COUNTER_ATOMIC (counter, {
                counter._.working --;
        });
 
-       g_ptr_array_remove (worker.threads, thread);
-
-       mono_coop_cond_signal (&worker.threads_exit_cond);
-
-       mono_coop_mutex_unlock (&worker.threads_lock);
-
        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing", mono_native_thread_id_get ());
 
        mono_refcount_dec (&worker);
@@ -641,7 +599,6 @@ worker_try_create (void)
                counter._.starting ++;
        });
 
-       mono_refcount_inc (&worker);
        thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, TRUE, 0, &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));
@@ -653,8 +610,6 @@ worker_try_create (void)
 
                mono_coop_mutex_unlock (&worker.worker_creation_lock);
 
-               mono_refcount_dec (&worker);
-
                return FALSE;
        }
 
@@ -752,6 +707,9 @@ monitor_thread (gpointer unused)
        MonoInternalThread *internal;
        guint i;
 
+       if (!mono_refcount_tryinc (&worker))
+               return 0;
+
        internal = mono_thread_internal_current ();
        g_assert (internal);
 
@@ -838,6 +796,7 @@ monitor_thread (gpointer unused)
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, finished", mono_native_thread_id_get ());
 
+       mono_refcount_dec (&worker);
        return 0;
 }
 
@@ -864,6 +823,7 @@ monitor_ensure_running (void)
                                        // printf ("monitor_thread: creating failed\n");
                                        worker.monitor_status = MONITOR_STATUS_NOT_RUNNING;
                                        mono_error_cleanup (&error);
+                                       mono_refcount_dec (&worker);
                                }
                                return;
                        }
@@ -880,7 +840,7 @@ hill_climbing_change_thread_count (gint16 new_thread_count, ThreadPoolHeuristicS
 
        hc = &worker.heuristic_hill_climbing;
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] hill climbing, change max number of threads %d", mono_native_thread_id_get (), new_thread_count);
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] hill climbing, change max number of threads %d", mono_native_thread_id_get (), new_thread_count);
 
        hc->last_thread_count = new_thread_count;
        hc->current_sample_interval = rand_next (&hc->random_interval_generator, hc->sample_interval_low, hc->sample_interval_high);
@@ -1204,7 +1164,15 @@ mono_threadpool_worker_notify_completed (void)
 gint32
 mono_threadpool_worker_get_min (void)
 {
-       return worker.limit_worker_min;
+       gint32 ret;
+
+       if (!mono_refcount_tryinc (&worker))
+               return 0;
+
+       ret = worker.limit_worker_min;
+
+       mono_refcount_dec (&worker);
+       return ret;
 }
 
 gboolean
@@ -1213,14 +1181,27 @@ mono_threadpool_worker_set_min (gint32 value)
        if (value <= 0 || value > worker.limit_worker_max)
                return FALSE;
 
+       if (!mono_refcount_tryinc (&worker))
+               return FALSE;
+
        worker.limit_worker_min = value;
+
+       mono_refcount_dec (&worker);
        return TRUE;
 }
 
 gint32
 mono_threadpool_worker_get_max (void)
 {
-       return worker.limit_worker_max;
+       gint32 ret;
+
+       if (!mono_refcount_tryinc (&worker))
+               return 0;
+
+       ret = worker.limit_worker_max;
+
+       mono_refcount_dec (&worker);
+       return ret;
 }
 
 gboolean
@@ -1232,17 +1213,24 @@ mono_threadpool_worker_set_max (gint32 value)
        if (value < worker.limit_worker_min || value < cpu_count)
                return FALSE;
 
-       if (value < worker.limit_worker_min || value < cpu_count)
+       if (!mono_refcount_tryinc (&worker))
                return FALSE;
 
        worker.limit_worker_max = value;
+
+       mono_refcount_dec (&worker);
        return TRUE;
 }
 
 void
 mono_threadpool_worker_set_suspended (gboolean suspended)
 {
+       if (!mono_refcount_tryinc (&worker))
+               return;
+
        worker.suspended = suspended;
        if (!suspended)
                worker_request ();
+
+       mono_refcount_dec (&worker);
 }
index 4b0aa6ec18d0dbcefea22663c85585c1d3c10a9f..0b36a37cee925f982d5d36686cbfecfb4e31e881 100644 (file)
@@ -71,10 +71,6 @@ typedef struct {
        GPtrArray *domains; // ThreadPoolDomain* []
        MonoCoopMutex domains_lock;
 
-       GPtrArray *threads; // MonoInternalThread* []
-       MonoCoopMutex threads_lock;
-       MonoCoopCond threads_exit_cond;
-
        ThreadPoolCounter counters;
 
        gint32 limit_io_min;
@@ -121,14 +117,8 @@ domains_unlock (void)
 static void
 destroy (gpointer unused)
 {
-#if 0
        g_ptr_array_free (threadpool.domains, TRUE);
        mono_coop_mutex_destroy (&threadpool.domains_lock);
-
-       g_ptr_array_free (threadpool.threads, TRUE);
-       mono_coop_mutex_destroy (&threadpool.threads_lock);
-       mono_coop_cond_destroy (&threadpool.threads_exit_cond);
-#endif
 }
 
 static void
@@ -141,10 +131,6 @@ initialize (void)
        threadpool.domains = g_ptr_array_new ();
        mono_coop_mutex_init (&threadpool.domains_lock);
 
-       threadpool.threads = g_ptr_array_new ();
-       mono_coop_mutex_init (&threadpool.threads_lock);
-       mono_coop_cond_init (&threadpool.threads_exit_cond);
-
        threadpool.limit_io_min = mono_cpu_count ();
        threadpool.limit_io_max = CLAMP (threadpool.limit_io_min * 100, MIN (threadpool.limit_io_min, 200), MAX (threadpool.limit_io_min, 200));
 
@@ -154,47 +140,6 @@ initialize (void)
 static void
 cleanup (void)
 {
-       guint i;
-       MonoInternalThread *current;
-
-       /* we make the assumption along the code that we are
-        * cleaning up only if the runtime is shutting down */
-       g_assert (mono_runtime_is_shutting_down ());
-
-       current = mono_thread_internal_current ();
-
-       mono_coop_mutex_lock (&threadpool.threads_lock);
-
-       /* stop all threadpool.threads */
-       for (i = 0; i < threadpool.threads->len; ++i) {
-               MonoInternalThread *thread = (MonoInternalThread*) g_ptr_array_index (threadpool.threads, i);
-               if (thread != current)
-                       mono_thread_internal_abort (thread);
-       }
-
-       mono_coop_mutex_unlock (&threadpool.threads_lock);
-
-#if 0
-       /* give a chance to the other threads to exit */
-       mono_thread_info_yield ();
-
-       mono_coop_mutex_lock (&threadpool.threads_lock);
-
-       for (;;) {
-               if (threadpool.threads->len == 0)
-                       break;
-
-               if (threadpool.threads->len == 1 && g_ptr_array_index (threadpool.threads, 0) == current) {
-                       /* We are waiting on ourselves */
-                       break;
-               }
-
-               mono_coop_cond_wait (&threadpool.threads_exit_cond, &threadpool.threads_lock);
-       }
-
-       mono_coop_mutex_unlock (&threadpool.threads_lock);
-#endif
-
        mono_threadpool_worker_cleanup ();
 
        mono_refcount_dec (&threadpool);
@@ -209,7 +154,7 @@ mono_threadpool_enqueue_work_item (MonoDomain *domain, MonoObject *work_item, Mo
        MonoBoolean f;
        gpointer args [2];
 
-       mono_error_init (error);
+       error_init (error);
        g_assert (work_item);
 
        if (!threadpool_class)
@@ -325,7 +270,7 @@ static MonoObject*
 try_invoke_perform_wait_callback (MonoObject** exc, MonoError *error)
 {
        HANDLE_FUNCTION_ENTER ();
-       mono_error_init (error);
+       error_init (error);
        MonoObject *res = mono_runtime_try_invoke (mono_defaults.threadpool_perform_wait_callback_method, NULL, NULL, exc, error);
        HANDLE_FUNCTION_RETURN_VAL (res);
 }
@@ -338,6 +283,9 @@ worker_callback (gpointer unused)
        ThreadPoolCounter counter;
        MonoInternalThread *thread;
 
+       if (!mono_refcount_tryinc (&threadpool))
+               return;
+
        thread = mono_thread_internal_current ();
 
        COUNTER_ATOMIC (counter, {
@@ -357,10 +305,6 @@ worker_callback (gpointer unused)
                return;
        }
 
-       mono_coop_mutex_lock (&threadpool.threads_lock);
-       g_ptr_array_add (threadpool.threads, thread);
-       mono_coop_mutex_unlock (&threadpool.threads_lock);
-
        /*
         * This is needed so there is always an lmf frame in the runtime invoke call below,
         * so ThreadAbortExceptions are caught even if the thread is in native code.
@@ -447,14 +391,6 @@ worker_callback (gpointer unused)
 
        domains_unlock ();
 
-       mono_coop_mutex_lock (&threadpool.threads_lock);
-
-       g_ptr_array_remove_fast (threadpool.threads, thread);
-
-       mono_coop_cond_signal (&threadpool.threads_exit_cond);
-
-       mono_coop_mutex_unlock (&threadpool.threads_lock);
-
        COUNTER_ATOMIC (counter, {
                counter._.working --;
        });
@@ -484,9 +420,7 @@ mono_threadpool_begin_invoke (MonoDomain *domain, MonoObject *target, MonoMethod
        if (!async_call_klass)
                async_call_klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoAsyncCall");
 
-       mono_lazy_initialize (&status, initialize);
-
-       mono_error_init (error);
+       error_init (error);
 
        message = mono_method_call_message_new (method, params, mono_get_delegate_invoke (method->klass), (params != NULL) ? (&async_callback) : NULL, (params != NULL) ? (&state) : NULL, error);
        return_val_if_nok (error, NULL);
@@ -517,7 +451,7 @@ mono_threadpool_end_invoke (MonoAsyncResult *ares, MonoArray **out_args, MonoObj
 {
        MonoAsyncCall *ac;
 
-       mono_error_init (error);
+       error_init (error);
        g_assert (exc);
        g_assert (out_args);
 
@@ -671,12 +605,18 @@ ves_icall_System_Threading_ThreadPool_GetAvailableThreadsNative (gint32 *worker_
        if (!worker_threads || !completion_port_threads)
                return;
 
-       mono_lazy_initialize (&status, initialize);
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool)) {
+               *worker_threads = 0;
+               *completion_port_threads = 0;
+               return;
+       }
 
        counter = COUNTER_READ ();
 
        *worker_threads = MAX (0, mono_threadpool_worker_get_max () - counter._.working);
        *completion_port_threads = threadpool.limit_io_max;
+
+       mono_refcount_dec (&threadpool);
 }
 
 void
@@ -685,10 +625,16 @@ ves_icall_System_Threading_ThreadPool_GetMinThreadsNative (gint32 *worker_thread
        if (!worker_threads || !completion_port_threads)
                return;
 
-       mono_lazy_initialize (&status, initialize);
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool)) {
+               *worker_threads = 0;
+               *completion_port_threads = 0;
+               return;
+       }
 
        *worker_threads = mono_threadpool_worker_get_min ();
        *completion_port_threads = threadpool.limit_io_min;
+
+       mono_refcount_dec (&threadpool);
 }
 
 void
@@ -697,25 +643,35 @@ ves_icall_System_Threading_ThreadPool_GetMaxThreadsNative (gint32 *worker_thread
        if (!worker_threads || !completion_port_threads)
                return;
 
-       mono_lazy_initialize (&status, initialize);
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool)) {
+               *worker_threads = 0;
+               *completion_port_threads = 0;
+               return;
+       }
 
        *worker_threads = mono_threadpool_worker_get_max ();
        *completion_port_threads = threadpool.limit_io_max;
+
+       mono_refcount_dec (&threadpool);
 }
 
 MonoBoolean
 ves_icall_System_Threading_ThreadPool_SetMinThreadsNative (gint32 worker_threads, gint32 completion_port_threads)
 {
-       mono_lazy_initialize (&status, initialize);
-
        if (completion_port_threads <= 0 || completion_port_threads > threadpool.limit_io_max)
                return FALSE;
 
-       if (!mono_threadpool_worker_set_min (worker_threads))
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool))
+               return FALSE;
+
+       if (!mono_threadpool_worker_set_min (worker_threads)) {
+               mono_refcount_dec (&threadpool);
                return FALSE;
+       }
 
        threadpool.limit_io_min = completion_port_threads;
 
+       mono_refcount_dec (&threadpool);
        return TRUE;
 }
 
@@ -724,16 +680,20 @@ ves_icall_System_Threading_ThreadPool_SetMaxThreadsNative (gint32 worker_threads
 {
        gint cpu_count = mono_cpu_count ();
 
-       mono_lazy_initialize (&status, initialize);
-
        if (completion_port_threads < threadpool.limit_io_min || completion_port_threads < cpu_count)
                return FALSE;
 
-       if (!mono_threadpool_worker_set_max (worker_threads))
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool))
                return FALSE;
 
+       if (!mono_threadpool_worker_set_max (worker_threads)) {
+               mono_refcount_dec (&threadpool);
+               return FALSE;
+       }
+
        threadpool.limit_io_max = completion_port_threads;
 
+       mono_refcount_dec (&threadpool);
        return TRUE;
 }
 
@@ -783,7 +743,7 @@ ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void)
        if (mono_domain_is_unloading (domain))
                return FALSE;
 
-       if (!mono_refcount_tryinc (&threadpool)) {
+       if (!mono_lazy_initialize (&status, initialize) || !mono_refcount_tryinc (&threadpool)) {
                /* threadpool has been destroyed, we are shutting down */
                return FALSE;
        }
@@ -820,9 +780,7 @@ ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void)
 
        mono_threadpool_worker_enqueue (worker_callback, NULL);
 
-       /* we do not decrement the threadpool refcount,
-        * as it's going to be done in the worker_callback */
-
+       mono_refcount_dec (&threadpool);
        return TRUE;
 }
 
index e6a1011d201d5c9c17216573840aca7760b24b17..a63a741f4a941e186f5b6122c7aa6efb5bbf9244 100644 (file)
@@ -176,7 +176,6 @@ 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);
 
index 968bd091061ba5df7eb0828566271b652e0154d4..238abb9504cb949f0d247daefa9d7dca32bbc40d 100644 (file)
@@ -695,6 +695,7 @@ mono_thread_attach_internal (MonoThread *thread, gboolean force_attach, gboolean
 
        if (shutting_down && !force_attach) {
                mono_threads_unlock ();
+               mono_thread_pop_appdomain_ref ();
                return FALSE;
        }
 
@@ -914,7 +915,7 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, MonoObject *sta
         */
        mono_threads_join_threads ();
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_threads_lock ();
        if (shutting_down) {
@@ -1017,7 +1018,7 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb
        MonoInternalThread *internal;
        gboolean res;
 
-       mono_error_init (error);
+       error_init (error);
 
        internal = create_internal_thread_object ();
 
@@ -1549,7 +1550,7 @@ ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj
        MonoError error;
        MonoString* str;
 
-       mono_error_init (&error);
+       error_init (&error);
 
        LOCK_THREAD (this_obj);
        
@@ -1571,7 +1572,7 @@ mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, g
 {
        LOCK_THREAD (this_obj);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (reset) {
                this_obj->flags &= ~MONO_THREAD_FLAG_NAME_SET;
@@ -1661,7 +1662,7 @@ byte_array_to_domain (MonoArray *arr, MonoDomain *domain, MonoError *error)
 {
        MonoArray *copy;
 
-       mono_error_init (error);
+       error_init (error);
        if (!arr)
                return NULL;
 
@@ -1742,7 +1743,7 @@ mono_join_uninterrupted (MonoThreadHandle* thread_to_join, gint32 ms, MonoError
        gint32 diff_ms;
        gint32 wait = ms;
 
-       mono_error_init (error);
+       error_init (error);
 
        start = (ms == -1) ? 0 : mono_msec_ticks ();
        for (;;) {
@@ -1851,7 +1852,7 @@ mono_wait_uninterrupted (MonoInternalThread *thread, guint32 numhandles, gpointe
        gint32 diff_ms;
        gint32 wait = ms;
 
-       mono_error_init (error);
+       error_init (error);
 
        start = (ms == -1) ? 0 : mono_100ns_ticks ();
        do {
@@ -2629,53 +2630,27 @@ is_running_protected_wrapper (void)
        return found;
 }
 
-static gboolean
-request_thread_stop (MonoInternalThread *thread)
+void
+mono_thread_stop (MonoThread *thread)
 {
-       LOCK_THREAD (thread);
+       MonoInternalThread *internal = thread->internal_thread;
 
-       if ((thread->state & ThreadState_StopRequested) != 0 ||
-               (thread->state & ThreadState_Stopped) != 0)
+       LOCK_THREAD (internal);
+
+       if (internal->state & (ThreadState_StopRequested | ThreadState_Stopped))
        {
-               UNLOCK_THREAD (thread);
-               return FALSE;
+               UNLOCK_THREAD (internal);
+               return;
        }
-       
-       /* Make sure the thread is awake */
-       mono_thread_resume (thread);
 
-       thread->state |= ThreadState_StopRequested;
-       thread->state &= ~ThreadState_AbortRequested;
-       
-       UNLOCK_THREAD (thread);
-       return TRUE;
-}
+       /* Make sure the internal is awake */
+       mono_thread_resume (internal);
 
-/**
- * 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 ());
+       internal->state |= ThreadState_StopRequested;
+       internal->state &= ~ThreadState_AbortRequested;
 
-       if (!request_thread_stop (thread))
-               return;
-       
-       async_abort_internal (thread, TRUE);
-}
-
-void mono_thread_stop (MonoThread *thread)
-{
-       MonoInternalThread *internal = thread->internal_thread;
+       UNLOCK_THREAD (internal);
 
-       if (!request_thread_stop (internal))
-               return;
-       
        if (internal == mono_thread_internal_current ()) {
                MonoError error;
                self_abort_internal (&error);
@@ -3208,22 +3183,21 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user)
        if (wait->num >= MONO_W32HANDLE_MAXIMUM_WAIT_OBJECTS)
                return FALSE;
 
-       /* The finalizer thread is not a background thread */
-       if (!mono_native_thread_id_equals (thread_get_tid (thread), self)
-            && (thread->state & ThreadState_Background) != 0
-            && (thread->flags & MONO_THREAD_FLAG_DONT_MANAGE) == 0
-       ) {
+       if (mono_native_thread_id_equals (thread_get_tid (thread), self))
+               return FALSE;
+       if (mono_gc_is_finalizer_internal_thread (thread))
+               return FALSE;
+
+       if ((thread->state & ThreadState_Background) && !(thread->flags & MONO_THREAD_FLAG_DONT_MANAGE)) {
                wait->handles[wait->num] = mono_threads_open_thread_handle (thread->handle);
                wait->threads[wait->num] = thread;
                wait->num++;
 
                THREAD_DEBUG (g_print ("%s: Aborting id: %"G_GSIZE_FORMAT"\n", __func__, (gsize)thread->tid));
                mono_thread_internal_abort (thread);
-               return TRUE;
        }
 
-       return !mono_native_thread_id_equals (thread_get_tid (thread), self)
-               && !mono_gc_is_finalizer_internal_thread (thread);
+       return TRUE;
 }
 
 /** 
@@ -3661,7 +3635,7 @@ mono_threads_get_thread_dump (MonoArray **out_threads, MonoArray **out_stack_fra
        MonoDebugSourceLocation *location;
        int tindex, nthreads;
 
-       mono_error_init (error);
+       error_init (error);
        
        *out_threads = NULL;
        *out_stack_frames = NULL;
@@ -4844,13 +4818,6 @@ async_abort_critical (MonoThreadInfo *info, gpointer ud)
        if (mono_get_eh_callbacks ()->mono_install_handler_block_guard (mono_thread_info_get_suspend_state (info)))
                return MonoResumeThread;
 
-       /*
-       The target thread is running at least one protected block, which must not be interrupted, so we give up.
-       The protected block code will give them a chance when appropriate.
-       */
-       if (mono_thread_get_abort_prot_block_count (thread) > 0)
-               return MonoResumeThread;
-
        /*someone is already interrupting it*/
        if (!mono_thread_set_interruption_requested (thread))
                return MonoResumeThread;
@@ -4903,7 +4870,7 @@ self_abort_internal (MonoError *error)
 {
        MonoException *exc;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* FIXME this is insanely broken, it doesn't cause interruption to happen synchronously
         * since passing FALSE to mono_thread_request_interruption makes sure it returns NULL */
index f826b7965e77f86719fd45b5d15f4545286801b0..e2cec88115b46804b96d1ec856b029954428da35 100644 (file)
@@ -5945,7 +5945,7 @@ mono_method_verify (MonoMethod *method, int level)
        for (i = 0; i < ctx.code_size && i < ip_offset; ++i) {
                if (ctx.code [i].flags & IL_CODE_FLAG_WAS_TARGET) {
                        if (!(ctx.code [i].flags & IL_CODE_FLAG_SEEN))
-                               ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Branch or exception block target middle of intruction at 0x%04x", i));
+                               ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Branch or exception block target middle of instruction at 0x%04x", i));
 
                        if (ctx.code [i].flags & IL_CODE_DELEGATE_SEQUENCE)
                                CODE_NOT_VERIFIABLE (&ctx, g_strdup_printf ("Branch to delegate code sequence at 0x%04x", i));
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 15062f029489d68f0f758c2d38028e17e1fe8610..c0ab592f6078316c1dd3736bb75a3d9dc46147b1 100644 (file)
@@ -117,7 +117,7 @@ HANDLE
 mono_w32file_get_console_output (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetStdHandle (STD_OUTPUT_HANDLE)");
 
@@ -133,7 +133,7 @@ HANDLE
 mono_w32file_get_console_input (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetStdHandle (STD_INPUT_HANDLE)");
 
@@ -149,7 +149,7 @@ HANDLE
 mono_w32file_get_console_error (void)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetStdHandle (STD_ERROR_HANDLE)");
 
index d1511ac15a11c576a3552efc7c76ed642799cded..5086bc442ef339c8a0fd77e530d81fe173e86199 100644 (file)
@@ -596,7 +596,7 @@ ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *io_error)
        len = MAX_PATH + 1; /*FIXME this is too smal under most unix systems.*/
        buf = g_new (gunichar2, len);
        
-       mono_error_init (&error);
+       error_init (&error);
        *io_error=ERROR_SUCCESS;
        result = NULL;
 
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 cd1b81f373689222deeec7f7114a36e9c79e6588..8c6b93d819ebe810d996cfee61ea3c3fdedea095 100644 (file)
@@ -29,7 +29,7 @@ HANDLE
 ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("OpenProcess");
 
@@ -46,7 +46,7 @@ mono_w32process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoE
 {
        g_unsupported_api ("GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
 
-       mono_error_init (error);
+       error_init (error);
        mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue, VerLanguageName");
 
        SetLastError (ERROR_NOT_SUPPORTED);
@@ -57,7 +57,7 @@ process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2
 {
        g_unsupported_api ("GetModuleInformation");
 
-       mono_error_init (error);
+       error_init (error);
        mono_error_set_not_supported (error, G_UNSUPPORTED_API, "GetModuleInformation");
 
        SetLastError (ERROR_NOT_SUPPORTED);
@@ -69,7 +69,7 @@ MonoArray *
 ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("EnumProcessModules, GetModuleBaseName, GetModuleFileNameEx");
 
@@ -85,7 +85,7 @@ MonoBoolean
 ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("ShellExecuteEx");
 
@@ -144,7 +144,7 @@ mono_process_create_process (MonoW32ProcessInfo *mono_process_info, MonoString *
        memset (&process_info, 0, sizeof (PROCESS_INFORMATION));
        g_unsupported_api (api_name);
 
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
        mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, api_name);
        mono_error_set_pending_exception (&mono_error);
 
@@ -157,7 +157,7 @@ MonoBoolean
 mono_icall_get_process_working_set_size (gpointer handle, gsize *min, gsize *max)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetProcessWorkingSetSize");
 
@@ -173,7 +173,7 @@ MonoBoolean
 mono_icall_set_process_working_set_size (gpointer handle, gsize min, gsize max)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("SetProcessWorkingSetSize");
 
@@ -189,7 +189,7 @@ gint32
 mono_icall_get_priority_class (gpointer handle)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("GetPriorityClass");
 
@@ -205,7 +205,7 @@ MonoBoolean
 mono_icall_set_priority_class (gpointer handle, gint32 priorityClass)
 {
        MonoError mono_error;
-       mono_error_init (&mono_error);
+       error_init (&mono_error);
 
        g_unsupported_api ("SetPriorityClass");
 
index affa016604dae8b8162ae0b86452a1e3ed513c83..960ad07697374077b14c8fcc75348e80c056b1fc 100644 (file)
@@ -143,7 +143,7 @@ process_set_field_string (MonoObject *obj, const gchar *fieldname, const gunicha
        MonoClassField *field;
        MonoString *string;
 
-       mono_error_init (error);
+       error_init (error);
 
        LOGDEBUG (g_message ("%s: Setting field %s to [%s]", __func__, fieldname, g_utf16_to_utf8 (val, len, NULL, NULL, NULL)));
 
@@ -281,7 +281,7 @@ process_module_string_read (MonoObject *filever, gpointer data, const gchar *fie
        gunichar2 *lang_key, *buffer;
        UINT chars;
 
-       mono_error_init (error);
+       error_init (error);
 
        lang_key_utf8 = g_strdup_printf (key, lang_lo, lang_hi, 0x04, 0xb0);
 
@@ -325,7 +325,7 @@ mono_w32process_get_fileversion (MonoObject *filever, gunichar2 *filename, MonoE
        gunichar2 lang_buf[128];
        guint32 lang, lang_count;
 
-       mono_error_init (error);
+       error_init (error);
 
        datalen = mono_w32process_get_fileversion_info_size (filename, &verinfohandle);
        if (datalen) {
@@ -464,7 +464,7 @@ process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2
        MODULEINFO modinfo;
        BOOL ok;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* Build a System.Diagnostics.ProcessModule with the data. */
        item = mono_object_new_checked (domain, proc_class, error);
@@ -513,7 +513,7 @@ process_get_module (MonoAssembly *assembly, MonoClass *proc_class, MonoError *er
        gchar *filename;
        const gchar *modulename;
 
-       mono_error_init (error);
+       error_init (error);
 
        domain = mono_domain_get ();
 
index 0517bdd65f17a13d0834ae26aab8bbf22417c3cf..5312790ad644b21b43d518ab238c73ab15ea2458 100644 (file)
@@ -825,7 +825,7 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
        MonoArray *data;
        MonoAddressFamily family;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* Build a System.Net.SocketAddress object instance */
        if (!domain->sockaddr_class)
@@ -1058,7 +1058,7 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
        gint32 family;
        int len;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!domain->sockaddr_class)
                domain->sockaddr_class = mono_class_load_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
@@ -2406,7 +2406,7 @@ addrinfo_to_IPHostEntry (MonoAddressInfo *info, MonoString **h_name, MonoArray *
        int addr_index;
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error);
+       error_init (error);
        addr_index = 0;
        *h_aliases = mono_array_new_checked (domain, mono_get_string_class (), 0, error);
        return_val_if_nok (error, FALSE);
index f53010594c79435c74b13c06bd545ee30d87ddff..af434f4218a008e40471928ff17ea2d51dbd11c7 100644 (file)
@@ -8,7 +8,7 @@
 /*.dll
 /*.mdb
 /*.lo
-/interpreter/*.lo
+/interp/*.lo
 /*.loT
 /*.la
 /.libs
index 37c19cabc3eeaa47a134a061d2ecd1f6e7d98522..1aa2808c3dc612d00f813db908e49e097959fda1 100755 (executable)
@@ -43,7 +43,7 @@ RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_bu
 
 MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
 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
@@ -388,15 +388,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
@@ -498,25 +498,51 @@ test_sources =                    \
        gc-test.cs \
        gshared.cs
 
+if NACL_CODEGEN
+test_sources += nacl.cs
+endif
 
-regtests_UNIVERSAL=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe basic-vectors.exe
-iregtests=basic.exe basic-float.exe basic-long.exe basic-calls.exe generics.exe objects.exe
-
-if FULL_AOT_TESTS
-regtests= \
-       $(regtests_UNIVERSAL)
+regtests_UNIVERSAL = \
+       basic.exe \
+       basic-float.exe \
+       basic-long.exe \
+       basic-calls.exe \
+       objects.exe \
+       arrays.exe \
+       basic-math.exe \
+       exceptions.exe \
+       iltests.exe \
+       devirtualization.exe \
+       generics.exe \
+       basic-simd.exe \
+       basic-vectors.exe
 
 if NACL_CODEGEN
-test_sources += nacl.cs
-regtests += nacl.exe
+regtests_UNIVERSAL += nacl.exe
 endif
 
-else
-regtests= \
-       $(regtests_UNIVERSAL) \
-       $(regtests_FULL_AOT_TESTS_BLACKLIST)
+regtests_DISABLED = 
+
+if FULL_AOT_TESTS
+regtests_DISABLED += 
 endif
 
+regtests = $(filter-out $(regtests_DISABLED),$(regtests_UNIVERSAL))
+
+iregtests = \
+       basic.exe \
+       basic-float.exe \
+       basic-long.exe \
+       basic-calls.exe \
+       objects.exe \
+       arrays.exe \
+       basic-math.exe \
+       exceptions.exe \
+       devirtualization.exe \
+       generics.exe \
+       basic-simd.exe \
+       basic-vectors.exe
+
 if X86
 arch_sources = $(x86_sources)
 arch_built=cpu-x86.h
@@ -602,7 +628,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 =
@@ -727,7 +753,7 @@ rcheck: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
 
 richeck: mono $(iregtests)
-       $(INTERPRETER_RUNTIME) --regression $(iregtests)
+       $(INTERP_RUNTIME) --regression $(iregtests)
 
 if ARM
 check-seq-points:
@@ -759,13 +785,6 @@ gsharedvtcheck:
 
 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
 
-# Skip aoting the tests that aren't compiled 
-# on the full aot profiles because they're skipped
-# on mobile profiles
-FULLAOT_LIBS_FULL_AOT_TESTS_BLACKLIST = \
-       Mono.Posix.dll \
-       System.Configuration.dll
-
 FULLAOT_LIBS_UNIVERSAL = \
        mscorlib.dll \
        System.Core.dll \
@@ -775,17 +794,23 @@ FULLAOT_LIBS_UNIVERSAL = \
        Mono.Simd.dll \
        Mono.Security.dll \
        System.Numerics.dll \
-       System.Numerics.Vectors.dll
+       System.Numerics.Vectors.dll \
+       Mono.Posix.dll \
+       System.Configuration.dll
+
+FULLAOT_LIBS_DISABLED =
 
 if FULL_AOT_TESTS
-FULLAOT_LIBS= \
-       $(FULLAOT_LIBS_UNIVERSAL)
-else
-FULLAOT_LIBS= \
-       $(FULLAOT_LIBS_UNIVERSAL) \
-       $(FULLAOT_LIBS_FULL_AOT_TESTS_BLACKLIST)
+# Skip aoting the tests that aren't compiled 
+# on the full aot profiles because they're skipped
+# on mobile profiles
+FULLAOT_LIBS_DISABLED += \
+       Mono.Posix.dll \
+       System.Configuration.dll
 endif
 
+FULLAOT_LIBS = $(filter-out $(FULLAOT_LIBS_DISABLED),$(FULLAOT_LIBS_UNIVERSAL))
+
 FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
 
 # This currently only works on amd64/arm
index c419dfa2b42abf4139037e97340225628b8670b3..7ff437f9f9d5e9e1585cc4ac2d9a890959ed0b41 100644 (file)
@@ -159,10 +159,17 @@ lower_memory_access (MonoCompile *cfg)
                for (ins = bb->code; ins; ins = ins->next) {
 handle_instruction:
                        switch (ins->opcode) {
-                       case OP_LDADDR:
-                               g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
-                               if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                       case OP_LDADDR: {
+                               MonoInst *var = (MonoInst*)ins->inst_p0;
+                               if (var->flags & MONO_INST_VOLATILE) {
+                                       if (cfg->verbose_level > 2) { printf ("Found address to volatile var, can't take it: "); mono_print_ins (ins); }
+                               } else {
+                                       g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
+                                       if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                               }
                                break;
+                       }
+
                        case OP_MOVE:
                                tmp = (MonoInst*)g_hash_table_lookup (addr_loads, GINT_TO_POINTER (ins->sreg1));
                                /*
index 6e91638d881fe1f3f3f97a4cf2c9d97e12c9555b..947e4e33d6fdbf9770fd1886413e09ac27e0a973 100644 (file)
@@ -4330,7 +4330,9 @@ add_wrappers (MonoAotCompile *acfg)
                                        named += slen;
                                }
 
-                               wrapper = mono_marshal_get_managed_wrapper (method, klass, 0);
+                               wrapper = mono_marshal_get_managed_wrapper (method, klass, 0, &error);
+                               mono_error_assert_ok (&error);
+
                                add_method (acfg, wrapper);
                                if (export_name)
                                        g_hash_table_insert (acfg->export_names, wrapper, export_name);
@@ -5244,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;
@@ -5347,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;
index ed2b485a626d415b54fda77ef970106282fca802..ce87be85147787fadc4017bb32d96a9be54733ac 100644 (file)
@@ -257,7 +257,7 @@ load_image (MonoAotModule *amodule, int index, MonoError *error)
 
        g_assert (index < amodule->image_table_len);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (amodule->image_table [index])
                return amodule->image_table [index];
@@ -374,7 +374,7 @@ decode_generic_inst (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoEr
        MonoGenericInst *inst;
        guint8 *p = buf;
 
-       mono_error_init (error);
+       error_init (error);
        type_argc = decode_value (p, &p);
        type_argv = g_new0 (MonoType*, type_argc);
 
@@ -401,7 +401,7 @@ decode_generic_context (MonoAotModule *module, MonoGenericContext *ctx, guint8 *
        guint8 *p = buf;
        guint8 *p2;
        int argc;
-       mono_error_init (error);
+       error_init (error);
 
        p2 = p;
        argc = decode_value (p, &p);
@@ -433,7 +433,7 @@ decode_klass_ref (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError
        guint8 *p = buf;
        int reftype;
 
-       mono_error_init (error);
+       error_init (error);
        reftype = decode_value (p, &p);
        if (reftype == 0) {
                *endbuf = p;
@@ -621,7 +621,7 @@ decode_type (MonoAotModule *module, guint8 *buf, guint8 **endbuf, MonoError *err
        MonoType *t;
 
        t = (MonoType *)g_malloc0 (sizeof (MonoType));
-       mono_error_init (error);
+       error_init (error);
 
        while (TRUE) {
                if (*p == MONO_TYPE_PINNED) {
@@ -852,7 +852,7 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
        guint8 *p = buf;
 
        memset (ref, 0, sizeof (MethodRef));
-       mono_error_init (error);
+       error_init (error);
 
        value = decode_value (p, &p);
        image_index = value >> 24;
@@ -1214,7 +1214,9 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                        klass = decode_klass_ref (module, p, &p, error);
                        if (!klass)
                                return FALSE;
-                       ref->method = mono_marshal_get_managed_wrapper (m, klass, 0);
+                       ref->method = mono_marshal_get_managed_wrapper (m, klass, 0, error);
+                       if (!mono_error_ok (error))
+                               return FALSE;
                        break;
                }
                default:
@@ -1338,7 +1340,7 @@ decode_resolve_method_ref_with_target (MonoAotModule *module, MonoMethod *target
 {
        MethodRef ref;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!decode_method_ref_with_target (module, &ref, target, buf, endbuf, error))
                return NULL;
@@ -2430,7 +2432,7 @@ mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int sl
        gpointer addr;
        MonoError inner_error;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (MONO_CLASS_IS_INTERFACE (klass) || klass->rank || !amodule)
                return NULL;
@@ -3849,7 +3851,7 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
        guint8 *code = NULL, *info;
        gboolean res;
 
-       mono_error_init (error);
+       error_init (error);
 
        init_amodule_got (amodule);
 
@@ -4142,7 +4144,7 @@ init_method (MonoAotModule *amodule, guint32 method_index, MonoMethod *method, M
        MonoJitInfo *jinfo = NULL;
        guint8 *code, *info;
 
-       mono_error_init (error);
+       error_init (error);
 
        code = (guint8 *)amodule->methods [method_index];
        info = &amodule->blob [mono_aot_get_offset (amodule->method_info_offsets, method_index)];
@@ -4353,7 +4355,7 @@ mono_aot_get_method_checked (MonoDomain *domain, MonoMethod *method, MonoError *
        gboolean cache_result = FALSE;
        MonoError inner_error;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (domain != mono_get_root_domain ())
                /* Non shared AOT code can't be used in other appdomains */
@@ -4619,7 +4621,7 @@ mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 to
        int method_index;
        gpointer res;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!aot_module)
                return NULL;
@@ -4738,7 +4740,7 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
        MonoMemPool *mp;
        gboolean using_gsharedvt = FALSE;
 
-       mono_error_init (error);
+       error_init (error);
 
        //printf ("DYN: %p %d\n", aot_module, plt_info_offset);
 
@@ -5837,7 +5839,7 @@ gpointer
 mono_aot_get_method_checked (MonoDomain *domain,
                                                         MonoMethod *method, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return NULL;
 }
 
@@ -5868,7 +5870,7 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
 gpointer
 mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
        return NULL;
 }
 
@@ -5892,7 +5894,7 @@ mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_
 gpointer
 mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        return NULL;
 }
index 00a3c6b901f86a6b0c92e4b9a2993dbb447f3e78..b3002716e46085da306e63dfef31888d1354d220 100644 (file)
@@ -318,6 +318,7 @@ class Tests
                return 0;
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_multi_dimension_arrays () {
                int sum;
 
@@ -548,6 +549,7 @@ class Tests
                return 0;
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_multidym_array_with_negative_lower_bound () {
                int[,] x = (int[,]) Array.CreateInstance(typeof (int), new int[] { 2, 2 }, new int[] { -2, -3 });
 
@@ -778,6 +780,7 @@ class Tests
        }
 
        // #13544
+       [Category ("!INTERPRETER")]
        public static int test_0_newarr_ovf () {
                if (!alloc_long (5000000000))
                        return 1;
index a2cf101450e792a1faf5177fdeb7e6b84ad06cbf..1174292433a87684b10a822ccaa3cdd8d27e9bf0 100644 (file)
@@ -113,6 +113,7 @@ public class VectorTests {
                return Vector2.Abs (v1);
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_vector2_abs () {
                var v1 = new Vector2 (-1.0f, -2.0f);
                var v2 = new Vector2 (1.0f, 2.0f);
@@ -350,6 +351,7 @@ public class VectorTests {
                return Vector4.Abs (v1);
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_vector4_abs () {
                var v1 = new Vector4 (-1.0f, -2.0f, -3.0f, -4.0f);
                var v2 = new Vector4 (1.0f, 2.0f, 3.0f, 4.0f);
@@ -588,6 +590,7 @@ public class VectorTests {
                return Vector3.Abs (v1);
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_vector3_abs () {
                var v1 = new Vector3 (-1.0f, -2.0f, -3.0f);
                var v2 = new Vector3 (1.0f, 2.0f, 3.0f);
index 41e241a33a8bf1a14ee1b64f4f07f5773fac4a0e..68780e5056a42385db381f00e4d43dfd995403cb 100644 (file)
@@ -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 21779306d9684b992216e9403965b5ca04a82473..ed1b7a14a7f3f502ef5708be026901355408022f 100644 (file)
@@ -998,7 +998,7 @@ mono_debugger_agent_init (void)
        /* Needed by the hash_table_new_type () call below */
        mono_gc_base_init ();
 
-       thread_to_tls = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_DEBUGGER, "thread-to-tls table");
+       thread_to_tls = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_DEBUGGER, "thread-to-tls table");
 
        tid_to_thread = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DEBUGGER, "tid-to-thread table");
 
@@ -1939,7 +1939,7 @@ objrefs_init (void)
 {
        objrefs = g_hash_table_new_full (NULL, NULL, NULL, free_objref);
        obj_to_objref = g_hash_table_new (NULL, NULL);
-       suspended_objs = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_DEBUGGER, "suspended objects table");
+       suspended_objs = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_DEBUGGER, "suspended objects table");
 }
 
 static void
@@ -4150,7 +4150,7 @@ insert_breakpoint (MonoSeqPointInfo *seq_points, MonoDomain *domain, MonoJitInfo
        gboolean it_has_sp = FALSE;
 
        if (error)
-               mono_error_init (error);
+               error_init (error);
 
        mono_seq_point_iterator_init (&it, seq_points);
        while (mono_seq_point_iterator_next (&it)) {
@@ -4350,7 +4350,7 @@ set_bp_in_method (MonoDomain *domain, MonoMethod *method, MonoSeqPointInfo *seq_
        MonoJitInfo *ji;
 
        if (error)
-               mono_error_init (error);
+               error_init (error);
 
        code = mono_jit_find_compiled_method_with_jit_info (domain, method, &ji);
        if (!code) {
@@ -4396,7 +4396,7 @@ set_breakpoint (MonoMethod *method, long il_offset, EventRequest *req, MonoError
        int i;
 
        if (error)
-               mono_error_init (error);
+               error_init (error);
 
        // FIXME:
        // - suspend/resume the vm to prevent code patching problems
@@ -8008,7 +8008,7 @@ get_assembly_object_command (MonoDomain *domain, MonoAssembly *ass, Buffer *buf,
 {
        HANDLE_FUNCTION_ENTER();
        ErrorCode err = ERR_NONE;
-       mono_error_init (error);
+       error_init (error);
        MonoReflectionAssemblyHandle o = mono_assembly_get_object_handle (domain, ass, error);
        if (MONO_HANDLE_IS_NULL (o)) {
                err = ERR_INVALID_OBJECT;
@@ -8659,7 +8659,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
                MonoError error;
                GPtrArray *array;
 
-               mono_error_init (&error);
+               error_init (&error);
                array = mono_class_get_methods_by_name (klass, name, flags & ~BINDING_FLAGS_IGNORE_CASE, (flags & BINDING_FLAGS_IGNORE_CASE) != 0, TRUE, &error);
                if (!is_ok (&error)) {
                        mono_error_cleanup (&error);
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..5aacab1c440f8bba6cfbc9313530ab57db01ef41 100644 (file)
@@ -21,7 +21,6 @@
 #endif
 
 #include <mono/metadata/mono-endian.h>
-#include <mono/metadata/debug-mono-symfile.h>
 #include <mono/metadata/mono-debug-debugger.h>
 
 #ifndef HOST_WIN32
@@ -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 98c6046e61a5cdea5dab273ee1b289d63c26a7b5..4e11a7d4157c07e17bcc9151b92114dae72c3c1d 100644 (file)
@@ -981,6 +981,7 @@ class Tests
                return 0;
        }
        
+       [Category ("!INTERPRETER")]
        public static int test_0_int_cast () {
                int a;
                long l;
@@ -1462,6 +1463,7 @@ class Tests
                return 0;
        }
        
+       [Category ("!INTERPRETER")]
        [Category ("NaClDisable")]
        public static int test_0_div_zero () {
                int d = 1;
@@ -1633,6 +1635,7 @@ class Tests
                return 0;
        }
 
+       [Category ("!INTERPRETER")]
        [Category ("NaClDisable")]
        public static int test_0_long_div_zero () {
                long d = 1;
@@ -1800,6 +1803,7 @@ class Tests
                return 0;
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_3_checked_cast_un () {
                 ulong i = 0x8000000034000000;
                 long j;
@@ -1815,6 +1819,7 @@ class Tests
                return 3;
        }
        
+       [Category ("!INTERPRETER")]
        public static int test_4_checked_cast () {
                 long i;
                 ulong j;
@@ -1842,6 +1847,7 @@ class Tests
                7, 0, 7, 1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7, 7, 7, 8,
        };
 
+       [Category ("!INTERPRETER")]
        public static int test_0_multi_dim_array_access () {
                int [,] a = System.Array.CreateInstance (typeof (int),
                        new int [] {3,6}, new int [] {2,2 }) as int[,];
@@ -1878,6 +1884,7 @@ class Tests
                o = "buddy";
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_2_array_mismatch () {
                string[] a = { "hello", "world" };
                object[] b = a;
@@ -2230,6 +2237,7 @@ class Tests
                }
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_exception_in_cctor () {
                try {
                        Broken.DoSomething ();
@@ -2318,6 +2326,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
@@ -2380,6 +2389,7 @@ class Tests
                }
        }
 
+       [Category ("!INTERPRETER")]
        public static int test_0_array_size () {
                bool failed;
 
@@ -2706,6 +2716,7 @@ class Tests
                public static Foo* pFoo;
        }
 
+       [Category ("!INTERPRETER")]
        /* MS.NET doesn't seem to throw in this case */
        public unsafe static int test_0_ldflda_null_pointer () {
                int* pi = &Foo.pFoo->i;
index 9defe79f3cc9ff701d1c4bd16da6c91db5f49653..8354e0ba3c104bdc84fc4a5071f49586b82ee7c0 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;
@@ -562,7 +593,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 +652,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 +661,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 +692,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 +748,6 @@ class Tests
                return 0;
        }
 
-       [Category ("!INTERPRETER")]
        [Category ("GSHAREDVT")]
        public static int test_6_partial_sharing_linq () {
                var messages = new List<Message> ();
@@ -732,7 +758,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 +934,6 @@ class Tests
                }
        }
 
-       [Category ("!INTERPRETER")]
        [Category ("!FULLAOT")]
        [Category ("!BITCODE")]
        public static int test_0_regress_668095_synchronized_gshared () {
@@ -1256,7 +1280,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 95e1fff2bb42a59abeb32870870b8c718163494f..0b123e50cf686664138ce21ffb0faa23c1e549c1 100644 (file)
@@ -155,121 +155,6 @@ mono_draw_cfg (MonoCompile *cfg, FILE *fp)
        fprintf (fp, "}\n");
 }
 
-#if 0
-
-static void
-mono_print_label (FILE *fp, MonoInst *tree) {
-       int arity;
-
-       if (!tree)
-               return;
-
-       arity = mono_burg_arity [tree->opcode];
-
-       fprintf (fp, "\\ %s%s", arity? "(": "",  mono_inst_name (tree->opcode));
-
-       switch (tree->opcode) {
-       case OP_ICONST:
-               fprintf (fp, "[%ld]", (long)tree->inst_c0);
-               break;
-       case OP_I8CONST:
-               fprintf (fp, "[%lld]", (long long)tree->inst_l);
-               break;
-       case OP_R8CONST:
-               fprintf (fp, "[%f]", *(double*)tree->inst_p0);
-               break;
-       case OP_R4CONST:
-               fprintf (fp, "[%f]", *(float*)tree->inst_p0);
-               break;
-       case OP_ARG:
-       case OP_LOCAL:
-               fprintf (fp, "[%d]", (int)tree->inst_c0);
-               break;
-       case OP_REGOFFSET:
-               fprintf (fp, "[0x%x(%s)]", (int)tree->inst_offset, mono_arch_regname (tree->inst_basereg));
-               break;
-       case OP_REGVAR:
-               fprintf (fp, "[%s]", mono_arch_regname (tree->dreg));
-               break;
-       case CEE_NEWARR:
-               fprintf (fp, "[%s]",  tree->inst_newa_class->name);
-               mono_print_label (fp, tree->inst_newa_len);
-               break;
-       case OP_CALL:
-       case OP_CALL_MEMBASE:
-       case OP_FCALL:
-       case OP_FCALL_MEMBASE:
-       case OP_LCALL:
-       case OP_LCALL_MEMBASE:
-       case OP_VCALL:
-       case OP_VCALL_MEMBASE:
-       case OP_VOIDCALL:
-       case OP_VOIDCALL_MEMBASE: {
-               MonoCallInst *call = (MonoCallInst*)tree;
-               if (call->method) {
-                       if (mono_method_signature (call->method)->hasthis && tree->inst_left) {
-                               mono_print_label (fp, tree->inst_left);
-                       }
-                       fprintf (fp, "[%s]", call->method->name);
-               }
-               break;
-       }
-       case OP_PHI: {
-               int i;
-               fprintf (fp, "[%d\\ (", (int)tree->inst_c0);
-               for (i = 0; i < tree->inst_phi_args [0]; i++) {
-                       if (i)
-                               fprintf (fp, ",\\ ");
-                       fprintf (fp, "%d", tree->inst_phi_args [i + 1]);
-               }
-               fprintf (fp, ")]");
-               break;
-       }
-       case OP_NOP:
-       case OP_JMP:
-       case OP_BREAK:
-               break;
-       case OP_BR:
-               fprintf (fp, "[B%d]", tree->inst_target_bb->block_num);
-               break;
-       case OP_SWITCH:
-       case CEE_ISINST:
-       case CEE_CASTCLASS:
-       case OP_CALL_REG:
-       case OP_FCALL_REG:
-       case OP_LCALL_REG:
-       case OP_VCALL_REG:
-       case OP_VOIDCALL_REG:
-               mono_print_label (fp, tree->inst_left);
-               break;
-       case CEE_BNE_UN:
-       case CEE_BEQ:
-       case CEE_BLT:
-       case CEE_BLT_UN:
-       case CEE_BGT:
-       case CEE_BGT_UN:
-       case CEE_BGE:
-       case CEE_BGE_UN:
-       case CEE_BLE:
-       case CEE_BLE_UN:
-               fprintf (fp, "[B%dB%d]", tree->inst_true_bb->block_num, tree->inst_false_bb->block_num);
-               mono_print_label (fp, tree->inst_left);
-               break;
-       default:
-               if (arity) {
-                       mono_print_label (fp, tree->inst_left);
-                       if (arity > 1)
-                               mono_print_label (fp, tree->inst_right);
-               }
-               break;
-       }
-
-       if (arity)
-               fprintf (fp, ")");
-}
-
-#endif
-
 static void
 mono_draw_code_cfg (MonoCompile *cfg, FILE *fp)
 {
index 65151b07024e8d1a2199d9b76119cd07be48c527..e4323480388d18ed54d50e046ddc014aedb50217 100644 (file)
@@ -1026,7 +1026,7 @@ public class Tests
                return t.ToString ();
        }
 
-       enum AnEnum {
+       public enum AnEnum {
                One,
                Two
        };
@@ -1106,10 +1106,12 @@ public class Tests
 
        interface IConstrainedCalls {
                Pair<int, int> vtype_ret<T, T2>(T t, T2 t2) where T: IReturnVType;
+               AnEnum enum_ret<T, T2>(T t, T2 t2) where T: IReturnVType;
        }
 
        public interface IReturnVType {
                Pair<int, int> return_vtype ();
+               AnEnum return_enum ();
        }
 
        public class CConstrainedCalls : IConstrainedCalls {
@@ -1117,12 +1119,20 @@ public class Tests
                public Pair<int, int> vtype_ret<T, T2>(T t, T2 t2) where T : IReturnVType {
                        return t.return_vtype ();
                }
+
+               [MethodImplAttribute (MethodImplOptions.NoInlining)]
+               public AnEnum enum_ret<T, T2>(T t, T2 t2) where T : IReturnVType {
+                       return t.return_enum ();
+               }
        }
 
        class ReturnVType : IReturnVType {
                public Pair<int, int> return_vtype () {
                        return new Pair<int, int> () { First = 1, Second = 2 };
                }
+               public AnEnum return_enum () {
+                       return AnEnum.Two;
+               }
        }
 
        public static int test_0_constrained_vtype_ret () {
@@ -1133,6 +1143,14 @@ public class Tests
                return 0;
        }
 
+       public static int test_0_constrained_enum_ret () {
+               IConstrainedCalls c = new CConstrainedCalls ();
+               var r = c.enum_ret<ReturnVType, int> (new ReturnVType (), 1);
+               if (r != AnEnum.Two)
+                       return 1;
+               return 0;
+       }
+
        public struct Pair<T1, T2> {
                public T1 First;
                public T2 Second;
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..9c21f95
--- /dev/null
@@ -0,0 +1,4550 @@
+/*
+ * 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;
+}
+
+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];
+       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 (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 + 1;
+       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 + 1;
+       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 + 1;
+       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;
+}
+
+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:
+                       margs->fargs [int_f] = frame->stack_args [i].data.f;
+                       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 ())
+               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);
+}
+
+void
+mono_interp_init_delegate (MonoDelegate *del)
+{
+       g_assert (!del->method);
+       del->method = ((RuntimeMethod *) del->method_ptr)->method;
+       g_assert (del->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;
+               }
+               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) {
+                       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_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->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);
+                       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;
+}
+
+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..59428a8
--- /dev/null
@@ -0,0 +1,22 @@
+#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);
+
+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..54c5422
--- /dev/null
@@ -0,0 +1,506 @@
+/*
+ * 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_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/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..e5e2ec9
--- /dev/null
@@ -0,0 +1,3382 @@
+/*
+ * 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);
+
+                       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 (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);
+       }
+
+       /* TODO: that's oddly specific? */
+       if (generic_context && target_method && !strcmp ("Invoke", target_method->name) && target_method->klass->parent == mono_defaults.multicastdelegate_class) {
+               csignature = mono_inflate_generic_signature (csignature, generic_context, &error);
+               mono_error_cleanup (&error); /* FIXME: don't swallow the error */
+       }
+
+       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 {
+                       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 */
+                                       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
+       } 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;
+       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;
+
+       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);
+                       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);
+                       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_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_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);
+                       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));
+                       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, 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);
+                                       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);
+                               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 = 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);
+                       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 == '.' && (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 355be88..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;
-       mono_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;
-
-       mono_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 7130aeab31cbb9ad51711ab2fc60287547ae1ca1..765d3096a1cd2707f02b2d45e89bb1b2a75f8943 100644 (file)
@@ -1332,7 +1332,7 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k
        MonoMethod *m;
        int vt_slot, iface_offset;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_class_is_interface (klass)) {
                MonoObject *this_obj;
@@ -1504,7 +1504,7 @@ resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method,
        gpointer addr, compiled_method, aot_addr;
        gboolean need_rgctx_tramp = FALSE, need_unbox_tramp = FALSE;
 
-       mono_error_init (error);
+       error_init (error);
        if (!this_obj)
                /* The caller will handle it */
                return NULL;
@@ -1588,7 +1588,7 @@ resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_a
        gpointer addr, compiled_method;
        gboolean need_unbox_tramp = FALSE;
 
-       mono_error_init (error);
+       error_init (error);
        /* Same as in common_call_trampoline () */
 
        /* Avoid loading metadata or creating a generic vtable if possible */
@@ -1915,7 +1915,7 @@ mono_throw_method_access (MonoMethod *callee, MonoMethod *caller)
        char *caller_name = mono_method_full_name (caller, 1);
        MonoError error;
 
-       mono_error_init (&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_pending_exception (&error);
        g_free (callee_name);
index cdd1c42ef491a6b772f6155f11bfd424dee7ffcd..cfdc728c0d019e49bf5b19d187be5919eb0d0465 100644 (file)
@@ -231,8 +231,7 @@ analyze_liveness_bb (MonoCompile *cfg, MonoBasicBlock *bb)
 
 #ifdef DEBUG_LIVENESS
                if (cfg->verbose_level > 1) {
-                       printf ("\t");
-                       mono_print_ins (ins);
+                       mono_print_ins_index (1, ins);
                }
 #endif
 
index 38ba5a241ec8e3d6373fd107c6513bccec045f9d..5982e0c200851a771b00e243d5a71586c450c074 100644 (file)
@@ -348,14 +348,19 @@ mono_print_bb (MonoBasicBlock *bb, const char *msg)
 {
        int i;
        MonoInst *tree;
+       GString *str = g_string_new ("");
 
-       printf ("\n%s %d: [IN: ", msg, bb->block_num);
+       g_string_append_printf (str, "%s %d: [IN: ", msg, bb->block_num);
        for (i = 0; i < bb->in_count; ++i)
-               printf (" BB%d(%d)", bb->in_bb [i]->block_num, bb->in_bb [i]->dfn);
-       printf (", OUT: ");
+               g_string_append_printf (str, " BB%d(%d)", bb->in_bb [i]->block_num, bb->in_bb [i]->dfn);
+       g_string_append_printf (str, ", OUT: ");
        for (i = 0; i < bb->out_count; ++i)
-               printf (" BB%d(%d)", bb->out_bb [i]->block_num, bb->out_bb [i]->dfn);
-       printf (" ]\n");
+               g_string_append_printf (str, " BB%d(%d)", bb->out_bb [i]->block_num, bb->out_bb [i]->dfn);
+       g_string_append_printf (str, " ]\n");
+
+       g_print ("%s", str->str);
+       g_string_free (str, TRUE);
+
        for (tree = bb->code; tree; tree = tree->next)
                mono_print_ins_index (-1, tree);
 }
@@ -4450,7 +4455,7 @@ handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMe
         * pack the arguments into an array, and do the rest of the work in in an icall.
         */
        if (((cmethod->klass == mono_defaults.object_class) || mono_class_is_interface (cmethod->klass) || (!cmethod->klass->valuetype && cmethod->klass->image != mono_defaults.corlib)) &&
-               (MONO_TYPE_IS_VOID (fsig->ret) || MONO_TYPE_IS_PRIMITIVE (fsig->ret) || MONO_TYPE_IS_REFERENCE (fsig->ret) || MONO_TYPE_ISSTRUCT (fsig->ret) || mini_is_gsharedvt_type (fsig->ret)) &&
+               (MONO_TYPE_IS_VOID (fsig->ret) || MONO_TYPE_IS_PRIMITIVE (fsig->ret) || MONO_TYPE_IS_REFERENCE (fsig->ret) || MONO_TYPE_ISSTRUCT (fsig->ret) || mono_class_is_enum (mono_class_from_mono_type (fsig->ret)) || mini_is_gsharedvt_type (fsig->ret)) &&
                (fsig->param_count == 0 || (!fsig->hasthis && fsig->param_count == 1) || (fsig->param_count == 1 && (MONO_TYPE_IS_REFERENCE (fsig->params [0]) || fsig->params [0]->byref || mini_is_gsharedvt_type (fsig->params [0]))))) {
                MonoInst *args [16];
 
@@ -4502,7 +4507,7 @@ handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMe
 
                if (mini_is_gsharedvt_type (fsig->ret)) {
                        ins = handle_unbox_gsharedvt (cfg, mono_class_from_mono_type (fsig->ret), ins);
-               } else if (MONO_TYPE_IS_PRIMITIVE (fsig->ret) || MONO_TYPE_ISSTRUCT (fsig->ret)) {
+               } else if (MONO_TYPE_IS_PRIMITIVE (fsig->ret) || MONO_TYPE_ISSTRUCT (fsig->ret) || mono_class_is_enum (mono_class_from_mono_type (fsig->ret))) {
                        MonoInst *add;
 
                        /* Unbox */
@@ -6708,7 +6713,7 @@ mini_get_method_allow_open (MonoMethod *m, guint32 token, MonoClass *klass, Mono
 {
        MonoMethod *method;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (m->wrapper_type != MONO_WRAPPER_NONE) {
                method = (MonoMethod *)mono_method_get_wrapper_data (m, token);
@@ -6765,7 +6770,7 @@ mini_get_signature (MonoMethod *method, guint32 token, MonoGenericContext *conte
 {
        MonoMethodSignature *fsig;
 
-       mono_error_init (error);
+       error_init (error);
        if (method->wrapper_type != MONO_WRAPPER_NONE) {
                fsig = (MonoMethodSignature *)mono_method_get_wrapper_data (method, token);
        } else {
@@ -11585,7 +11590,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                                        tclass, MONO_RGCTX_INFO_REFLECTION_TYPE);
                                        } else if (cfg->compile_aot) {
                                                if (method->wrapper_type) {
-                                                       mono_error_init (&error); //got to do it since there are multiple conditionals below
+                                                       error_init (&error); //got to do it since there are multiple conditionals below
                                                        if (mono_class_get_checked (tclass->image, tclass->type_token, &error) == tclass && !generic_context) {
                                                                /* Special case for static synchronized wrappers */
                                                                EMIT_NEW_TYPE_FROM_HANDLE_CONST (cfg, ins, tclass->image, tclass->type_token, generic_context);
index 42715480b0005e5969b924da1773fd3b46488759..f85644d42ca6d5446732a7427bb27e48b48d9177 100644 (file)
@@ -1515,6 +1515,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                        nwords = (align_size + sizeof (gpointer) -1 ) / sizeof (gpointer);
                        ainfo->storage = RegTypeStructByVal;
                        ainfo->struct_size = size;
+                       ainfo->align = align;
                        /* FIXME: align stack_size if needed */
                        if (eabi_supported) {
                                if (align >= 8 && (gr & 1))
@@ -2166,7 +2167,16 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig)
                        break;
                case RegTypeStructByVal:
                        lainfo->storage = LLVMArgAsIArgs;
-                       lainfo->nslots = ainfo->struct_size / sizeof (gpointer);
+                       if (eabi_supported && ainfo->align == 8) {
+                               /* LLVM models this by passing an int64 array */
+                               lainfo->nslots = ALIGN_TO (ainfo->struct_size, 8) / 8;
+                               lainfo->esize = 8;
+                       } else {
+                               lainfo->nslots = ainfo->struct_size / sizeof (gpointer);
+                               lainfo->esize = 4;
+                       }
+
+                       printf ("D: %d\n", ainfo->align);
                        break;
                case RegTypeStructByAddr:
                case RegTypeStructByAddrOnStack:
index 28678638b6c0e46c3592214e34b8093e399f4d39..31194f2e60d596b17facb97b744e482f3abb3864 100644 (file)
@@ -208,7 +208,7 @@ typedef struct {
        guint8  reg;
        ArgStorage  storage;
        /* RegTypeStructByVal */
-       gint32  struct_size;
+       gint32  struct_size, align;
        guint8  size    : 4; /* 1, 2, 4, 8, or regs used by RegTypeStructByVal */
 } ArgInfo;
 
index 3ad91e31cd0dda930ff1206ef5690d9c1971b896..1884dc1d49d714d53444064d6e76947b989aedd0 100644 (file)
@@ -1902,7 +1902,7 @@ mono_arch_create_vars (MonoCompile *cfg)
        if (cfg->method->save_lmf) {
                cfg->create_lmf_var = TRUE;
                cfg->lmf_ir = TRUE;
-#ifndef TARGET_MACH
+#ifdef HAVE_GET_TLS_ADDR
                cfg->lmf_ir_mono_lmf = TRUE;
 #endif
        }
index 68427314ac5e3fef0b4526e3ae0f117652d5202d..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)
@@ -1375,7 +1382,7 @@ wrap_non_exception_throws (MonoMethod *m)
 static MonoArray*
 build_native_trace (MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 /* This puppy only makes sense on mobile, IOW, ARM. */
 #if defined (HAVE_BACKTRACE_SYMBOLS) && defined (TARGET_ARM)
        MonoArray *res;
@@ -1638,7 +1645,7 @@ mono_handle_exception_internal_first_pass (MonoContext *ctx, MonoObject *obj, gi
                                }
 
                                MonoError isinst_error;
-                               mono_error_init (&isinst_error);
+                               error_init (&isinst_error);
                                if (ei->flags == MONO_EXCEPTION_CLAUSE_NONE && mono_object_isinst_checked (ex_obj, catch_class, &error)) {
                                        setup_stack_trace (mono_ex, dynamic_methods, &trace_ips);
                                        g_slist_free (dynamic_methods);
@@ -1946,7 +1953,7 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu
                                        filter_idx ++;
                                }
 
-                               mono_error_init (&error);
+                               error_init (&error);
                                if ((ei->flags == MONO_EXCEPTION_CLAUSE_NONE && 
                                     mono_object_isinst_checked (ex_obj, catch_class, &error)) || filtered) {
                                        /*
index e29b80e2e30438dd1a0858ebe132864ce5ce008c..65ce24f3afc7bfbbf421b5676ae57c35cb9b48f4 100644 (file)
@@ -870,7 +870,7 @@ class_get_rgctx_template_oti (MonoClass *klass, int type_argc, guint32 slot, gbo
 static gpointer
 class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_type, MonoError *error)
 {
-       mono_error_init (error);
+       error_init (error);
 
        switch (info_type) {
        case MONO_RGCTX_INFO_STATIC_DATA: {
@@ -1538,7 +1538,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
        gpointer data;
        gboolean temporary;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (!oti->data)
                return NULL;
@@ -2320,7 +2320,7 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex
        int rgctx_index;
        gboolean do_free;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (rgctx);
 
@@ -2408,7 +2408,7 @@ mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot,
        MonoRuntimeGenericContext *rgctx;
        gpointer info;
 
-       mono_error_init (error);
+       error_init (error);
 
        mono_domain_lock (domain);
 
index 0e06bf13f89e66c30c8abced81def1968d00d386..e60d80a4ff2dfddda2329ed7005509e5c58b3990 100644 (file)
@@ -3782,7 +3782,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
 {
        MonoJumpInfo *patch_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                unsigned char *ip = patch_info->ip.i + code;
index 563607f8c0fbeb4b48eba4b4103a1c94729623ff..46ddd5085bb8b100760c3482d21b637ded685a06 100644 (file)
@@ -1431,7 +1431,10 @@ sig_to_llvm_sig_full (EmitContext *ctx, MonoMethodSignature *sig, LLVMCallInfo *
                        pindex ++;
                        break;
                case LLVMArgAsIArgs:
-                       param_types [pindex] = LLVMArrayType (IntPtrType (), ainfo->nslots);
+                       if (ainfo->esize == 8)
+                               param_types [pindex] = LLVMArrayType (LLVMInt64Type (), ainfo->nslots);
+                       else
+                               param_types [pindex] = LLVMArrayType (IntPtrType (), ainfo->nslots);
                        pindex ++;
                        break;
                case LLVMArgVtypeByRef:
@@ -3490,7 +3493,10 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref,
                }
                case LLVMArgAsIArgs:
                        g_assert (addresses [reg]);
-                       args [pindex] = LLVMBuildLoad (ctx->builder, convert (ctx, addresses [reg], LLVMPointerType (LLVMArrayType (IntPtrType (), ainfo->nslots), 0)), "");
+                       if (ainfo->esize == 8)
+                               args [pindex] = LLVMBuildLoad (ctx->builder, convert (ctx, addresses [reg], LLVMPointerType (LLVMArrayType (LLVMInt64Type (), ainfo->nslots), 0)), "");
+                       else
+                               args [pindex] = LLVMBuildLoad (ctx->builder, convert (ctx, addresses [reg], LLVMPointerType (LLVMArrayType (IntPtrType (), ainfo->nslots), 0)), "");
                        break;
                case LLVMArgVtypeAsScalar:
                        g_assert_not_reached ();
@@ -9110,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
@@ -9128,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 4742555d85146fa8b91faa741713483fbc558cc6..4eecb95e25bc1ed7e6ddbc5def91439dbaf392ed 100644 (file)
@@ -4539,7 +4539,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
 {
        MonoJumpInfo *patch_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                unsigned char *ip = patch_info->ip.i + code;
index c65def26bab13a97247661a99e8be0b98ef2397d..bccd97d16a30f26b935ece4bae2b85f8d19c0c69 100644 (file)
@@ -1396,9 +1396,7 @@ MINI_OP(OP_ARM64_CBNZX, "arm64_cbnzx", NONE, IREG, NONE)
 #endif
 
 /* Same as OUTARG_VT, but has a dreg */
-#ifdef ENABLE_LLVM
 MINI_OP(OP_LLVM_OUTARG_VT,     "llvm_outarg_vt", IREG, VREG, NONE)
-#endif
 
 MINI_OP(OP_OBJC_GET_SELECTOR, "objc_get_selector", IREG, NONE, NONE)
 
index e59f98caccaeed539af8d22b88aec85ebd659829..4af328dc5d7d466360d306afcd293ac7b7011127 100644 (file)
@@ -4689,7 +4689,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
        MonoJumpInfo *patch_info;
        gboolean compile_aot = !run_cctors;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                unsigned char *ip = patch_info->ip.i + code;
index ece3233935909c31244c455544e7dea8776d227f..9336b94f2d2bcc0f5935fa09163f6f5bfb9e0098 100644 (file)
@@ -66,6 +66,7 @@
 #include <mono/utils/mono-threads-coop.h>
 #include <mono/utils/checked-build.h>
 #include <mono/metadata/w32handle.h>
+#include <mono/metadata/threadpool.h>
 
 #include "mini.h"
 #include "seq-points.h"
@@ -90,7 +91,7 @@
 #endif
 
 #ifdef ENABLE_INTERPRETER
-#include "interpreter/interp.h"
+#include "interp/interp.h"
 #endif
 
 static guint32 default_opt = 0;
@@ -1288,7 +1289,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
        unsigned char *ip = patch_info->ip.i + code;
        gconstpointer target = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        switch (patch_info->type) {
        case MONO_PATCH_INFO_BB:
@@ -1769,7 +1770,7 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *er
        MonoJitICallInfo *callinfo = NULL;
        WrapperInfo *winfo = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
 #ifdef ENABLE_INTERPRETER
        if (mono_use_interpreter)
@@ -2277,7 +2278,7 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void
        gpointer *param_refs;
        int i, pindex;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (info->gsharedvt_invoke);
 
@@ -2366,7 +2367,7 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
                return mono_interp_runtime_invoke (method, obj, params, exc, error);
 #endif
 
-       mono_error_init (error);
+       error_init (error);
 
        if (obj == NULL && !(method->flags & METHOD_ATTRIBUTE_STATIC) && !method->string_ctor && (method->wrapper_type == 0)) {
                g_warning ("Ignoring invocation of an instance method on a NULL instance.\n");
@@ -2907,7 +2908,7 @@ mono_jit_create_remoting_trampoline (MonoDomain *domain, MonoMethod *method, Mon
        MonoMethod *nm;
        guint8 *addr = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && mono_method_signature (method)->generic_param_count) {
                return mono_create_specific_trampoline (method, MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING,
@@ -3047,6 +3048,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*
@@ -4110,6 +4115,8 @@ mini_cleanup (MonoDomain *domain)
        mono_runtime_cleanup (domain);
 #endif
 
+       mono_threadpool_cleanup ();
+
        mono_profiler_shutdown ();
 
        free_jit_tls_data ((MonoJitTlsData *)mono_tls_get_jit_tls ());
index 419c4bf51b5919157d3d81dfc0254ba74ba86679..d6e6bc42408637a697f6038972fcef2da6389e78 100644 (file)
@@ -5429,7 +5429,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
 {
        MonoJumpInfo *patch_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                unsigned char *ip = patch_info->ip.i + code;
index d02988845ae3019dd65b70e4586a3f8ca16a1a7e..88fd22fe9362301c02d7a969cfdd4a1e89f0e3ea 100644 (file)
@@ -3682,7 +3682,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
 {
        MonoJumpInfo *patch_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        /* FIXME: Move part of this to arch independent code */
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
index 7506b5ce80794164011318f39c951e60605844dd..92abc196e803e233adfa61969d631d8952492a9e 100644 (file)
@@ -167,7 +167,7 @@ mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_
 
        g_assert (imt_slot < MONO_IMT_SIZE);
 
-       mono_error_init (error);
+       error_init (error);
        /* This has to be variance aware since imt_method can be from an interface that vt->klass doesn't directly implement */
        interface_offset = mono_class_interface_offset_with_variance (vt->klass, imt_method->klass, &variance_used);
        if (interface_offset < 0)
@@ -523,7 +523,7 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
        gpointer *orig_vtable_slot, *vtable_slot_to_patch = NULL;
        MonoJitInfo *ji = NULL;
 
-       mono_error_init (error);
+       error_init (error);
 
        virtual_ = vt && (gpointer)vtable_slot > (gpointer)vt;
        imt_call = vt && (gpointer)vtable_slot < (gpointer)vt;
@@ -1133,7 +1133,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
                if (!is_remote) {
                        sig = tramp_info->sig;
                        if (!(sig && method == tramp_info->method)) {
-                               mono_error_init (&err);
+                               error_init (&err);
                                sig = mono_method_signature_checked (method, &err);
                                if (!sig) {
                                        mono_error_set_pending_exception (&err);
@@ -1167,7 +1167,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
        if (method) {
                sig = tramp_info->sig;
                if (!(sig && method == tramp_info->method)) {
-                       mono_error_init (&err);
+                       error_init (&err);
                        sig = mono_method_signature_checked (method, &err);
                        if (!sig) {
                                mono_error_set_pending_exception (&err);
@@ -1457,7 +1457,7 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad
        gpointer code;
        guint32 code_size = 0;
 
-       mono_error_init (error);
+       error_init (error);
 
        code = mono_jit_find_compiled_method_with_jit_info (domain, method, &ji);
        /*
@@ -1515,7 +1515,7 @@ mono_create_jit_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *e
 {
        gpointer tramp;
 
-       mono_error_init (error);
+       error_init (error);
 
        if (mono_aot_only) {
                if (mono_llvm_only && method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
@@ -1609,7 +1609,7 @@ mono_create_delegate_trampoline_info (MonoDomain *domain, MonoClass *klass, Mono
        tramp_info->impl_nothis = mono_arch_get_delegate_invoke_impl (mono_method_signature (invoke), FALSE);
        tramp_info->method = method;
        if (method) {
-               mono_error_init (&error);
+               error_init (&error);
                tramp_info->sig = mono_method_signature_checked (method, &error);
                tramp_info->need_rgctx_tramp = mono_method_needs_static_rgctx_invoke (method, FALSE);
        }
@@ -1636,7 +1636,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 35d0eadf8be064d959bd344dbf391e162a994e2c..807cd5dd470cf7a2c230ede0b523020e1131d380 100644 (file)
@@ -3236,7 +3236,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
 
        if (cfg->gen_seq_points)
                cfg->seq_points = g_ptr_array_new ();
-       mono_error_init (&cfg->error);
+       error_init (&cfg->error);
 
        if (cfg->compile_aot && !try_generic_shared && (method->is_generic || mono_class_is_gtd (method->klass) || method_is_gshared)) {
                cfg->exception_type = MONO_EXCEPTION_GENERIC_SHARING_FAILED;
@@ -3278,7 +3278,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        }
        cfg->method_to_register = method_to_register;
 
-       mono_error_init (&err);
+       error_init (&err);
        sig = mono_method_signature_checked (cfg->method, &err);        
        if (!sig) {
                cfg->exception_type = MONO_EXCEPTION_TYPE_LOAD;
@@ -4066,7 +4066,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
        GTimer *jit_timer;
        MonoMethod *prof_method, *shared;
 
-       mono_error_init (error);
+       error_init (error);
 
        if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
            (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
index d55825ed383013e36b052235d3fdc49848cd78db..d8e9f9ca547311b597c6fa42f6a1e599a26ec0b4 100644 (file)
@@ -826,7 +826,7 @@ typedef struct {
         * in the structure.
         */
        int nslots;
-       /* Only if storage == LLVMArgAsFpArgs/LLVMArgFpStruct (4/8) */
+       /* Only if storage == LLVMArgAsIArgs/LLVMArgAsFpArgs/LLVMArgFpStruct (4/8) */
        int esize;
        /* Parameter index in the LLVM signature */
        int pindex;
@@ -2085,12 +2085,6 @@ typedef struct {
        int type;
 } StackSlot;
 
-#if HAVE_ARRAY_ELEM_INIT
-extern const guint8 mono_burg_arity [];
-#else
-extern guint8 mono_burg_arity [];
-#endif
-
 extern const char MONO_ARCH_CPU_SPEC [];
 #define MONO_ARCH_CPU_SPEC_IDX_COMBINE(a) a ## _idx
 #define MONO_ARCH_CPU_SPEC_IDX(a) MONO_ARCH_CPU_SPEC_IDX_COMBINE(a)
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 a0294d7dd462a2db2c3efcfee3057d053844ab27..623783262034c2a9d18540b85dedffb41ef139a4 100644 (file)
@@ -223,6 +223,8 @@ mono_save_seq_point_info (MonoCompile *cfg)
                }
        }
 
+       g_free (seq_points);
+
        if (has_debug_data)
                g_free (next);
 
index b143645fb7d83c9d70d04ac4e9f6d2f9d81b9ded..b2b7a7fc5fd556eb43ea7c2332876cba6446856e 100644 (file)
@@ -982,80 +982,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);
 
+       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));
 
-       x86_patch (leave_tramp, code);
-       amd64_ret (code);
+       label_leave_tramp [1] = code;
+       x86_jump8 (code, 0);
 
 
+
+       /* 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);
 
index 62039f7267901a805e94c8e1fb79c4c7c72a9dca..dc9b091bf6f95262b3dd0bec4a1903c88576e3d7 100644 (file)
@@ -93,6 +93,9 @@ MonoGCDescriptor mono_gc_make_descr_for_array (int vector, gsize *elem_bitmap, i
 /* simple interface for data structures needed in the runtime */
 MonoGCDescriptor mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits);
 
+/* Return a root descriptor for a vector with repeating refs bitmap */
+MonoGCDescriptor mono_gc_make_vector_descr (void);
+
 /* Return a root descriptor for a root with all refs */
 MonoGCDescriptor mono_gc_make_root_descr_all_refs (int numbits);
 
index cf89aedad4f5f7e10c46216141c0bc81ae4d8a9a..0138669a78897f120a97561e8f96b22edb5cfa57 100644 (file)
@@ -412,6 +412,7 @@ sgen_card_table_clear_cards (void)
        /*XXX we could do this in 2 ways. using mincore or iterating over all sections/los objects */
        sgen_major_collector_iterate_block_ranges (clear_cards);
        sgen_los_iterate_live_block_ranges (clear_cards);
+       sgen_wbroots_iterate_live_block_ranges (clear_cards);
 }
 
 static void
@@ -433,6 +434,7 @@ sgen_card_table_scan_remsets (ScanCopyContext ctx)
        /*First we copy*/
        sgen_major_collector_iterate_block_ranges (move_cards_to_shadow_table);
        sgen_los_iterate_live_block_ranges (move_cards_to_shadow_table);
+       sgen_wbroots_iterate_live_block_ranges (move_cards_to_shadow_table);
 
        /*Then we clear*/
        sgen_card_table_clear_cards ();
@@ -446,6 +448,8 @@ sgen_card_table_scan_remsets (ScanCopyContext ctx)
        SGEN_TV_GETTIME (atv);
        last_los_scan_time = SGEN_TV_ELAPSED (btv, atv);
        los_card_scan_time += last_los_scan_time;
+
+       sgen_wbroots_scan_card_table (ctx);
 }
 
 guint8*
@@ -488,6 +492,67 @@ sgen_card_table_dump_obj_card (GCObject *object, size_t size, void *dummy)
 }
 #endif
 
+/*
+ * Cardtable scanning
+ */
+
+#define MWORD_MASK (sizeof (mword) - 1)
+
+static inline int
+find_card_offset (mword card)
+{
+/*XXX Use assembly as this generates some pretty bad code */
+#if (defined(__i386__) || defined(__arm__)) && defined(__GNUC__)
+       return  (__builtin_ffs (card) - 1) / 8;
+#elif (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__)
+       return (__builtin_ffsll (card) - 1) / 8;
+#elif defined(__s390x__)
+       return (__builtin_ffsll (GUINT64_TO_LE(card)) - 1) / 8;
+#else
+       int i;
+       guint8 *ptr = (guint8 *) &card;
+       for (i = 0; i < sizeof (mword); ++i) {
+               if (ptr[i])
+                       return i;
+       }
+       return 0;
+#endif
+}
+
+guint8*
+sgen_find_next_card (guint8 *card_data, guint8 *end)
+{
+       mword *cards, *cards_end;
+       mword card;
+
+       while ((((mword)card_data) & MWORD_MASK) && card_data < end) {
+               if (*card_data)
+                       return card_data;
+               ++card_data;
+       }
+
+       if (card_data == end)
+               return end;
+
+       cards = (mword*)card_data;
+       cards_end = (mword*)((mword)end & ~MWORD_MASK);
+       while (cards < cards_end) {
+               card = *cards;
+               if (card)
+                       return (guint8*)cards + find_card_offset (card);
+               ++cards;
+       }
+
+       card_data = (guint8*)cards_end;
+       while (card_data < end) {
+               if (*card_data)
+                       return card_data;
+               ++card_data;
+       }
+
+       return end;
+}
+
 void
 sgen_cardtable_scan_object (GCObject *obj, mword block_obj_size, guint8 *cards, ScanCopyContext ctx)
 {
index 059fb77fa64925d61f73ff1311c1f7b979b7343e..a4fa1e32b6e91b2be1b3f281c21172bdbed6744c 100644 (file)
@@ -9,6 +9,7 @@
 
 /*WARNING: This function returns the number of cards regardless of overflow in case of overlapping cards.*/
 mword sgen_card_table_number_of_cards_in_range (mword address, mword size);
+guint8* sgen_find_next_card (guint8 *card_data, guint8 *end);
 
 void sgen_card_table_reset_region (mword start, mword end);
 void* sgen_card_table_align_pointer (void *ptr);
index 195894f8cbf1eecfa6997df325edc00fd9caf643..a78fb3dad57e7b8d3d3d31671ba54a5d24a13f05 100644 (file)
@@ -804,6 +804,15 @@ scan_roots_for_specific_ref (GCObject *key, int root_type)
                        }
                        break;
                }
+               case ROOT_DESC_VECTOR: {
+                       void **p;
+
+                       for (p = start_root; p < (void**)root->end_root; p++) {
+                               if (*p)
+                                       check_root_obj_specific_ref (root, key, (GCObject *)*p);
+                       }
+                       break;
+               }
                case ROOT_DESC_USER: {
                        SgenUserRootMarkFunc marker = sgen_get_user_descriptor_func (desc);
                        marker (start_root, check_root_obj_specific_ref_from_marker, NULL);
@@ -908,6 +917,15 @@ sgen_scan_for_registered_roots_in_domain (MonoDomain *domain, int root_type)
                        }
                        break;
                }
+               case ROOT_DESC_VECTOR: {
+                       void **p;
+
+                       for (p = start_root; p < (void**)root->end_root; p++) {
+                               if (*p)
+                                       check_obj_not_in_domain ((MonoObject **)*p);
+                       }
+                       break;
+               }
                case ROOT_DESC_USER: {
                        SgenUserRootMarkFunc marker = sgen_get_user_descriptor_func (desc);
                        marker (start_root, check_obj_not_in_domain_callback, NULL);
index 248b07b8f50fff935da561c90488a52af682ac17..f358c9da42977d736172a2d3fe15b8798ecf6970 100644 (file)
@@ -275,6 +275,12 @@ mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits)
        }
 }
 
+SgenDescriptor
+mono_gc_make_vector_descr (void)
+{
+       return MAKE_ROOT_DESC (ROOT_DESC_VECTOR, 0);
+}
+
 SgenDescriptor
 mono_gc_make_root_descr_all_refs (int numbits)
 {
index 54e1b7681fbe3fbb48a3c5385888b8b0d3567922..e072ca45d3267c1e21108f9eaafd7d33c0a62767 100644 (file)
@@ -114,6 +114,7 @@ enum {
        ROOT_DESC_BITMAP,
        ROOT_DESC_RUN_LEN, 
        ROOT_DESC_COMPLEX,
+       ROOT_DESC_VECTOR,
        ROOT_DESC_USER,
        ROOT_DESC_TYPE_MASK = 0x7,
        ROOT_DESC_TYPE_SHIFT = 3,
index 7c02172c6ee188b91fd9ded6a42c49a6d24d70a7..ec27de4224b9520a93998439738af18de6bbf08d 100644 (file)
@@ -858,6 +858,7 @@ static void
 precisely_scan_objects_from (void** start_root, void** end_root, char* n_start, char *n_end, SgenDescriptor desc, ScanCopyContext ctx)
 {
        CopyOrMarkObjectFunc copy_func = ctx.ops->copy_or_mark_object;
+       ScanPtrFieldFunc scan_field_func = ctx.ops->scan_ptr_field;
        SgenGrayQueue *queue = ctx.queue;
 
        switch (desc & ROOT_DESC_TYPE_MASK) {
@@ -892,6 +893,15 @@ precisely_scan_objects_from (void** start_root, void** end_root, char* n_start,
                }
                break;
        }
+       case ROOT_DESC_VECTOR: {
+               void **p;
+
+               for (p = start_root; p < end_root; p++) {
+                       if (*p)
+                               scan_field_func (NULL, (GCObject**)p, queue);
+               }
+               break;
+       }
        case ROOT_DESC_USER: {
                SgenUserRootMarkFunc marker = sgen_get_user_descriptor_func (desc);
                marker (start_root, single_arg_user_copy_or_mark, &ctx);
@@ -1481,13 +1491,16 @@ enqueue_scan_from_roots_jobs (SgenGrayQueue *gc_thread_gray_queue, char *heap_st
        scrrj->root_type = ROOT_TYPE_NORMAL;
        sgen_workers_enqueue_job (&scrrj->scan_job.job, enqueue);
 
-       scrrj = (ScanFromRegisteredRootsJob*)sgen_thread_pool_job_alloc ("scan from registered roots wbarrier", job_scan_from_registered_roots, sizeof (ScanFromRegisteredRootsJob));
-       scrrj->scan_job.ops = ops;
-       scrrj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
-       scrrj->heap_start = heap_start;
-       scrrj->heap_end = heap_end;
-       scrrj->root_type = ROOT_TYPE_WBARRIER;
-       sgen_workers_enqueue_job (&scrrj->scan_job.job, enqueue);
+       if (current_collection_generation == GENERATION_OLD) {
+               /* During minors we scan the cardtable for these roots instead */
+               scrrj = (ScanFromRegisteredRootsJob*)sgen_thread_pool_job_alloc ("scan from registered roots wbarrier", job_scan_from_registered_roots, sizeof (ScanFromRegisteredRootsJob));
+               scrrj->scan_job.ops = ops;
+               scrrj->scan_job.gc_thread_gray_queue = gc_thread_gray_queue;
+               scrrj->heap_start = heap_start;
+               scrrj->heap_end = heap_end;
+               scrrj->root_type = ROOT_TYPE_WBARRIER;
+               sgen_workers_enqueue_job (&scrrj->scan_job.job, enqueue);
+       }
 
        /* Threads */
 
@@ -2599,6 +2612,94 @@ sgen_deregister_root (char* addr)
        UNLOCK_GC;
 }
 
+void
+sgen_wbroots_iterate_live_block_ranges (sgen_cardtable_block_callback cb)
+{
+       void **start_root;
+       RootRecord *root;
+       SGEN_HASH_TABLE_FOREACH (&roots_hash [ROOT_TYPE_WBARRIER], void **, start_root, RootRecord *, root) {
+               cb ((mword)start_root, (mword)root->end_root - (mword)start_root);
+       } SGEN_HASH_TABLE_FOREACH_END;
+}
+
+/* Root equivalent of sgen_client_cardtable_scan_object */
+static void
+sgen_wbroot_scan_card_table (void** start_root, mword size,  ScanCopyContext ctx)
+{
+       ScanPtrFieldFunc scan_field_func = ctx.ops->scan_ptr_field;
+       guint8 *card_data = sgen_card_table_get_card_scan_address ((mword)start_root);
+       guint8 *card_base = card_data;
+       mword card_count = sgen_card_table_number_of_cards_in_range ((mword)start_root, size);
+       guint8 *card_data_end = card_data + card_count;
+       mword extra_idx = 0;
+       char *obj_start = sgen_card_table_align_pointer (start_root);
+       char *obj_end = (char*)start_root + size;
+#ifdef SGEN_HAVE_OVERLAPPING_CARDS
+       guint8 *overflow_scan_end = NULL;
+#endif
+
+#ifdef SGEN_HAVE_OVERLAPPING_CARDS
+       /*Check for overflow and if so, setup to scan in two steps*/
+       if (card_data_end >= SGEN_SHADOW_CARDTABLE_END) {
+               overflow_scan_end = sgen_shadow_cardtable + (card_data_end - SGEN_SHADOW_CARDTABLE_END);
+               card_data_end = SGEN_SHADOW_CARDTABLE_END;
+       }
+
+LOOP_HEAD:
+#endif
+
+       card_data = sgen_find_next_card (card_data, card_data_end);
+
+       for (; card_data < card_data_end; card_data = sgen_find_next_card (card_data + 1, card_data_end)) {
+               size_t idx = (card_data - card_base) + extra_idx;
+               char *start = (char*)(obj_start + idx * CARD_SIZE_IN_BYTES);
+               char *card_end = start + CARD_SIZE_IN_BYTES;
+               char *elem = start, *first_elem = start;
+
+               /*
+                * Don't clean first and last card on 32bit systems since they
+                * may also be part from other roots.
+                */
+               if (card_data != card_base && card_data != (card_data_end - 1))
+                       sgen_card_table_prepare_card_for_scanning (card_data);
+
+               card_end = MIN (card_end, obj_end);
+
+               if (elem < (char*)start_root)
+                       first_elem = elem = (char*)start_root;
+
+               for (; elem < card_end; elem += SIZEOF_VOID_P) {
+                       if (*(GCObject**)elem)
+                               scan_field_func (NULL, (GCObject**)elem, ctx.queue);
+               }
+
+               binary_protocol_card_scan (first_elem, elem - first_elem);
+       }
+
+#ifdef SGEN_HAVE_OVERLAPPING_CARDS
+       if (overflow_scan_end) {
+               extra_idx = card_data - card_base;
+               card_base = card_data = sgen_shadow_cardtable;
+               card_data_end = overflow_scan_end;
+               overflow_scan_end = NULL;
+               goto LOOP_HEAD;
+       }
+#endif
+}
+
+void
+sgen_wbroots_scan_card_table (ScanCopyContext ctx)
+{
+       void **start_root;
+       RootRecord *root;
+
+       SGEN_HASH_TABLE_FOREACH (&roots_hash [ROOT_TYPE_WBARRIER], void **, start_root, RootRecord *, root) {
+               SGEN_ASSERT (0, (root->root_desc & ROOT_DESC_TYPE_MASK) == ROOT_DESC_VECTOR, "Unsupported root type");
+
+               sgen_wbroot_scan_card_table (start_root, (mword)root->end_root - (mword)start_root, ctx);
+       } SGEN_HASH_TABLE_FOREACH_END;
+}
+
 /*
  * ######################################################################
  * ########  Thread handling (stop/start code)
index ba7aee729406a55f2ae6bde264d7219e9e349620..a89a5471dd729c563d09721fcd4a5bd9ccdadf68 100644 (file)
@@ -832,6 +832,9 @@ void sgen_finalize_if (SgenObjectPredicateFunc predicate, void *user_data);
 void sgen_remove_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, int generation);
 void sgen_set_suspend_finalizers (void);
 
+void sgen_wbroots_iterate_live_block_ranges (sgen_cardtable_block_callback cb);
+void sgen_wbroots_scan_card_table (ScanCopyContext ctx);
+
 void sgen_register_disappearing_link (GCObject *obj, void **link, gboolean track, gboolean in_gc);
 
 GCObject* sgen_weak_link_get (void **link_addr);
index 6eb4d266fdc16d423a5ef48398c1cb7dec3e2a59..98d8917593cd385d6f77c5bdfed4facb5e96ef63 100644 (file)
@@ -240,7 +240,7 @@ SCAN_OBJECT_FUNCTION_NAME (GCObject *full_object, SgenDescriptor desc, SgenGrayQ
                GCObject *__old = *(ptr);                               \
                binary_protocol_scan_process_reference ((full_object), (ptr), __old); \
                if (__old && !sgen_ptr_in_nursery (__old)) {            \
-                       if (G_UNLIKELY (!sgen_ptr_in_nursery (ptr) &&   \
+                       if (G_UNLIKELY (full_object && !sgen_ptr_in_nursery (ptr) && \
                                        sgen_safe_object_is_small (__old, sgen_obj_get_descriptor (__old) & DESC_TYPE_MASK) && \
                                        major_block_is_evacuating (MS_BLOCK_FOR_OBJ (__old)))) { \
                                mark_mod_union_card ((full_object), (void**)(ptr), __old); \
@@ -249,7 +249,7 @@ SCAN_OBJECT_FUNCTION_NAME (GCObject *full_object, SgenDescriptor desc, SgenGrayQ
                                COPY_OR_MARK_FUNCTION_NAME ((ptr), __old, queue); \
                        }                                               \
                } else {                                                \
-                       if (G_UNLIKELY (sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)) && !sgen_cement_is_forced (__old))) \
+                       if (G_UNLIKELY (full_object && sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)) && !sgen_cement_is_forced (__old))) \
                                mark_mod_union_card ((full_object), (void**)(ptr), __old); \
                        }                                               \
                } while (0)
@@ -261,7 +261,7 @@ SCAN_OBJECT_FUNCTION_NAME (GCObject *full_object, SgenDescriptor desc, SgenGrayQ
                        PREFETCH_READ (__old);                  \
                        COPY_OR_MARK_FUNCTION_NAME ((ptr), __old, queue); \
                } else {                                                \
-                       if (G_UNLIKELY (sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)) && !sgen_cement_is_forced (__old))) \
+                       if (G_UNLIKELY (full_object && sgen_ptr_in_nursery (__old) && !sgen_ptr_in_nursery ((ptr)) && !sgen_cement_is_forced (__old))) \
                                mark_mod_union_card ((full_object), (void**)(ptr), __old); \
                        }                                               \
                } while (0)
@@ -310,6 +310,12 @@ SCAN_VTYPE_FUNCTION_NAME (GCObject *full_object, char *start, SgenDescriptor des
 static void
 SCAN_PTR_FIELD_FUNCTION_NAME (GCObject *full_object, GCObject **ptr, SgenGrayQueue *queue)
 {
+       /*
+        * full_object is NULL if we scan unmanaged memory. This means we can't mark
+        * mod unions for it, so these types of roots currently don't have support
+        * for the concurrent collector (aka they need to be scanned as normal roots
+        * both in the start and finishing pause)
+        */
        HANDLE_PTR (ptr, NULL);
 }
 #endif
index b280749a46a3dd8f9d045cd6de5e6ae7ee4a7e16..5c4ec06a9ebda9b21afd80477086a42fe303ba00 100644 (file)
@@ -2809,6 +2809,7 @@ sgen_marksweep_init_internal (SgenMajorCollector *collector, gboolean is_concurr
 
        collector->major_ops_serial.copy_or_mark_object = major_copy_or_mark_object_canonical;
        collector->major_ops_serial.scan_object = major_scan_object_with_evacuation;
+       collector->major_ops_serial.scan_ptr_field = major_scan_ptr_field_with_evacuation;
        collector->major_ops_serial.drain_gray_stack = drain_gray_stack;
        if (is_concurrent) {
                collector->major_ops_concurrent_start.copy_or_mark_object = major_copy_or_mark_object_concurrent_canonical;
index cc1930bcc2f443a65b4c536208051e89a119e94f..77c9413ac6c9a540283f3947a9a0a7b177968888 100644 (file)
@@ -330,7 +330,9 @@ marker_idle_func (void *data_untyped)
                if (data->private_gray_queue.num_sections > 16 && workers_finished && worker_awakenings < active_workers_num) {
                        /* We bound the number of worker awakenings just to be sure */
                        worker_awakenings++;
+                       mono_os_mutex_lock (&finished_lock);
                        sgen_workers_ensure_awake ();
+                       mono_os_mutex_unlock (&finished_lock);
                }
        } else {
                worker_try_finish (data);
@@ -424,7 +426,13 @@ sgen_workers_start_all_workers (SgenObjectOperations *object_ops_nopar, SgenObje
        worker_awakenings = 0;
        mono_memory_write_barrier ();
 
+       /*
+        * We expect workers to start finishing only after all of them were awaken.
+        * Otherwise we might think that we have fewer workers and use wrong context.
+        */
+       mono_os_mutex_lock (&finished_lock);
        sgen_workers_ensure_awake ();
+       mono_os_mutex_unlock (&finished_lock);
 }
 
 void
index 58ca018ac9b8d426153dd6b2067a9c288f337cf5..5062f48d39cd0e7ec57f13591b9602ba0a40a7e4 100644 (file)
@@ -65,10 +65,14 @@ MCS = $(MCS_NO_LIB) -lib:$(CLASS)
 
 ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe
 
-if FULL_AOT_TESTS
-TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
-else
 TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)"
+
+if FULL_AOT_TESTS
+TEST_RUNNER += --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
+endif
+
+if HYBRID_AOT_TESTS
+TEST_RUNNER += --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)"
 endif
 
 
@@ -930,16 +934,18 @@ EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
        $(ILASM) -out:$@ $<
 
 if !FULL_AOT_TESTS
-if !HYBRID_AOT_TESTS
 TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
 endif
-endif
 
 if FULL_AOT_TESTS
 TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
 else
+if HYBRID_AOT_TESTS
+TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
+else
 TEST_DRIVER_DEPEND=TestDriver.dll
 endif
+endif
 
 %.exe: %.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:$@ $<
@@ -995,8 +1001,12 @@ bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
 if FULL_AOT_TESTS
 prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
 else
+if HYBRID_AOT_TESTS
+prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+else
 prereqs: $(PREREQSI_IL) $(PREREQSI_CS)
 endif
+endif
 
 # Target to precompile the test executables
 tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la prereqs $(GSHARED_TESTS)
@@ -1040,6 +1050,9 @@ compile-tests:
 if FULL_AOT_TESTS
        $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
 endif
+if HYBRID_AOT_TESTS
+       $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+endif
 
 # Remove empty .stdout and .stderr files for wrench
 rm-empty-logs:
@@ -1462,6 +1475,9 @@ test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 test-inline-call-stack.exe: $(TEST_DRIVER_DEPEND) test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
        $(MCS) -r:TestDriver.dll -r:test-inline-call-stack-library.dll -out:test-inline-call-stack.exe $(srcdir)/test-inline-call-stack.cs
@@ -1509,6 +1525,9 @@ bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-8167
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-36848-a.cs
 bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
@@ -1518,6 +1537,9 @@ bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += bug-81691-a.cs bug-81691-b.cs
 bug-81691.exe bug-81691-b.dll: $(srcdir)/bug-81691.cs $(srcdir)/bug-81691-a.cs $(srcdir)/bug-81691-b.cs
@@ -1533,6 +1555,9 @@ bug-81466-lib.dll: bug-81466-lib.il
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-81466.exe: bug-81466.il bug-81466-lib.dll
        $(ILASM) /exe /output:bug-81466.exe $(srcdir)/bug-81466.il
 
@@ -1542,6 +1567,9 @@ bug-324535-il.dll : bug-324535-il.il
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 bug-324535.exe : bug-324535.cs bug-324535-il.dll
        $(MCS) -r:bug-324535-il.dll -out:bug-324535.exe $(srcdir)/bug-324535.cs
 
@@ -1551,6 +1579,9 @@ custom-modifiers-lib.dll: custom-modifiers-lib.il
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll
        $(MCS) -r:custom-modifiers-lib.dll -out:custom-modifiers.2.exe $(srcdir)/custom-modifiers.2.cs
 
@@ -1560,6 +1591,9 @@ bug-382986-lib.dll: bug-382986-lib.cs
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 bug-382986.exe: bug-382986.cs bug-382986-lib.dll
        $(MCS) -out:$@ -r:bug-382986-lib.dll $(srcdir)/bug-382986.cs
@@ -1587,6 +1621,9 @@ generic-unboxing.2.dll : generic-unboxing.2.il
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-boxing.2.il
 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
@@ -1594,6 +1631,9 @@ generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-unbox.2.cs
 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
@@ -1609,6 +1649,9 @@ generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
 if FULL_AOT_TESTS
        $(RUNTIME) $(AOT_BUILD_FLAGS) $@
 endif
+if HYBRID_AOT_TESTS
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 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
 
@@ -1763,7 +1806,8 @@ UNHANDLED_EXCEPTION_255_TESTS =   \
        unhandled-exception-4.exe       \
        unhandled-exception-5.exe       \
        unhandled-exception-6.exe       \
-       unhandled-exception-7.exe
+       unhandled-exception-7.exe       \
+       unhandled-exception-8.exe
 
 test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION_255_TESTS)
        $(MAKE) test-unhandled-exception-2-1-with-managed-handler
diff --git a/mono/tests/unhandled-exception-8.cs b/mono/tests/unhandled-exception-8.cs
new file mode 100644 (file)
index 0000000..7b4de0e
--- /dev/null
@@ -0,0 +1,24 @@
+
+using System;
+using System.Threading;
+
+class CustomException : Exception
+{
+}
+
+class Driver
+{
+       /* expected exit code: 255 */
+       public static void Main ()
+       {
+               if (Environment.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
+                       AppDomain.CurrentDomain.UnhandledException += (s, e) => {};
+
+               ManualResetEvent mre = new ManualResetEvent(false);
+
+               ThreadPool.RegisterWaitForSingleObject (mre, (state, timedOut) => { throw new CustomException (); }, null, -1, true);
+               mre.Set();
+
+               Thread.Sleep (5000);
+       }
+}
\ No newline at end of file
index 25dd54a92576e995e679a27356d15ee6c9f19bea..ccad6f00ddb385a62e48f1cd831f690a00a11a6a 100755 (executable)
@@ -3414,7 +3414,7 @@ done
 
 ./make_exception_overlap_test.sh exception_entry_overlap_try_over_filter invalid ".try TRY_BLOCK_1 to FILTER_BLOCK_3_A filter FILTER_BLOCK_3 handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END" "yes"
 
-#blocks start in the middle of an intruction
+#blocks start in the middle of an instruction
 ./make_exception_overlap_test.sh try_block_start_in_the_middle_of_a_instruction invalid ".try AFTER_PREFIX_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler CATCH_BLOCK_1 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
 
 ./make_exception_overlap_test.sh catch_block_start_in_the_middle_of_a_instruction invalid ".try TRY_BLOCK_1 to TRY_BLOCK_1_END catch [mscorlib]System.Exception handler AFTER_PREFIX_2 to CATCH_BLOCK_1_END" ".try TRY_BLOCK_2 to TRY_BLOCK_2_END catch [mscorlib]System.Exception handler CATCH_BLOCK_2 to CATCH_BLOCK_2_END"
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 9b92493191ed1a08bad915c7ab7df8ecd6a5fcb5..9f5fd6addb19608c19acb1a7549eecf7000af369 100644 (file)
@@ -114,7 +114,7 @@ mono_conc_hashtable_new (GHashFunc hash_func, GEqualFunc key_equal_func)
 {
        MonoConcurrentHashTable *res = g_new0 (MonoConcurrentHashTable, 1);
        res->hash_func = hash_func ? hash_func : g_direct_hash;
-       res->equal_func = key_equal_func ? key_equal_func : g_direct_equal;
+       res->equal_func = key_equal_func;
        // res->equal_func = g_direct_equal;
        res->table = conc_table_new (INITIAL_SIZE);
        res->element_count = 0;
index 0d474ecf4846becdedd68426408764a71d304e09..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
@@ -139,7 +146,8 @@ typedef struct {
                 }                                                                                                                              \
        } while (0)
 #else
-#define MONO_CONTEXT_GET_CURRENT(ctx) \
+
+#define MONO_CONTEXT_GET_CURRENT_GREGS(ctx) \
        __asm__ __volatile__(   \
        "movl $0x0, %c[eax](%0)\n" \
        "mov %%ebx, %c[ebx](%0)\n" \
@@ -162,6 +170,40 @@ typedef struct {
                [esi] MONO_CONTEXT_OFFSET (esi, 0, mgreg_t), \
                [edi] MONO_CONTEXT_OFFSET (edi, 0, mgreg_t) \
        : "memory")
+
+#ifdef UCONTEXT_REG_XMM
+#define MONO_CONTEXT_GET_CURRENT_FREGS(ctx) \
+       do { \
+               __asm__ __volatile__ ( \
+                       "movups %%xmm0, %c[xmm0](%0)\n" \
+                       "movups %%xmm1, %c[xmm1](%0)\n" \
+                       "movups %%xmm2, %c[xmm2](%0)\n" \
+                       "movups %%xmm3, %c[xmm3](%0)\n" \
+                       "movups %%xmm4, %c[xmm4](%0)\n" \
+                       "movups %%xmm5, %c[xmm5](%0)\n" \
+                       "movups %%xmm6, %c[xmm6](%0)\n" \
+                       "movups %%xmm7, %c[xmm7](%0)\n" \
+                       : \
+                       : "a" (&(ctx)), \
+                               [xmm0] MONO_CONTEXT_OFFSET (fregs, X86_XMM0, MonoContextSimdReg), \
+                               [xmm1] MONO_CONTEXT_OFFSET (fregs, X86_XMM1, MonoContextSimdReg), \
+                               [xmm2] MONO_CONTEXT_OFFSET (fregs, X86_XMM2, MonoContextSimdReg), \
+                               [xmm3] MONO_CONTEXT_OFFSET (fregs, X86_XMM3, MonoContextSimdReg), \
+                               [xmm4] MONO_CONTEXT_OFFSET (fregs, X86_XMM4, MonoContextSimdReg), \
+                               [xmm5] MONO_CONTEXT_OFFSET (fregs, X86_XMM5, MonoContextSimdReg), \
+                               [xmm6] MONO_CONTEXT_OFFSET (fregs, X86_XMM6, MonoContextSimdReg), \
+                               [xmm7] MONO_CONTEXT_OFFSET (fregs, X86_XMM7, MonoContextSimdReg), \
+       } while (0)
+#else
+#define MONO_CONTEXT_GET_CURRENT_FREGS(ctx)
+#endif
+
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+    do {       \
+               MONO_CONTEXT_GET_CURRENT_GREGS(ctx);    \
+               MONO_CONTEXT_GET_CURRENT_FREGS(ctx);    \
+       } while (0)
+
 #endif
 
 #define MONO_ARCH_HAS_MONO_CONTEXT 1
index 55f84ffd8e8f1de87aab2c64464ebab9d3955ea6..2afe7fae2dee3bd5a00dce04e9399eeefee96668 100644 (file)
@@ -584,7 +584,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
        MonoString *assembly_name = NULL, *type_name = NULL, *method_name = NULL, *field_name = NULL, *msg = NULL;
        MonoDomain *domain = mono_domain_get ();
 
-       mono_error_init (error_out);
+       error_init (error_out);
 
        switch (error->error_code) {
        case MONO_ERROR_NONE:
@@ -780,7 +780,7 @@ void
 mono_error_move (MonoError *dest, MonoError *src)
 {
        memcpy (dest, src, sizeof (MonoErrorInternal));
-       mono_error_init (src);
+       error_init (src);
 }
 
 /**
index fa9caa6759e36bb2cecb619b19822f56e08520e2..88f986c509492da698af9bab26a91a6628e2d889 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _MonoErrorBoxed MonoErrorBoxed;
 
 MONO_BEGIN_DECLS
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API void
 mono_error_init (MonoError *error);
 
index 7deca1275f5f26f39602ad5404a5d061ef5cc94a..046ef46d6b181684b2d86affafbff3d9ce4b1f46 100644 (file)
@@ -52,7 +52,7 @@ enum {
        MONO_LAZY_INIT_STATUS_CLEANED,
 };
 
-static inline void
+static inline gboolean
 mono_lazy_initialize (mono_lazy_init_t *lazy_init, void (*initialize) (void))
 {
        gint32 status;
@@ -62,7 +62,7 @@ mono_lazy_initialize (mono_lazy_init_t *lazy_init, void (*initialize) (void))
        status = *lazy_init;
 
        if (status >= MONO_LAZY_INIT_STATUS_INITIALIZED)
-               return;
+               return status == MONO_LAZY_INIT_STATUS_INITIALIZED;
        if (status == MONO_LAZY_INIT_STATUS_INITIALIZING
             || InterlockedCompareExchange (lazy_init, MONO_LAZY_INIT_STATUS_INITIALIZING, MONO_LAZY_INIT_STATUS_NOT_INITIALIZED)
                 != MONO_LAZY_INIT_STATUS_NOT_INITIALIZED
@@ -70,12 +70,13 @@ mono_lazy_initialize (mono_lazy_init_t *lazy_init, void (*initialize) (void))
                while (*lazy_init == MONO_LAZY_INIT_STATUS_INITIALIZING)
                        mono_thread_info_yield ();
                g_assert (InterlockedRead (lazy_init) >= MONO_LAZY_INIT_STATUS_INITIALIZED);
-               return;
+               return status == MONO_LAZY_INIT_STATUS_INITIALIZED;
        }
 
        initialize ();
 
        mono_atomic_store_release (lazy_init, MONO_LAZY_INIT_STATUS_INITIALIZED);
+       return TRUE;
 }
 
 static inline void
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;
index 97f57cee4ee331024d2088ed9b5b04c53ac151f6..4ac99a8468512c38eefdc5ae76104f0e015f4ad0 100644 (file)
@@ -127,7 +127,7 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon
 {
        MONO_WIN32_CRYPT_PROVIDER_HANDLE provider;
 
-       mono_error_init (error);
+       error_init (error);
 
        g_assert (handle);
        provider = (MONO_WIN32_CRYPT_PROVIDER_HANDLE) *handle;
index 884dc7f1600775ab0a2474b267f835f7ec23739a..a51253c1d86a1baee8fb210a5fcdf4640358443c 100644 (file)
@@ -51,7 +51,7 @@ get_entropy_from_egd (const char *path, guchar *buffer, int buffer_size, MonoErr
        guint offset = 0;
        int err = 0;
 
-       mono_error_init (error);
+       error_init (error);
        
        socket_fd = socket (PF_UNIX, SOCK_STREAM, 0);
        if (socket_fd < 0) {
@@ -155,7 +155,7 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon
 {
        g_assert (handle);
 
-       mono_error_init (error);
+       error_init (error);
 
        if (use_egd) {
                const char *socket_path = g_getenv ("MONO_EGD_SOCKET");
@@ -224,7 +224,7 @@ mono_rand_try_get_bytes (gpointer *handle, guchar *buffer, gint buffer_size, Mon
 {
        gint count = 0;
 
-       mono_error_init (error);
+       error_init (error);
        
        do {
                if (buffer_size - count >= sizeof (gint32) && RAND_MAX >= 0xFFFFFFFF) {
index 7f2748536830157d0179423a510f6c7e21e9b6da..ed6b1807a3a22a97bcba35b62862c27e3a09e670 100644 (file)
@@ -288,6 +288,12 @@ mono_threads_exit_gc_safe_region_unbalanced (gpointer cookie, gpointer *stackdat
        default:
                g_error ("Unknown thread state");
        }
+
+       if (info->async_target) {
+               info->async_target (info->user_data);
+               info->async_target = NULL;
+               info->user_data = NULL;
+       }
 }
 
 void
@@ -355,6 +361,12 @@ mono_threads_enter_gc_unsafe_region_unbalanced_with_info (MonoThreadInfo *info,
                g_error ("Unknown thread state");
        }
 
+       if (info->async_target) {
+               info->async_target (info->user_data);
+               info->async_target = NULL;
+               info->user_data = NULL;
+       }
+
        return info;
 }
 
diff --git a/mono/utils/mono-threads-haiku.c b/mono/utils/mono-threads-haiku.c
new file mode 100644 (file)
index 0000000..231ff3b
--- /dev/null
@@ -0,0 +1,25 @@
+#include <config.h>
+
+#if defined(__HAIKU__)
+
+#include <mono/utils/mono-threads.h>
+#include <pthread.h>
+#include <os/kernel/OS.h>
+
+void
+mono_threads_platform_reset_priority(pthread_attr_t *attr)
+{
+       /* FIXME: Implement this on Haiku */
+}
+
+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 dcb7e27d2a1e16503f6d8d897f55593dd4421e3e..2b48be021d9a2e7112a24b715dd87a5fca9ef2b2 100644 (file)
@@ -35,8 +35,9 @@ extern int tkill (pid_t tid, int signal);
 
 #include <sys/resource.h>
 
-static void
-reset_priority (pthread_attr_t *attr)
+#ifdef MONO_THREADS_PLATFORM_HAS_ATTR_SETSCHED
+void
+mono_threads_platform_reset_priority (pthread_attr_t *attr)
 {
        struct sched_param param;
        gint res;
@@ -82,6 +83,7 @@ reset_priority (pthread_attr_t *attr)
        if (res != 0)
                g_error ("%s: pthread_attr_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
 }
+#endif
 
 int
 mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid)
@@ -121,7 +123,7 @@ mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_
        g_assert (!res);
 #endif /* HAVE_PTHREAD_ATTR_SETSTACKSIZE */
 
-       reset_priority (&attr);
+       mono_threads_platform_reset_priority (&attr);
 
        if (stack_size) {
                res = pthread_attr_getstacksize (&attr, &min_stack_size);
index b0e98d43f287c05c329affdc0c9e2376e6eedd35..76821d0d359980fb78176606d20a210f61b48b0f 100644 (file)
@@ -1005,8 +1005,12 @@ currently used only to deliver exceptions.
 void
 mono_thread_info_setup_async_call (MonoThreadInfo *info, void (*target_func)(void*), void *user_data)
 {
-       /* An async call can only be setup on an async suspended thread */
-       g_assert (mono_thread_info_run_state (info) == STATE_ASYNC_SUSPENDED);
+       if (!mono_threads_is_coop_enabled ()) {
+               /* In non-coop mode, an async call can only be setup on an async suspended thread, but in coop mode, a thread
+                * may be in blocking state, and will execute the async call when leaving the safepoint, leaving a gc safe
+                * region or entering a gc unsafe region */
+               g_assert (mono_thread_info_run_state (info) == STATE_ASYNC_SUSPENDED);
+       }
        /*FIXME this is a bad assert, we probably should do proper locking and fail if one is already set*/
        g_assert (!info->async_target);
        info->async_target = target_func;
index 0e77e3956630a51a293468778eaae83ce4bb900e..344fbdec3c89bda1e4de22e147f47ad8a15810d1 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
@@ -478,6 +482,9 @@ gint mono_threads_suspend_get_suspend_signal (void);
 gint mono_threads_suspend_get_restart_signal (void);
 gint mono_threads_suspend_get_abort_signal (void);
 
+#if defined(USE_POSIX_BACKEND)
+void mono_threads_platform_reset_priority (pthread_attr_t *attr);
+#endif /* defined(USE_POSIX_BACKEND) */
 int mono_threads_platform_create_thread (MonoThreadStart thread_fn, gpointer thread_data, gsize* const stack_size, MonoNativeThreadId *out_tid);
 void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
 void mono_threads_platform_init (void);
index b86ab331dbf7e2cab2180e69cef51ae5060c10a4..2f6b6c501037c6cd070612896455c227b3f2b9ae 100644 (file)
@@ -211,10 +211,10 @@ mono_bitset_count (const MonoBitSet *set) {
        for (i = 0; i < set->size / BITS_PER_CHUNK; ++i) {
                d = set->data [i];
 #ifdef __GNUC__
-               if (sizeof (gsize) == sizeof (unsigned long))
-                       count += __builtin_popcountl (d);
-               else
+               if (sizeof (gsize) == sizeof (unsigned int))
                        count += __builtin_popcount (d);
+               else
+                       count += __builtin_popcountll (d);
 #else
                while (d) {
                        count ++;
index 625cd5c8e9f1ad750a44f5c0ac2638b2e6c76bde..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>
     </project>
     <project dir="class/Microsoft.CSharp" library="Microsoft.CSharp-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.Core.dll -r:./../../class/lib/net_4_x/Mono.CSharp.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.Core.dll -r:./../../class/lib/net_4_x/System.dll</flags>
       <output>Microsoft.CSharp.dll</output>
       <built_sources></built_sources>
       <library_output>./../../class/lib/net_4_x/Microsoft.CSharp.dll</library_output>
diff --git a/po/mcs/.gitattributes b/po/mcs/.gitattributes
new file mode 100644 (file)
index 0000000..813b603
--- /dev/null
@@ -0,0 +1 @@
+LINGUAS eol=lf
index 5751de4be9b6bf8c36b01cc6fd82ee31dc52ce58..2f03aa0e2ecf8e810e0fdc3855c4fa0e5cc41746 100644 (file)
@@ -1,4 +1 @@
-es
-ja
-de
-pt_BR
\ No newline at end of file
+es ja de pt_BR
\ No newline at end of file
diff --git a/runtime/.gitattributes b/runtime/.gitattributes
new file mode 100644 (file)
index 0000000..943f7e1
--- /dev/null
@@ -0,0 +1,3 @@
+monodis-wrapper.in     crlf=input
+mono-wrapper.in        crlf=input
+
index 30238150d93ca546c3ba77e37149970d7a664127..2166c5ce95c3144272d577900ed2275ba440971f 100644 (file)
@@ -6,3 +6,17 @@ monodocs2slashdoc      crlf=input
 mono-heapviz   crlf=input
 mono-package-runtime   crlf=input
 mono-test-install      crlf=input
+csc.in crlf=input
+dmcs.in        crlf=input
+gmcs.in        crlf=input
+mcs.in crlf=input
+mod.in crlf=input
+mono-configuration-crypto.in   crlf=input
+mono-find-provides.in  crlf=input
+mono-find-requires.in  crlf=input
+mono-service.in        crlf=input
+mono-symbolicate.in    crlf=input
+peverify.in    crlf=input
+script.in      crlf=input
+script_umask.in        crlf=input
+xbuild.in      crlf=input
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*