Merge pull request #3289 from BrzVlad/fix-critical-finalizer
authorRodrigo Kumpera <kumpera@gmail.com>
Thu, 21 Jul 2016 22:35:06 +0000 (15:35 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Jul 2016 22:35:06 +0000 (15:35 -0700)
[sgen] Fix critical/normal finalization order at domain unload

154 files changed:
.gitignore
.gitmodules
acceptance-tests/versions.mk
configure.ac
external/buildtools [new submodule]
external/nuget-buildtasks [new submodule]
llvm/Makefile.am
man/mono-symbolicate.1
mcs/Makefile
mcs/build/platforms/darwin.make
mcs/build/platforms/linux.make
mcs/build/platforms/win32.make
mcs/build/profiles/mobile_static.make
mcs/build/profiles/xbuild_12.make
mcs/build/rules.make
mcs/class/Facades/Makefile
mcs/class/Facades/System.Drawing.Primitives/Makefile
mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources [new file with mode: 0644]
mcs/class/Facades/System.Drawing.Primitives/mobile_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/mobile_static_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/monodroid_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/monotouch_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/monotouch_tv_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/monotouch_watch_System.Drawing.Primitives.dll.sources
mcs/class/Facades/System.Drawing.Primitives/xammac_System.Drawing.Primitives.dll.sources [deleted file]
mcs/class/Facades/System.Drawing.Primitives/xammac_net_4_5_System.Drawing.Primitives.dll.sources
mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/Makefile [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading-net_4_x.csproj [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading.dll.sources [deleted file]
mcs/class/Facades/System.Private.CoreLib.Threading/TypeForwarders.cs [deleted file]
mcs/class/Facades/subdirs.make
mcs/class/Makefile
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs
mcs/class/Microsoft.Build.Utilities/Mono.XBuild.Utilities/ReservedNameUtils.cs
mcs/class/Microsoft.NuGet.Build.Tasks/Makefile [new file with mode: 0644]
mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources [new file with mode: 0644]
mcs/class/Mono.CompilerServices.SymbolWriter/SymbolWriterImpl.cs
mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
mcs/class/System/System.Net/ResponseStream.cs
mcs/class/corlib/Mono/RuntimeHandles.cs
mcs/class/corlib/Mono/RuntimeStructs.cs
mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs [new file with mode: 0644]
mcs/class/corlib/ReferenceSources/MethodBase.cs
mcs/class/corlib/ReferenceSources/RuntimeType.cs
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/System.Reflection/EventInfo.cs
mcs/class/corlib/System.Reflection/PropertyInfo.cs
mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs [deleted file]
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/Test/System.IO/PathTest.cs
mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs
mcs/class/corlib/Test/System/TimeZoneInfoTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/class/corlib/corlib_test.dll.sources
mcs/class/referencesource/mscorlib/system/security/safesecurityhandles.cs
mcs/class/test-helpers/TestHelpers.cs [new symlink]
mcs/ilasm/scanner/InstrToken.cs
mcs/mcs/assembly.cs
mcs/tools/mono-symbolicate/LocationProvider.cs
mcs/tools/mono-symbolicate/Logger.cs [new file with mode: 0644]
mcs/tools/mono-symbolicate/Makefile
mcs/tools/mono-symbolicate/README [deleted file]
mcs/tools/mono-symbolicate/README.md [new file with mode: 0644]
mcs/tools/mono-symbolicate/StackFrameData.cs
mcs/tools/mono-symbolicate/SymbolManager.cs
mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs
mcs/tools/mono-symbolicate/Test/symbolicate.expected
mcs/tools/mono-symbolicate/mono-symbolicate.exe.sources
mcs/tools/mono-symbolicate/symbolicate.cs
mcs/tools/xbuild/Makefile
mcs/tools/xbuild/data/12.0/Microsoft.Common.targets
mcs/tools/xbuild/data/14.0/Microsoft.Common.props [new file with mode: 0644]
mcs/tools/xbuild/data/14.0/Microsoft.Common.targets
mcs/tools/xbuild/data/4.0/Microsoft.Common.targets
mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Core.props [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets [deleted file]
mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets [deleted file]
mono/cil/cil-opcodes.xml
mono/cil/opcode.def
mono/io-layer/wait.c
mono/metadata/appdomain.c
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/handle.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/marshal.c
mono/metadata/mempool.c
mono/metadata/metadata-verify.c
mono/metadata/mono-config.c
mono/metadata/reflection.c
mono/metadata/remoting.c
mono/metadata/sgen-bridge-internals.h
mono/metadata/sgen-bridge.c
mono/metadata/sgen-bridge.h
mono/metadata/sgen-os-posix.c
mono/metadata/threadpool-ms-io-epoll.c
mono/metadata/threadpool-ms-io-kqueue.c
mono/metadata/threadpool-ms-io-poll.c
mono/metadata/threadpool-ms-io.c
mono/metadata/threadpool-ms.c
mono/metadata/verify.c
mono/mini/Makefile.am.in
mono/mini/TestHelpers.cs [new file with mode: 0644]
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/cpu-amd64.md
mono/mini/debugger-agent.c
mono/mini/linear-scan.c
mono/mini/llvm-jit.cpp
mono/mini/method-to-ir.c
mono/mini/mini-amd64-gsharedvt.c
mono/mini/mini-amd64.c
mono/mini/mini-amd64.h
mono/mini/mini-exceptions.c
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm-cpp.h
mono/mini/mini-llvm.c
mono/mini/mini-ops.h
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini-x86.c
mono/mini/mini.c
mono/mini/mini.h
mono/mini/test_op_il_seq_point.sh
mono/mini/tramp-amd64.c
mono/mini/unwind.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-gc.h
mono/sgen/sgen-marksweep.c
mono/tests/Makefile.am
mono/tests/assemblyresolve/Makefile.am
mono/tests/bug-461867.cs
mono/tests/marshal.cs
mono/tests/marshal9.cs
mono/tests/marshalbool.cs
mono/tests/process-leak.cs
mono/tests/sgen-toggleref.cs
mono/tests/test-runner.cs
mono/tests/winx64structs.cs
mono/utils/mono-os-mutex.h
mono/utils/mono-os-semaphore.h
mono/utils/mono-threads.c
runtime/Makefile.am
scripts/ci/run-test-mobile_static.sh
scripts/submodules/versions.mk
scripts/submodules/versions.py

index 3258779bae5618a8cfb4e68ad84b7959c1b2d9e7..1c359b94f8e393917aa038e93db82479c3cbc9a7 100644 (file)
@@ -38,6 +38,7 @@ obj/
 [Rr]elease*/
 Ankh.NoLoad
 *.gpState
+.vscode/
 
 # Tooling
 _ReSharper*/
index 2025d14474d4528e26bed929d272fa63ededdffa..7c8d2d14e8b109d99672c2673da1cc4e9359c48d 100644 (file)
@@ -29,3 +29,9 @@
 [submodule "external/nunit-lite"]
        path = external/nunit-lite
        url = git://github.com/mono/NUnitLite.git
+[submodule "external/nuget-buildtasks"]
+       path = external/nuget-buildtasks
+       url = git://github.com/mono/NuGet.BuildTasks
+[submodule "external/buildtools"]
+       path = external/buildtools
+       url = git://github.com/mono/buildtools.git
index 491b67e11ce18921c10b7d20e73767d5eb3db52a..84b4f85c6cdc1dd693b8a41f339693b0fb73fecf 100644 (file)
@@ -1,5 +1,6 @@
 .PHONY: validate-versions reset-versions
 
+SUBMODULES_CONFIG_FILE = $(top_srcdir)/acceptance-tests/SUBMODULES.json
 include $(top_srcdir)/scripts/submodules/versions.mk
 
 $(eval $(call ValidateVersionTemplate,roslyn,ROSLYN))
index 0930a431abaebcf0602fcbe87ccb18c85f26865b..f2ac137b67f46b2067829fdf1f1af9d31a3abd59 100644 (file)
@@ -353,6 +353,18 @@ AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes)
 AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
 
+if test -z "$PLATFORM_DARWIN_TRUE"; then :
+PLATFORM_AOT_SUFFIX=.dylib
+fi
+
+if test -z "$PLATFORM_LINUX_TRUE"; then :
+PLATFORM_AOT_SUFFIX=.so
+fi
+
+AC_SUBST(PLATFORM_AOT_SUFFIX)
+
+## PLATFORM_AOT_SUFFIX not so simple for windows :-)
+
 AC_CHECK_TOOL(CC, gcc, gcc)
 AC_PROG_CC
 AC_CHECK_TOOL(CXX, g++, g++)
@@ -748,6 +760,8 @@ dnl
 TEST_PROFILE=default
 enable_llvm_default=no
 
+INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=2800
+
 if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    DISABLE_MCS_DOCS_default=yes
    with_profile4_x_default=no
@@ -777,7 +791,7 @@ elif test x$with_runtime_preset = xall; then
    with_monotouch_watch_default=yes
    with_monotouch_tv_default=yes
    with_xammac_default=yes
-   with_mobile_static_default=yes
+   with_mobile_static_default=no
    with_bitcode_default=no
 elif test x$with_runtime_preset = xmobile_static; then
    DISABLE_MCS_DOCS_default=yes
@@ -792,6 +806,15 @@ elif test x$with_runtime_preset = xmobile_static; then
    with_bitcode_default=no
    with_cooperative_gc_default=no
    TEST_PROFILE=mobile_static 
+
+   mono_feature_disable_com='yes'
+   mono_feature_disable_remoting='yes'
+   mono_feature_disable_reflection_emit_save='yes'
+   mono_feature_disable_reflection_emit='yes'
+   mono_feature_disable_appdomains='yes'
+
+   AOT_BUILD_FLAGS="-O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--full-aot"
 elif test x$with_runtime_preset = xbitcode_mobile_static; then
    DISABLE_MCS_DOCS_default=yes
    with_profile4_x_default=no
@@ -805,7 +828,15 @@ elif test x$with_runtime_preset = xbitcode_mobile_static; then
    with_cooperative_gc_default=yes
    TEST_PROFILE=mobile_static 
    enable_llvm_default=yes
-   MONO_LLVMONLY=yes
+
+   mono_feature_disable_com='yes'
+   mono_feature_disable_remoting='yes'
+   mono_feature_disable_reflection_emit_save='yes'
+   mono_feature_disable_reflection_emit='yes'
+   mono_feature_disable_appdomains='yes'
+
+   AOT_BUILD_FLAGS="--aot=llvmonly,$INVARIANT_AOT_OPTIONS"
+   AOT_RUN_FLAGS="--llvmonly"
 else
    with_profile4_x_default=yes
    with_monodroid_default=no
@@ -818,6 +849,11 @@ else
    with_cooperative_gc_default=no
 fi
 
+if test "x$AOT_BUILD_FLAGS" != "x"; then :
+   AC_SUBST(AOT_BUILD_FLAGS)
+   AC_SUBST(AOT_RUN_FLAGS)
+fi
+
 AC_SUBST(TEST_PROFILE)
 
 if test "x$with_profile4_x" = "xdefault"; then
@@ -854,7 +890,7 @@ AM_CONDITIONAL(BITCODE, test "x$with_bitcode" = "xyes")
 AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
 AM_CONDITIONAL(INSTALL_MOBILE_STATIC, [test "x$with_mobile_static" != "xno"])
 
-AC_SUBST(MONO_LLVMONLY)
+AC_SUBST(INSTALL_MOBILE_STATIC)
 
 AC_SUBST(BITCODE)
 
@@ -4204,6 +4240,10 @@ fi
       echo "PLATFORM = darwin" >> $mcs_topdir/build/config.make
     fi
 
+    if test "x$PLATFORM_AOT_SUFFIX" != "x"; then
+      echo "PLATFORM_AOT_SUFFIX = $PLATFORM_AOT_SUFFIX" >> $mcs_topdir/build/config.make
+    fi
+
        if test x$AOT_SUPPORTED = xyes -a x$enable_system_aot = xdefault; then
           enable_system_aot=yes
        fi
@@ -4226,8 +4266,9 @@ fi
       echo "BCL_OPTIMIZE = 1" >> $srcdir/$mcsdir/build/config.make
     fi
 
-    if test "x$MONO_LLVMONLY" = "xyes" ; then
-      echo "MONO_LLVMONLY = 1" >> $srcdir/$mcsdir/build/config.make
+    if test "x$AOT_BUILD_FLAGS" != "x" ; then
+      echo "AOT_RUN_FLAGS=$AOT_RUN_FLAGS" >> $srcdir/$mcsdir/build/config.make
+      echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
     fi
 
   fi
diff --git a/external/buildtools b/external/buildtools
new file mode 160000 (submodule)
index 0000000..a7dbffc
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit a7dbffc17d029f2d66f56ddc9f50349a1bc0dcfe
diff --git a/external/nuget-buildtasks b/external/nuget-buildtasks
new file mode 160000 (submodule)
index 0000000..04bdab5
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 04bdab55d8de9edcf628694cfd2001561e8f8e60
index e8004bf5cb934c30915bc9888eb71ce12d2a7b82..cda2a5762f980cede02751fd2efbf9eb32ef2233 100644 (file)
@@ -7,6 +7,7 @@
 
 LLVM_PATH=llvm
 
+SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
 include $(top_srcdir)/scripts/submodules/versions.mk
 
 $(eval $(call ValidateVersionTemplate,llvm,LLVM))
index e5f8ee54d3206f96eec2e73a2567b2ec9d7bd055..e386b3d804d7587d0b33e9c309ef94848236d58d 100644 (file)
@@ -9,26 +9,23 @@
 mono-symbolicate \- Mono Symbolicate Tool
 .SH SYNOPSIS
 .PP
-.B mono-symbolicate exefile stacktracesfile [directories...]
+.B mono-symbolicate <msym dir> <input file>
+.PP
+.B mono-symbolicate store-symbols <msym dir> [<dir>]+
 .SH DESCRIPTION
 mono-symbolicate is a tool that converts a stack trace with <filename unknown>:0
 into one with file names and line numbers.
 .PP
-The output of calling this tool will be the provided
-.I stacktracesfile
-where <filename unknown>:0 parts are replaced by
-a file name and a line number.
+When mono-symbolicate is called with a symbol directory and a file containing a stacktrace:
+.P
+.B mono-symbolicate <msym dir> <input file>
 .PP
-For the tool to work it needs to load referenced assemblies, it will first look
-in the same folder as
-.I exefile
-then from one of the provided
-.I directories.
+The tool writes into stdout the file contents while adding file location to stack frames when
+it is possible to symbolicate with the symbols available on the symbol directory.
 .PP
-The tool assumes that the folder with a referenced assembly called for example
-name.dll will also include name.dll.mdb,
-if the referenced assembly is AOT compiled then the tool is also expecting to find
-name.dll.msym.
+Managed symbols .exe/.dll can be added to the symbol directory by doing:
+.P
+.B mono-symbolicate store-symbols <msym dir> [<dir>]+
 .SH AUTHOR
 Written by Marcos Henrich
 .SH COPYRIGHT
index 7dbfb638917892d2637276347599b56aa8b8cfba..6a7a58d7fc98a418579b18a527484a6889a05d01 100644 (file)
@@ -15,7 +15,7 @@ monotouch_watch_runtime_SUBDIRS := build class
 monotouch_tv_runtime_SUBDIRS := build class
 xammac_SUBDIRS := build class
 mobile_SUBDIRS := build class
-mobile_static_SUBDIRS := build class
+mobile_static_SUBDIRS := build class ilasm
 binary_reference_assemblies_SUBDIRS := build class
 net_4_x_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
 xammac_net_4_5_SUBDIRS := build class
index bfc73413391266a012d5977ab25d4adb902a7167..4b7b279f0c701ffc6fa0097267a0111bb2d95590 100644 (file)
@@ -23,8 +23,6 @@ PLATFORM_PATH_SEPARATOR = :
 # This is for changing / to \ on windows
 PLATFORM_CHANGE_SEPARATOR_CMD = cat
 
-PLATFORM_AOT_SUFFIX = .dylib
-
 hidden_prefix = .
 hidden_suffix = 
 
index fd54351c47bf9d2deab761d1dd64c693afa522d9..00504140796593b770c9295ba9c53e04352f171d 100644 (file)
@@ -23,8 +23,6 @@ PLATFORM_PATH_SEPARATOR = :
 # This is for changing / to \ on windows
 PLATFORM_CHANGE_SEPARATOR_CMD = cat
 
-PLATFORM_AOT_SUFFIX = .so
-
 hidden_prefix = .
 hidden_suffix = 
 
index d5df46e9da8bb1791901c2f8ab33dc5c01c2a41e..bed99f53387d0a7b9860fcb5334478d926a22769 100644 (file)
@@ -26,9 +26,6 @@ PLATFORM_PATH_SEPARATOR = ;
 
 override CURDIR:=$(shell cygpath -m $(CURDIR))
 
-## not so simple :-)
-#PLATFORM_AOT_SUFFIX = .dll
-
 hidden_prefix = 
 hidden_suffix = .tmp
 
index 5663124343ac69dca38e1601b358c6ae24f01eec..d9ff3b67dc9334f4b6727536b33ef219a08db150 100644 (file)
@@ -43,17 +43,5 @@ NO_VTS_TEST = yes
 # Note need for trailing comma. If you add, keep it
 PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
 
-ifndef MONO_DISABLE_GSHAREDVT
-GSHAREDVT_FLAG = -O=gsharedvt
-endif
-
-ifneq ($(MONO_LLVMONLY),)
-AOT_BUILD_FLAGS_PREFIX = --aot=llvmonly,
-AOT_RUN_FLAGS =  --llvmonly
-else
-AOT_BUILD_FLAGS_PREFIX = $(GSHAREDVT_FLAG) --aot=full,
-AOT_RUN_FLAGS = --full-aot
-endif
-
 ALWAYS_AOT = yes
 
index a0b681071ddb49c38d4c62d9ed349c669e4391d8..f8a39cb48f00059e54c08e1a71e27d638ad423dd 100644 (file)
@@ -6,6 +6,4 @@ PARENT_PROFILE = ../net_4_x/
 DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x/mscorlib.dll
 PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12
 
-RESGEN_EXE = $(topdir)/class/lib/net_4_x/resgen.exe
-
 XBUILD_VERSION = 12.0
index eae908e3addb223ae4b4ecbb674c40ade4c600ae..ac3a476dfb1055fa46cad6cca78fddf90391d007 100644 (file)
@@ -45,9 +45,9 @@ INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PR
 INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe
 INTERNAL_CSC = $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
 
-RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/resgen.exe
+RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)resgen.exe
 INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(RESGEN_EXE)
-RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN)
+RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN)
 STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe
 
 depsdir = $(topdir)/build/deps
@@ -132,29 +132,6 @@ endif
 # Make sure propagates
 export TEST_HARNESS
 
-# start aot config
-
-# We set the prefix of the aot build flags
-# in the profile. This determines the aot type,
-# whether it be llvmonly or full. To this we append the
-# options which do not change between them, the INVARIANT_AOT_OPTIONS
-ifndef AOT_BUILD_FLAGS_PREFIX
-AOT_BUILD_FLAGS_PREFIX = --aot=
-endif
-
-# Set the options for building and running AOT
-# The trampoline numbers are provisional, they are what is required
-# to run the mcs/class test suites. They should be considered a lower bound.
-INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256
-
-ifndef MONO_DISABLE_GSHAREDVT
-INVARIANT_AOT_OPTIONS:=$(INVARIANT_AOT_OPTIONS),ngsharedvt-trampolines=2800
-endif
-
-AOT_BUILD_FLAGS = $(AOT_BUILD_FLAGS_PREFIX)$(INVARIANT_AOT_OPTIONS)
-
-# end AOT config
-
 ifdef BCL_OPTIMIZE
 PROFILE_MCS_FLAGS += -optimize
 endif
@@ -223,7 +200,7 @@ aot-all-profile: $(patsubst %,$(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUF
 
 $(topdir)/class/lib/$(PROFILE)/%$(PLATFORM_AOT_SUFFIX): $(topdir)/class/lib/$(PROFILE)/%
        @ mkdir -p $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp
-       @echo "AOT     [$(PROFILE)] AOT $* " && cd $(topdir)/class/lib/$(PROFILE)/ && MONO_PATH="." $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$*_bitcode $* >> $(PROFILE)-aot.log
+       @echo "AOT     [$(PROFILE)] AOT $* " && cd $(topdir)/class/lib/$(PROFILE)/ && MONO_PATH="." $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS),temp-path=$*_bitcode_tmp $* >> $(PROFILE)-aot.log
        @ rm -rf $(topdir)/class/lib/$(PROFILE)/$*_bitcode_tmp
 
 endif #ifneq ("$(wildcard $(topdir)/class/lib/$(PROFILE))","")
index d984f22ecd51922003ddc2fb5dd3a7bf711c4f0d..4ef52f56dcad794058bfaae88a87d2849945173c 100644 (file)
@@ -28,7 +28,7 @@ include $(MCS_BUILD_DIR)/rules.make
 
 dist-local: dist-default
 
-DIST_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
+DIST_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS) $(net_4_x_SUBDIRS) $(mobile_only_SUBDIRS)
 DISTFILES=subdirs.make
 
 doc-update-local:
@@ -39,7 +39,7 @@ doc-update-recursive:
 
 System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML \
 System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.IO.Compression.FileSystem \
-System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http:
+System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http System.ServiceProcess:
 
 all-local-aot:
 
index e788928d5b36c7ffefc80efc6dbc5752677ff31f..a42f4bc608a9922dbf0023033c6bd2ea49635584 100644 (file)
@@ -12,7 +12,7 @@ LIBRARY = System.Drawing.Primitives.dll
 KEY_FILE = ../../msfinal.pub
 SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
 LIB_REFS = System
-LIB_MCS_FLAGS = $(SIGN_FLAGS)
+LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
 
 ifneq (2.1, $(FRAMEWORK_VERSION))
 ifndef XAMMAC_4_5
diff --git a/mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/embedded_System.Drawing.Primitives.dll.sources
new file mode 100644 (file)
index 0000000..dd5e421
--- /dev/null
@@ -0,0 +1,8 @@
+AssemblyInfo.cs
+
+../../System.Drawing/System.Drawing/Point.cs
+../../System.Drawing/System.Drawing/PointF.cs
+../../System.Drawing/System.Drawing/Rectangle.cs
+../../System.Drawing/System.Drawing/RectangleF.cs
+../../System.Drawing/System.Drawing/Size.cs
+../../System.Drawing/System.Drawing/SizeF.cs
diff --git a/mcs/class/Facades/System.Drawing.Primitives/mobile_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/mobile_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index dd5e421..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-AssemblyInfo.cs
-
-../../System.Drawing/System.Drawing/Point.cs
-../../System.Drawing/System.Drawing/PointF.cs
-../../System.Drawing/System.Drawing/Rectangle.cs
-../../System.Drawing/System.Drawing/RectangleF.cs
-../../System.Drawing/System.Drawing/Size.cs
-../../System.Drawing/System.Drawing/SizeF.cs
diff --git a/mcs/class/Facades/System.Drawing.Primitives/mobile_static_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/mobile_static_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index 006657a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Drawing.Primitives/monodroid_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/monodroid_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index 006657a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Drawing.Primitives/monotouch_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/monotouch_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index 006657a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Drawing.Primitives/monotouch_tv_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/monotouch_tv_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index 006657a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Drawing.Primitives/xammac_System.Drawing.Primitives.dll.sources b/mcs/class/Facades/System.Drawing.Primitives/xammac_System.Drawing.Primitives.dll.sources
deleted file mode 100644 (file)
index 006657a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include mobile_System.Drawing.Primitives.dll.sources
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs b/mcs/class/Facades/System.Private.CoreLib.Threading/AssemblyInfo.cs
deleted file mode 100644 (file)
index de58780..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 
-// Copyright (c) 2015 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.
-// 
-
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle ("System.Private.CoreLib.Threading.dll")]
-[assembly: AssemblyDescription ("System.Private.CoreLib.Threading.dll")]
-[assembly: AssemblyDefaultAlias ("System.Private.CoreLib.Threading.dll")]
-[assembly: AssemblyCompany ("Xamarin, Inc.")]
-[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
-[assembly: AssemblyCopyright ("Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
-[assembly: AssemblyInformationalVersion ("4.0.0.0")]
-[assembly: AssemblyFileVersion ("4.0.0.0")]
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.Threading/Facades_System.Private.CoreLib.Threading-net_4_x.csproj
deleted file mode 100644 (file)
index df6c913..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{642A1B9E-1A2F-4C55-B184-E22F8C2E95B5}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
-    <IntermediateOutputPath>obj-Facades</IntermediateOutputPath>\r
-    <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>\r
-    <NoStdLib>True</NoStdLib>\r
-    \r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>System.Private.CoreLib.Threading</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="TypeForwarders.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
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\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
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile b/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile
deleted file mode 100644 (file)
index 347b171..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-MCS_BUILD_DIR = ../../../build
-
-thisdir = class/Facades/System.Private.CoreLib.Threading
-SUBDIRS = 
-include $(MCS_BUILD_DIR)/rules.make
-
-LIBRARY_SUBDIR = Facades
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Private.CoreLib.Threading.dll
-
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System
-LIB_MCS_FLAGS = $(SIGN_FLAGS) 
-
-PLATFORM_DEBUG_FLAGS =
-
-NO_TEST = yes
-
-include $(MCS_BUILD_DIR)/library.make
-
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading-net_4_x.csproj b/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading-net_4_x.csproj
deleted file mode 100644 (file)
index 17de547..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProductVersion>9.0.30729</ProductVersion>\r
-    <SchemaVersion>2.0</SchemaVersion>\r
-    <ProjectGuid>{A577B5A0-5038-4D8E-8C80-18ED9FEC8686}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <OutputPath>./../../../class/lib/net_4_x/Facades</OutputPath>\r
-    <NoStdLib>True</NoStdLib>\r
-    <NoConfig>True</NoConfig>\r
-    \r
-    <AppDesignerFolder>Properties</AppDesignerFolder>\r
-    <RootNamespace>\r
-    </RootNamespace>\r
-    <AssemblyName>System.Private.CoreLib.Threading</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <FileAlignment>512</FileAlignment>\r
-  </PropertyGroup>\r
-    <PropertyGroup>\r
-    <SignAssembly>true</SignAssembly>\r
-    <DelaySign>true</DelaySign>\r
-  </PropertyGroup>\r
-  <PropertyGroup>\r
-    <AssemblyOriginatorKeyFile>../../msfinal.pub</AssemblyOriginatorKeyFile>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>full</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>false</Optimize>\r
-    <DefineConstants>DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>pdbonly</DebugType>\r
-    <NoWarn>1699,1616,1699</NoWarn>\r
-    <Optimize>true</Optimize>\r
-    <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-  </PropertyGroup>\r
-  <!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0, \r
-  Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This\r
-  is a problem to compile the Mono mscorlib.dll -->\r
-  <PropertyGroup>\r
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>\r
-  </PropertyGroup>\r
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
-  <ItemGroup>\r
-    <Compile Include="AssemblyInfo.cs" />\r
-    <Compile Include="TypeForwarders.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
-  </Target>\r
-  <Target Name="AfterBuild">\r
-  </Target>\r
-  -->\r
-  <PropertyGroup>\r
-    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PreBuildEvent>\r
-\r
-    <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-    <PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
-    </PostBuildEvent>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\r
-    <ProjectReference Include="../../corlib/corlib-net_4_x.csproj">\r
-      <Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>\r
-      <Name>corlib-net_4_x</Name>\r
-    </ProjectReference>\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
-    <Folder Include="Properties\" />\r
-  </ItemGroup>\r
-</Project>\r
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading.dll.sources b/mcs/class/Facades/System.Private.CoreLib.Threading/System.Private.CoreLib.Threading.dll.sources
deleted file mode 100644 (file)
index 8e33d4d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TypeForwarders.cs
-AssemblyInfo.cs
-
diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/TypeForwarders.cs b/mcs/class/Facades/System.Private.CoreLib.Threading/TypeForwarders.cs
deleted file mode 100644 (file)
index 7b9aa7a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// 
-// Copyright (c) 2015 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.
-// 
-
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AbandonedMutexException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.AutoResetEvent))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventResetMode))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.EventWaitHandle))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Interlocked))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.LazyInitializer))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.ManualResetEvent))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Monitor))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Mutex))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Semaphore))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SemaphoreFullException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SpinWait))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.SynchronizationLockException))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Volatile))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.WaitHandleCannotBeOpenedException))]
-
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Condition))]
-//Missing: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Lock))]
index e7d21881798b1c07c522d2f2ae9694bc0cf7a303..8a525e19ab2627e5416715a932fc6e5c98998334 100644 (file)
@@ -24,14 +24,15 @@ System.Security.Cryptography.Encryption.Aes System.Security.Cryptography.Encrypt
 System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA System.Security.Cryptography.RandomNumberGenerator \
 System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
 System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
-System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Private.CoreLib.Threading System.Reflection.TypeExtensions \
+System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Reflection.TypeExtensions \
 System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument System.IO.Compression \
 System.Security.Cryptography.Algorithms System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
 System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
 
 # common_SUBDIRS dependencies
-common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml \
-System.Drawing.Primitives
+common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml
+
+drawing_DEPS_SUBDIRS = System.Drawing.Primitives
 
 reflection_PARALLEL_SUBDIRS = System.Reflection.Emit.ILGeneration System.Reflection.Emit.Lightweight System.Reflection.Emit
 
@@ -41,7 +42,7 @@ monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
 mobile_static_SUBDIRS = $(monotouch_SUBDIRS)
 mobile_static_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
-net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS)
+net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(drawing_DEPS_SUBDIRS)
 net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(reflection_PARALLEL_SUBDIRS) System.Diagnostics.PerformanceCounter \
 System.Net.Http.WebRequestHandler
 
@@ -54,7 +55,7 @@ xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 xammac_net_4_5_SUBDIRS = $(net_4_x_SUBDIRS)
 xammac_net_4_5_PARALLEL_SUBDIRS = $(net_4_x_PARALLEL_SUBDIRS)
 
-monotouch_watch_SUBDIRS = $(monotouch_SUBDIRS)
+monotouch_watch_SUBDIRS = $(monotouch_SUBDIRS) $(drawing_DEPS_SUBDIRS)
 monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
 
 monotouch_tv_SUBDIRS = $(monotouch_SUBDIRS)
index 46db72b36c7747d14b54cbc7f6d3a695262c0b15..1b16375f3fa099563acfb64fca80ad44a351ace4 100644 (file)
@@ -48,7 +48,6 @@ mobile_common_dirs := \
        System.ComponentModel.Composition.4.5 \
        System.Net \
        System.Net.Http \
-       System.Net.Http.WebRequest      \
        System.Windows \
        System.Xml.Serialization \
        Mono.CSharp     \
@@ -65,6 +64,9 @@ mobile_common_dirs := \
 mobile_static_dirs := \
        $(mobile_common_dirs)   \
        Mono.Dynamic.Interpreter        \
+       PEAPI   \
+       Mono.CompilerServices.SymbolWriter      \
+       Mono.Simd                       \
        $(pcl_facade_dirs)
 
 mobile_dynamic_dirs := \
@@ -317,13 +319,13 @@ binary_reference_assemblies_SUBDIRS := reference-assemblies
 net_4_x_SUBDIRS := $(net_4_x_dirs) $(xbuild_4_0_dirs)
 net_4_x_PARALLEL_SUBDIRS := $(net_4_x_parallel_dirs) aot-compiler
 xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
-xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
+xbuild_14_SUBDIRS := $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
 include ../build/rules.make
 
 SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS)
 
-DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs)
+DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
 # No new makefiles for: System.Messaging, System.Web.Mobile,
 # System.ServiceProcess
index b74e26ab43eb365ea8c2f8fae31138aa8dd3041c..40f04ad996adbd6d817d6b0a944b26f193f123f9 100644 (file)
@@ -142,7 +142,9 @@ namespace Microsoft.Build.Tasks
                                        framework_dir = Path.Combine (redistlist_dir, framework_dir);
 
                                var directories = new List<string> ();
-                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir));
+
+                               //MSBuild has a trailing slash on this value
+                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir) + Path.DirectorySeparatorChar);
 
                                string include = xr.GetAttribute ("IncludeFramework");
                                if (!String.IsNullOrEmpty (include)) {
index 6789cfbd9283a577f38482fde1387b546529dc8d..36f81236c243a64f347a18dcf2db231a8da9f210 100644 (file)
@@ -100,7 +100,7 @@ namespace Mono.XBuild.Utilities {
                                else
                                        return String.Empty;
                        case "identity":
-                               return Path.Combine (Path.GetDirectoryName (itemSpec), Path.GetFileName (itemSpec));
+                               return itemSpec;
                        case "modifiedtime":
                                if (File.Exists (itemSpec))
                                        return File.GetLastWriteTime (itemSpec).ToString ();
diff --git a/mcs/class/Microsoft.NuGet.Build.Tasks/Makefile b/mcs/class/Microsoft.NuGet.Build.Tasks/Makefile
new file mode 100644 (file)
index 0000000..e3561d4
--- /dev/null
@@ -0,0 +1,35 @@
+thisdir = class/Microsoft.NuGet.Build.Tasks
+SUBDIRS =
+include ../../build/rules.make
+
+XBUILD_DIR=$(topdir)/tools/xbuild
+include $(XBUILD_DIR)/xbuild.make
+
+NUGET_BUILDTASKS_REPO_DIR=$(topdir)/../external/nuget-buildtasks
+NUGET_BUILDTASKS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/NuGet
+
+LIBRARY = Microsoft.NuGet.Build.Tasks.dll
+LIBRARY_INSTALL_DIR = $(NUGET_BUILDTASKS_TARGETS_DIR)
+
+KEY_FILE = $(NUGET_BUILDTASKS_REPO_DIR)/build/PublicKey.snk
+SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE)
+
+RESOURCE_DEFS = Microsoft.NuGet.Build.Tasks.Strings,$(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Strings.resx
+
+LIB_REFS = $(PARENT_PROFILE)System \
+       $(PARENT_PROFILE)System.Core \
+       $(PARENT_PROFILE)System.Data \
+       $(PARENT_PROFILE)System.Xml \
+       $(PARENT_PROFILE)System.Xml.Linq \
+       $(PARENT_PROFILE)System.Runtime.Serialization \
+       $(XBUILD_UTILITIES) \
+       $(XBUILD_FRAMEWORK)
+
+LIB_MCS_FLAGS = \
+       -nowarn:3021            \
+       $(SIGN_FLAGS)
+
+EXTRA_DISTFILES = \
+       $(NUGET_BUILDTASKS_REPO_DIR)/build/PublicKey.snk
+
+include ../../build/library.make
diff --git a/mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources b/mcs/class/Microsoft.NuGet.Build.Tasks/xbuild_14_Microsoft.NuGet.Build.Tasks.dll.sources
new file mode 100644 (file)
index 0000000..3fa9acd
--- /dev/null
@@ -0,0 +1,164 @@
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Delegates.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/ExceptionFromResource.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/InternalsVisibleTo.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/NativeMethods.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/NuGetPackageObject.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Preprocessor.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs
+../../../external/nuget-buildtasks/src/Microsoft.NuGet.Build.Tasks/Strings.Designer.cs
+
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryType.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonToken.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonType.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Bson/BsonObjectId.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BinaryConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataSetConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DataTableConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/DateTimeConverterBase.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/ExpandoObjectConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/KeyValuePairConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/BsonObjectIdConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/RegexConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ConstructorHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/VersionConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateFormatHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DateTimeZoneHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Formatting.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConstructorAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPosition.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyKeyedCollection.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxy.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPath.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JRaw.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Required.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDynamicContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonLinqContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPrimitiveContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorEventArgs.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultReferenceResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/PreserveReferencesHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/IJsonLineInfo.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonArrayAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonContainerAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/DefaultValueHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonObjectAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializerSettings.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonValidatingReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/IJEnumerable.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenEqualityComparer.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MemberSerialization.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ObjectCreationHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/JavaScriptDateTimeConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonPropertyAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonIgnoreAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonTextWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriterException.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReaderException.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConverterCollection.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonConvert.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializationException.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonSerializer.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/Extensions.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JConstructor.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JContainer.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JEnumerable.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JObject.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JArray.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JToken.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JProperty.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JTokenType.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Linq/JValue.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/Extensions.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaException.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModel.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaModelBuilder.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNodeCollection.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaNode.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/UndefinedSchemaIdHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventArgs.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/ValidationEventHandler.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CamelCasePropertyNamesContractResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ErrorContext.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IContractResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IValueProvider.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonProperty.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/MissingMemberHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/NullValueHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/ReferenceLoopHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchema.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaConstants.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/IReferenceResolver.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaType.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonStringContract.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/CachedAttributeGetter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/OnErrorAttribute.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/Base64Encoder.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicProxyMetaObject.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Serialization/ObjectConstructor.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionDelegateFactory.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/LateBoundReflectionDelegateFactory.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MethodCall.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringReference.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ThreadSafeStore.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/TypeNameHandling.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/BidirectionalDictionary.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ConvertUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionWrapper.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/DictionaryWrapper.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValue.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/EnumValues.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonToken.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/JsonWriter.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringBuffer.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/CollectionUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ListWrapper.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MathUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/MiscellaneousUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/TypeExtensions.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/ValidationUtils.cs
+../../../external/Newtonsoft.Json/Src/Newtonsoft.Json/WriteState.cs
index a1fd0f918a6735eefede4e9d1892633c0782b9d9..0b25cd7cf5e2338315338b5c3924f2c9cde4cbc0 100644 (file)
@@ -50,7 +50,7 @@ namespace Mono.CompilerServices.SymbolWriter
 
                Hashtable documents = new Hashtable ();
 
-#if !CECIL
+#if !CECIL && !MOBILE
                ModuleBuilder mb;
                delegate Guid GetGuidFunc (ModuleBuilder mb);
                GetGuidFunc get_guid_func;
index dd2dc7f1c70d6e37264ac1c428b2d6592f37eacf..d06cb33fe21c43bca6002a04358d3c9f0c28bbe9 100644 (file)
@@ -1,5 +1,4 @@
 NUnitMoonHelper.cs
-../../test-helpers/NetworkHelpers.cs
 FeatureBased/Features.Client/AsyncCallTesterProxy.cs
 FeatureBased/Features.Client/AsyncPatternServer.cs
 FeatureBased/Features.Client/DataContractTesterProxy.cs
index 860509b9aceaa2776fb0bb105699e7a0d6fa528e..6a47f40ae2a3cf823bfda8923e86cb2a7334e2f1 100644 (file)
@@ -81,19 +81,25 @@ namespace System.Net {
                                byte [] bytes = null;
                                MemoryStream ms = GetHeaders (true);
                                bool chunked = response.SendChunked;
-                               if (ms != null) {
-                                       long start = ms.Position;
-                                       if (chunked && !trailer_sent) {
-                                               bytes = GetChunkSizeBytes (0, true);
-                                               ms.Position = ms.Length;
-                                               ms.Write (bytes, 0, bytes.Length);
+                               if (stream.CanWrite) {
+                                       try {
+                                               if (ms != null) {
+                                                       long start = ms.Position;
+                                                       if (chunked && !trailer_sent) {
+                                                               bytes = GetChunkSizeBytes (0, true);
+                                                               ms.Position = ms.Length;
+                                                               ms.Write (bytes, 0, bytes.Length);
+                                                       }
+                                                       InternalWrite (ms.GetBuffer (), (int) start, (int) (ms.Length - start));
+                                                       trailer_sent = true;
+                                               } else if (chunked && !trailer_sent) {
+                                                       bytes = GetChunkSizeBytes (0, true);
+                                                       InternalWrite (bytes, 0, bytes.Length);
+                                                       trailer_sent = true;
+                                               }
+                                       } catch (IOException ex) {
+                                               // Ignore error due to connection reset by peer
                                        }
-                                       InternalWrite (ms.GetBuffer (), (int) start, (int) (ms.Length - start));
-                                       trailer_sent = true;
-                               } else if (chunked && !trailer_sent) {
-                                       bytes = GetChunkSizeBytes (0, true);
-                                       InternalWrite (bytes, 0, bytes.Length);
-                                       trailer_sent = true;
                                }
                                response.Close ();
                        }
index b83ff68550b6b352edfb3242c3d8c2b9b5bad80e..88eeeee8f0c75c53ecada2173314e374ac1d5416 100644 (file)
@@ -141,4 +141,134 @@ namespace Mono {
                        return i;
                }
        }
+
+       internal struct RuntimeEventHandle {
+               IntPtr value;
+
+               internal RuntimeEventHandle (IntPtr v)
+               {
+                       value = v;
+               }
+
+               public IntPtr Value {
+                       get {
+                               return value;
+                       }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType () != obj.GetType ())
+                               return false;
+
+                       return value == ((RuntimeEventHandle)obj).Value;
+               }
+
+               public bool Equals (RuntimeEventHandle handle)
+               {
+                       return value == handle.Value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return value.GetHashCode ();
+               }
+
+               public static bool operator == (RuntimeEventHandle left, RuntimeEventHandle right)
+               {
+                       return left.Equals (right);
+               }
+
+               public static bool operator != (RuntimeEventHandle left, RuntimeEventHandle right)
+               {
+                       return !left.Equals (right);
+               }
+       }
+
+       internal struct RuntimePropertyHandle {
+               IntPtr value;
+
+               internal RuntimePropertyHandle (IntPtr v)
+               {
+                       value = v;
+               }
+
+               public IntPtr Value {
+                       get {
+                               return value;
+                       }
+               }
+
+               public override bool Equals (object obj)
+               {
+                       if (obj == null || GetType () != obj.GetType ())
+                               return false;
+
+                       return value == ((RuntimePropertyHandle)obj).Value;
+               }
+
+               public bool Equals (RuntimePropertyHandle handle)
+               {
+                       return value == handle.Value;
+               }
+
+               public override int GetHashCode ()
+               {
+                       return value.GetHashCode ();
+               }
+
+               public static bool operator == (RuntimePropertyHandle left, RuntimePropertyHandle right)
+               {
+                       return left.Equals (right);
+               }
+
+               public static bool operator != (RuntimePropertyHandle left, RuntimePropertyHandle right)
+               {
+                       return !left.Equals (right);
+               }
+       }
+
+       internal struct RuntimeGPtrArrayHandle {
+               unsafe RuntimeStructs.GPtrArray* value;
+
+               internal unsafe RuntimeGPtrArrayHandle (RuntimeStructs.GPtrArray* value)
+               {
+                       this.value = value;
+               }
+
+               internal unsafe RuntimeGPtrArrayHandle (IntPtr ptr)
+               {
+                       this.value = (RuntimeStructs.GPtrArray*) ptr;
+               }
+
+               internal int Length {
+                       get {
+                               unsafe {
+                                       return value->len;
+                               }
+                       }
+               }
+
+               internal IntPtr this[int i] => Lookup (i);
+
+               internal IntPtr Lookup (int i)
+               {
+                       if (i >= 0 && i < Length) {
+                               unsafe {
+                                       return value->data[i];
+                               }
+                       } else
+                               throw new IndexOutOfRangeException ();
+               }
+
+               [MethodImpl(MethodImplOptions.InternalCall)]
+               unsafe extern static void GPtrArrayFree (RuntimeStructs.GPtrArray* value, bool freeSeg);
+
+               internal static void DestroyAndFree (ref RuntimeGPtrArrayHandle h, bool freeSeg) {
+                       unsafe {
+                               GPtrArrayFree (h.value, freeSeg);
+                               h.value = null;
+                       }
+               }
+       }
 }
index 29b75c077d3660938f38e503f2ea558f3043cc4f..20cd93fdaecfa0c70be0f1ae84d492588b1b41aa 100644 (file)
@@ -37,6 +37,12 @@ namespace Mono {
                        internal uint token;
                        internal MonoClass** constraints; /* NULL terminated */
                }
+
+               // glib.h GPtrArray
+               internal unsafe struct GPtrArray {
+                       internal IntPtr* data;
+                       internal int len;
+               }
        }
 
 }
diff --git a/mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs b/mcs/class/corlib/Mono/SafeGPtrArrayHandle.cs
new file mode 100644 (file)
index 0000000..6332259
--- /dev/null
@@ -0,0 +1,51 @@
+//
+// Safe handle class for Mono.RuntimeGPtrArrayHandle
+//
+// Authors:
+//   Aleksey Kliger <aleksey@xamarin.com>
+//   Rodrigo Kumpera <kumpera@xamarin.com>
+//
+// Copyright 2016 Dot net foundation.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace Mono {
+       internal sealed class SafeGPtrArrayHandle : IDisposable {
+               RuntimeGPtrArrayHandle handle;
+               bool freeSeg;
+
+               internal SafeGPtrArrayHandle (IntPtr ptr, bool freeSeg)
+               {
+                       handle = new RuntimeGPtrArrayHandle (ptr);
+                       this.freeSeg = freeSeg;
+               }
+
+               ~SafeGPtrArrayHandle ()
+               {
+                       Dispose (false);
+               }
+
+               void Dispose (bool disposing)
+               {
+                       RuntimeGPtrArrayHandle.DestroyAndFree (ref handle, freeSeg);
+               }
+
+               public void Dispose () {
+                       Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+
+               internal int Length {
+                       get {
+                               return handle.Length;
+                       }
+               }
+
+               internal IntPtr this[int i] => handle[i];
+       }
+
+
+}
index 2fb847a6ef9638ec4aae614a2358d7ef59c8d913..8cd000563288e73fec2c2cce006fe964df4a6f7a 100644 (file)
@@ -46,7 +46,12 @@ namespace System.Reflection
 
                internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle)
                {
-                       return GetMethodFromHandleInternalType (handle.Value, IntPtr.Zero);
+                       return GetMethodFromHandleInternalType_native (handle.Value, IntPtr.Zero, false);
+               }
+
+               internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       return GetMethodFromHandleInternalType_native (handle.Value, reflectedType.Value, false);
                }
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
@@ -57,7 +62,12 @@ namespace System.Reflection
                        return GetMethodBodyInternal (handle);
                }
 
+               static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle) {
+                       return GetMethodFromHandleInternalType_native (method_handle, type_handle, true);
+               }
+
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               extern static MethodBase GetMethodFromHandleInternalType (IntPtr method_handle, IntPtr type_handle);            
+               internal extern static MethodBase GetMethodFromHandleInternalType_native (IntPtr method_handle, IntPtr type_handle, bool genericCheck);
+
        }
-}
\ No newline at end of file
+}
index 4981f4175a15c4b1846a98a2bf2f75e4815864e8..08159216f565de940787de6b3441daf5875ce092 100644 (file)
@@ -472,13 +472,55 @@ namespace System
                static extern Type MakeGenericType (Type gt, Type [] types);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               internal extern RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, Type reflected_type);
+               internal extern IntPtr GetMethodsByName_native (string name, BindingFlags bindingAttr, bool ignoreCase);
+
+               internal RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetMethodsByName_native (name, bindingAttr, ignoreCase), false)) {
+                               var n = h.Length;
+                               var a = new RuntimeMethodInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var mh = new RuntimeMethodHandle (h[i]);
+                                       a[i] = (RuntimeMethodInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
+                               }
+                               return a;
+                       }
+               }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, Type reflected_type);              
+               extern IntPtr GetPropertiesByName_native (string name, BindingFlags bindingAttr, bool icase);           
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetConstructors_native (BindingFlags bindingAttr);
+
+               RuntimeConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetConstructors_native (bindingAttr), false)) {
+                               var n = h.Length;
+                               var a = new RuntimeConstructorInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var mh = new RuntimeMethodHandle (h[i]);
+                                       a[i] = (RuntimeConstructorInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
+                               }
+                               return a;
+                       }
+               }
+
+               RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetPropertiesByName_native (name, bindingAttr, icase), false)) {
+                               var n = h.Length;
+                               var a = new RuntimePropertyInfo [n];
+                               for (int i = 0; i < n; i++) {
+                                       var ph = new Mono.RuntimePropertyHandle (h[i]);
+                                       a[i] = (RuntimePropertyInfo) PropertyInfo.GetPropertyFromHandle (ph, refh);
+                               }
+                               return a;
+                       }
+               }
 
                public override InterfaceMapping GetInterfaceMap (Type ifaceType)
                {
@@ -627,10 +669,38 @@ namespace System
                extern int GetGenericParameterPosition ();
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetEvents_native (string name, BindingFlags bindingAttr);
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
-               extern RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+               extern IntPtr GetFields_native (string name, BindingFlags bindingAttr);
+
+               RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetFields_native (name, bindingAttr), false)) {
+                               int n = h.Length;
+                               var a = new RuntimeFieldInfo[n];
+                               for (int i = 0; i < n; i++) {
+                                       var fh = new RuntimeFieldHandle (h[i]);
+                                       a[i] = (RuntimeFieldInfo) FieldInfo.GetFieldFromHandle (fh, refh);
+                               }
+                               return a;
+                       }
+               }
+
+               RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, RuntimeType reflectedType)
+               {
+                       var refh = new RuntimeTypeHandle (reflectedType);
+                       using (var h = new Mono.SafeGPtrArrayHandle (GetEvents_native (name, bindingAttr), false)) {
+                               int n = h.Length;
+                               var a = new RuntimeEventInfo[n];
+                               for (int i = 0; i < n; i++) {
+                                       var eh = new Mono.RuntimeEventHandle (h[i]);
+                                       a[i] = (RuntimeEventInfo) EventInfo.GetEventFromHandle (eh, refh);
+                               }
+                               return a;
+                       }
+               }
 
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public extern override Type[] GetInterfaces();
index fc62a4db6e3bff42240dfdca7c37c83252c7e266..d0512f24695a2a5dbe3111080092742268f8da45 100644 (file)
@@ -320,9 +320,12 @@ namespace System.IO {
 
                internal static string WindowsDriveAdjustment (string path)
                {
-                       // two special cases to consider when a drive is specified
-                       if (path.Length < 2)
+                       // three special cases to consider when a drive is specified
+                       if (path.Length < 2) {
+                               if (path.Length == 1 && (path[0] == '\\' || path[0] == '/'))
+                                       return Path.GetPathRoot(Directory.GetCurrentDirectory());
                                return path;
+                       }
                        if ((path [1] != ':') || !Char.IsLetter (path [0]))
                                return path;
 
index 040fe38beaecdf099e2f28bdb8b572bdfcba458c..9668f1f56c2b85e6bd47899349e8a2b6323fdb79 100644 (file)
@@ -28,6 +28,7 @@
 //
 
 using System.Diagnostics;
+using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection {
@@ -277,5 +278,25 @@ namespace System.Reflection {
                public virtual MethodInfo RemoveMethod {
                        get { return GetRemoveMethod (true); }
                }
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private static extern EventInfo internal_from_handle_type (IntPtr event_handle, IntPtr type_handle);
+
+               internal static EventInfo GetEventFromHandle (Mono.RuntimeEventHandle handle)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       return internal_from_handle_type (handle.Value, IntPtr.Zero);
+               }
+
+               internal static EventInfo GetEventFromHandle (Mono.RuntimeEventHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       EventInfo ei = internal_from_handle_type (handle.Value, reflectedType.Value);
+                       if (ei == null)
+                               throw new ArgumentException ("The event handle and the type handle are incompatible.");
+                       return ei;
+               }
        }
 }
index 68a62f74a67f5143857c543685a3567be6fa0f7d..9eeb9cc917197b8052062edc222664ba604b87dc 100644 (file)
@@ -196,5 +196,18 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 #endif
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               private static extern PropertyInfo internal_from_handle_type (IntPtr event_handle, IntPtr type_handle);
+
+               internal static PropertyInfo GetPropertyFromHandle (Mono.RuntimePropertyHandle handle, RuntimeTypeHandle reflectedType)
+               {
+                       if (handle.Value == IntPtr.Zero)
+                               throw new ArgumentException ("The handle is invalid.");
+                       PropertyInfo pi = internal_from_handle_type (handle.Value, reflectedType.Value);
+                       if (pi == null)
+                               throw new ArgumentException ("The property handle and the type handle are incompatible.");
+                       return pi;
+               }
        }
 }
diff --git a/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs b/mcs/class/corlib/System.Security/SafeAccessTokenHandle.cs
deleted file mode 100644 (file)
index d7682bf..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Win32.SafeHandles
-{
-       public sealed class SafeAccessTokenHandle : SafeHandle
-       {
-               public override bool IsInvalid {
-                       get {
-                               return handle == IntPtr.Zero;
-                       }
-               }
-
-               public SafeAccessTokenHandle ()
-                       : base (IntPtr.Zero, true)
-               {
-                       
-               }
-
-               protected override bool ReleaseHandle()
-               {
-                       return true;
-               }
-       }
-}
index fc1cd5448262fa7c0dc7720e5bec7d2ec910409f..ff76486877cfb2427ccf2b5f9069985552b4c3d2 100644 (file)
@@ -912,7 +912,7 @@ namespace System
 
                public bool IsDaylightSavingTime (DateTimeOffset dateTimeOffset)
                {
-                       throw new NotImplementedException ();
+                       return IsDaylightSavingTime (dateTimeOffset.DateTime);
                }
 
                internal DaylightTime GetDaylightChanges (int year)
index 897342eba7f20d6483be863287879c2b469029e1..c3ab9935350c9b1f3071960bda46d06d97b74d81 100644 (file)
@@ -688,6 +688,11 @@ namespace MonoTests.System.IO
                                                i, root + test [i, 0], ex.GetType ()));
                                }
                        }
+
+                       // These cases require that we don't pass a root to GetFullPath - it should return the proper drive root.
+                       string root4 = Path.GetPathRoot(Directory.GetCurrentDirectory());
+                       Assert.AreEqual(root4, Path.GetFullPath(@"\"));
+                       Assert.AreEqual(root4, Path.GetFullPath("/"));
                }
 
                [Test]
index d4dcbcef6ec3a15b59370d05b2747cd6c868a993..5483974809bed349bde1a190afdd83810cd4038c 100644 (file)
@@ -36,6 +36,7 @@ using System.Runtime.Serialization;
 using System.Security.Permissions;
 using System.Collections.Generic;
 using System.Threading;
+using MonoTests.Helpers;
 
 
 namespace MonoTests.System.Runtime.CompilerServices {
@@ -197,11 +198,9 @@ namespace MonoTests.System.Runtime.CompilerServices {
                var cwt = new ConditionalWeakTable <object,object> ();
                List<object> keepAlive = null;
                List<WeakReference> keys = null;
-               Thread t = new Thread (delegate () {
+               FinalizerHelpers.PerformNoPinAction (delegate () {
                                FillStuff (cwt, out keepAlive, out keys);
                        });
-               t.Start ();
-               t.Join ();
 
                GC.Collect ();
 
@@ -254,10 +253,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                cwt.Add (b, new object ());
 
                List<WeakReference> res = null;
-               ThreadStart dele = () => { res = FillWithNetwork (cwt); };
-               var th = new Thread(dele);
-               th.Start ();
-               th.Join ();
+               FinalizerHelpers.PerformNoPinAction (() => { res = FillWithNetwork (cwt); });
 
                GC.Collect ();
                GC.Collect ();
@@ -301,16 +297,12 @@ namespace MonoTests.System.Runtime.CompilerServices {
                List<WeakReference> res, res2;
                res = res2 = null;
 
-               ThreadStart dele = () => {
+               FinalizerHelpers.PerformNoPinAction (() => {
                        res = FillWithNetwork2 (cwt);
                        ForcePromotion ();
                        k = FillReachable (cwt);
                        res2 = FillWithNetwork2 (cwt);
-               };
-
-               var th = new Thread(dele);
-               th.Start ();
-               th.Join ();
+               });
 
                GC.Collect ();
 
@@ -445,10 +437,7 @@ namespace MonoTests.System.Runtime.CompilerServices {
                        Assert.Ignore ("Not working on Boehm.");
                lock (_lock1) { 
                        var cwt = new ConditionalWeakTable <object,object> ();
-                       ThreadStart dele = () => { FillWithFinalizable (cwt); };
-                       var th = new Thread(dele);
-                       th.Start ();
-                       th.Join ();
+                       FinalizerHelpers.PerformNoPinAction (() => { FillWithFinalizable (cwt); });
                        GC.Collect ();
                        GC.Collect ();
 
index 5ede3b2ea8fd17d38ab774ed47a20e5cdc5cad8b..55a6ea2ecfe4c6d11c609802597b1c11d7f5d63b 100644 (file)
@@ -359,6 +359,21 @@ namespace MonoTests.System
                                Assert.IsFalse (tzi.IsDaylightSavingTime (date));
                                Assert.AreEqual (new TimeSpan (2,0,0), tzi.GetUtcOffset (date));
                        }
+
+                       [Test] //Covers #41349
+                       public void TestIsDST_DateTimeOffset ()
+                       {
+                               TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Europe/Athens");
+                               var date = new DateTime (2014, 3, 30 , 2, 0, 0);
+                               var offset = tzi.GetUtcOffset (date);
+                               var dateOffset = new DateTimeOffset (date, offset);
+                               Assert.IsFalse (tzi.IsDaylightSavingTime (dateOffset));
+
+                               date = new DateTime (2014, 3, 30 , 3, 0, 0);
+                               offset = tzi.GetUtcOffset (date);
+                               dateOffset = new DateTimeOffset (date, offset);
+                               Assert.IsTrue (tzi.IsDaylightSavingTime (dateOffset));
+                       }
                }
                
                [TestFixture]
index 1419dea79edd94d11e69acf8d297f169d411a4ec..b36d3d446bc4cea25a3674a2ca7ffe6724df5484 100644 (file)
@@ -25,6 +25,7 @@ Mono.Globalization.Unicode/NormalizationTableUtil.cs
 Mono/Runtime.cs
 Mono/RuntimeStructs.cs
 Mono/RuntimeHandles.cs
+Mono/SafeGPtrArrayHandle.cs
 Mono/DataConverter.cs
 Mono.Interop/ComInteropProxy.cs
 Mono.Interop/IDispatch.cs
@@ -617,7 +618,6 @@ System.Security/NamedPermissionSet.cs
 System.Security/PermissionBuilder.cs
 System.Security/PermissionSet.cs
 System.Security/PolicyLevelType.cs
-System.Security/SafeAccessTokenHandle.cs
 System.Security/SecureString.cs
 System.Security/SecurityElement.cs
 System.Security/SecurityFrame.cs
@@ -1395,6 +1395,7 @@ ReferenceSources/SecurityContext.cs
 ../referencesource/mscorlib/system/security/attributes.cs
 ../referencesource/mscorlib/system/security/securitycontext.cs
 ../referencesource/mscorlib/system/security/securitydocument.cs
+../referencesource/mscorlib/system/security/safesecurityhandles.cs
 
 ../referencesource/mscorlib/system/security/claims/Claim.cs
 ../referencesource/mscorlib/system/security/claims/ClaimsIdentity.cs
index b7cf0d04b3a6a481de7fc9391d73868df0a04c7b..7dfe833f16380903f66c61071e763743e1c1d92d 100644 (file)
@@ -513,4 +513,4 @@ System.Threading/CountdownEventTests.cs
 System/AggregateExceptionTests.cs
 System.Threading/ThreadLocalTests.cs
 System.Threading/SpinLockTests.cs
-
+../../test-helpers/TestHelpers.cs
index 49adc58c26a185a2e34918a5fc2083620178c8a8..8161a3be2a0d9a94b8952f9f2becd7dc8c84b4d6 100644 (file)
@@ -38,7 +38,11 @@ namespace Microsoft.Win32.SafeHandles {
         [SecurityCritical]
         protected override bool ReleaseHandle()
         {
+#if MONO
+            return true;
+#else
             return Win32Native.CloseHandle(handle);
+#endif
         }
     }
 
diff --git a/mcs/class/test-helpers/TestHelpers.cs b/mcs/class/test-helpers/TestHelpers.cs
new file mode 120000 (symlink)
index 0000000..5cf769a
--- /dev/null
@@ -0,0 +1 @@
+../../../mono/mini/TestHelpers.cs
\ No newline at end of file
index edd6db37398d6b56afa7d9a3d181142b0605c9c8..bc78f97fd18fdcc0b5dac527f8f4c7aed782533e 100644 (file)
@@ -1,6 +1,8 @@
 // InstrToken.cs\r
 // Author: Sergey Chaban (serge@wildwestsoftware.com)\r
 \r
+#if !MOBILE\r
+\r
 using System;\r
 using System.Reflection.Emit;\r
 \r
@@ -103,3 +105,5 @@ namespace Mono.ILASM {
        }\r
 \r
 }\r
+\r
+#endif\r
index d1eb34c0f726f10b076c472c03b518128e99aa76..004d29f8bd25dec87cc69901bd57b869d37cf9b5 100644 (file)
@@ -909,7 +909,7 @@ namespace Mono.CSharp
                                        Builder.Save (module.Builder.ScopeName, pekind, machine);
                                }
                        } catch (ArgumentOutOfRangeException) {
-                               Report.Error (16, "Output file `{0}' exceeds the 4GB limit");
+                               Report.Error (16, "Output file `{0}' exceeds the 4GB limit", name);
                        } catch (Exception e) {
                                Report.Error (16, "Could not write to file `{0}'. {1}", name, e.Message);
                        }
index 3e9d8837138e8cb8d1930f9f53f8b58e32f00333..c3a97993c6a75da170fc7363ef3d888cdbd834f2 100644 (file)
@@ -12,10 +12,12 @@ namespace Mono
        class AssemblyLocationProvider
        {
                AssemblyDefinition assembly;
+               Logger logger;
 
-               public AssemblyLocationProvider (string assemblyPath)
+               public AssemblyLocationProvider (string assemblyPath, Logger logger)
                {
                        assemblyPath = Path.GetFullPath (assemblyPath);
+                       this.logger = logger;
 
                        if (!File.Exists (assemblyPath))
                                throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
@@ -33,9 +35,17 @@ namespace Mono
                        var nested = sfData.TypeFullName.Split ('+');
                        var types = assembly.MainModule.Types;
                        foreach (var ntype in nested) {
-                               type = types.FirstOrDefault (t => t.Name == ntype);
-                               if (type == null)
+                               if (type == null) {
+                                       // Use namespace first time.
+                                       type = types.FirstOrDefault (t => t.FullName == ntype);
+                               } else {
+                                       type = types.FirstOrDefault (t => t.Name == ntype);
+                               }
+
+                               if (type == null) {
+                                       logger.LogWarning ("Could not find type: {0}", ntype);
                                        return false;
+                               }
 
                                types = type.NestedTypes;
                        }
@@ -44,8 +54,10 @@ namespace Mono
                        var methodName = sfData.MethodSignature.Substring (0, parensStart).TrimEnd ();
                        var methodParameters = sfData.MethodSignature.Substring (parensStart);
                        var method = type.Methods.FirstOrDefault (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters));
-                       if (method == null)
+                       if (method == null) {
+                               logger.LogWarning ("Could not find method: {0}", methodName);
                                return false;
+                       }
 
                        int ilOffset;
                        if (sfData.IsILOffset) {
diff --git a/mcs/tools/mono-symbolicate/Logger.cs b/mcs/tools/mono-symbolicate/Logger.cs
new file mode 100644 (file)
index 0000000..4dd1174
--- /dev/null
@@ -0,0 +1,48 @@
+using System;
+
+namespace Mono
+{
+       public class Logger
+       {
+               public enum Level
+               {
+                       Debug = 1,
+                       Warning = 2,
+                       Error = 3,
+                       None = 4,
+               }
+
+               Level level;
+               Action<string> logAction;
+
+               public Logger (Level level, Action<string> logAction)
+               {
+                       this.level = level;
+                       this.logAction = logAction;
+               }
+
+               public void LogDebug (string str, params string[] vals)
+               {
+                       Log (Level.Debug, "Debug: " + str, vals);
+               }
+
+               public void LogWarning (string str, params string[] vals)
+               {
+                       Log (Level.Warning, "Warning: " + str, vals);
+               }
+
+               public void LogError (string str, params string[] vals)
+               {
+                       Log (Level.Error, "Error: " + str, vals);
+               }
+
+               private void Log (Level msgLevel, string str, params string[] vals)
+               {
+                       if ((int) level > (int) msgLevel)
+                               return;
+
+                       logAction (string.Format (str, vals));
+               }
+       }
+}
+
index 62dd73f7f226821297ce0dcbe22708d28a2f9570..67c98b7dd145ff06c3559bb6a4cf9937f4754ca9 100644 (file)
@@ -26,7 +26,7 @@ SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
 CHECK_DIFF = @\
        $(MONO) $(TEST_EXE) > $(STACKTRACE_FILE); \
        $(MONO) $(LIB_PATH)/$(PROGRAM) $(MSYM_DIR) $(STACKTRACE_FILE) > $(SYMBOLICATE_RAW_FILE); \
-       sed "s/).*Test\//) in /" $(SYMBOLICATE_RAW_FILE) | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > $(SYMBOLICATE_RESULT_FILE); \
+       sed "s/) .* in .*\/mcs\//) in mcs\//" $(SYMBOLICATE_RAW_FILE) | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > $(SYMBOLICATE_RESULT_FILE); \
        DIFF=$$(diff $(SYMBOLICATE_RESULT_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
        if [ ! -z "$$DIFF" ]; then \
                echo "Symbolicate tests failed."; \
@@ -43,7 +43,8 @@ PREPARE_OUTDIR = @\
 
 COMPILE = \
        $(CSCOMPILE) $(TEST_CS) -out:$(TEST_EXE); \
-       $(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(OUT_DIR)
+       $(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(OUT_DIR); \
+       $(MONO) $(LIB_PATH)/$(PROGRAM) store-symbols $(MSYM_DIR) $(LIB_PATH);
 
 check: test-local
 
diff --git a/mcs/tools/mono-symbolicate/README b/mcs/tools/mono-symbolicate/README
deleted file mode 100644 (file)
index 8dfcc9a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-Mono Symbolicate Tool - README
-
-Usage
------------------------------
-
-mono-symbolicate exefile stacktracesfile [directories...]
-
-Description
------------------------------
-
-mono-symbolicate is a tool that converts a stack trace with `<filename unknown>:0`
-into one with file names and line numbers.
-
-The output of calling this tool will be the provided stacktracesfile where
-`<filename unknown>:0` parts are replaced by a file name and a line number.
-
-For the tool to work it needs to load referenced assemblies, it will first look
-in the same folder as exefile then from one of the provided directories.
-
-The tool assumes that the folder with a referenced assembly called for example
-name.dll will also include name.dll.mdb, if the referenced assembly is AOT
-compiled then the tool is also expecting to find name.dll.msym.
\ No newline at end of file
diff --git a/mcs/tools/mono-symbolicate/README.md b/mcs/tools/mono-symbolicate/README.md
new file mode 100644 (file)
index 0000000..65988ad
--- /dev/null
@@ -0,0 +1,92 @@
+Mono Symbolicate Tool - README
+
+Usage
+-----------------------------
+
+```
+mono-symbolicate <msym dir> <input file>
+mono-symbolicate store-symbols <msym dir> [<dir>]+
+```
+
+Description
+-----------------------------
+
+`mono-symbolicate` is a tool that converts a stack trace with `<filename unknown>:0`
+into one with file names and line numbers.
+
+The output of calling this tool will be the provided stacktracesfile where
+`<filename unknown>:0` parts are replaced by a file name and a line number.
+
+The tool uses the AOTID and MVID metadata contained at the end of the stacktraces,
+to retrieve the symbols mapping code into line numbers from a provided symbol directory.
+
+When `mono-symbolicate` is called with a symbol directory and a file containing a stacktrace:
+``` mono-symbolicate <msym dir> <input file> ```
+The tool writes into stdout the file contents while adding file location to stack frames when
+it is possible to symbolicate with the symbols available on the symbol directory.
+
+## Symbol directory
+The symbol directory contains subfolder named as a MVID or AOTID.
+ - MVID subfolders contain .dll/.exe and .mdb files.
+ - AOTID subfolder contain .msym files.
+
+Managed assemblies can be added by calling `mono-symbolicate` with the command `store-symbols`:
+```
+mono-symbolicate store-symbols <msym dir> [<dir>]+
+```
+
+.msym are generated and stored automatically in an AOTID subfolder at the same time the assembly
+is compiled ahead of time, by running a command such as:
+```
+mono --aot=msym-dir=<msym dir>
+```
+
+## Practical example
+
+If you do not have `mono-symbolicate` installed on your system you can set it to the built one by doing:
+```
+alias mono="MONO_PATH=../../class/lib/net_4_x ../../../runtime/mono-wrapper"
+alias mono-symbolicate="mono ../../class/lib/net_4_x/mono-symbolicate.exe"
+```
+
+For the example we will use the csharp file `Test/StackTraceDumper.cs` which contains a program that
+outputs a larger number of stacktraces.
+
+The first step is to compile our program with debug data.
+```
+mkdir example
+mcs -debug -out:example/Program.exe Test/StackTraceDumper.cs
+```
+
+Next we need to create the symbol directory and store all the symbols we might need while symbolicating.
+```
+mkdir example/msym-dir
+mono-symbolicate store-symbols example/msym-dir example
+```
+
+After running `mono-symbolicate store-symbols` command the directory `example/msym-dir` should have a subdirectory
+named as a minified GUID containing the Program.exe and Program.mdb.
+
+If we want to symbolicate the stacktraces containing BCL stack frames we need to add those symbols too.
+```
+mono-symbolicate store-symbols example/msym-dir ../../class/lib/net_4_x
+```
+
+We delete the mdb file so on our next step the generated stack trace won't have line numbers.
+```
+rm example/*.mdb
+```
+
+Now we can run our program and dump its output to `example/out`.
+```
+mono example/Program.exe > example/out
+```
+
+Doing `cat example/out` shows us a large number of stacktraces without any line number.
+
+We can finally run `mono-symbolicate` to replace all the `<filename unknown>:0` with actually useful file names and line numbers.
+```
+mono-symbolicate example/msym-dir example/out
+```
+The previous command should display the same as `cat example/out` but this time with file names and line numbers.
+
index cc9b44c91e4c84433198d5d8f10e89c0bf52e83c..ed5134709cd774a025ee43a933407712df6d3d55 100644 (file)
@@ -1,3 +1,4 @@
+using System;
 using System.Text.RegularExpressions;
 using System.Globalization;
 
@@ -14,6 +15,8 @@ namespace Mono
                public readonly uint MethodIndex;
                public readonly string Line;
 
+               public readonly bool IsValid;
+
                public string File { get; private set; }
                public int LineNumber { get; private set; }
 
@@ -27,6 +30,15 @@ namespace Mono
                        Offset = offset;
                        IsILOffset = isILOffset;
                        MethodIndex = methodIndex;
+
+                       IsValid = true;
+               }
+
+               private StackFrameData (string line)
+               {
+                       LineNumber = -1;
+
+                       Line = line;
                }
 
                public static bool TryParse (string line, out StackFrameData stackFrame)
@@ -34,8 +46,13 @@ namespace Mono
                        stackFrame = null;
 
                        var match = regex.Match (line);
-                       if (!match.Success)
+                       if (!match.Success) {
+                               if (line.Trim ().StartsWith ("at ", StringComparison.InvariantCulture)) {
+                                       stackFrame = new StackFrameData (line);
+                                       return true;
+                               }
                                return false;
+                       }
 
                        string typeFullName, methodSignature;
                        var methodStr = match.Groups ["Method"].Value.Trim ();
index 466f18dc68c82b4bf4fb2d48bd51b7d7faae5540..42990e5325e2243e994deda826b8c5dbda616ad4 100644 (file)
@@ -12,14 +12,21 @@ namespace Mono
        public class SymbolManager
        {
                string msymDir;
+               Logger logger;
 
-               public SymbolManager (string msymDir) {
+               public SymbolManager (string msymDir, Logger logger) {
                        this.msymDir = msymDir;
+                       this.logger = logger;
                }
 
                internal bool TryResolveLocation (StackFrameData sfData, string mvid, string aotid)
                {
+                       if (mvid == null)
+                               return false;
+
                        var assemblyLocProvider = GetOrCreateAssemblyLocationProvider (mvid);
+                       if (assemblyLocProvider == null)
+                               return false;
 
                        SeqPointInfo seqPointInfo = null;
                        if (!sfData.IsILOffset && aotid != null)
@@ -36,19 +43,23 @@ namespace Mono
                                return assemblies[mvid];
 
                        var mvidDir = Path.Combine (msymDir, mvid);
-                       if (!Directory.Exists (mvidDir))
-                               throw new Exception (string.Format("MVID directory does not exist: {0}", mvidDir));
+                       if (!Directory.Exists (mvidDir)) {
+                               logger.LogWarning ("MVID directory does not exist: {0}", mvidDir);
+                               return  null;
+                       }
 
                        string assemblyPath = null;
                        var exeFiles = Directory.GetFiles (mvidDir, "*.exe");
                        var dllFiles = Directory.GetFiles (mvidDir, "*.dll");
 
-                       if (exeFiles.Length + dllFiles.Length != 1)
-                               throw new Exception (string.Format ("MVID directory should include one assembly: {0}", mvidDir));
+                       if (exeFiles.Length + dllFiles.Length != 1) {
+                               logger.LogError ("MVID directory should include one assembly: {0}", mvidDir);
+                               return null;
+                       }
 
                        assemblyPath = (exeFiles.Length > 0)? exeFiles[0] : dllFiles[0];
 
-                       var locProvider = new AssemblyLocationProvider (assemblyPath);
+                       var locProvider = new AssemblyLocationProvider (assemblyPath, logger);
 
                        assemblies.Add (mvid, locProvider);
 
@@ -63,8 +74,10 @@ namespace Mono
                                return seqPointInfos[aotid];
 
                        var aotidDir = Path.Combine (msymDir, aotid);
-                       if (!Directory.Exists (aotidDir))
-                               throw new Exception (string.Format("AOTID directory does not exist: {0}", aotidDir));
+                       if (!Directory.Exists (aotidDir)) {
+                               logger.LogError ("AOTID directory does not exist: {0}", aotidDir);
+                               return null;
+                       }
 
                        string msymFile = null;
                        var msymFiles = Directory.GetFiles(aotidDir, "*.msym");
@@ -86,6 +99,7 @@ namespace Mono
                                foreach (var assemblyPath in assemblies) {
                                        var mdbPath = assemblyPath + ".mdb";
                                        if (!File.Exists (mdbPath)) {
+                                               logger.LogWarning ("Directory {0} contains {1} but no mdb {2}.", dir, Path.GetFileName (assemblyPath), Path.GetFileName (mdbPath));
                                                // assemblies without mdb files are useless
                                                continue;
                                        }
@@ -95,6 +109,12 @@ namespace Mono
                                        var mvid = assembly.MainModule.Mvid.ToString ("N");
                                        var mvidDir = Path.Combine (msymDir, mvid);
 
+                                       if (Directory.Exists (mvidDir)) {
+                                               try {
+                                                       Directory.Delete (mvidDir, true);
+                                               } catch (DirectoryNotFoundException e) {}
+                                       }
+
                                        Directory.CreateDirectory (mvidDir);
 
                                        var mvidAssemblyPath = Path.Combine (mvidDir, Path.GetFileName (assemblyPath));
index 78e2db9a8986eea92339c3eb772d778dfcd5a1cf..726997d21345d6c3b16ca9f8caf5353eb77e7429 100644 (file)
@@ -46,6 +46,11 @@ class StackTraceDumper {
                Catch (() => InnerGenericClass<string>.InnerInnerGenericClass<int>.ThrowException ("Stack trace with 2 inner generic class and generic overload"));
 
                Catch (() => InnerGenericClass<int>.InnerInnerGenericClass<string>.ThrowException ("Stack trace with 2 inner generic class and generic overload"));
+
+               Catch (() => {
+                       var d = new Dictionary<string, string> ();
+                       d.ContainsKey (null); // ArgumentNullException
+               });
        }
 
        public static void Catch (Action action)
index a3cd72acd0ef271381ede360b4d50799ca61c8fb..b93d05c7a1392a55cac1e4a1e60a5e18bc364326 100644 (file)
 System.Exception: Stacktrace with 1 frame
-  at StackTraceDumper.Main () in StackTraceDumper.cs:9 
+  at StackTraceDumper.Main () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:9 
 Stacktrace:
-  at StackTraceDumper.Main () in StackTraceDumper.cs:9 
+  at StackTraceDumper.Main () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:9 
 
 System.Exception: Stacktrace with 2 frames
-  at StackTraceDumper.<Main>m__0 () in StackTraceDumper.cs:16 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.<Main>m__0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.<Main>m__0 () in StackTraceDumper.cs:16 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.<Main>m__0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stacktrace with 3 frames
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.<Main>m__1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.<Main>m__1 () in StackTraceDumper.cs:18 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.<Main>m__1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stacktrace with 4 frames
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
-  at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
-Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:78 
-  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in StackTraceDumper.cs:76 
-  at StackTraceDumper.<Main>m__2 () in StackTraceDumper.cs:20 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 
+  at StackTraceDumper.<Main>m__2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+Stacktrace:
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 
+  at StackTraceDumper.<Main>m__2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with method overload using ref parameter
-  at StackTraceDumper.ThrowException (System.String& message) in StackTraceDumper.cs:70 
-  at StackTraceDumper.<Main>m__3 () in StackTraceDumper.cs:24 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 
+  at StackTraceDumper.<Main>m__3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String& message) in StackTraceDumper.cs:70 
-  at StackTraceDumper.<Main>m__3 () in StackTraceDumper.cs:24 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 
+  at StackTraceDumper.<Main>m__3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with method overload using out parameter
-  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in StackTraceDumper.cs:83 
-  at StackTraceDumper.<Main>m__4 () in StackTraceDumper.cs:29 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 
+  at StackTraceDumper.<Main>m__4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in StackTraceDumper.cs:83 
-  at StackTraceDumper.<Main>m__4 () in StackTraceDumper.cs:29 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 
+  at StackTraceDumper.<Main>m__4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with 1 generic parameter
-  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in StackTraceDumper.cs:88 
-  at StackTraceDumper.<Main>m__5 () in StackTraceDumper.cs:32 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 
+  at StackTraceDumper.<Main>m__5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in StackTraceDumper.cs:88 
-  at StackTraceDumper.<Main>m__5 () in StackTraceDumper.cs:32 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 
+  at StackTraceDumper.<Main>m__5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with 2 generic parameters
-  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in StackTraceDumper.cs:108 
-  at StackTraceDumper.<Main>m__6 () in StackTraceDumper.cs:34 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 
+  at StackTraceDumper.<Main>m__6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in StackTraceDumper.cs:108 
-  at StackTraceDumper.<Main>m__6 () in StackTraceDumper.cs:34 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 
+  at StackTraceDumper.<Main>m__6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack frame with generic method overload
-  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in StackTraceDumper.cs:93 
-  at StackTraceDumper.<Main>m__7 () in StackTraceDumper.cs:36 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 
+  at StackTraceDumper.<Main>m__7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in StackTraceDumper.cs:93 
-  at StackTraceDumper.<Main>m__7 () in StackTraceDumper.cs:36 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 
+  at StackTraceDumper.<Main>m__7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner class
-  at StackTraceDumper+InnerClass.ThrowException (System.String message) in StackTraceDumper.cs:114 
-  at StackTraceDumper.<Main>m__8 () in StackTraceDumper.cs:38 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 
+  at StackTraceDumper.<Main>m__8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerClass.ThrowException (System.String message) in StackTraceDumper.cs:114 
-  at StackTraceDumper.<Main>m__8 () in StackTraceDumper.cs:38 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 
+  at StackTraceDumper.<Main>m__8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner generic class
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in StackTraceDumper.cs:121 
-  at StackTraceDumper.<Main>m__9 () in StackTraceDumper.cs:40 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 
+  at StackTraceDumper.<Main>m__9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in StackTraceDumper.cs:121 
-  at StackTraceDumper.<Main>m__9 () in StackTraceDumper.cs:40 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 
+  at StackTraceDumper.<Main>m__9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Generic to string:string
 
 System.Exception: Stack trace with inner generic class and method generic parameter
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in StackTraceDumper.cs:127 
-  at StackTraceDumper.<Main>m__A () in StackTraceDumper.cs:42 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 
+  at StackTraceDumper.<Main>m__A () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in StackTraceDumper.cs:127 
-  at StackTraceDumper.<Main>m__A () in StackTraceDumper.cs:42 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 
+  at StackTraceDumper.<Main>m__A () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in StackTraceDumper.cs:132 
-  at StackTraceDumper.<Main>m__B () in StackTraceDumper.cs:44 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 
+  at StackTraceDumper.<Main>m__B () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in StackTraceDumper.cs:132 
-  at StackTraceDumper.<Main>m__B () in StackTraceDumper.cs:44 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 
+  at StackTraceDumper.<Main>m__B () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with 2 inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in StackTraceDumper.cs:138 
-  at StackTraceDumper.<Main>m__C () in StackTraceDumper.cs:46 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 
+  at StackTraceDumper.<Main>m__C () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in StackTraceDumper.cs:138 
-  at StackTraceDumper.<Main>m__C () in StackTraceDumper.cs:46 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 
+  at StackTraceDumper.<Main>m__C () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 
 System.Exception: Stack trace with 2 inner generic class and generic overload
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in StackTraceDumper.cs:143 
-  at StackTraceDumper.<Main>m__D () in StackTraceDumper.cs:48 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 
+  at StackTraceDumper.<Main>m__D () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+Stacktrace:
+  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 
+  at StackTraceDumper.<Main>m__D () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
+
+System.ArgumentNullException: Value cannot be null.
+Parameter name: key
+  at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 
+  at StackTraceDumper.<Main>m__E () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
 Stacktrace:
-  at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in StackTraceDumper.cs:143 
-  at StackTraceDumper.<Main>m__D () in StackTraceDumper.cs:48 
-  at StackTraceDumper.Catch (System.Action action) in StackTraceDumper.cs:54 
+  at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 
+  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 
+  at StackTraceDumper.<Main>m__E () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 
+  at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 
index b6f80e99aceec3c0d00a110dc0e07c8945041c66..daa4ebfb64bb8c47fdda4633e09ef01953ee0d73 100644 (file)
@@ -4,4 +4,5 @@ SeqPointInfo.cs
 StackFrameData.cs
 StackTraceMetadata.cs
 SymbolManager.cs
+Logger.cs
 ../../class/Mono.Options/Mono.Options/Options.cs
index 6479a48b8637c4fd6f8835c320ca27c168343b88..78b6945f149ed3dc0f0a76949160e86121d476a3 100644 (file)
@@ -23,6 +23,8 @@ namespace Mono
                        }
                }
 
+               static Logger logger;
+
                public static int Main (String[] args)
                {
                        var showHelp = false;
@@ -30,17 +32,12 @@ namespace Mono
 
                        Command cmd = null;
 
-                       if (args[0] == "store-symbols")
-                               cmd = new Command (StoreSymbolsAction, 2);
-
-                       if (cmd != null) {
-                               args = args.Skip (1).ToArray ();
-                       } else {
-                               cmd = new Command (SymbolicateAction, 2, 2);
-                       }
+                       var logLevel = Logger.Level.Warning;
 
                        var options = new OptionSet {
                                { "h|help", "Show this help", v => showHelp = true },
+                               { "q", "Quiet, warnings are not displayed", v => logLevel = Logger.Level.Error },
+                               { "v", "Verbose, log debug messages", v => logLevel = Logger.Level.Debug },
                        };
 
                        try {
@@ -50,15 +47,26 @@ namespace Mono
                                showHelp = true;
                        }
 
+                       if (extra.Count > 0 && extra[0] == "store-symbols")
+                               cmd = new Command (StoreSymbolsAction, 2);
+
+                       if (cmd != null) {
+                               extra.RemoveAt (0);
+                       } else {
+                               cmd = new Command (SymbolicateAction, 2, 2);
+                       }
+
                        if (showHelp || extra == null || extra.Count < cmd.MinArgCount || extra.Count > cmd.MaxArgCount) {
-                               Console.Error.WriteLine ("Usage: symbolicate <msym dir> <input file>");
-                               Console.Error.WriteLine ("       symbolicate store-symbols <msym dir> [<dir>]+");
+                               Console.Error.WriteLine ("Usage: symbolicate [options] <msym dir> <input file>");
+                               Console.Error.WriteLine ("       symbolicate [options] store-symbols <msym dir> [<dir>]+");
                                Console.WriteLine ();
                                Console.WriteLine ("Available options:");
                                options.WriteOptionDescriptions (Console.Out);
                                return 1;
                        }
 
+                       logger = new Logger (logLevel, msg => Console.Error.WriteLine (msg));
+
                        cmd.Action (extra);
 
                        return 0;
@@ -69,7 +77,7 @@ namespace Mono
                        var msymDir = args [0];
                        var inputFile = args [1];
 
-                       var symbolManager = new SymbolManager (msymDir);
+                       var symbolManager = new SymbolManager (msymDir, logger);
 
                        using (StreamReader r = new StreamReader (inputFile)) {
                                var sb = Process (r, symbolManager);
@@ -82,7 +90,7 @@ namespace Mono
                        var msymDir = args[0];
                        var lookupDirs = args.Skip (1).ToArray ();
 
-                       var symbolManager = new SymbolManager (msymDir);
+                       var symbolManager = new SymbolManager (msymDir, logger);
 
                        symbolManager.StoreSymbols (lookupDirs);
                }
@@ -137,11 +145,14 @@ namespace Mono
                                aotid = aotidMetadata.Value;
 
                        var linesMvid = ProcessLinesMVID (metadata);
-                       var lineNumber = 0;
+                       var lineNumber = -1;
                        foreach (var sfData in stackFrames) {
                                string mvid = null;
+                               lineNumber++;
+                               if (!sfData.IsValid)
+                                       continue;
                                if (linesMvid.ContainsKey (lineNumber))
-                                       mvid = linesMvid [lineNumber++];
+                                       mvid = linesMvid [lineNumber];
 
                                symbolManager.TryResolveLocation (sfData, mvid, aotid);
 
index 70457756436001b8c749fe9c846bd6e0a218c05c..9d6e914532dad6265dc577dd2bbe6c0e176d5895 100644 (file)
@@ -20,18 +20,35 @@ else
 install-local: install-extras
 endif
 
+PORTABLE_TARGETS_SRC=../../../external/buildtools/src/Portable/Targets
+PCL5_FX_SRC=../../../external/buildtools/src/Portable/Frameworks/v5.0
+
 NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
+PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
 VS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/VisualStudio
 PORTABLE_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/Portable
+NUGET_BUILDTASKS_TARGETS_DIR = $(mono_libdir)/mono/xbuild/Microsoft/NuGet
+
+ifeq (14.0, $(XBUILD_VERSION))
+install-extras: install-versioned-files install-global-files
+else
+install-extras: install-versioned-files
+endif
 
+#install files into xbuild's versioned locations
+install-versioned-files: install-bin-data install-nuget-imports
 
-install-extras: install-bin-data install-frameworks install-pcl-targets install-web-targets
+#install files that are only installed once across all xbuild versions
+install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets
 
 install-bin-data:
        $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
        $(INSTALL_DATA) data/xbuild.rsp $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.tasks $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.targets $(DESTDIR)$(XBUILD_BIN_DIR)
+ifeq (14.0, $(XBUILD_VERSION))
+       $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.Common.props $(DESTDIR)$(XBUILD_BIN_DIR)/../
+endif
        $(INSTALL_DATA) data/$(XBUILD_VERSION)/Microsoft.CSharp.targets $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/Microsoft.Build.xsd $(DESTDIR)$(XBUILD_BIN_DIR)
        $(INSTALL_DATA) data/Microsoft.VisualBasic.targets $(DESTDIR)$(XBUILD_BIN_DIR)
@@ -62,20 +79,16 @@ install-frameworks:
        $(INSTALL_DATA) frameworks/net_4.6.1.xml $(DESTDIR)$(NETFRAMEWORK_DIR)/v4.6.1/RedistList/FrameworkList.xml
 
 install-pcl-targets:
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.0.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.0/Microsoft.Portable.VisualBasic.targets
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.5/Microsoft.Portable.VisualBasic.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
-       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6
-       $(INSTALL_DATA) targets/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.Common.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.CSharp_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.CSharp.targets
-       $(INSTALL_DATA) targets/Microsoft.Portable.VisualBasic_4.5.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/v4.6/Microsoft.Portable.VisualBasic.targets
+       $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.props $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.props
+       $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/Microsoft.Portable.Core.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/Microsoft.Portable.Core.targets
+
+       for VERSION in v4.0 v4.5 v4.6 v5.0; do \
+               $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.Common.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.Common.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.CSharp.targets; \
+               $(INSTALL_DATA) $(PORTABLE_TARGETS_SRC)/$$VERSION/Microsoft.Portable.VisualBasic.targets $(DESTDIR)$(PORTABLE_TARGETS_DIR)/$$VERSION/Microsoft.Portable.VisualBasic.targets; \
+       done
 
 install-web-targets:
        $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v9.0/WebApplications
@@ -89,6 +102,31 @@ install-web-targets:
        $(MKINSTALLDIRS) $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
        $(INSTALL_DATA) targets/Microsoft.WebApplication.targets $(DESTDIR)$(VS_TARGETS_DIR)/v14.0/WebApplications
 
+NUGET_BUILDTASKS_REPO_DIR=$(topdir)/../external/nuget-buildtasks
+
+install-nuget-targets:
+       $(MKINSTALLDIRS) $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.props $(DESTDIR)$(NUGET_BUILDTASKS_TARGETS_DIR)
+
+install-nuget-imports:
+ifeq (14.0, $(XBUILD_VERSION))
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
+       $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props $(DESTDIR)$(XBUILD_BIN_DIR)/../Imports/Microsoft.Common.props/ImportBefore
+       $(INSTALL_DATA) $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets $(DESTDIR)$(XBUILD_BIN_DIR)/../Microsoft.Common.targets/ImportAfter
+endif
+
+# The .NETPortable,Version=v5.0 framework contains no assemblies, and essentially just fills the requirement
+# for a framework moniker. When using it, assemblies are provided by NuGet packages such as .NETStandard.Library
+install-pcl5-framework:
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/RedistList
+       $(INSTALL_DATA) $(PCL5_FX_SRC)/FrameworkList.xml $(DESTDIR)$(PCL5_FX_DIR)/RedistList/FrameworkList.xml
+
+       $(MKINSTALLDIRS) $(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/.NET Framework 4.6.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/.NET Framework 4.6.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
+       $(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
 
 EXTRA_DISTFILES = \
        data/xbuild.rsp \
@@ -104,6 +142,7 @@ EXTRA_DISTFILES = \
        data/4.0/Microsoft.Common.targets \
        data/12.0/Microsoft.Common.targets \
        data/14.0/Microsoft.Common.targets \
+       data/14.0/Microsoft.Common.props \
        data/2.0/Microsoft.CSharp.targets \
        data/3.5/Microsoft.CSharp.targets \
        data/4.0/Microsoft.CSharp.targets \
@@ -122,13 +161,10 @@ EXTRA_DISTFILES = \
        frameworks/net_4.5.2.xml \
        frameworks/net_4.6.xml \
        frameworks/net_4.6.1.xml \
-       targets/Microsoft.Portable.CSharp_4.0.targets \
-       targets/Microsoft.Portable.CSharp_4.5.targets \
-       targets/Microsoft.Portable.VisualBasic_4.0.targets \
-       targets/Microsoft.Portable.VisualBasic_4.5.targets \
-       targets/Microsoft.Portable.Common.targets \
-       targets/Microsoft.Portable.Core.targets \
-       targets/Microsoft.Portable.Core.props \
-       targets/Microsoft.WebApplication.targets \
+       targets/Microsoft.WebApplication.targets        \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props       \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets      \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets \
+       $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.props \
        xbuild.make \
        xbuild_test.make
index fb80dbc9454704e74412435730aa359801d8154b..ffe1f63b83831bf76308f05d066a6bcd62b5828e 100644 (file)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +93,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
diff --git a/mcs/tools/xbuild/data/14.0/Microsoft.Common.props b/mcs/tools/xbuild/data/14.0/Microsoft.Common.props
new file mode 100644 (file)
index 0000000..6c4d33c
--- /dev/null
@@ -0,0 +1,16 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <PropertyGroup>
+               <ImportByWildcardBeforeMicrosoftCommonProps Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == ''">true</ImportByWildcardBeforeMicrosoftCommonProps>
+               <ImportByWildcardAfterMicrosoftCommonProps Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == ''">true</ImportByWildcardAfterMicrosoftCommonProps>
+       </PropertyGroup>
+
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore\*"
+               Condition="'$(ImportByWildcardBeforeMicrosoftCommonProps)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportBefore')"/>
+
+       <PropertyGroup>
+               <MicrosoftCommonPropsHasBeenImported>true</MicrosoftCommonPropsHasBeenImported>
+       </PropertyGroup>
+
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter\*"
+               Condition="'$(ImportByWildcardAfterMicrosoftCommonProps)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props\ImportAfter')"/>
+</Project>
index bea93366ec988a3bffd8a9cc9d7ed18049147b22..433cffe8e69a8bfb86808755e4bfa26911c7d77a 100644 (file)
@@ -1,4 +1,6 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+       <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="'$(MicrosoftCommonPropsHasBeenImported)' != 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +95,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
index e260aa1ac30524b8efc87db8221f95d80fff60dc..152dd2b985e906f5ed3e6ac13142dd6e90198390 100644 (file)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" InitialTargets="_ValidateEssentialProperties" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" InitialTargets="_CheckForInvalidConfigurationAndPlatform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
                <ImportByWildcardBeforeMicrosoftCommonTargets Condition="'$(ImportByWildcardBeforeMicrosoftCommonTargets)' == ''">true</ImportByWildcardBeforeMicrosoftCommonTargets>
                <ImportByWildcardAfterMicrosoftCommonTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonTargets>
                <_OriginalPlatform>$(Platform)</_OriginalPlatform>
                <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
                <PlatformName Condition="'$(PlatformName)' == ''">$(Platform)</PlatformName>
+       </PropertyGroup>
 
+       <!-- in MSBuild, these properties are set in a separate file that is only imported for .NETFramework -->
+       <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
                <AddAdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == ''">true</AddAdditionalExplicitAssemblyReferences>
                <AdditionalExplicitAssemblyReferences Condition="'$(AddAdditionalExplicitAssemblyReferences)' == 'true' and '$(TargetFrameworkVersion)' != 'v2.0' and '$(TargetFrameworkVersion)' != 'v3.0'">System.Core;$(AdditionalExplicitAssemblyReferences)</AdditionalExplicitAssemblyReferences>
        </PropertyGroup>
@@ -90,7 +93,7 @@
                <TargetingClr2Framework Condition="('$(TargetFrameworkIdentifier)' == '.NETFramework') and ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5')">true</TargetingClr2Framework>
        </PropertyGroup>
 
-       <Target Name="_ValidateEssentialProperties">
+       <Target Name="_CheckForInvalidConfigurationAndPlatform">
                <Error Condition=" '$(OutputPath)' == '' and '$(SkipInvalidConfigurations)' != 'true'"
                        Text="'OutputPath' property is not set for this project. Usually this is caused by invalid Configuration/Platform combination. Original values: Configuration: $(_OriginalConfiguration) Platform: $(_OriginalPlatform)."/>
 
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.0.targets
deleted file mode 100644 (file)
index 36bc56e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.CSharp_4.5.targets
deleted file mode 100644 (file)
index 36bc56e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.Common.targets
deleted file mode 100644 (file)
index 82bea1e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Core.props b/mcs/tools/xbuild/targets/Microsoft.Portable.Core.props
deleted file mode 100644 (file)
index 4bf2d9c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <PropertyGroup>
-               <AvailablePlatforms>Any CPU</AvailablePlatforms>
-
-               <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
-               <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
-               <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
-
-               <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
-               <NoStdLib>true</NoStdLib>
-
-               <ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
-       </PropertyGroup>
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.Core.targets
deleted file mode 100644 (file)
index 5ca4483..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <PropertyGroup>
-               <ResolveReferencesDependsOn>
-                       $(ResolveReferencesDependsOn);
-                       ImplicitlyExpandTargetFramework;
-               </ResolveReferencesDependsOn>
-
-               <ImplicitlyExpandTargetFrameworkDependsOn>
-                       $(ImplicitlyExpandTargetFrameworkDependsOn);
-                       GetReferenceAssemblyPaths
-               </ImplicitlyExpandTargetFrameworkDependsOn>
-       </PropertyGroup>
-
-       <Target Name="ImplicitlyExpandTargetFramework"
-               Condition="'$(ImplicitlyExpandTargetFramework)' == 'true'"
-               DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)">
-
-               <ItemGroup>
-                       <ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
-                       <ReferencePath Include="%(ReferenceAssemblyPaths.Identity)\*.dll">
-                               <CopyLocal>false</CopyLocal>
-                               <ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
-                               <IsSystemReference>True</IsSystemReference>
-                       </ReferencePath>
-               </ItemGroup>
-       </Target>
-
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.0.targets
deleted file mode 100644 (file)
index bf58fee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
diff --git a/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets b/mcs/tools/xbuild/targets/Microsoft.Portable.VisualBasic_4.5.targets
deleted file mode 100644 (file)
index bf58fee..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-       <Import Project="..\Microsoft.Portable.Core.props" />
-       <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
-       <Import Project="..\Microsoft.Portable.Core.targets" />
-</Project>
index 087e3f3008721786750ca531e3487a87aa994907..c8ef14eaeed3dd86d814920839c14dc6ddd56398 100644 (file)
 <opcode name="mono_calli_extra_arg" input="VarPop" output="VarPush" args="InlineSig" o1="0xF0" o2="0x18" flow="call" />
 <opcode name="mono_lddomain" input="Pop0" output="PushI" args="InlineNone" o1="0xF0" o2="0x19" flow="next" />
 <opcode name="mono_atomic_store_i4" input="PopI+PopI" output="Push0" args="InlineI" o1="0xF0" o2="0x1A" flow="next" />
+<opcode name="mono_get_last_error" input="Pop0" output="PushI" args="InlineNone" o1="0xF0" o2="0x1B" flow="next" />
 </opdesc>
index ee69b699ba6797fb7f53a0f2599e650a0983198f..fca2448151a9771b1a91e6fed9d4b130147559b1 100644 (file)
@@ -319,6 +319,7 @@ OPDEF(CEE_MONO_LDPTR_NURSERY_BITS, "mono_ldptr_nursery_bits", Pop0, PushI, Inlin
 OPDEF(CEE_MONO_CALLI_EXTRA_ARG, "mono_calli_extra_arg", VarPop, VarPush, InlineSig, X, 2, 0xF0, 0x18, CALL)
 OPDEF(CEE_MONO_LDDOMAIN, "mono_lddomain", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x19, NEXT)
 OPDEF(CEE_MONO_ATOMIC_STORE_I4, "mono_atomic_store_i4", PopI+PopI, Push0, InlineI, X, 2, 0xF0, 0x1A, NEXT)
+OPDEF(CEE_MONO_GET_LAST_ERROR, "mono_get_last_error", Pop0, PushI, InlineNone, X, 2, 0xF0, 0x1B, NEXT)
 #ifndef OPALIAS
 #define _MONO_CIL_OPALIAS_DEFINED_
 #define OPALIAS(a,s,r)
index e9b46f450cc4c488818877a61a0aa710ab3019be..a8b41b576a9cf56a2a18af0f08ef3e4e41366853 100644 (file)
@@ -69,7 +69,7 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
        int thr_ret;
        gboolean apc_pending = FALSE;
        gpointer current_thread = wapi_get_current_thread_handle ();
-       gint64 now, end;
+       gint64 wait_start, timeout_in_ticks;
        
        if (current_thread == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -139,8 +139,10 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
                goto done;
        }
        
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
+       if (timeout != INFINITE) {
+               wait_start = mono_100ns_ticks ();
+               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
+       }
 
        do {
                /* Check before waiting on the condition, just in case
@@ -158,13 +160,13 @@ guint32 WaitForSingleObjectEx(gpointer handle, guint32 timeout,
                if (timeout == INFINITE) {
                        waited = mono_w32handle_timedwait_signal_handle (handle, INFINITE, FALSE, alertable ? &apc_pending : NULL);
                } else {
-                       now = mono_100ns_ticks ();
-                       if (end < now) {
+                       gint64 elapsed = mono_100ns_ticks () - wait_start;
+                       if (elapsed >= timeout_in_ticks) {
                                ret = WAIT_TIMEOUT;
                                goto done;
                        }
 
-                       waited = mono_w32handle_timedwait_signal_handle (handle, (end - now) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (handle, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
                }
 
                if(waited==0 && !apc_pending) {
@@ -248,7 +250,7 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
        int thr_ret;
        gboolean apc_pending = FALSE;
        gpointer current_thread = wapi_get_current_thread_handle ();
-       gint64 now, end;
+       gint64 wait_start, timeout_in_ticks;
        
        if (current_thread == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -323,9 +325,10 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                goto done;
        }
 
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
-
+       if (timeout != INFINITE) {
+               wait_start = mono_100ns_ticks ();
+               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
+       }
        do {
                /* Check before waiting on the condition, just in case
                 */
@@ -341,13 +344,13 @@ guint32 SignalObjectAndWait(gpointer signal_handle, gpointer wait,
                if (timeout == INFINITE) {
                        waited = mono_w32handle_timedwait_signal_handle (wait, INFINITE, FALSE, alertable ? &apc_pending : NULL);
                } else {
-                       now = mono_100ns_ticks ();
-                       if (end < now) {
+                       gint64 elapsed = mono_100ns_ticks () - wait_start;
+                       if (elapsed >= timeout_in_ticks) {
                                ret = WAIT_TIMEOUT;
                                goto done;
                        }
 
-                       waited = mono_w32handle_timedwait_signal_handle (wait, (end - now) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
+                       waited = mono_w32handle_timedwait_signal_handle (wait, (timeout_in_ticks - elapsed) / 10 / 1000, FALSE, alertable ? &apc_pending : NULL);
                }
 
                if (waited==0 && !apc_pending) {
@@ -454,7 +457,7 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
        gboolean poll;
        gpointer sorted_handles [MAXIMUM_WAIT_OBJECTS];
        gboolean apc_pending = FALSE;
-       gint64 now, end;
+       gint64 wait_start, timeout_in_ticks;
        
        if (current_thread == NULL) {
                SetLastError (ERROR_INVALID_HANDLE);
@@ -539,8 +542,10 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                return WAIT_TIMEOUT;
        }
 
-       if (timeout != INFINITE)
-               end = mono_100ns_ticks () + timeout * 1000 * 10;
+       if (timeout != INFINITE) {
+               wait_start = mono_100ns_ticks ();
+               timeout_in_ticks = (gint64)timeout * 10 * 1000; //can't overflow as timeout is 32bits
+       }
 
        /* Have to wait for some or all handles to become signalled
         */
@@ -588,11 +593,11 @@ guint32 WaitForMultipleObjectsEx(guint32 numobjects, gpointer *handles,
                        if (timeout == INFINITE) {
                                ret = mono_w32handle_timedwait_signal (INFINITE, poll, &apc_pending);
                        } else {
-                               now = mono_100ns_ticks ();
-                               if (end < now) {
+                               gint64 elapsed = mono_100ns_ticks () - wait_start;
+                               if (elapsed >= timeout_in_ticks) {
                                        ret = WAIT_TIMEOUT;
                                } else {
-                                       ret = mono_w32handle_timedwait_signal ((end - now) / 10 / 1000, poll, &apc_pending);
+                                       ret = mono_w32handle_timedwait_signal ((timeout_in_ticks - elapsed) / 10 / 1000, poll, &apc_pending);
                                }
                        }
                } else {
index f1492bd8c8ba8a1ce811fd0e2eb251ebc3c94c6d..82150dbe0574a8f5477b22d387e4373587e2d03f 100644 (file)
@@ -962,7 +962,9 @@ ves_icall_System_AppDomain_createDomain (MonoString *friendly_name, MonoAppDomai
 {
        MonoError error;
        MonoAppDomain *ad = NULL;
+
 #ifdef DISABLE_APPDOMAINS
+       mono_error_init (&error);
        mono_error_set_not_supported (&error, "AppDomain creation is not supported on this runtime.");
 #else
        char *fname;
@@ -1762,13 +1764,13 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror)
        sibling_target_len = strlen (sibling_target);
        
        copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".mdb", sibling_target, sibling_target_len, 7);
-       if (copy_result == TRUE)
+       if (copy_result)
                copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".config", sibling_target, sibling_target_len, 7);
        
        g_free (sibling_source);
        g_free (sibling_target);
        
-       if (copy_result == FALSE)  {
+       if (!copy_result)  {
                g_free (shadow);
                mono_error_set_execution_engine (oerror, "Failed to create shadow copy of sibling data (CopyFile).");
                return NULL;
index 3ce27a7119e6a207fac4d44e920e91de9d12e9f4..f51c979a50fab8ab5d230010e483867b188a7ed5 100644 (file)
@@ -1403,7 +1403,7 @@ void
 mono_unload_interface_id (MonoClass *klass);
 
 GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex);
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError *error);
 
 char*
 mono_class_full_name (MonoClass *klass);
index 6f61c9b27b8a5c8d6a5480546da8cfd7f22d91ee..a419af381492313e250c7887c0217c26ea071269 100644 (file)
@@ -7895,10 +7895,8 @@ mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, cons
                klass = search_modules (image, name_space, name, error);
                if (klass || !is_ok (error))
                        return klass;
-       }
-
-       if (!token)
                return NULL;
+       }
 
        if (mono_metadata_token_table (token) == MONO_TABLE_EXPORTEDTYPE) {
                MonoTableInfo  *t = &image->tables [MONO_TABLE_EXPORTEDTYPE];
index bf538fa6d285f2d5a58a4e46989081bdcbc146a1..56b9b9353cd706fc6bab6b125dc0112f9b6a4f92 100644 (file)
@@ -104,6 +104,7 @@ mono_handle_stack_free (HandleStack *stack)
                c = next;
        }
        g_free (c);
+       g_free (stack);
 }
 
 void
index 1998506166145621b55257c4afbbb9b258f7ffb4..757ed8c5be79f0dbc270a476f5eb2c9c359d997a 100644 (file)
@@ -65,6 +65,9 @@ ICALL(RUNTIME_12, "GetNativeStackTrace", ves_icall_Mono_Runtime_GetNativeStackTr
 ICALL_TYPE(RTCLASS, "Mono.RuntimeClassHandle", RTCLASS_1)
 ICALL(RTCLASS_1, "GetTypeFromClass", ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass)
 
+ICALL_TYPE(RTPTRARRAY, "Mono.RuntimeGPtrArrayHandle", RTPTRARRAY_1)
+ICALL(RTPTRARRAY_1, "GPtrArrayFree", ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree)
+
 #ifndef PLATFORM_RO_FS
 ICALL_TYPE(KPAIR, "Mono.Security.Cryptography.KeyPairPersistence", KPAIR_1)
 ICALL(KPAIR_1, "_CanSecure", ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure)
@@ -545,6 +548,9 @@ ICALL(TYPEB_5, "get_event_info", mono_reflection_event_builder_get_event_info)
 ICALL(TYPEB_6, "setup_generic_class", mono_reflection_setup_generic_class)
 ICALL(TYPEB_7, "setup_internal_class", mono_reflection_setup_internal_class)
 
+ICALL_TYPE(EVENTI, "System.Reflection.EventInfo", EVENTI_1)
+ICALL(EVENTI_1, "internal_from_handle_type", ves_icall_System_Reflection_EventInfo_internal_from_handle_type)
+
 ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
 ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
 ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info)
@@ -556,7 +562,7 @@ ICALL(MEMBERI_1, "get_MetadataToken", ves_icall_reflection_get_token)
 ICALL_TYPE(MBASE, "System.Reflection.MethodBase", MBASE_1)
 ICALL(MBASE_1, "GetCurrentMethod", ves_icall_GetCurrentMethod)
 ICALL(MBASE_2, "GetMethodBodyInternal", ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal)
-ICALL(MBASE_4, "GetMethodFromHandleInternalType", ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType)
+ICALL(MBASE_4, "GetMethodFromHandleInternalType_native", ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native)
 
 ICALL_TYPE(MODULE, "System.Reflection.Module", MODULE_1)
 ICALL(MODULE_1, "Close", ves_icall_System_Reflection_Module_Close)
@@ -622,6 +628,9 @@ ICALL_TYPE(PARAMI, "System.Reflection.ParameterInfo", PARAMI_1)
 ICALL(PARAMI_1, "GetMetadataToken", ves_icall_reflection_get_token)
 ICALL(PARAMI_2, "GetTypeModifiers", ves_icall_ParameterInfo_GetTypeModifiers)
 
+ICALL_TYPE(PROPI, "System.Reflection.PropertyInfo", PROPI_1)
+ICALL(PROPI_1, "internal_from_handle_type", ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type)
+
 ICALL_TYPE(RTFIELD, "System.Reflection.RtFieldInfo", RTFIELD_1)
 ICALL(RTFIELD_1, "UnsafeGetValue", ves_icall_MonoField_GetValueInternal)
 
@@ -733,19 +742,19 @@ ICALL(MHAN_1, "GetFunctionPointer", ves_icall_RuntimeMethodHandle_GetFunctionPoi
 
 ICALL_TYPE(RT, "System.RuntimeType", RT_1)
 ICALL(RT_1, "CreateInstanceInternal", ves_icall_System_Activator_CreateInstanceInternal)
-ICALL(RT_2, "GetConstructors_internal", ves_icall_RuntimeType_GetConstructors_internal)
+ICALL(RT_2, "GetConstructors_native", ves_icall_RuntimeType_GetConstructors_native)
 ICALL(RT_30, "GetCorrespondingInflatedConstructor", ves_icall_RuntimeType_GetCorrespondingInflatedMethod)
 ICALL(RT_31, "GetCorrespondingInflatedMethod", ves_icall_RuntimeType_GetCorrespondingInflatedMethod)
-ICALL(RT_3, "GetEvents_internal", ves_icall_RuntimeType_GetEvents_internal)
-ICALL(RT_5, "GetFields_internal", ves_icall_RuntimeType_GetFields_internal)
+ICALL(RT_3, "GetEvents_native", ves_icall_RuntimeType_GetEvents_native)
+ICALL(RT_5, "GetFields_native", ves_icall_RuntimeType_GetFields_native)
 ICALL(RT_6, "GetGenericArgumentsInternal", ves_icall_RuntimeType_GetGenericArguments)
 ICALL(RT_9, "GetGenericParameterPosition", ves_icall_RuntimeType_GetGenericParameterPosition)
 ICALL(RT_10, "GetInterfaceMapData", ves_icall_RuntimeType_GetInterfaceMapData)
 ICALL(RT_11, "GetInterfaces", ves_icall_RuntimeType_GetInterfaces)
-ICALL(RT_12, "GetMethodsByName", ves_icall_RuntimeType_GetMethodsByName)
+ICALL(RT_12, "GetMethodsByName_native", ves_icall_RuntimeType_GetMethodsByName_native)
 ICALL(RT_13, "GetNestedTypes_internal", ves_icall_RuntimeType_GetNestedTypes)
 ICALL(RT_14, "GetPacking", ves_icall_RuntimeType_GetPacking)
-ICALL(RT_15, "GetPropertiesByName", ves_icall_RuntimeType_GetPropertiesByName)
+ICALL(RT_15, "GetPropertiesByName_native", ves_icall_RuntimeType_GetPropertiesByName_native)
 ICALL(RT_16, "GetTypeCodeImplInternal", ves_icall_type_GetTypeCodeInternal)
 ICALL(RT_28, "IsTypeExportedToWindowsRuntime", ves_icall_System_RuntimeType_IsTypeExportedToWindowsRuntime)
 ICALL(RT_29, "IsWindowsRuntimeObjectType", ves_icall_System_RuntimeType_IsWindowsRuntimeObjectType)
index 94081c73fd39db09f93646f3441788a9892b25ff..25273d463d9d72c50a947eb45997a4ac60cde09b 100644 (file)
@@ -1535,6 +1535,12 @@ ves_icall_Mono_RuntimeClassHandle_GetTypeFromClass (MonoClass *klass)
        return mono_class_get_type (klass);
 }
 
+ICALL_EXPORT void
+ves_icall_Mono_RuntimeGPtrArrayHandle_GPtrArrayFree (GPtrArray *ptr_array, MonoBoolean freeSeg)
+{
+       g_ptr_array_free (ptr_array, freeSeg);
+}
+
 /* System.TypeCode */
 typedef enum {
        TYPECODE_EMPTY,
@@ -1759,7 +1765,6 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        MonoError error;
        gboolean found = FALSE;
        MonoClass *klass;
-       MonoClass *k;
 
        g_assert (handle);
 
@@ -1768,13 +1773,7 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        } else {
                klass = mono_class_from_mono_type (type);
 
-               /* Check that the field belongs to the class */
-               for (k = klass; k; k = k->parent) {
-                       if (k == handle->parent) {
-                               found = TRUE;
-                               break;
-                       }
-               }
+               found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
 
                if (!found)
                        /* The managed code will throw the exception */
@@ -1786,6 +1785,55 @@ ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField
        return result;
 }
 
+ICALL_EXPORT MonoReflectionEvent*
+ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *handle, MonoType *type)
+{
+       MonoError error;
+       MonoClass *klass;
+
+       g_assert (handle);
+
+       if (!type) {
+               klass = handle->parent;
+       } else {
+               klass = mono_class_from_mono_type (type);
+
+               gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+               if (!found)
+                       /* Managed code will throw an exception */
+                       return NULL;
+       }
+
+       MonoReflectionEvent *result = mono_event_get_object_checked (mono_domain_get (), klass, handle, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
+
+ICALL_EXPORT MonoReflectionProperty*
+ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type)
+{
+       MonoError error;
+       MonoClass *klass;
+
+       g_assert (handle);
+
+       if (!type) {
+               klass = handle->parent;
+       } else {
+               klass = mono_class_from_mono_type (type);
+
+               gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent);
+               if (!found)
+                       /* Managed code will throw an exception */
+                       return NULL;
+       }
+
+       MonoReflectionProperty *result = mono_property_get_object_checked (mono_domain_get (), klass, handle, &error);
+       mono_error_set_pending_exception (&error);
+       return result;
+}
+
 ICALL_EXPORT MonoArray*
 ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *field, MonoBoolean optional)
 {
@@ -3741,38 +3789,32 @@ enum {
        BFLAGS_OptionalParamBinding = 0x40000
 };
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetFields_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetFields_native (MonoReflectionType *type, MonoString *name, guint32 bflags)
 {
        MonoError error;
        MonoDomain *domain; 
-       MonoClass *startklass, *klass, *refklass;
-       MonoArray *res;
-       MonoObject *member;
-       int i, match;
+       MonoClass *startklass, *klass;
+       int match;
        gpointer iter;
        char *utf8_name = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;    
        MonoClassField *field;
-       MonoPtrArray tmp_array;
 
        domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               MonoArray *result = mono_array_new_checked (domain, mono_defaults.field_info_class, 0, &error);
-               mono_error_set_pending_exception (&error);
-               return result;
+               return g_ptr_array_new ();
        }
 
        klass = startklass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
 
-       mono_ptr_array_init (tmp_array, 2, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection fields list");
+       GPtrArray *ptr_array = g_ptr_array_sized_new (16);
        
 handle_parent: 
        if (mono_class_has_failure (klass)) {
-               mono_ptr_array_destroy (tmp_array);
-               mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
-               return NULL;
+               mono_error_init (&error);
+               mono_error_set_for_class_failure (&error, klass);
+               goto fail;
        }
 
        iter = NULL;
@@ -3816,29 +3858,17 @@ handle_parent:
                                continue;
                }
 
-               member = (MonoObject*)mono_field_get_object_checked (domain, refklass, field, &error);
-               if (!mono_error_ok (&error))
-                   goto fail;
-               mono_ptr_array_append (tmp_array, member);
+               g_ptr_array_add (ptr_array, field);
        }
        if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
 
-       res = mono_array_new_cached (domain, mono_defaults.field_info_class, mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto fail;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
        if (utf8_name != NULL)
                g_free (utf8_name);
+       return ptr_array;
 
-       return res;
 fail:
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (ptr_array, FALSE);
        mono_error_set_pending_exception (&error);
        return NULL;
 }
@@ -3859,7 +3889,7 @@ method_nonpublic (MonoMethod* method, gboolean start_klass)
 }
 
 GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex)
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoError *error)
 {
        GPtrArray *array;
        MonoClass *startklass;
@@ -3873,7 +3903,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla
 
        array = g_ptr_array_new ();
        startklass = klass;
-       *ex = NULL;
+       mono_error_init (error);
 
        if (name != NULL)
                compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
@@ -3962,49 +3992,24 @@ loader_error:
                g_free (method_slots);
        g_ptr_array_free (array, TRUE);
 
-       if (mono_class_has_failure (klass)) {
-               *ex = mono_class_get_exception_for_failure (klass);
-       } else {
-               *ex = mono_get_exception_execution_engine ("Unknown error");
-       }
+       g_assert (mono_class_has_failure (klass));
+       mono_error_set_for_class_failure (error, klass);
        return NULL;
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetMethodsByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetMethodsByName_native (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
 {
-       static MonoClass *MethodInfo_array;
        MonoError error;
        MonoDomain *domain; 
-       MonoArray *res;
-       MonoVTable *array_vtable;
-       MonoException *ex = NULL;
        const char *mname = NULL;
        GPtrArray *method_array;
-       MonoClass *klass, *refklass;
-       int i;
-
-       mono_error_init (&error);
-
-       if (!MethodInfo_array) {
-               MonoClass *klass = mono_array_class_get (mono_defaults.method_info_class, 1);
-               mono_memory_barrier ();
-               MethodInfo_array = klass;
-       }
+       MonoClass *klass;
 
        klass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
        domain = ((MonoObject *)type)->vtable->domain;
-       array_vtable = mono_class_vtable_full (domain, MethodInfo_array, &error);
-       if (!is_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return NULL;
-       }
        if (type->type->byref) {
-               res = mono_array_new_specific_checked (array_vtable, 0, &error);
-               mono_error_set_pending_exception (&error);
-
-               return res;
+               return g_ptr_array_new ();
        }
 
        if (name) {
@@ -4013,66 +4018,38 @@ ves_icall_RuntimeType_GetMethodsByName (MonoReflectionType *type, MonoString *na
                    return NULL;
        }
 
-       method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &ex);
+       method_array = mono_class_get_methods_by_name (klass, mname, bflags, ignore_case, FALSE, &error);
        g_free ((char*)mname);
-       if (ex) {
-               mono_set_pending_exception (ex);
-               return NULL;
-       }
-
-       res = mono_array_new_specific_checked (array_vtable, method_array->len, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return NULL;
-       }
-
-       for (i = 0; i < method_array->len; ++i) {
-               MonoMethod *method = (MonoMethod *)g_ptr_array_index (method_array, i);
-               MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, refklass, &error);
-               if (!mono_error_ok (&error))
-                       goto failure;
-               mono_array_setref (res, i, rm);
-       }
-
-failure:
-       g_ptr_array_free (method_array, TRUE);
-       if (!mono_error_ok (&error))
-               mono_set_pending_exception (mono_error_convert_to_exception (&error));
-       return res;
+       mono_error_set_pending_exception (&error);
+       return method_array;
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetConstructors_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetConstructors_native (MonoReflectionType *type, guint32 bflags)
 {
-       MonoDomain *domain; 
-       MonoClass *startklass, *klass, *refklass;
-       MonoArray *res = NULL;
+       MonoClass *startklass, *klass;
        MonoMethod *method;
-       MonoObject *member;
-       int i, match;
+       int match;
        gpointer iter = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
        MonoError error;
        
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_defaults.method_info_class, 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection constructors list"); /*FIXME, guestimating*/
-
-
        klass = startklass = mono_class_from_mono_type (type->type);
-       refklass = mono_class_from_mono_type (reftype->type);
 
        mono_class_setup_methods (klass);
        if (mono_class_has_failure (klass)) {
-               mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
-               goto leave;
+               mono_error_init (&error);
+               mono_error_set_for_class_failure (&error, klass);
+               mono_error_set_pending_exception (&error);
+               return NULL;
        }
 
+       res_array = g_ptr_array_sized_new (4); /* FIXME, guestimating */
+
        iter = NULL;
        while ((method = mono_class_get_methods (klass, &iter))) {
                match = 0;
@@ -4099,24 +4076,10 @@ ves_icall_RuntimeType_GetConstructors_internal (MonoReflectionType *type, guint3
 
                if (!match)
                        continue;
-               member = (MonoObject*)mono_method_get_object_checked (domain, method, refklass, &error);
-               if (mono_error_set_pending_exception (&error))
-                       goto leave;
-
-               mono_ptr_array_append (tmp_array, member);
+               g_ptr_array_add (res_array, method);
        }
 
-       res = mono_array_new_cached (domain, mono_class_get_constructor_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (mono_error_set_pending_exception (&error))
-               goto leave;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-leave:
-       mono_ptr_array_destroy (tmp_array);
-
-       return res;
+       return res_array;
 }
 
 static guint
@@ -4182,34 +4145,27 @@ property_accessor_nonpublic (MonoMethod* accessor, gboolean start_klass)
        return method_nonpublic (accessor, start_klass);
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetPropertiesByName (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetPropertiesByName_native (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoBoolean ignore_case)
 {
        MonoError error;
-       MonoDomain *domain; 
        MonoClass *startklass, *klass;
-       MonoArray *res;
        MonoMethod *method;
        MonoProperty *prop;
-       int i, match;
+       int match;
        guint32 flags;
        gchar *propname = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;
        gpointer iter;
        GHashTable *properties = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
 
-       mono_error_init (&error);
-       
-       domain = ((MonoObject *)type)->vtable->domain;
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_class_get_property_info_class (), 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 8, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection properties list"); /*This the average for ASP.NET types*/
-
+       mono_error_init (&error);
+       
        klass = startklass = mono_class_from_mono_type (type->type);
 
        if (name != NULL) {
@@ -4219,6 +4175,8 @@ ves_icall_RuntimeType_GetPropertiesByName (MonoReflectionType *type, MonoString
                compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
        }
 
+       res_array = g_ptr_array_sized_new (8); /*This the average for ASP.NET types*/
+
        properties = g_hash_table_new (property_hash, (GEqualFunc)property_equal);
 handle_parent:
        mono_class_setup_methods (klass);
@@ -4270,41 +4228,28 @@ handle_parent:
                if (g_hash_table_lookup (properties, prop))
                        continue;
 
-               MonoReflectionProperty *pr = mono_property_get_object_checked (domain, startklass, prop, &error);
-               if (!pr)
-                       goto failure;
-               mono_ptr_array_append (tmp_array, pr);
+               g_ptr_array_add (res_array, prop);
                
                g_hash_table_insert (properties, prop, prop);
        }
-       if ((!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
+       if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
                goto handle_parent;
 
        g_hash_table_destroy (properties);
        g_free (propname);
 
-       res = mono_array_new_cached (domain, mono_class_get_property_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto failure;
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
-       return res;
-
+       return res_array;
 
 
 loader_error:
        if (mono_class_has_failure (klass))
                mono_error_set_for_class_failure (&error, klass);
 
-failure:
        if (properties)
                g_hash_table_destroy (properties);
        if (name)
                g_free (propname);
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (res_array, FALSE);
 
        mono_error_set_pending_exception (&error);
 
@@ -4326,32 +4271,27 @@ event_equal (MonoEvent *event1, MonoEvent *event2)
        return g_str_equal (event1->name, event2->name);
 }
 
-ICALL_EXPORT MonoArray*
-ves_icall_RuntimeType_GetEvents_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
+ICALL_EXPORT GPtrArray*
+ves_icall_RuntimeType_GetEvents_native (MonoReflectionType *type, MonoString *name, guint32 bflags)
 {
        MonoError error;
-       MonoDomain *domain; 
        MonoClass *startklass, *klass;
-       MonoArray *res;
        MonoMethod *method;
        MonoEvent *event;
-       int i, match;
+       int match;
        gpointer iter;
        char *utf8_name = NULL;
        int (*compare_func) (const char *s1, const char *s2) = NULL;    
        GHashTable *events = NULL;
-       MonoPtrArray tmp_array;
+       GPtrArray *res_array;
 
-       mono_error_init (&error);
-       
-       domain = mono_object_domain (type);
        if (type->type->byref) {
-               res = mono_array_new_cached (domain, mono_class_get_event_info_class (), 0, &error);
-               mono_error_set_pending_exception (&error);
-               return res;
+               return g_ptr_array_new ();
        }
 
-       mono_ptr_array_init (tmp_array, 4, MONO_ROOT_SOURCE_REFLECTION, "temporary reflection events list");
+       mono_error_init (&error);
+
+       res_array = g_ptr_array_sized_new (4);
 
        klass = startklass = mono_class_from_mono_type (type->type);
 
@@ -4416,11 +4356,7 @@ handle_parent:
                if (g_hash_table_lookup (events, event))
                        continue;
 
-               MonoReflectionEvent *ev_obj;
-               ev_obj = mono_event_get_object_checked (domain, startklass, event, &error);
-               if (!ev_obj)
-                       goto failure;
-               mono_ptr_array_append (tmp_array, ev_obj);
+               g_ptr_array_add (res_array, event); 
 
                g_hash_table_insert (events, event, event);
        }
@@ -4429,19 +4365,10 @@ handle_parent:
 
        g_hash_table_destroy (events);
 
-       res = mono_array_new_cached (domain, mono_class_get_event_info_class (), mono_ptr_array_size (tmp_array), &error);
-       if (!is_ok (&error))
-               goto failure;
-
-       for (i = 0; i < mono_ptr_array_size (tmp_array); ++i)
-               mono_array_setref (res, i, mono_ptr_array_get (tmp_array, i));
-
-       mono_ptr_array_destroy (tmp_array);
-
        if (utf8_name != NULL)
                g_free (utf8_name);
 
-       return res;
+       return res_array;
 
 loader_error:
        if (mono_class_has_failure (klass))
@@ -4454,7 +4381,7 @@ failure:
        if (utf8_name != NULL)
                g_free (utf8_name);
 
-       mono_ptr_array_destroy (tmp_array);
+       g_ptr_array_free (res_array, FALSE);
 
        mono_error_set_pending_exception (&error);
        return NULL;
@@ -5123,7 +5050,7 @@ ves_icall_System_Reflection_Assembly_GetManifestResourceInfoInternal (MonoReflec
                        mono_metadata_decode_row (table, i - 1, file_cols, MONO_FILE_SIZE);
                        val = mono_metadata_string_heap (assembly->assembly->image, file_cols [MONO_FILE_NAME]);
                        MONO_OBJECT_SETREF (info, filename, mono_string_new (mono_object_domain (assembly), val));
-                       if (file_cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA)
+                       if (file_cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA)
                                info->location = 0;
                        else
                                info->location = RESOURCE_LOCATION_EMBEDDED;
@@ -5266,7 +5193,7 @@ ves_icall_System_Reflection_Assembly_GetModulesInternal (MonoReflectionAssembly
 
        for (i = 0; i < file_count; ++i, ++j) {
                mono_metadata_decode_row (table, i, cols, MONO_FILE_SIZE);
-               if (cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA) {
+               if (cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA) {
                        MonoReflectionModule *rm = mono_module_file_get_object_checked (domain, image, i, &error);
                        if (mono_error_set_pending_exception (&error))
                                return NULL;
@@ -5349,21 +5276,24 @@ mono_method_get_equivalent_method (MonoMethod *method, MonoClass *klass)
 }
 
 ICALL_EXPORT MonoReflectionMethod*
-ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType (MonoMethod *method, MonoType *type)
+ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (MonoMethod *method, MonoType *type, MonoBoolean generic_check)
 {
        MonoReflectionMethod *res = NULL;
        MonoError error;
        MonoClass *klass;
-       if (type) {
+       if (type && generic_check) {
                klass = mono_class_from_mono_type (type);
-               if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass)) 
+               if (mono_class_get_generic_type_definition (method->klass) != mono_class_get_generic_type_definition (klass))
                        return NULL;
+
                if (method->klass != klass) {
                        method = mono_method_get_equivalent_method (method, klass);
                        if (!method)
                                return NULL;
                }
-       } else
+       } else if (type)
+               klass = mono_class_from_mono_type (type);
+       else
                klass = method->klass;
        res = mono_method_get_object_checked (mono_domain_get (), method, klass, &error);
        mono_error_set_pending_exception (&error);
index 161bd0031a37893599330767c38280d1b288328b..50eaded2e37279442560273998901d1e3cbb82ea 100644 (file)
@@ -1993,13 +1993,13 @@ mono_image_walk_resource_tree (MonoCLIImageInfo *info, guint32 res_id,
                }
 #endif
        } else if (level==2) {
-               if (is_string == TRUE || (is_string == FALSE && lang_id != 0 && name_offset != lang_id))
+               if (is_string || (lang_id != 0 && name_offset != lang_id))
                        return NULL;
        } else {
                g_assert_not_reached ();
        }
 
-       if(is_dir==TRUE) {
+       if (is_dir) {
                MonoPEResourceDir *res_dir=(MonoPEResourceDir *)(((char *)root)+dir_offset);
                MonoPEResourceDirEntry *sub_entries=(MonoPEResourceDirEntry *)(res_dir+1);
                guint32 entries, i;
index 3edf257bee53630bcae260331657d73c757d2a3a..86229fbe3284a572d97ff84ba64aa4f3d1216be7 100644 (file)
@@ -422,7 +422,8 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate)
        return delegate->delegate_trampoline;
 
 fail:
-       mono_gchandle_free (target_handle);
+       if (target_handle != 0)
+               mono_gchandle_free (target_handle);
        mono_error_set_pending_exception (&error);
        return NULL;
 }
@@ -7455,19 +7456,25 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
        /* Set LastError if needed */
        if (piinfo->piflags & PINVOKE_ATTRIBUTE_SUPPORTS_LAST_ERROR) {
 #ifdef TARGET_WIN32
-               static MonoMethodSignature *get_last_error_sig = NULL;
-               if (!get_last_error_sig) {
-                       get_last_error_sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
-                       get_last_error_sig->ret = &mono_defaults.int_class->byval_arg;
-                       get_last_error_sig->pinvoke = 1;
-               }
+               if (!aot) {
+                       static MonoMethodSignature *get_last_error_sig = NULL;
+                       if (!get_last_error_sig) {
+                               get_last_error_sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
+                               get_last_error_sig->ret = &mono_defaults.int_class->byval_arg;
+                               get_last_error_sig->pinvoke = 1;
+                       }
 
-               /*
-                * Have to call GetLastError () early and without a wrapper, since various runtime components could
-                * clobber its value.
-                */
-               mono_mb_emit_native_call (mb, get_last_error_sig, GetLastError);
-               mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+                       /*
+                        * Have to call GetLastError () early and without a wrapper, since various runtime components could
+                        * clobber its value.
+                        */
+                       mono_mb_emit_native_call (mb, get_last_error_sig, GetLastError);
+                       mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+               } else {
+                       mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
+                       mono_mb_emit_byte (mb, CEE_MONO_GET_LAST_ERROR);
+                       mono_mb_emit_icall (mb, mono_marshal_set_last_error_windows);
+               }
 #else
                mono_mb_emit_icall (mb, mono_marshal_set_last_error);
 #endif
@@ -9526,7 +9533,7 @@ get_virtual_stelemref_wrapper (int kind)
        MonoMethod *res;
        char *name;
        const char *param_names [16];
-       guint32 b1, b2, b3;
+       guint32 b1, b2, b3, b4;
        int aklass, vklass, vtable, uiid;
        int array_slot_addr;
        WrapperInfo *info;
@@ -9739,7 +9746,7 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoClass, idepth));
                mono_mb_emit_byte (mb, CEE_LDIND_U2);
 
-               b2 = mono_mb_emit_branch (mb, CEE_BLT_UN);
+               b3 = mono_mb_emit_branch (mb, CEE_BLT_UN);
 
                /* if (vklass->supertypes [aklass->idepth - 1] != aklass) goto failure */
                mono_mb_emit_ldloc (mb, vklass);
@@ -9757,7 +9764,7 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_byte (mb, CEE_LDIND_I);
 
                mono_mb_emit_ldloc (mb, aklass);
-               b3 = mono_mb_emit_branch (mb, CEE_BNE_UN);
+               b4 = mono_mb_emit_branch (mb, CEE_BNE_UN);
 
                /* do_store: */
                mono_mb_patch_branch (mb, b1);
@@ -9769,6 +9776,7 @@ get_virtual_stelemref_wrapper (int kind)
                /* do_exception: */
                mono_mb_patch_branch (mb, b2);
                mono_mb_patch_branch (mb, b3);
+               mono_mb_patch_branch (mb, b4);
 
                mono_mb_emit_exception (mb, "ArrayTypeMismatchException", NULL);
                break;
@@ -11889,8 +11897,6 @@ ftnptr_eh_callback_default (guint32 gchandle)
        MonoException *exc;
        gpointer stackdata;
 
-       g_assert (gchandle >= 0);
-
        mono_threads_enter_gc_unsafe_region_unbalanced (&stackdata);
 
        exc = (MonoException*) mono_gchandle_get_target (gchandle);
index 60d36ae2ad1765d76cbf450dbb8feb9b616bf479..6bf3410d818ec7115921f01c4e9c45dd27109e80 100644 (file)
@@ -172,7 +172,7 @@ mono_mempool_stats (MonoMemPool *pool)
 {
        MonoMemPool *p;
        int count = 0;
-       guint32 still_free = pool->end - pool->pos;
+       guint32 still_free;
 
        p = pool;
        while (p) {
@@ -180,6 +180,7 @@ mono_mempool_stats (MonoMemPool *pool)
                count++;
        }
        if (pool) {
+               still_free = pool->end - pool->pos;
                g_print ("Mempool %p stats:\n", pool);
                g_print ("Total mem allocated: %d\n", pool->d.allocated);
                g_print ("Num chunks: %d\n", count);
index 2c5612c2a1d6a4f30c2da778f08d6998505904ff..c3beaa4553795cf7d9285b3b0f68c5d3c88abf7e 100644 (file)
@@ -4228,8 +4228,6 @@ mono_verifier_is_sig_compatible (MonoImage *image, MonoMethod *method, MonoMetho
                        return FALSE;
                if (original_sig->explicit_this != signature->explicit_this)
                        return FALSE;
-               if (original_sig->call_convention != signature->call_convention)
-                       return FALSE;
                if (original_sig->pinvoke != signature->pinvoke)
                        return FALSE;
                if (original_sig->sentinelpos != signature->sentinelpos)
index 80261f2b62e9a3d74741b48af5aff8fb135903b9..42f36d36854a771c3b1a7c1915cbfe1cf81038dd 100644 (file)
@@ -702,7 +702,7 @@ publisher_policy_start (gpointer user_data,
                memset (&info->old_version_bottom, 0, sizeof (info->old_version_bottom));
                memset (&info->old_version_top, 0, sizeof (info->old_version_top));
                memset (&info->new_version, 0, sizeof (info->new_version));
-       } if (!strcmp (element_name, "assemblyIdentity")) {
+       } else if (!strcmp (element_name, "assemblyIdentity")) {
                for (n = 0; attribute_names [n]; n++) {
                        const gchar *attribute_name = attribute_names [n];
                        
index 2dd53c18b14fa153f37d63e368fb6cfebefe366e..034d0de610a57a92208a27c84b8bc631af58b148 100644 (file)
@@ -7156,7 +7156,7 @@ mono_module_file_get_object_checked (MonoDomain *domain, MonoImage *image, int t
        MONO_OBJECT_SETREF (res, fqname, mono_string_new (domain, name));
        MONO_OBJECT_SETREF (res, name, mono_string_new (domain, name));
        MONO_OBJECT_SETREF (res, scopename, mono_string_new (domain, name));
-       res->is_resource = cols [MONO_FILE_FLAGS] && FILE_CONTAINS_NO_METADATA;
+       res->is_resource = cols [MONO_FILE_FLAGS] & FILE_CONTAINS_NO_METADATA;
        res->token = mono_metadata_make_token (MONO_TABLE_FILE, table_index + 1);
 
        return res;
@@ -7638,6 +7638,7 @@ mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *
        MonoReflectionEvent *res;
        MonoReflectionMonoEvent *mono_event;
 
+       mono_error_init (error);
        CHECK_OBJECT (MonoReflectionEvent *, event, klass);
        mono_event = (MonoReflectionMonoEvent *)mono_object_new_checked (domain, mono_class_get_mono_event_class (), error);
        if (!mono_event)
index 67a7b7f827d3cf8b5670427576d5f70f758b7ea4..62379f245e97f296a16b4a72a252c86bf7d79a84 100644 (file)
@@ -1521,8 +1521,7 @@ mono_marshal_get_ldflda_wrapper (MonoType *type)
                        klass = mono_defaults.array_class;
                } else if (type->type == MONO_TYPE_VALUETYPE) {
                        klass = type->data.klass;
-               } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING ||
-                          t == MONO_TYPE_CLASS) { 
+               } else if (t == MONO_TYPE_OBJECT || t == MONO_TYPE_CLASS || t == MONO_TYPE_STRING) { 
                        klass = mono_defaults.object_class;
                } else if (t == MONO_TYPE_PTR || t == MONO_TYPE_FNPTR) {
                        klass = mono_defaults.int_class;
index 129582ed778f3e95c4588983d85f37bf8416403c..0597bdd7882fdd994391eadbe65c84ca58c0c181 100644 (file)
@@ -64,7 +64,7 @@ void sgen_new_bridge_init (SgenBridgeProcessor *collector);
 void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
 void sgen_set_bridge_implementation (const char *name);
 void sgen_bridge_set_dump_prefix (const char *prefix);
-void sgen_init_bridge_processor();
+void sgen_init_bridge (void);
 
 #endif
 
index a1f0f51fbbb940f3494b108dc9a7be3dea5f3cf7..006e68c50121f32e9de1a776a9f164ead82907dd 100644 (file)
 #include "sgen/sgen-qsort.h"
 #include "utils/mono-logger-internals.h"
 
+typedef enum {
+       BRIDGE_PROCESSOR_INVALID,
+       BRIDGE_PROCESSOR_OLD,
+       BRIDGE_PROCESSOR_NEW,
+       BRIDGE_PROCESSOR_TARJAN,
+       BRIDGE_PROCESSOR_DEFAULT = BRIDGE_PROCESSOR_TARJAN
+} BridgeProcessorSelection;
+
+// Bridge processor type pending / in use
+static BridgeProcessorSelection bridge_processor_selection = BRIDGE_PROCESSOR_DEFAULT;
+// Most recently requested callbacks
+static MonoGCBridgeCallbacks pending_bridge_callbacks;
+// Currently-in-use callbacks
 MonoGCBridgeCallbacks bridge_callbacks;
+
+// Bridge processor state
 static SgenBridgeProcessor bridge_processor;
+// This is used for a special debug feature
 static SgenBridgeProcessor compare_to_bridge_processor;
 
 volatile gboolean bridge_processing_in_progress = FALSE;
 
+// FIXME: The current usage pattern for this function is unsafe. Bridge processing could start immediately after unlock
 void
 mono_gc_wait_for_bridge_processing (void)
 {
@@ -45,40 +62,95 @@ mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks)
        if (callbacks->bridge_version != SGEN_BRIDGE_VERSION)
                g_error ("Invalid bridge callback version. Expected %d but got %d\n", SGEN_BRIDGE_VERSION, callbacks->bridge_version);
 
-       bridge_callbacks = *callbacks;
+       // Defer assigning to bridge_callbacks until we have the gc lock.
+       // Note: This line is unsafe if we are on a separate thread from the one the runtime was initialized on.
+       pending_bridge_callbacks = *callbacks;
+
+       // If sgen has started, will assign bridge callbacks and init bridge
+       sgen_init_bridge ();
 }
 
-static gboolean
-init_bridge_processor_by_name (SgenBridgeProcessor *processor, const char *name)
+static BridgeProcessorSelection
+bridge_processor_name (const char *name)
 {
        if (!strcmp ("old", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_old_bridge_init (processor);
+               return BRIDGE_PROCESSOR_OLD;
        } else if (!strcmp ("new", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_new_bridge_init (processor);
+               return BRIDGE_PROCESSOR_NEW;
        } else if (!strcmp ("tarjan", name)) {
-               memset (processor, 0, sizeof (SgenBridgeProcessor));
-               sgen_tarjan_bridge_init (processor);
+               return BRIDGE_PROCESSOR_TARJAN;
        } else {
-               return FALSE;
+               return BRIDGE_PROCESSOR_INVALID;
+       }
+}
+
+// Initialize a single bridge processor
+static void
+init_bridge_processor (SgenBridgeProcessor *processor, BridgeProcessorSelection selection)
+{
+       memset (processor, 0, sizeof (SgenBridgeProcessor));
+
+       switch (selection) {
+               case BRIDGE_PROCESSOR_OLD:
+                       sgen_old_bridge_init (processor);
+                       break;
+               case BRIDGE_PROCESSOR_NEW:
+                       sgen_new_bridge_init (processor);
+                       break;
+               case BRIDGE_PROCESSOR_TARJAN:
+                       sgen_tarjan_bridge_init (processor);
+                       break;
+               default:
+                       g_assert_not_reached ();
        }
-       return TRUE;
 }
 
+/*
+ * Initializing the sgen bridge consists of setting the bridge callbacks,
+ * and initializing the bridge processor. Init should follow these rules:
+ *
+ *   - Init happens only after sgen is initialized (because we don't
+ *     know which bridge processor to initialize until then, and also
+ *     to allow bridge processor init to interact with sgen if it wants)
+ *
+ *   - Init happens only after mono_gc_register_bridge_callbacks is called
+ *
+ *   - Init should not happen concurrently with a GC (because a GC will
+ *     call sgen_need_bridge_processing at various times)
+ *
+ *   - Initializing the bridge processor should happen only once
+ *
+ * We call sgen_init_bridge when the callbacks are set, and also when sgen
+ * is done initing. Actual initialization then only occurs if it is ready.
+ */
 void
-sgen_init_bridge_processor()
+sgen_init_bridge ()
 {
-       // If a bridge was registered but there is no bridge processor yet, init defaults
-       if (bridge_callbacks.cross_references && !bridge_processor.reset_data)
-               sgen_tarjan_bridge_init (&bridge_processor);
+       if (sgen_gc_initialized ()) {
+               // This lock is not initialized until the GC is
+               sgen_gc_lock ();
+
+               bridge_callbacks = pending_bridge_callbacks;
+
+               // If a bridge was registered but there is no bridge processor yet
+               if (bridge_callbacks.cross_references && !bridge_processor.reset_data)
+                       init_bridge_processor (&bridge_processor, bridge_processor_selection);
+
+               sgen_gc_unlock ();
+       }
 }
 
 void
 sgen_set_bridge_implementation (const char *name)
 {
-       if (!init_bridge_processor_by_name (&bridge_processor, name))
-               g_warning ("Invalid value for bridge implementation, valid values are: 'new', 'old' and 'tarjan'.");
+       BridgeProcessorSelection selection = bridge_processor_name (name);
+
+       if (selection == BRIDGE_PROCESSOR_INVALID)
+               g_warning ("Invalid value for bridge processor implementation, valid values are: 'new', 'old' and 'tarjan'.");
+       else if (bridge_processor.reset_data)
+               g_warning ("Cannot set bridge processor implementation once bridge has already started");
+       else
+               bridge_processor_selection = selection;
 }
 
 gboolean
@@ -593,11 +665,10 @@ sgen_bridge_handle_gc_debug (const char *opt)
                set_dump_prefix (prefix);
        } else if (g_str_has_prefix (opt, "bridge-compare-to=")) {
                const char *name = strchr (opt, '=') + 1;
-               if (init_bridge_processor_by_name (&compare_to_bridge_processor, name)) {
-                       if (compare_to_bridge_processor.reset_data == bridge_processor.reset_data) {
-                               g_warning ("Cannot compare bridge implementation to itself - ignoring.");
-                               memset (&compare_to_bridge_processor, 0, sizeof (SgenBridgeProcessor));
-                       }
+               BridgeProcessorSelection selection = bridge_processor_name (name);
+
+               if (selection != BRIDGE_PROCESSOR_INVALID) {
+                       init_bridge_processor (&compare_to_bridge_processor, selection);
                } else {
                        g_warning ("Invalid bridge implementation to compare against - ignoring.");
                }
index 2292225e08369ee5bbf8da799ddfa259a1b655c9..b11df8a17b5e39d83ef82e05e98ca52c5125cf87 100644 (file)
@@ -95,7 +95,11 @@ typedef struct {
        void (*cross_references) (int num_sccs, MonoGCBridgeSCC **sccs, int num_xrefs, MonoGCBridgeXRef *xrefs);
 } MonoGCBridgeCallbacks;
 
-// Clients should call before initializing runtime.
+/*
+ * Note: This may be called at any time, but cannot be called concurrently
+ * with (during and on a separate thread from) sgen init. Callers are
+ * responsible for enforcing this.
+ */
 MONO_API void mono_gc_register_bridge_callbacks (MonoGCBridgeCallbacks *callbacks);
 
 MONO_API void mono_gc_wait_for_bridge_processing (void);
index 5a9bae85b6db35d7c95d81b19ad82a6c2e921a65..1016841f535149e796fa8ea8f8afe89e868d633c 100644 (file)
@@ -46,6 +46,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        gpointer stack_start;
 
        info->client_info.stopped_domain = mono_domain_get ();
+       info->client_info.stack_start = NULL;
        info->client_info.signal = 0;
        stop_count = sgen_global_stop_count;
        /* duplicate signal */
index 462fa98df8143115552eeb48bc32c6e21813a529..2bc99e105b9cca5e57845d28d8ff21e3a68a305d 100644 (file)
@@ -84,7 +84,9 @@ epoll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), g
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = epoll_wait (epoll_fd, epoll_events, EPOLL_NEVENTS, -1);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index e162c3cc9be24eec2bc8dfe1558449bedb9ac314..4422b668e8f61c7c2d2a630e1b1cb702dfb5fd56 100644 (file)
@@ -81,7 +81,9 @@ kqueue_event_wait (void (*callback) (gint fd, gint events, gpointer user_data),
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = kevent (kqueue_fd, NULL, 0, kqueue_events, KQUEUE_NEVENTS, NULL);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index 4d4cceb090269f97b4f53ecad27601c128da93a6..68e6611fba2619ee83cb65ea78cf16c249549c37 100644 (file)
@@ -143,7 +143,9 @@ poll_event_wait (void (*callback) (gint fd, gint events, gpointer user_data), gp
 
        mono_gc_set_skip_thread (TRUE);
 
+       MONO_ENTER_GC_SAFE;
        ready = mono_poll (poll_fds, poll_fds_size, -1);
+       MONO_EXIT_GC_SAFE;
 
        mono_gc_set_skip_thread (FALSE);
 
index b78ca83b28551282d59395dba3d132807871f8c8..7cdaf5be6842228814efe36fa9922ba81fbe4ea5 100644 (file)
@@ -565,7 +565,7 @@ ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJob *job)
 {
        ThreadPoolIOUpdate *update;
 
-       g_assert (handle >= 0);
+       g_assert (handle);
 
        g_assert ((job->operation == EVENT_IN) ^ (job->operation == EVENT_OUT));
        g_assert (job->callback);
index 1f4a6cc605237a36e6f13c3a28acc3c229086dff..87c976b48739179b813cc7a1364e23d7745df73e 100644 (file)
@@ -476,7 +476,7 @@ domain_get_next (ThreadPoolDomain *current)
                                        break;
                                }
                        }
-                       g_assert (current_idx >= 0);
+                       g_assert (current_idx != (guint)-1);
                }
                for (i = current_idx + 1; i < len + current_idx + 1; ++i) {
                        ThreadPoolDomain *tmp = (ThreadPoolDomain *)g_ptr_array_index (threadpool->domains, i % len);
index c3da0227e3c78f729968ffa1e9c4391a47a84e51..09b76d4a128204dd9f34f314c3d4514c5ded671b 100644 (file)
@@ -2768,7 +2768,7 @@ verify_delegate_compatibility (VerifyContext *ctx, MonoClass *delegate, ILStackD
                        CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("This object not compatible with function pointer for delegate creation at 0x%04x", ctx->ip_offset));
        } else {
                if (method->flags & METHOD_ATTRIBUTE_STATIC) {
-                       if (!stack_slot_is_null_literal (value) && !is_first_arg_bound)
+                       if (!stack_slot_is_null_literal (value))
                                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Non-null this args used with static function for delegate creation at 0x%04x", ctx->ip_offset));
                } else {
                        if (!verify_stack_type_compatibility_full (ctx, &method->klass->byval_arg, value, FALSE, TRUE) && !stack_slot_is_null_literal (value))
index 59422581b173255cb7f8eb001581972d47b9294b..0145a955d42e90c429645a6e9f675fe73a4edc33 100755 (executable)
@@ -486,12 +486,24 @@ test_sources =                    \
        gc-test.cs \
        gshared.cs
 
-regtests=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
+
+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
+
+if INSTALL_MOBILE_STATIC
+regtests= \
+       $(regtests_UNIVERSAL)
+
 if NACL_CODEGEN
 test_sources += nacl.cs
 regtests += nacl.exe
 endif
 
+else
+regtests= \
+       $(regtests_UNIVERSAL) \
+       $(regtests_MOBILE_STATIC_BLACKLIST)
+endif
+
 if X86
 arch_sources = $(x86_sources)
 arch_built=cpu-x86.h
@@ -583,12 +595,12 @@ libmini_la_CFLAGS = $(mono_CFLAGS)
 libmonoboehm_2_0_la_SOURCES =
 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 libmonosgen_2_0_la_SOURCES =
 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 #
 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
@@ -620,8 +632,8 @@ generics.exe: generics.cs TestDriver.dll generics-variant-types.dll
 %.exe: %.il
        $(ILASM) -output=$@ $<
 
-TestDriver.dll: $(srcdir)/TestDriver.cs
-       $(MCS) -out:$@ -target:library $<
+TestDriver.dll: $(srcdir)/TestDriver.cs $(srcdir)/TestHelpers.cs
+       $(MCS) -out:$@ -target:library $^
 
 generics-variant-types.dll: generics-variant-types.il
        $(ILASM) -dll -output=$@ $<
@@ -683,7 +695,7 @@ testi: mono test.exe
 checktests: $(regtests)
        for i in $(regtests); do $(MINI_RUNTIME) $$i; done
 
-rcheck: mono $(regtests)
+rcheck-ci: mono $(regtests)
 if NACL_CODEGEN
        for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
 else
@@ -691,7 +703,7 @@ else
        exit $$(cat regressionexitcode.out)
 endif
 
-rcheck2: mono $(regtests)
+rcheck-normal: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
 
 if ARM
@@ -724,26 +736,43 @@ gsharedvtcheck:
 
 fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe)
 
-FULLAOT_LIBS = \
+# Skip aoting the tests that aren't compiled 
+# on the mobile_static profile because they're skipped
+# on mobile profiles
+FULLAOT_LIBS_MOBILE_STATIC_BLACKLIST = \
+       Mono.Posix.dll \
+       System.Configuration.dll \
+       Mono.Simd.dll
+
+FULLAOT_LIBS_UNIVERSAL = \
        mscorlib.dll \
        System.Core.dll \
        System.dll \
-       Mono.Posix.dll \
-       System.Configuration.dll \
-       System.Security.dll \
        System.Xml.dll \
-       Mono.Security.dll \
-       Mono.Simd.dll
+       System.Security.dll \
+       Mono.Security.dll
+
+if INSTALL_MOBILE_STATIC
+FULLAOT_LIBS= \
+       Mono.Dynamic.Interpreter.dll \
+       $(FULLAOT_LIBS_UNIVERSAL)
+else
+FULLAOT_LIBS= \
+       $(FULLAOT_LIBS_UNIVERSAL) \
+       $(FULLAOT_LIBS_MOBILE_STATIC_BLACKLIST)
+endif
+
+FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp
 
 # This currently only works on amd64/arm
 fullaotcheck: $(mono) $(fullaot_regtests)
-       rm -rf fullaot-tmp
-       mkdir fullaot-tmp
+       rm -rf $(FULLAOT_TMP_DIR)
+       mkdir $(FULLAOT_TMP_DIR)
        $(MAKE) fullaot-libs AOT_FLAGS="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" GSHAREDVT=$(GSHAREDVT)
-       cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll fullaot-tmp/
-       MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" fullaot-tmp/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
-       ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) fullaot-tmp/
-       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=fullaot-tmp $(top_builddir)/runtime/mono-wrapper --full-aot fullaot-tmp/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
+       cp $(regtests) $(fullaot_regtests) generics-variant-types.dll TestDriver.dll $(FULLAOT_TMP_DIR)/
+       MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper $(LLVM_AOT_RUNTIME_OPTS) $(GSHAREDVT_RUNTIME_OPTS) --aot="full,$(MONO_FULLAOT_ADDITIONAL_ARGS)" $(FULLAOT_TMP_DIR)/{generics-variant-types.dll,TestDriver.dll,*.exe} || exit 1
+       ln -s $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),$$PWD/mono) $(FULLAOT_TMP_DIR)/
+       for i in $(fullaot_regtests); do echo $$i; MONO_PATH=$(FULLAOT_TMP_DIR) $(top_builddir)/runtime/mono-wrapper --full-aot $(FULLAOT_TMP_DIR)/$$i --exclude '!FULLAOT' $(ARCH_FULLAOT_EXCLUDE) || exit 1; done
 
 # This can run in parallel
 fullaot-libs: $(patsubst %,fullaot-tmp/%.dylib,$(FULLAOT_LIBS))
@@ -792,7 +821,14 @@ stat3: mono bench.exe
 docu: mini.sgm
        docbook2txt mini.sgm
 
-check-local: rcheck check-seq-points
+# CI - Wrench
+# BUILD_URL = Jenkins
+RUNNING_ON_CI = $(CI)$(BUILD_URL)
+
+# We need these because automake can't process normal make conditionals
+check_local_targets = $(if $(RUNNING_ON_CI), rcheck-ci check-seq-points, rcheck-normal)
+
+check-local: $(check_local_targets)
 
 clean-local:
        rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe regressionexitcode.out TestResult-op_il_seq_point.xml*
@@ -803,6 +839,7 @@ BUILT_SOURCES = version.h $(arch_built)
 
 CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
 EXTRA_DIST = TestDriver.cs \
+       TestHelpers.cs \
        genmdesc.pl                             \
        emitnunit.pl                    \
        $(test_sources)                         \
diff --git a/mono/mini/TestHelpers.cs b/mono/mini/TestHelpers.cs
new file mode 100644 (file)
index 0000000..01ed135
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Threading;
+
+namespace MonoTests.Helpers {
+
+       public static class FinalizerHelpers {
+               private static IntPtr aptr;
+
+               private static unsafe void NoPinActionHelper (int depth, Action act)
+               {
+                       // Avoid tail calls
+                       int* values = stackalloc int [20];
+                       aptr = new IntPtr (values);
+
+                       if (depth <= 0)
+                               act ();
+                       else
+                               NoPinActionHelper (depth - 1, act);
+               }
+
+               public static void PerformNoPinAction (Action act)
+               {
+                       Thread thr = new Thread (() => NoPinActionHelper (1024, act));
+                       thr.Start ();
+                       thr.Join ();
+               }
+       }
+}
+
index 1522b040dd3aff366fdf6b8fcadb0169bda100a6..7791ec26d0b55fbff726f895120fea3eb16e118b 100644 (file)
@@ -3589,7 +3589,9 @@ get_runtime_invoke_sig (MonoMethodSignature *sig)
 
        mb = mono_mb_new (mono_defaults.object_class, "FOO", MONO_WRAPPER_NONE);
        m = mono_mb_create_method (mb, sig, 16);
-       return mono_marshal_get_runtime_invoke (m, FALSE);
+       MonoMethod *invoke = mono_marshal_get_runtime_invoke (m, FALSE);
+       mono_mb_free (mb);
+       return invoke;
 }
 
 static MonoMethod*
@@ -4237,6 +4239,7 @@ add_wrappers (MonoAotCompile *acfg)
                                if (export_name)
                                        g_hash_table_insert (acfg->export_names, wrapper, export_name);
                        }
+                       g_free (cattr);
                }
 
                if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
@@ -4661,9 +4664,11 @@ add_types_from_method_header (MonoAotCompile *acfg, MonoMethod *method)
                for (j = 0; j < header->num_locals; ++j)
                        if (header->locals [j]->type == MONO_TYPE_GENERICINST)
                                add_generic_class_with_depth (acfg, mono_class_from_mono_type (header->locals [j]), depth + 1, "local");
+               mono_metadata_free_mh (header);
        } else {
                mono_error_cleanup (&error); /* FIXME report the error */
        }
+
 }
 
 /*
@@ -5399,6 +5404,7 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
                }
        }
 
+       g_ptr_array_free (patches, TRUE);
        g_free (locs);
 }
 
@@ -5894,6 +5900,8 @@ emit_method_info (MonoAotCompile *acfg, MonoCompile *cfg)
 
        encode_patch_list (acfg, patches, n_patches, cfg->compile_llvm, first_got_offset, p, &p);
 
+       g_ptr_array_free (patches, TRUE);
+
        acfg->stats.info_size += p - buf;
 
        g_assert (p - buf < buf_size);
@@ -5980,6 +5988,8 @@ emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean stor
 
                unwind_desc = get_unwind_info_offset (acfg, encoded, encoded_len);
                encode_value (unwind_desc, p, &p);
+
+               g_free (encoded);
        } else {
                encode_value (jinfo->unwind_info, p, &p);
        }
@@ -6518,6 +6528,7 @@ emit_trampoline_full (MonoAotCompile *acfg, int got_offset, MonoTrampInfo *info,
 
        encode_patch_list (acfg, patches, patches->len, FALSE, got_offset, p, &p);
        g_assert (p - buf < buf_size);
+       g_ptr_array_free (patches, TRUE);
 
        sprintf (symbol, "%s%s_p", acfg->user_symbol_prefix, name);
 
@@ -6555,6 +6566,8 @@ emit_trampoline_full (MonoAotCompile *acfg, int got_offset, MonoTrampInfo *info,
                if (acfg->dwarf)
                        mono_dwarf_writer_emit_trampoline (acfg->dwarf, symbol, symbol2, NULL, NULL, code_size, unwind_ops);
        }
+
+       g_free (buf);
 }
 
 static G_GNUC_UNUSED void
@@ -6654,10 +6667,12 @@ emit_trampolines (MonoAotCompile *acfg)
                        offset = MONO_RGCTX_SLOT_MAKE_RGCTX (i);
                        mono_arch_create_rgctx_lazy_fetch_trampoline (offset, &info, TRUE);
                        emit_trampoline (acfg, acfg->got_offset, info);
+                       g_free (info);
 
                        offset = MONO_RGCTX_SLOT_MAKE_MRGCTX (i);
                        mono_arch_create_rgctx_lazy_fetch_trampoline (offset, &info, TRUE);
                        emit_trampoline (acfg, acfg->got_offset, info);
+                       g_free (info);
                }
 
 #ifdef MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE
@@ -6678,6 +6693,11 @@ emit_trampolines (MonoAotCompile *acfg)
                        }
                }
 
+#ifdef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
+               mono_arch_create_handler_block_trampoline (&info, TRUE);
+               emit_trampoline (acfg, acfg->got_offset, info);
+#endif
+
 #endif /* #ifdef MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES */
 
                /* Emit trampolines which are numerous */
@@ -7052,6 +7072,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        opts->soft_debug = TRUE;
                } else if (str_begins_with (arg, "gen-seq-points-file=")) {
                        fprintf (stderr, "Mono Warning: aot option gen-seq-points-file= is deprecated.\n");
+               } else if (str_begins_with (arg, "gen-seq-points-file")) {
+                       fprintf (stderr, "Mono Warning: aot option gen-seq-points-file is deprecated.\n");
                } else if (str_begins_with (arg, "msym-dir=")) {
                        debug_options.no_seq_points_compact_data = FALSE;
                        opts->gen_msym_dir = TRUE;
@@ -7469,7 +7491,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (disabled): %s\n", mono_method_get_full_name (method));
                InterlockedIncrement (&acfg->stats.ocount);
-               mono_destroy_compile (cfg);
                return;
        }
        cfg->method_index = index;
@@ -7512,7 +7533,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (abs call): %s\n", mono_method_get_full_name (method));
                InterlockedIncrement (&acfg->stats.abscount);
-               mono_destroy_compile (cfg);
                return;
        }
 
@@ -7541,7 +7561,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                if (acfg->aot_opts.print_skipped_methods)
                        printf ("Skip (patches): %s\n", mono_method_get_full_name (method));
                acfg->stats.ocount++;
-               mono_destroy_compile (cfg);
                mono_acfg_unlock (acfg);
                return;
        }
@@ -7718,20 +7737,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
                        locals [i] = (MonoInst *)mono_mempool_alloc (acfg->mempool, sizeof (MonoInst));
                        memcpy (locals [i], cfg->locals [i], sizeof (MonoInst));
                }
+               mono_metadata_free_mh (header);
                cfg->locals = locals;
        }
 
        /* Free some fields used by cfg to conserve memory */
-       mono_mempool_destroy (cfg->mempool);
-       cfg->mempool = NULL;
-       g_free (cfg->varinfo);
-       cfg->varinfo = NULL;
-       g_free (cfg->vars);
-       cfg->vars = NULL;
-       if (cfg->rs) {
-               mono_regstate_free (cfg->rs);
-               cfg->rs = NULL;
-       }
+       mono_empty_compile (cfg);
 
        //printf ("Compile:           %s\n", mono_method_full_name (method, TRUE));
 
@@ -8236,7 +8247,7 @@ emit_llvm_file (MonoAotCompile *acfg)
                opts = g_strdup ("");
        else
 #if LLVM_API_VERSION > 100
-               opts = g_strdup ("-O2");
+               opts = g_strdup ("-O2 -disable-tail-calls");
 #else
                opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
 #endif
@@ -8253,7 +8264,7 @@ emit_llvm_file (MonoAotCompile *acfg)
        if (acfg->aot_opts.llvm_only) {
                /* Use the stock clang from xcode */
                // FIXME: arch
-               command = g_strdup_printf ("clang -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O2 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
+               command = g_strdup_printf ("clang++ -fexceptions -march=x86-64 -fpic -msse -msse2 -msse3 -msse4 -O2 -fno-optimize-sibling-calls -Wno-override-module -c -o \"%s\" \"%s.opt.bc\"", acfg->llvm_ofile, acfg->tmpbasename);
 
                aot_printf (acfg, "Executing clang: %s\n", command);
                if (execute_system (command) != 0)
@@ -8822,6 +8833,7 @@ emit_extra_methods (MonoAotCompile *acfg)
                        g_ptr_array_add (table, new_entry);
                }
        }
+       g_free (chain_lengths);
 
        //printf ("MAX: %d\n", max_chain_length);
 
@@ -8851,6 +8863,8 @@ emit_extra_methods (MonoAotCompile *acfg)
        /* Emit the table */
        emit_aot_data (acfg, MONO_AOT_TABLE_EXTRA_METHOD_TABLE, "extra_method_table", buf, p - buf);
 
+       g_free (buf);
+
        /* 
         * Emit a table reverse mapping method indexes to their index in extra_method_info.
         * This is used by mono_aot_find_jit_info ().
@@ -8865,6 +8879,10 @@ emit_extra_methods (MonoAotCompile *acfg)
                encode_int (info_offsets [i], p, &p);
        }
        emit_aot_data (acfg, MONO_AOT_TABLE_EXTRA_METHOD_INFO_OFFSETS, "extra_method_info_offsets", buf, p - buf);
+
+       g_free (buf);
+       g_free (info_offsets);
+       g_ptr_array_free (table, TRUE);
 }      
 
 static void
@@ -9070,10 +9088,14 @@ emit_class_name_table (MonoAotCompile *acfg)
                        else
                                encode_int16 (0, p, &p);
                }
+               g_free (entry);
        }
        g_assert (p - buf <= buf_size);
+       g_ptr_array_free (table, TRUE);
 
        emit_aot_data (acfg, MONO_AOT_TABLE_CLASS_NAME, "class_name_table", buf, p - buf);
+
+       g_free (buf);
 }
 
 static void
@@ -9943,9 +9965,17 @@ compile_asm (MonoAotCompile *acfg)
                wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags);
 #else
        // Default (linux)
-       command = g_strdup_printf ("\"%sld\" %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS,
+       char *args = g_strdup_printf ("%s %s -shared -o %s %s %s %s", tool_prefix, LD_OPTIONS,
                wrap_path (tmp_outfile_name), wrap_path (llvm_ofile),
                wrap_path (g_strdup_printf ("%s.o", acfg->tmpfname)), ld_flags);
+
+       if (acfg->llvm) {
+               command = g_strdup_printf ("clang++ %s", args);
+       } else {
+               command = g_strdup_printf ("\"%sld\" %s", tool_prefix, args);
+       }
+       g_free (args);
+
 #endif
        aot_printf (acfg, "Executing the native linker: %s\n", command);
        if (execute_system (command) != 0) {
@@ -10084,8 +10114,10 @@ acfg_free (MonoAotCompile *acfg)
        mono_img_writer_destroy (acfg->w);
        for (i = 0; i < acfg->nmethods; ++i)
                if (acfg->cfgs [i])
-                       g_free (acfg->cfgs [i]);
+                       mono_destroy_compile (acfg->cfgs [i]);
+
        g_free (acfg->cfgs);
+
        g_free (acfg->static_linking_symbol);
        g_free (acfg->got_symbol);
        g_free (acfg->plt_symbol);
index d60828b00275760042eed71237eb699886164971..14fcfbabc056fbde074805348a4d92c75fdb1133 100644 (file)
@@ -5834,7 +5834,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
 
 gpointer
 mono_aot_get_method_checked (MonoDomain *domain,
-                                                        MonoMethod *method, MonoError *error);
+                                                        MonoMethod *method, MonoError *error)
 {
        mono_error_init (error);
        return NULL;
index 01219b452680de3f456877078820114f54b48f73..3eeae0fc0da1a42d346b733da64fe69f0d1e048b 100755 (executable)
@@ -792,3 +792,4 @@ gc_spill_slot_liveness_def: len:0
 gc_param_slot_liveness_def: len:0
 
 generic_class_init: src1:A len:32 clob:c
+get_last_error: dest:i len:32
index c03b1408e01f9b4e9638fc6a65f447eb72d425ac..9b569ffc9c72fa8ca23ff029f10199efeb9745cd 100644 (file)
@@ -8383,11 +8383,15 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
        case CMD_TYPE_GET_METHODS_BY_NAME_FLAGS: {
                char *name = decode_string (p, &p, end);
                int i, flags = decode_int (p, &p, end);
-               MonoException *ex = NULL;
-               GPtrArray *array = mono_class_get_methods_by_name (klass, name, flags & ~BINDING_FLAGS_IGNORE_CASE, (flags & BINDING_FLAGS_IGNORE_CASE) != 0, TRUE, &ex);
+               MonoError error;
+               GPtrArray *array;
 
-               if (!array)
+               mono_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);
                        return ERR_LOADER_ERROR;
+               }
                buffer_add_int (buf, array->len);
                for (i = 0; i < array->len; ++i) {
                        MonoMethod *method = (MonoMethod *)g_ptr_array_index (array, i);
index 6ee1e0ff7929ef8118525e4280d15b911eb029c9..287022daad738c08857273cf5d686eb060edc1eb 100644 (file)
@@ -81,9 +81,11 @@ mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_ma
        gboolean cost_driven;
 
        if (!cfg->disable_reuse_registers && vars && (((MonoMethodVar*)vars->data)->interval != NULL)) {
-               mono_linear_scan2 (cfg, vars, regs, used_mask);
-               return;
-       }
+               mono_linear_scan2 (cfg, vars, regs, used_mask);
+               g_list_free (regs);
+               g_list_free (vars);
+               return;
+       }
 
        cost_driven = TRUE;
 
index 78e94917a52a59e9a71b4cccc18996b6dfbb2961..2011fddafaf2b67bb34877c797008a9705e0fc4e 100644 (file)
@@ -816,6 +816,13 @@ mono_llvm_optimize_method (MonoEERef eeref, LLVMValueRef method)
        g_assert_not_reached ();
 }
 
+gpointer
+mono_llvm_compile_method (MonoEERef mono_ee, LLVMValueRef method, int nvars, LLVMValueRef *callee_vars, gpointer *callee_addrs, gpointer *eh_frame)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
 void
 mono_llvm_dispose_ee (MonoEERef *eeref)
 {
index d0232dd540fe9da0b8d36379f37b14fad2b433be..386a319cc50234118d4e32d940a370c1d0833609 100644 (file)
@@ -7080,7 +7080,8 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        GHashTable *prev_cbb_hash;
        MonoBasicBlock **prev_cil_offset_to_bb;
        MonoBasicBlock *prev_cbb;
-       unsigned char* prev_cil_start;
+       const unsigned char *prev_ip;
+       unsigned char *prev_cil_start;
        guint32 prev_cil_offset_to_bb_len;
        MonoMethod *prev_current_method;
        MonoGenericContext *prev_generic_context;
@@ -7156,6 +7157,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        prev_cil_offset_to_bb = cfg->cil_offset_to_bb;
        prev_cil_offset_to_bb_len = cfg->cil_offset_to_bb_len;
        prev_cil_start = cfg->cil_start;
+       prev_ip = cfg->ip;
        prev_cbb = cfg->cbb;
        prev_current_method = cfg->current_method;
        prev_generic_context = cfg->generic_context;
@@ -7175,6 +7177,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        cfg->cil_offset_to_bb = prev_cil_offset_to_bb;
        cfg->cil_offset_to_bb_len = prev_cil_offset_to_bb_len;
        cfg->cil_start = prev_cil_start;
+       cfg->ip = prev_ip;
        cfg->locals = prev_locals;
        cfg->args = prev_args;
        cfg->arg_types = prev_arg_types;
@@ -8191,7 +8194,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
        if (!header) {
                mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
                goto exception_exit;
+       } else {
+               cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        }
+
        generic_container = mono_method_get_generic_container (method);
        sig = mono_method_signature (method);
        num_args = sig->hasthis + sig->param_count;
@@ -12277,6 +12283,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                }
                case CEE_THROW:
                        CHECK_STACK (1);
+                       if (sp [-1]->type != STACK_OBJ)
+                               UNVERIFIED;
+
                        MONO_INST_NEW (cfg, ins, OP_THROW);
                        --sp;
                        ins->sreg1 = sp [0]->dreg;
@@ -12954,6 +12963,18 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        case CEE_MONO_LDDOMAIN:
                                CHECK_STACK_OVF (1);
                                EMIT_NEW_PCONST (cfg, ins, cfg->compile_aot ? NULL : cfg->domain);
+                               ip += 2;
+                               *sp++ = ins;
+                               break;
+                       case CEE_MONO_GET_LAST_ERROR:
+                               CHECK_OPSIZE (2);
+                               CHECK_STACK_OVF (1);
+
+                               MONO_INST_NEW (cfg, ins, OP_GET_LAST_ERROR);
+                               ins->dreg = alloc_dreg (cfg, STACK_I4);
+                               ins->type = STACK_I4;
+                               MONO_ADD_INS (cfg->cbb, ins);
+
                                ip += 2;
                                *sp++ = ins;
                                break;
@@ -13680,7 +13701,6 @@ mono_error_exit:
        g_slist_free (class_inits);
        mono_basic_block_free (original_bb);
        cfg->dont_inline = g_list_remove (cfg->dont_inline, method);
-       cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
        if (cfg->exception_type)
                return -1;
        else
index ddf699c58caf5878afcec17bdb707222e4820d97..6a4e7af9d4485ea1894c08f45c9421519744cc12 100644 (file)
@@ -49,6 +49,7 @@ storage_name (ArgStorage st)
        case ArgOnStack: return "ArgOnStack";
        case ArgValuetypeInReg: return "ArgValuetypeInReg";
        case ArgValuetypeAddrInIReg: return "ArgValuetypeAddrInIReg";
+       case ArgValuetypeAddrOnStack: return "ArgValuetypeAddrOnStack";
        case ArgGSharedVtInReg: return "ArgGSharedVtInReg";
        case ArgGSharedVtOnStack: return "ArgGSharedVtOnStack";
        case ArgNone: return "ArgNone";
@@ -167,6 +168,18 @@ get_arg_slots (ArgInfo *ainfo, int **out_slots, gboolean is_source_argument)
                src = g_malloc (nsrc * sizeof (int));
                src [0] = map_freg (sreg);
                break;
+       case ArgValuetypeAddrInIReg:
+               nsrc = 1;
+               src = g_malloc (nsrc * sizeof (int));
+               src [0] = map_reg (ainfo->pair_regs [0]);
+               break;
+       case ArgValuetypeAddrOnStack:
+               nsrc = 1;
+               src = g_malloc (nsrc * sizeof (int));
+               // is_source_argument adds 2 because we're skipping over the old BBP and the return address
+               // XXX this is a very fragile setup as changes in alignment for the caller reg array can cause the magic number be 3
+               src [0] = map_stack_slot (sslot + (is_source_argument ? 2 : 0));
+               break;
        default:
                NOT_IMPLEMENTED;
                break;
@@ -196,6 +209,11 @@ handle_marshal_when_src_gsharedvt (ArgInfo *dst_info, int *arg_marshal, int *arg
                        *arg_marshal = GSHAREDVT_ARG_BYREF_TO_BYVAL;
                        *arg_slots = dst_info->nregs;
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       *arg_marshal = GSHAREDVT_ARG_NONE;
+                       *arg_slots = dst_info->nregs;
+                       break;
                default:
                        NOT_IMPLEMENTED; // Inappropriate value: if dst and src are gsharedvt at once, we shouldn't be here
                        break;
@@ -214,6 +232,10 @@ handle_marshal_when_dst_gsharedvt (ArgInfo *src_info, int *arg_marshal)
                case ArgOnStack:
                        *arg_marshal = GSHAREDVT_ARG_BYVAL_TO_BYREF;
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       *arg_marshal = GSHAREDVT_ARG_NONE;
+                       break;
                default:
                        NOT_IMPLEMENTED; // See above
                        break;
@@ -325,6 +347,10 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        handle_marshal_when_src_gsharedvt (dst_info, &arg_marshal, &arg_slots);
                        handle_map_when_gsharedvt_on_stack (src_info, &nsrc, &src, TRUE);
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       nsrc = get_arg_slots (src_info, &src, TRUE);
+                       break;
                default:
                        g_error ("Gsharedvt can't handle source arg type %d", (int)src_info->storage); // Inappropriate value: ArgValuetypeAddrInIReg is for returns only
                }
@@ -345,6 +371,10 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
                        handle_marshal_when_dst_gsharedvt (src_info, &arg_marshal);
                        handle_map_when_gsharedvt_on_stack (dst_info, &ndst, &dst, FALSE);
                        break;
+               case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
+                       ndst = get_arg_slots (dst_info, &dst, FALSE);
+                       break;
                default:
                        g_error ("Gsharedvt can't handle dest arg type %d", (int)dst_info->storage); // See above
                }
@@ -483,6 +513,9 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si
 
        info->stack_usage = ALIGN_TO (info->stack_usage, MONO_ARCH_FRAME_ALIGNMENT);
 
+       g_free (callee_cinfo);
+       g_free (caller_cinfo);
+
        DEBUG_AMD64_GSHAREDVT_PRINT ("allocated an info at %p stack usage %d\n", info, info->stack_usage);
        return info;
 }
index 2f855729e9adcdb172cbd8dea181edd7294068a9..258b265e063cc4f986c7e5b5a7c9bfa47a1e82af 100644 (file)
@@ -8,6 +8,7 @@
  *   Dietmar Maurer (dietmar@ximian.com)
  *   Patrik Torstensson
  *   Zoltan Varga (vargaz@gmail.com)
+ *   Johan Lorensson (lateralusx.github@gmail.com)
  *
  * (C) 2003 Ximian, Inc.
  * Copyright 2003-2011 Novell, Inc (http://www.novell.com)
@@ -428,206 +429,207 @@ collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index,
 }
 
 #ifdef TARGET_WIN32
-static void
-add_valuetype_win64 (MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
-                                        gboolean is_return,
-                                        guint32 *gr, guint32 *fr, guint32 *stack_size)
-{
-       guint32 size, i, nfields;
-       guint32 argsize = 8;
-       ArgumentClass arg_class;
-       MonoMarshalType *info = NULL;
-       StructFieldInfo *fields = NULL;
-       MonoClass *klass;
-       gboolean pass_on_stack = FALSE;
 
-       klass = mono_class_from_mono_type (type);
-       size = mini_type_stack_size_full (&klass->byval_arg, NULL, sig->pinvoke);
+/* Windows x64 ABI can pass/return value types in register of size 1,2,4,8 bytes. */
+#define MONO_WIN64_VALUE_TYPE_FITS_REG(arg_size) (arg_size <= SIZEOF_REGISTER && (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8))
 
-       /*
-       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
-       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
-       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
-       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
-       * it must be represented in call and cannot be dropped.
-       */
-       if (0 == size && MONO_TYPE_ISSTRUCT (type) && sig->pinvoke)
-               ainfo->pass_empty_struct = TRUE;
-       
-       if (!sig->pinvoke)
-               pass_on_stack = TRUE;
+static gboolean
+allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg)
+{
+       gboolean result = FALSE;
 
-       /* If this struct can't be split up naturally into 8-byte */
-       /* chunks (registers), pass it on the stack.              */
-       if (sig->pinvoke && !pass_on_stack) {
-               guint32 align;
-               guint32 field_size;
+       assert (arg_info != NULL && int_regs != NULL && float_regs != NULL && current_int_reg != NULL && current_float_reg != NULL);
+       assert (arg_info->storage == ArgValuetypeInReg || arg_info->storage == ArgValuetypeAddrInIReg);
 
-               info = mono_marshal_load_type_info (klass);
-               g_assert (info);
+       arg_info->pair_storage [0] = arg_info->pair_storage [1] = ArgNone;
+       arg_info->pair_regs [0] = arg_info->pair_regs [1] = ArgNone;
+       arg_info->pair_size [0] = 0;
+       arg_info->pair_size [1] = 0;
+       arg_info->nregs = 0;
 
-               /*
-                * Collect field information recursively to be able to
-                * handle nested structures.
-                */
-               nfields = count_fields_nested (klass, sig->pinvoke);
-               fields = g_new0 (StructFieldInfo, nfields);
-               collect_field_info_nested (klass, fields, 0, 0, sig->pinvoke, klass->unicode);
+       if (arg_class == ARG_CLASS_INTEGER && *current_int_reg < int_reg_count) {
+               /* Pass parameter in integer register. */
+               arg_info->pair_storage [0] = ArgInIReg;
+               arg_info->pair_regs [0] = int_regs [*current_int_reg];
+               (*current_int_reg) ++;
+               result = TRUE;
+       } else if (arg_class == ARG_CLASS_SSE && *current_float_reg < float_reg_count) {
+               /* Pass parameter in float register. */
+               arg_info->pair_storage [0] = (arg_size <= sizeof (gfloat)) ? ArgInFloatSSEReg : ArgInDoubleSSEReg;
+               arg_info->pair_regs [0] = float_regs [*current_float_reg];
+               (*current_float_reg) ++;
+               result = TRUE;
+       }
 
-               for (i = 0; i < nfields; ++i) {
-                       if ((fields [i].offset < 8) && (fields [i].offset + fields [i].size) > 8) {
-                               pass_on_stack = TRUE;
-                               break;
-                       }
-               }
+       if (result == TRUE) {
+               arg_info->pair_size [0] = arg_size;
+               arg_info->nregs = 1;
        }
 
-       if (pass_on_stack) {
-               /* Allways pass in memory */
-               ainfo->offset = *stack_size;
-               *stack_size += ALIGN_TO (size, 8);
-               ainfo->storage = is_return ? ArgValuetypeAddrInIReg : ArgOnStack;
-               if (!is_return)
-                       ainfo->arg_size = ALIGN_TO (size, 8);
+       return result;
+}
 
-               g_free (fields);
-               return;
-       }
+inline gboolean
+allocate_parameter_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg)
+{
+       return allocate_register_for_valuetype_win64 (arg_info, arg_class, arg_size, param_regs, PARAM_REGS, float_param_regs, FLOAT_PARAM_REGS, current_int_reg, current_float_reg);
+}
 
-       if (!sig->pinvoke) {
-               int n = mono_class_value_size (klass, NULL);
+inline gboolean
+allocate_return_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg)
+{
+       return allocate_register_for_valuetype_win64 (arg_info, arg_class, arg_size, return_regs, RETURN_REGS, float_return_regs, FLOAT_RETURN_REGS, current_int_reg, current_float_reg);
+}
 
-               argsize = n;
+static void
+allocate_storage_for_valuetype_win64 (ArgInfo *arg_info, MonoType *type, gboolean is_return, ArgumentClass arg_class,
+                                                                         guint32 arg_size, guint32 *current_int_reg, guint32 *current_float_reg, guint32 *stack_size)
+{
+       /* Windows x64 value type ABI.
+       *
+       * Parameters: https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
+       *
+       * Integer/Float types smaller than or equals to 8 bytes or porperly sized struct/union (1,2,4,8)
+       *    Try pass in register using ArgValuetypeInReg/(ArgInIReg|ArgInFloatSSEReg|ArgInDoubleSSEReg) as storage and size of parameter(1,2,4,8), if no more registers, pass on stack using ArgOnStack as storage and size of parameter(1,2,4,8).
+       * Integer/Float types bigger than 8 bytes or struct/unions larger than 8 bytes or (3,5,6,7).
+       *    Try to pass pointer in register using ArgValuetypeAddrInIReg, if no more registers, pass pointer on stack using ArgValuetypeAddrOnStack as storage and parameter size of register (8 bytes).
+       *
+       * Return values:  https://msdn.microsoft.com/en-us/library/7572ztz4.aspx.
+       *
+       * Integers/Float types smaller than or equal to 8 bytes
+       *    Return in corresponding register RAX/XMM0 using ArgValuetypeInReg/(ArgInIReg|ArgInFloatSSEReg|ArgInDoubleSSEReg) as storage and size of parameter(1,2,4,8).
+       * Properly sized struct/unions (1,2,4,8)
+       *    Return in register RAX using ArgValuetypeInReg as storage and size of parameter(1,2,4,8).
+       * Types bigger than 8 bytes or struct/unions larger than 8 bytes or (3,5,6,7).
+       *    Return pointer to allocated stack space (allocated by caller) using ArgValuetypeAddrInIReg as storage and parameter size.
+       */
 
-               if (n > 8)
-                       arg_class = ARG_CLASS_MEMORY;
-               else
-                       /* Always pass in 1 integer register */
-                       arg_class = ARG_CLASS_INTEGER;
-       } else {
-               g_assert (info);
+       assert (arg_info != NULL && type != NULL && current_int_reg != NULL && current_float_reg != NULL && stack_size != NULL);
 
-               /*Only drop value type if its not an empty struct as input that must be represented in call*/
-               if ((!fields && !ainfo->pass_empty_struct) || (!fields && ainfo->pass_empty_struct && is_return)) {
-                       ainfo->storage = ArgValuetypeInReg;
-                       ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
-                       return;
-               }
+       if (!is_return) {
 
-               switch (info->native_size) {
-               case 0:
-                       g_assert (!fields && MONO_TYPE_ISSTRUCT (type) && !is_return);
-                       break;
-               case 1: case 2: case 4: case 8:
-                       break;
-               default:
-                       if (is_return) {
-                               ainfo->storage = ArgValuetypeAddrInIReg;
-                               ainfo->offset = *stack_size;
-                               *stack_size += ALIGN_TO (info->native_size, 8);
-                       }
-                       else {
-                               ainfo->storage = ArgValuetypeAddrInIReg;
+               /* Parameter cases. */
+               if (arg_class != ARG_CLASS_MEMORY && MONO_WIN64_VALUE_TYPE_FITS_REG (arg_size)) {
+                       assert (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8);
 
-                               if (*gr < PARAM_REGS) {
-                                       ainfo->pair_storage [0] = ArgInIReg;
-                                       ainfo->pair_regs [0] = param_regs [*gr];
-                                       (*gr) ++;
-                               }
-                               else {
-                                       ainfo->pair_storage [0] = ArgOnStack;
-                                       ainfo->offset = *stack_size;
-                                       ainfo->arg_size = sizeof (mgreg_t);
-                                       *stack_size += 8;
-                               }
+                       /* First, try to use registers for parameter. If type is struct it can only be passed by value in integer register. */
+                       arg_info->storage = ArgValuetypeInReg;
+                       if (!allocate_parameter_register_for_valuetype_win64 (arg_info, !MONO_TYPE_ISSTRUCT (type) ? arg_class : ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg)) {
+                               /* No more registers, fallback passing parameter on stack as value. */
+                               assert (arg_info->pair_storage [0] == ArgNone && arg_info->pair_storage [1] == ArgNone && arg_info->pair_size [0] == 0 && arg_info->pair_size [1] == 0 && arg_info->nregs == 0);
+                               
+                               /* Passing value directly on stack, so use size of value. */
+                               arg_info->storage = ArgOnStack;
+                               arg_size = ALIGN_TO (arg_size, sizeof (mgreg_t));
+                               arg_info->offset = *stack_size;
+                               arg_info->arg_size = arg_size;
+                               *stack_size += arg_size;
+                       }
+               } else {
+                       /* Fallback to stack, try to pass address to parameter in register. Always use integer register to represent stack address. */
+                       arg_info->storage = ArgValuetypeAddrInIReg;
+                       if (!allocate_parameter_register_for_valuetype_win64 (arg_info, ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg)) {
+                               /* No more registers, fallback passing address to parameter on stack. */
+                               assert (arg_info->pair_storage [0] == ArgNone && arg_info->pair_storage [1] == ArgNone && arg_info->pair_size [0] == 0 && arg_info->pair_size [1] == 0 && arg_info->nregs == 0);
+                                                               
+                               /* Passing an address to value on stack, so use size of register as argument size. */
+                               arg_info->storage = ArgValuetypeAddrOnStack;
+                               arg_size = sizeof (mgreg_t);
+                               arg_info->offset = *stack_size;
+                               arg_info->arg_size = arg_size;
+                               *stack_size += arg_size;
                        }
-
-                       g_free (fields);
-                       return;
                }
+       } else {
+               /* Return value cases. */
+               if (arg_class != ARG_CLASS_MEMORY && MONO_WIN64_VALUE_TYPE_FITS_REG (arg_size)) {
+                       assert (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8);
 
-               int size;
-               guint32 align;
-               ArgumentClass class1;
+                       /* Return value fits into return registers. If type is struct it can only be returned by value in integer register. */
+                       arg_info->storage = ArgValuetypeInReg;
+                       allocate_return_register_for_valuetype_win64 (arg_info, !MONO_TYPE_ISSTRUCT (type) ? arg_class : ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg);
 
-               if (nfields == 0 && ainfo->pass_empty_struct) {
-                       g_assert (!fields && !is_return);
-                       class1 = ARG_CLASS_INTEGER;
-               }
-               else if (nfields == 0)
-                       class1 = ARG_CLASS_MEMORY;
-               else
-                       class1 = ARG_CLASS_NO_CLASS;
-               for (i = 0; i < nfields; ++i) {
-                       /* How far into this quad this data extends.*/
-                       /* (8 is size of quad) */
-                       argsize = fields [i].offset + fields [i].size;
+                       /* Only RAX/XMM0 should be used to return valuetype. */
+                       assert ((arg_info->pair_regs[0] == AMD64_RAX && arg_info->pair_regs[1] == ArgNone) || (arg_info->pair_regs[0] == AMD64_XMM0 && arg_info->pair_regs[1] == ArgNone));
+               } else {
+                       /* Return value doesn't fit into return register, return address to allocated stack space (allocated by caller and passed as input). */
+                       arg_info->storage = ArgValuetypeAddrInIReg;
+                       allocate_return_register_for_valuetype_win64 (arg_info, ARG_CLASS_INTEGER, arg_size, current_int_reg, current_float_reg);
+
+                       /* Only RAX should be used to return valuetype address. */
+                       assert (arg_info->pair_regs[0] == AMD64_RAX && arg_info->pair_regs[1] == ArgNone);
 
-                       class1 = merge_argument_class_from_type (fields [i].type, class1);
+                       arg_size = ALIGN_TO (arg_size, sizeof (mgreg_t));
+                       arg_info->offset = *stack_size;
+                       *stack_size += arg_size;
                }
-               g_assert (class1 != ARG_CLASS_NO_CLASS);
-               arg_class = class1;
        }
+}
 
-       g_free (fields);
+static void
+get_valuetype_size_win64 (MonoClass *klass, gboolean pinvoke, ArgInfo *arg_info, MonoType *type, ArgumentClass *arg_class, guint32 *arg_size)
+{
+       *arg_size = 0;
+       *arg_class = ARG_CLASS_NO_CLASS;
 
-       /* Allocate registers */
-       {
-               int orig_gr = *gr;
-               int orig_fr = *fr;
+       assert (klass != NULL && arg_info != NULL && type != NULL && arg_class != NULL && arg_size != NULL);
+       
+       if (pinvoke) {
+               /* Calculate argument class type and size of marshalled type. */
+               MonoMarshalType *info = mono_marshal_load_type_info (klass);
+               *arg_size = info->native_size;
+       } else {
+               /* Calculate argument class type and size of managed type. */
+               *arg_size = mono_class_value_size (klass, NULL);
+       }
 
-               while (argsize != 1 && argsize != 2 && argsize != 4 && argsize != 8)
-                       argsize ++;
+       /* Windows ABI only handle value types on stack or passed in integer register (if it fits register size). */
+       *arg_class = MONO_WIN64_VALUE_TYPE_FITS_REG (*arg_size) ? ARG_CLASS_INTEGER : ARG_CLASS_MEMORY;
 
-               ainfo->storage = ArgValuetypeInReg;
-               ainfo->pair_storage [0] = ainfo->pair_storage [1] = ArgNone;
-               ainfo->pair_size [0] = argsize;
-               ainfo->pair_size [1] = 0;
-               ainfo->nregs = 1;
-               switch (arg_class) {
-               case ARG_CLASS_INTEGER:
-                       if (*gr >= PARAM_REGS)
-                               arg_class = ARG_CLASS_MEMORY;
-                       else {
-                               ainfo->pair_storage [0] = ArgInIReg;
-                               if (is_return)
-                                       ainfo->pair_regs [0] = return_regs [*gr];
-                               else
-                                       ainfo->pair_regs [0] = param_regs [*gr];
-                               (*gr) ++;
-                       }
-                       break;
-               case ARG_CLASS_SSE:
-                       if (*fr >= FLOAT_PARAM_REGS)
-                               arg_class = ARG_CLASS_MEMORY;
-                       else {
-                               if (argsize <= 4)
-                                       ainfo->pair_storage [0] = ArgInFloatSSEReg;
-                               else
-                                       ainfo->pair_storage [0] = ArgInDoubleSSEReg;
-                               ainfo->pair_regs [0] = *fr;
-                               (*fr) ++;
-                       }
-                       break;
-               case ARG_CLASS_MEMORY:
-                       break;
-               default:
-                       g_assert_not_reached ();
-               }
+       if (*arg_class == ARG_CLASS_MEMORY) {
+               /* Value type has a size that doesn't seem to fit register according to ABI. Try to used full stack size of type. */
+               *arg_size = mini_type_stack_size_full (&klass->byval_arg, NULL, pinvoke);
+       }
 
-               if (arg_class == ARG_CLASS_MEMORY) {
-                       /* Revert possible register assignments */
-                       *gr = orig_gr;
-                       *fr = orig_fr;
+       /*
+       * Standard C and C++ doesn't allow empty structs, empty structs will always have a size of 1 byte.
+       * GCC have an extension to allow empty structs, https://gcc.gnu.org/onlinedocs/gcc/Empty-Structures.html.
+       * This cause a little dilemma since runtime build using none GCC compiler will not be compatible with
+       * GCC build C libraries and the other way around. On platforms where empty structs has size of 1 byte
+       * it must be represented in call and cannot be dropped.
+       */
+       if (*arg_size == 0 && MONO_TYPE_ISSTRUCT (type)) {
+               arg_info->pass_empty_struct = TRUE;
+               *arg_size = SIZEOF_REGISTER;
+               *arg_class = ARG_CLASS_INTEGER;
+       }
 
-                       ainfo->offset = *stack_size;
-                       *stack_size += sizeof (mgreg_t);
-                       ainfo->storage = is_return ? ArgValuetypeAddrInIReg : ArgOnStack;
-                       if (!is_return)
-                               ainfo->arg_size = sizeof (mgreg_t);
-               }
+       assert (*arg_class != ARG_CLASS_NO_CLASS);
+}
+
+static void
+add_valuetype_win64 (MonoMethodSignature *signature, ArgInfo *arg_info, MonoType *type,
+                                               gboolean is_return, guint32 *current_int_reg, guint32 *current_float_reg, guint32 *stack_size)
+{
+       guint32 arg_size = SIZEOF_REGISTER;
+       MonoClass *klass = NULL;
+       ArgumentClass arg_class;
+       
+       assert (signature != NULL && arg_info != NULL && type != NULL && current_int_reg != NULL && current_float_reg != NULL && stack_size != NULL);
+
+       klass = mono_class_from_mono_type (type);
+       get_valuetype_size_win64 (klass, signature->pinvoke, arg_info, type, &arg_class, &arg_size);
+
+       /* Only drop value type if its not an empty struct as input that must be represented in call */
+       if ((arg_size == 0 && !arg_info->pass_empty_struct) || (arg_size == 0 && arg_info->pass_empty_struct && is_return)) {
+               arg_info->storage = ArgValuetypeInReg;
+               arg_info->pair_storage [0] = arg_info->pair_storage [1] = ArgNone;
+       } else {
+               /* Alocate storage for value type. */
+               allocate_storage_for_valuetype_win64 (arg_info, type, is_return, arg_class, arg_size, current_int_reg, current_float_reg, stack_size);
        }
 }
+
 #endif /* TARGET_WIN32 */
 
 static void
@@ -1187,6 +1189,8 @@ mono_arch_init (void)
        mono_aot_register_jit_icall ("mono_amd64_throw_corlib_exception", mono_amd64_throw_corlib_exception);
        mono_aot_register_jit_icall ("mono_amd64_resume_unwind", mono_amd64_resume_unwind);
        mono_aot_register_jit_icall ("mono_amd64_get_original_ip", mono_amd64_get_original_ip);
+       mono_aot_register_jit_icall ("mono_amd64_handler_block_trampoline_helper", mono_amd64_handler_block_trampoline_helper);
+
 #if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
        mono_aot_register_jit_icall ("mono_amd64_start_gsharedvt_call", mono_amd64_start_gsharedvt_call);
 #endif
@@ -1225,6 +1229,15 @@ mono_arch_cpu_optimizations (guint32 *exclude_mask)
                *exclude_mask |= MONO_OPT_CMOV;
        }
 
+#ifdef TARGET_WIN32
+       /* The current SIMD doesn't support the argument used by a LD_ADDR to be of type OP_VTARG_ADDR. */
+       /* This will now be used for value types > 8 or of size 3,5,6,7 as dictated by windows x64 value type ABI. */
+       /* Since OP_VTARG_ADDR needs to be resolved in mono_spill_global_vars and the SIMD implementation optimize */
+       /* away the LD_ADDR in load_simd_vreg, that will cause an error in mono_spill_global_vars since incorrect opcode */
+       /* will now have a reference to an argument that won't be fully decomposed. */
+       *exclude_mask |= MONO_OPT_SIMD;
+#endif
+
        return opts;
 }
 
@@ -1348,7 +1361,7 @@ mono_arch_compute_omit_fp (MonoCompile *cfg)
        for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
                ArgInfo *ainfo = &cinfo->args [i];
 
-               if (ainfo->storage == ArgOnStack) {
+               if (ainfo->storage == ArgOnStack || ainfo->storage == ArgValuetypeAddrInIReg || ainfo->storage == ArgValuetypeAddrOnStack) {
                        /* 
                         * The stack offset can only be determined when the frame
                         * size is known.
@@ -1727,11 +1740,13 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                                break;
                        case ArgValuetypeInReg:
                                break;
-                       case ArgValuetypeAddrInIReg: {
+                       case ArgValuetypeAddrInIReg:
+                       case ArgValuetypeAddrOnStack: {
                                MonoInst *indir;
                                g_assert (!cfg->arch.omit_fp);
-                               
+                               g_assert (ainfo->storage == ArgValuetypeAddrInIReg || (ainfo->storage == ArgValuetypeAddrOnStack && ainfo->pair_storage [0] == ArgNone));
                                MONO_INST_NEW (cfg, indir, 0);
+
                                indir->opcode = OP_REGOFFSET;
                                if (ainfo->pair_storage [0] == ArgInIReg) {
                                        indir->inst_basereg = cfg->frame_reg;
@@ -1753,7 +1768,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
                                NOT_IMPLEMENTED;
                        }
 
-                       if (!inreg && (ainfo->storage != ArgOnStack) && (ainfo->storage != ArgValuetypeAddrInIReg) && (ainfo->storage != ArgGSharedVtOnStack)) {
+                       if (!inreg && (ainfo->storage != ArgOnStack) && (ainfo->storage != ArgValuetypeAddrInIReg) && (ainfo->storage != ArgValuetypeAddrOnStack) && (ainfo->storage != ArgGSharedVtOnStack)) {
                                ins->opcode = OP_REGOFFSET;
                                ins->inst_basereg = cfg->frame_reg;
                                /* These arguments are saved to the stack in the prolog */
@@ -2139,6 +2154,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                case ArgOnStack:
                case ArgValuetypeInReg:
                case ArgValuetypeAddrInIReg:
+               case ArgValuetypeAddrOnStack:
                case ArgGSharedVtInReg:
                case ArgGSharedVtOnStack: {
                        if (ainfo->storage == ArgOnStack && !MONO_TYPE_ISSTRUCT (t) && !call->tail_call)
@@ -2299,8 +2315,12 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                }
                break;
        }
-       case ArgValuetypeAddrInIReg: {
+       case ArgValuetypeAddrInIReg:
+       case ArgValuetypeAddrOnStack: {
                MonoInst *vtaddr, *load;
+
+               g_assert (ainfo->storage == ArgValuetypeAddrInIReg || (ainfo->storage == ArgValuetypeAddrOnStack && ainfo->pair_storage [0] == ArgNone));
+               
                vtaddr = mono_compile_create_var (cfg, &ins->klass->byval_arg, OP_LOCAL);
                
                MONO_INST_NEW (cfg, load, OP_LDADDR);
@@ -3719,6 +3739,30 @@ emit_setup_lmf (MonoCompile *cfg, guint8 *code, gint32 lmf_offset, int cfa_offse
        return code;
 }
 
+#ifdef TARGET_WIN32
+
+#define TEB_LAST_ERROR_OFFSET 0x068
+
+static guint8*
+emit_get_last_error (guint8* code, int dreg)
+{
+       /* Threads last error value is located in TEB_LAST_ERROR_OFFSET. */
+       x86_prefix (code, X86_GS_PREFIX);
+       amd64_mov_reg_membase (code, dreg, TEB_LAST_ERROR_OFFSET, 0, sizeof (guint32));
+
+       return code;
+}
+
+#else
+
+static guint8*
+emit_get_last_error (guint8* code, int dreg)
+{
+       g_assert_not_reached ();
+}
+
+#endif
+
 /* benchmark and set based on cpu */
 #define LOOP_ALIGNMENT 8
 #define bb_is_loop_start(bb) ((bb)->loop_body_start && (bb)->nesting)
@@ -6555,6 +6599,9 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        ins->backend.pc_offset = code - cfg->native_code;
                        bb->spill_slot_defs = g_slist_prepend_mempool (cfg->mempool, bb->spill_slot_defs, ins);
                        break;
+               case OP_GET_LAST_ERROR:
+                       emit_get_last_error(code, ins->dreg);
+                       break;
                default:
                        g_warning ("unknown opcode %s in %s()\n", mono_inst_name (ins->opcode), __FUNCTION__);
                        g_assert_not_reached ();
@@ -6983,6 +7030,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                                if (ainfo->pair_storage [0] == ArgInIReg)
                                        amd64_mov_membase_reg (code, ins->inst_left->inst_basereg, ins->inst_left->inst_offset, ainfo->pair_regs [0],  sizeof (gpointer));
                                break;
+                       case ArgValuetypeAddrOnStack:
+                               break;
                        case ArgGSharedVtInReg:
                                amd64_mov_membase_reg (code, ins->inst_basereg, ins->inst_offset, ainfo->reg, 8);
                                break;
@@ -7787,10 +7836,7 @@ get_delegate_virtual_invoke_impl (MonoTrampInfo **info, gboolean load_imt_reg, i
        amd64_jump_membase (code, AMD64_RAX, offset);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, NULL);
 
-       if (load_imt_reg)
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_imt_%d", - offset / sizeof (gpointer));
-       else
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_%d", offset / sizeof (gpointer));
+       tramp_name = mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset);
        *info = mono_tramp_info_create (tramp_name, start, code - start, NULL, unwind_ops);
        g_free (tramp_name);
 
@@ -7818,12 +7864,16 @@ mono_arch_get_delegate_invoke_impls (void)
                res = g_slist_prepend (res, info);
        }
 
-       for (i = 0; i <= MAX_VIRTUAL_DELEGATE_OFFSET; ++i) {
+       for (i = 1; i <= MONO_IMT_SIZE; ++i) {
                get_delegate_virtual_invoke_impl (&info, TRUE, - i * SIZEOF_VOID_P);
                res = g_slist_prepend (res, info);
+       }
 
+       for (i = 0; i <= MAX_VIRTUAL_DELEGATE_OFFSET; ++i) {
                get_delegate_virtual_invoke_impl (&info, FALSE, i * SIZEOF_VOID_P);
                res = g_slist_prepend (res, info);
+               get_delegate_virtual_invoke_impl (&info, TRUE, i * SIZEOF_VOID_P);
+               res = g_slist_prepend (res, info);
        }
 
        return res;
index fb65862bbc19b15285cb7a10c20392c86a287b9a..22e7413a6f531cb207b974d0cefdfff2605a12e9 100644 (file)
@@ -188,12 +188,20 @@ typedef struct MonoCompileArch {
 } MonoCompileArch;
 
 #ifdef TARGET_WIN32
-#define PARAM_REGS 4
-#define FLOAT_PARAM_REGS 4
 
 static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 };
 
-static AMD64_Reg_No return_regs [] = { AMD64_RAX, AMD64_RDX };
+static AMD64_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 };
+
+static AMD64_Reg_No return_regs [] = { AMD64_RAX };
+
+static AMD64_Reg_No float_return_regs [] = { AMD64_XMM0 };
+
+#define PARAM_REGS G_N_ELEMENTS(param_regs)
+#define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs)
+#define RETURN_REGS G_N_ELEMENTS(return_regs)
+#define FLOAT_RETURN_REGS G_N_ELEMENTS(float_return_regs)
+
 #else
 #define PARAM_REGS 6
 #define FLOAT_PARAM_REGS 8
@@ -248,6 +256,7 @@ typedef enum {
        ArgOnStack,
        ArgValuetypeInReg,
        ArgValuetypeAddrInIReg,
+       ArgValuetypeAddrOnStack,
        /* gsharedvt argument passed by addr */
        ArgGSharedVtInReg,
        ArgGSharedVtOnStack,
@@ -393,6 +402,7 @@ typedef struct {
 
 #define MONO_ARCH_LLVM_SUPPORTED 1
 #define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1
+#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT 1
 #define MONO_ARCH_HAVE_CARD_TABLE_WBARRIER 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GC_MAPS_SUPPORTED 1
@@ -472,6 +482,9 @@ mono_amd64_get_exception_trampolines (gboolean aot);
 int
 mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL;
 
+gpointer
+mono_amd64_handler_block_trampoline_helper (void);
+
 #ifdef TARGET_WIN32
 
 void mono_arch_unwindinfo_add_push_nonvol (gpointer* monoui, gpointer codebegin, gpointer nextip, guchar reg );
index 0094c976487fa062220d33ac1a8ea15534e1bd3d..4030fb08384971855e3a7687813fb8ff7686e105 100644 (file)
@@ -2645,7 +2645,6 @@ install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx)
 
 /*
  * Finds the bottom handler block running and install a block guard if needed.
- * FIXME add full-aot support.
  */
 gboolean
 mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
@@ -2654,9 +2653,10 @@ mono_install_handler_block_guard (MonoThreadUnwindState *ctx)
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS];
        gpointer resume_ip;
 
-       /* FIXME */
+#ifndef MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD_AOT
        if (mono_aot_only)
                return FALSE;
+#endif
 
        /* Guard against a null MonoJitTlsData. This can happens if the thread receives the
          * interrupt signal before the JIT has time to initialize its TLS data for the given thread.
index 425eea95ed81854b1d84e0637c7a0929dc3dbbc7..1bf14393db25142339add6f35a4e311d3ccbc728 100644 (file)
@@ -229,6 +229,14 @@ mono_llvm_set_call_preserveall_cc (LLVMValueRef func)
        unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
 }
 
+void
+mono_llvm_set_call_notail (LLVMValueRef func)
+{
+#if LLVM_API_VERSION > 100
+       //unwrap<CallInst>(func)->setTailCallKind (CallInst::TailCallKind::TCK_NoTail);
+#endif
+}
+
 #if LLVM_API_VERSION > 100
 
 void*
@@ -246,16 +254,21 @@ mono_llvm_di_create_compile_unit (void *di_builder, const char *cu_name, const c
 }
 
 void*
-mono_llvm_di_create_function (void *di_builder, void *cu, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
+mono_llvm_di_create_function (void *di_builder, void *cu, LLVMValueRef func, const char *name, const char *mangled_name, const char *dir, const char *file, int line)
 {
        DIBuilder *builder = (DIBuilder*)di_builder;
        DIFile *di_file;
        DISubroutineType *type;
+       DISubprogram *di_func;
 
        // FIXME: Share DIFile
        di_file = builder->createFile (file, dir);
        type = builder->createSubroutineType (builder->getOrCreateTypeArray (ArrayRef<Metadata*> ()));
-       return builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);
+       di_func = builder->createFunction (di_file, name, mangled_name, di_file, line, type, true, true, 0);
+
+       unwrap<Function>(func)->setMetadata ("dbg", di_func);
+
+       return di_func;
 }
 
 void*
index 064c587ce54d5773cf59881f420947ea1d302d81..f969274e4a7f6bfb211b13063d73dea5f51a61a2 100644 (file)
@@ -89,6 +89,9 @@ mono_llvm_set_preserveall_cc (LLVMValueRef func);
 void
 mono_llvm_set_call_preserveall_cc (LLVMValueRef call);
 
+void
+mono_llvm_set_call_notail (LLVMValueRef call);
+
 _Unwind_Reason_Code 
 mono_debug_personality (int a, _Unwind_Action b,
        uint64_t c, struct _Unwind_Exception *d, struct _Unwind_Context *e);
@@ -100,7 +103,7 @@ void*
 mono_llvm_create_di_builder (LLVMModuleRef module);
 
 void*
-mono_llvm_di_create_function (void *di_builder, void *cu, const char *name, const char *mangled_name, const char *dir, const char *file, int line);
+mono_llvm_di_create_function (void *di_builder, void *cu, LLVMValueRef func, const char *name, const char *mangled_name, const char *dir, const char *file, int line);
 
 void*
 mono_llvm_di_create_compile_unit (void *di_builder, const char *cu_name, const char *dir, const char *producer);
index bc7b1765b71905c6bc162749d11c927f4618ff05..6031df370c283e4be3816e4640b24b6528739bb4 100644 (file)
@@ -813,14 +813,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse2.min.pd";
        case OP_MINPS:
                return "llvm.x86.sse.min.ps";
-       case OP_PMIND_UN:
-               return "llvm.x86.sse41.pminud";
-       case OP_PMINW_UN:
-               return "llvm.x86.sse41.pminuw";
-       case OP_PMINB_UN:
-               return "llvm.x86.sse2.pminu.b";
-       case OP_PMINW:
-               return "llvm.x86.sse2.pmins.w";
        case OP_MAXPD:
                return "llvm.x86.sse2.max.pd";
        case OP_MAXPS:
@@ -833,12 +825,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse3.hsub.pd";
        case OP_HSUBPS:
                return "llvm.x86.sse3.hsub.ps";
-       case OP_PMAXD_UN:
-               return "llvm.x86.sse41.pmaxud";
-       case OP_PMAXW_UN:
-               return "llvm.x86.sse41.pmaxuw";
-       case OP_PMAXB_UN:
-               return "llvm.x86.sse2.pmaxu.b";
        case OP_ADDSUBPS:
                return "llvm.x86.sse3.addsub.ps";
        case OP_ADDSUBPD:
@@ -913,10 +899,6 @@ simd_op_to_intrins (int opcode)
                return "llvm.x86.sse2.cvttpd2dq";
        case OP_CVTTPS2DQ:
                return "llvm.x86.sse2.cvttps2dq";
-       case OP_COMPPS:
-               return "llvm.x86.sse.cmp.ps";
-       case OP_COMPPD:
-               return "llvm.x86.sse2.cmp.pd";
        case OP_PACKW:
                return "llvm.x86.sse2.packsswb.128";
        case OP_PACKD:
@@ -1156,8 +1138,19 @@ static LLVMValueRef
 emit_volatile_load (EmitContext *ctx, int vreg)
 {
        MonoType *t;
+       LLVMValueRef v;
 
-       LLVMValueRef v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#ifdef TARGET_ARM64
+       // FIXME: This hack is required because we pass the rgctx in a callee saved
+       // register on arm64 (x15), and llvm might keep the value in that register
+       // even through the register is marked as 'reserved' inside llvm.
+       if (ctx->cfg->rgctx_var && ctx->cfg->rgctx_var->dreg == vreg)
+               v = mono_llvm_build_load (ctx->builder, ctx->addresses [vreg], "", TRUE);
+       else
+               v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#else
+       v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#endif
        t = ctx->vreg_cli_types [vreg];
        if (t && !t->byref) {
                /* 
@@ -1590,18 +1583,17 @@ get_aotconst_typed (EmitContext *ctx, MonoJumpInfoType type, gconstpointer data,
        MonoCompile *cfg;
        guint32 got_offset;
        LLVMValueRef indexes [2];
-       MonoJumpInfo *ji;
        LLVMValueRef got_entry_addr, load;
        LLVMBuilderRef builder = ctx->builder;
        char *name = NULL;
 
        cfg = ctx->cfg;
 
-       ji = g_new0 (MonoJumpInfo, 1);
-       ji->type = type;
-       ji->data.target = data;
+       MonoJumpInfo tmp_ji;
+       tmp_ji.type = type;
+       tmp_ji.data.target = data;
 
-       ji = mono_aot_patch_info_dup (ji);
+       MonoJumpInfo *ji = mono_aot_patch_info_dup (&tmp_ji);
 
        ji->next = cfg->patch_info;
        cfg->patch_info = ji;
@@ -2423,7 +2415,7 @@ emit_get_method (MonoLLVMModule *module)
        LLVMBasicBlockRef entry_bb, fail_bb, bb, code_start_bb, code_end_bb;
        LLVMBasicBlockRef *bbs;
        LLVMTypeRef rtype;
-       LLVMBuilderRef builder;
+       LLVMBuilderRef builder = LLVMCreateBuilder ();
        char *name;
        int i;
 
@@ -2449,14 +2441,12 @@ emit_get_method (MonoLLVMModule *module)
        name = g_strdup_printf ("BB_CODE_START");
        code_start_bb = LLVMAppendBasicBlock (func, name);
        g_free (name);
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, code_start_bb);
        LLVMBuildRet (builder, LLVMBuildBitCast (builder, module->code_start, rtype, ""));
 
        name = g_strdup_printf ("BB_CODE_END");
        code_end_bb = LLVMAppendBasicBlock (func, name);
        g_free (name);
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, code_end_bb);
        LLVMBuildRet (builder, LLVMBuildBitCast (builder, module->code_end, rtype, ""));
 
@@ -2467,7 +2457,6 @@ emit_get_method (MonoLLVMModule *module)
                g_free (name);
                bbs [i] = bb;
 
-               builder = LLVMCreateBuilder ();
                LLVMPositionBuilderAtEnd (builder, bb);
 
                m = (LLVMValueRef)g_hash_table_lookup (module->idx_to_lmethod, GINT_TO_POINTER (i));
@@ -2478,11 +2467,9 @@ emit_get_method (MonoLLVMModule *module)
        }
 
        fail_bb = LLVMAppendBasicBlock (func, "FAIL");
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, fail_bb);
        LLVMBuildRet (builder, LLVMConstNull (rtype));
 
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
 
        switch_ins = LLVMBuildSwitch (builder, LLVMGetParam (func, 0), fail_bb, 0);
@@ -2493,6 +2480,8 @@ emit_get_method (MonoLLVMModule *module)
        }
 
        mark_as_used (module, func);
+
+       LLVMDisposeBuilder (builder);
 }
 
 /*
@@ -2508,7 +2497,7 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
        LLVMBasicBlockRef entry_bb, fail_bb, bb;
        LLVMBasicBlockRef *bbs;
        LLVMTypeRef rtype;
-       LLVMBuilderRef builder;
+       LLVMBuilderRef builder = LLVMCreateBuilder ();
        char *name;
        int i;
 
@@ -2534,18 +2523,15 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
                g_free (name);
                bbs [i] = bb;
 
-               builder = LLVMCreateBuilder ();
                LLVMPositionBuilderAtEnd (builder, bb);
 
                LLVMBuildRet (builder, LLVMBuildBitCast (builder, m, rtype, ""));
        }
 
        fail_bb = LLVMAppendBasicBlock (func, "FAIL");
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, fail_bb);
        LLVMBuildRet (builder, LLVMConstNull (rtype));
 
-       builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
 
        switch_ins = LLVMBuildSwitch (builder, LLVMGetParam (func, 0), fail_bb, 0);
@@ -2558,6 +2544,7 @@ emit_get_unbox_tramp (MonoLLVMModule *module)
        }
 
        mark_as_used (module, func);
+       LLVMDisposeBuilder (builder);
 }
 
 /* Add a function to mark the beginning of LLVM code */
@@ -2577,6 +2564,7 @@ emit_llvm_code_start (MonoLLVMModule *module)
        builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
        LLVMBuildRetVoid (builder);
+       LLVMDisposeBuilder (builder);
 }
 
 static LLVMValueRef
@@ -2650,6 +2638,7 @@ emit_init_icall_wrapper (MonoLLVMModule *module, const char *name, const char *i
        LLVMBuildRetVoid (builder);
 
        LLVMVerifyFunction(func, LLVMAbortProcessAction);
+       LLVMDisposeBuilder (builder);
        return func;
 }
 
@@ -2683,6 +2672,7 @@ emit_llvm_code_end (MonoLLVMModule *module)
        builder = LLVMCreateBuilder ();
        LLVMPositionBuilderAtEnd (builder, entry_bb);
        LLVMBuildRetVoid (builder);
+       LLVMDisposeBuilder (builder);
 }
 
 static void
@@ -2873,6 +2863,7 @@ emit_unbox_tramp (EmitContext *ctx, const char *method_name, LLVMTypeRef method_
                LLVMBuildRet (builder, call);
 
        g_hash_table_insert (ctx->module->idx_to_unbox_tramp, GINT_TO_POINTER (method_index), tramp);
+       LLVMDisposeBuilder (builder);
 }
 
 /*
@@ -3986,6 +3977,7 @@ emit_handler_start (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef builder
                        LLVMPositionBuilderAtEnd (builder2, entry_bb);
                        LLVMBuildRet (builder2, LLVMConstInt (LLVMInt32Type (), 0, FALSE));
                        ctx->module->personality = personality;
+                       LLVMDisposeBuilder (builder2);
                }
 #else
                static gint32 mapping_inited;
@@ -5799,12 +5791,13 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        if (!var) {
                                LLVMValueRef indexes [16];
 
-                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME");
+                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME_");
                                LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, strlen (name) + 1));
                                LLVMSetLinkage (name_var, LLVMPrivateLinkage);
                                LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals");
+                               mark_as_used (ctx->module, name_var);
 
-                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES");
+                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES_");
 
                                indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, 0);
                                indexes [1] = LLVMConstInt (LLVMInt32Type (), 0, 0);
@@ -5813,6 +5806,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                LLVMSetExternallyInitialized (ref_var, TRUE);
                                LLVMSetSection (ref_var, "__DATA, __objc_selrefs, literal_pointers, no_dead_strip");
                                LLVMSetAlignment (ref_var, sizeof (mgreg_t));
+                               mark_as_used (ctx->module, ref_var);
 
                                g_hash_table_insert (ctx->module->objc_selector_to_var, g_strdup (name), ref_var);
                                var = ref_var;
@@ -5942,19 +5936,31 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildBitCast (builder, v, rt, "");
                        break;
                }
+               case OP_PMIND_UN:
+               case OP_PMINW_UN:
+               case OP_PMINB_UN: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntULT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
+               case OP_PMAXD_UN:
+               case OP_PMAXW_UN:
+               case OP_PMAXB_UN: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntUGT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
+               case OP_PMINW: {
+                       LLVMValueRef cmp = LLVMBuildICmp (builder, LLVMIntSLT, lhs, rhs, "");
+                       values [ins->dreg] = LLVMBuildSelect (builder, cmp, lhs, rhs, "");
+                       break;
+               }
                case OP_MINPD:
                case OP_MINPS:
                case OP_MAXPD:
                case OP_MAXPS:
                case OP_ADDSUBPD:
                case OP_ADDSUBPS:
-               case OP_PMIND_UN:
-               case OP_PMINW_UN:
-               case OP_PMINB_UN:
-               case OP_PMINW:
-               case OP_PMAXD_UN:
-               case OP_PMAXW_UN:
-               case OP_PMAXB_UN:
                case OP_HADDPD:
                case OP_HADDPS:
                case OP_HSUBPD:
@@ -6070,6 +6076,33 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildInsertElement (builder, values [ins->sreg1], convert (ctx, values [ins->sreg2], LLVMDoubleType ()), LLVMConstInt (LLVMInt32Type (), ins->inst_c0, FALSE), dname);
                        break;
 
+#if 0
+                       // Requires a later llvm version
+               case OP_CVTDQ2PD: {
+                       LLVMValueRef indexes [16];
+
+                       indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, FALSE);
+                       indexes [1] = LLVMConstInt (LLVMInt32Type (), 1, FALSE);
+                       LLVMValueRef mask = LLVMConstVector (indexes, 2);
+                       LLVMValueRef shuffle = LLVMBuildShuffleVector (builder, lhs, LLVMConstNull (LLVMTypeOf (lhs)), mask, "");
+                       values [ins->dreg] = LLVMBuildSIToFP (builder, shuffle, LLVMVectorType (LLVMDoubleType (), 2), dname);
+                       break;
+               }
+               case OP_CVTPS2PD: {
+                       LLVMValueRef indexes [16];
+
+                       indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, FALSE);
+                       indexes [1] = LLVMConstInt (LLVMInt32Type (), 1, FALSE);
+                       LLVMValueRef mask = LLVMConstVector (indexes, 2);
+                       LLVMValueRef shuffle = LLVMBuildShuffleVector (builder, lhs, LLVMConstNull (LLVMTypeOf (lhs)), mask, "");
+                       values [ins->dreg] = LLVMBuildFPExt (builder, shuffle, LLVMVectorType (LLVMDoubleType (), 2), dname);
+                       break;
+               }
+               case OP_CVTTPS2DQ:
+                       values [ins->dreg] = LLVMBuildFPToSI (builder, lhs, LLVMVectorType (LLVMInt32Type (), 4), dname);
+                       break;
+#endif
+
                case OP_CVTDQ2PD:
                case OP_CVTDQ2PS:
                case OP_CVTPD2DQ:
@@ -6090,19 +6123,46 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        values [ins->dreg] = LLVMBuildCall (builder, get_intrinsic (ctx, simd_op_to_intrins (ins->opcode)), &v, 1, dname);
                        break;
                }
-
                case OP_COMPPS:
                case OP_COMPPD: {
-                       LLVMValueRef args [3];
+                       LLVMRealPredicate op;
 
-                       args [0] = lhs;
-                       args [1] = rhs;
-                       args [2] = LLVMConstInt (LLVMInt8Type (), ins->inst_c0, FALSE);
+                       switch (ins->inst_c0) {
+                       case SIMD_COMP_EQ:
+                               op = LLVMRealOEQ;
+                               break;
+                       case SIMD_COMP_LT:
+                               op = LLVMRealOLT;
+                               break;
+                       case SIMD_COMP_LE:
+                               op = LLVMRealOLE;
+                               break;
+                       case SIMD_COMP_UNORD:
+                               op = LLVMRealUNO;
+                               break;
+                       case SIMD_COMP_NEQ:
+                               op = LLVMRealUNE;
+                               break;
+                       case SIMD_COMP_NLT:
+                               op = LLVMRealUGE;
+                               break;
+                       case SIMD_COMP_NLE:
+                               op = LLVMRealUGT;
+                               break;
+                       case SIMD_COMP_ORD:
+                               op = LLVMRealORD;
+                               break;
+                       default:
+                               g_assert_not_reached ();
+                       }
 
-                       values [ins->dreg] = LLVMBuildCall (builder, get_intrinsic (ctx, simd_op_to_intrins (ins->opcode)), args, 3, dname);
+                       LLVMValueRef cmp = LLVMBuildFCmp (builder, op, lhs, rhs, "");
+                       if (ins->opcode == OP_COMPPD)
+                               values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt64Type (), 2), ""), LLVMTypeOf (lhs), "");
+                       else
+                               values [ins->dreg] = LLVMBuildBitCast (builder, LLVMBuildSExt (builder, cmp, LLVMVectorType (LLVMInt32Type (), 4), ""), LLVMTypeOf (lhs), "");
                        break;
                }
-
                case OP_ICONV_TO_X:
                        /* This is only used for implementing shifts by non-immediate */
                        values [ins->dreg] = lhs;
@@ -6618,6 +6678,14 @@ free_ctx (EmitContext *ctx)
        g_hash_table_destroy (ctx->region_to_handler);
        g_hash_table_destroy (ctx->clause_to_handler);
        g_hash_table_destroy (ctx->jit_callees);
+
+       GHashTableIter iter;
+       g_hash_table_iter_init (&iter, ctx->method_to_callers);
+       while (g_hash_table_iter_next (&iter, NULL, (gpointer)&l))
+               g_slist_free (l);
+
+       g_hash_table_destroy (ctx->method_to_callers);
+
        g_free (ctx->method_name);
        g_ptr_array_free (ctx->bblock_list, TRUE);
 
@@ -7714,11 +7782,6 @@ typedef enum {
        INTRINS_SSE_HADDPD,
        INTRINS_SSE_HSUBPD,
        INTRINS_SSE_ADDSUBPD,
-       INTRINS_SSE_PMINUD,
-       INTRINS_SSE_PMAXUD,
-       INTRINS_SSE_PMINUW,
-       INTRINS_SSE_PMINSW,
-       INTRINS_SSE_PMAXUW,
        INTRINS_SSE_PADDSW,
        INTRINS_SSE_PSUBSW,
        INTRINS_SSE_PADDUSW,
@@ -7726,8 +7789,6 @@ typedef enum {
        INTRINS_SSE_PAVGW,
        INTRINS_SSE_PMULHW,
        INTRINS_SSE_PMULHU,
-       INTRINS_SSE_PMINUB,
-       INTRINS_SSE_PMAXUB,
        INTRINS_SE_PADDSB,
        INTRINS_SSE_PSUBSB,
        INTRINS_SSE_PADDUSB,
@@ -7803,11 +7864,6 @@ static IntrinsicDesc intrinsics[] = {
        {INTRINS_SSE_HADDPD, "llvm.x86.sse3.hadd.pd"},
        {INTRINS_SSE_HSUBPD, "llvm.x86.sse3.hsub.pd"},
        {INTRINS_SSE_ADDSUBPD, "llvm.x86.sse3.addsub.pd"},
-       {INTRINS_SSE_PMINUD, "llvm.x86.sse41.pminud"},
-       {INTRINS_SSE_PMAXUD, "llvm.x86.sse41.pmaxud"},
-       {INTRINS_SSE_PMINUW, "llvm.x86.sse41.pminuw"},
-       {INTRINS_SSE_PMINSW, "llvm.x86.sse2.pmins.w"},
-       {INTRINS_SSE_PMAXUW, "llvm.x86.sse41.pmaxuw"},
        {INTRINS_SSE_PADDSW, "llvm.x86.sse2.padds.w"},
        {INTRINS_SSE_PSUBSW, "llvm.x86.sse2.psubs.w"},
        {INTRINS_SSE_PADDUSW, "llvm.x86.sse2.paddus.w"},
@@ -7815,8 +7871,6 @@ static IntrinsicDesc intrinsics[] = {
        {INTRINS_SSE_PAVGW, "llvm.x86.sse2.pavg.w"},
        {INTRINS_SSE_PMULHW, "llvm.x86.sse2.pmulh.w"},
        {INTRINS_SSE_PMULHU, "llvm.x86.sse2.pmulhu.w"},
-       {INTRINS_SSE_PMINUB, "llvm.x86.sse2.pminu.b"},
-       {INTRINS_SSE_PMAXUB, "llvm.x86.sse2.pmaxu.b"},
        {INTRINS_SE_PADDSB, "llvm.x86.sse2.padds.b"},
        {INTRINS_SSE_PSUBSB, "llvm.x86.sse2.psubs.b"},
        {INTRINS_SSE_PADDUSB, "llvm.x86.sse2.paddus.b"},
@@ -8022,13 +8076,6 @@ add_intrinsic (LLVMModuleRef module, int id)
                AddFunc (module, name, ret_type, arg_types, 2);
                break;
                /* SSE Binary ops */
-       case INTRINS_SSE_PMINUD:
-       case INTRINS_SSE_PMAXUD:
-               add_sse_binary (module, name, MONO_TYPE_I4);
-               break;
-       case INTRINS_SSE_PMINUW:
-       case INTRINS_SSE_PMINSW:
-       case INTRINS_SSE_PMAXUW:
        case INTRINS_SSE_PADDSW:
        case INTRINS_SSE_PSUBSW:
        case INTRINS_SSE_PADDUSW:
@@ -8052,8 +8099,6 @@ add_intrinsic (LLVMModuleRef module, int id)
        case INTRINS_SSE_ADDSUBPD:
                add_sse_binary (module, name, MONO_TYPE_R8);
                break;
-       case INTRINS_SSE_PMINUB:
-       case INTRINS_SSE_PMAXUB:
        case INTRINS_SE_PADDSB:
        case INTRINS_SSE_PSUBSB:
        case INTRINS_SSE_PADDUSB:
@@ -8126,11 +8171,6 @@ add_intrinsics (LLVMModuleRef module)
                AddFunc (module, "llvm_resume_unwind_trampoline", LLVMVoidType (), NULL, 0);
        }
 
-       /* SSE intrinsics */
-#if defined(TARGET_X86) || defined(TARGET_AMD64)
-
-#endif
-
        /* Load/Store intrinsics */
        {
                LLVMTypeRef arg_types [5];
@@ -8298,10 +8338,6 @@ mono_llvm_create_aot_module (MonoAssembly *assembly, const char *global_prefix,
                /* clang ignores our debug info because it has an invalid version */
                module->emit_dwarf = FALSE;
 
-#if LLVM_API_VERSION > 100
-       module->emit_dwarf = FALSE;
-#endif
-
        add_intrinsics (module->lmodule);
        add_types (module);
 
@@ -8879,7 +8915,7 @@ emit_dbg_subprogram (EmitContext *ctx, MonoCompile *cfg, LLVMValueRef method, co
        filename = g_path_get_basename (source_file);
 
 #if LLVM_API_VERSION > 100
-       return mono_llvm_di_create_function (module->di_builder, module->cu, cfg->method->name, name, dir, filename, n_seq_points ? sym_seq_points [0].line : 1);
+       return mono_llvm_di_create_function (module->di_builder, module->cu, method, cfg->method->name, name, dir, filename, n_seq_points ? sym_seq_points [0].line : 1);
 #endif
 
        ctx_args [0] = LLVMConstInt (LLVMInt32Type (), 0x29, FALSE);
index 4c29d4a0e4dd0e9f5b3be528f88faa68f1be86ba..07dd0a435376575104bed2e5da8a9ffa6a8bc099 100644 (file)
@@ -1400,3 +1400,4 @@ MINI_OP(OP_OBJC_GET_SELECTOR, "objc_get_selector", IREG, NONE, NONE)
 MINI_OP(OP_GET_SP, "get_sp", IREG, NONE, NONE)
 MINI_OP(OP_SET_SP, "set_sp", NONE, IREG, NONE)
 
+MINI_OP(OP_GET_LAST_ERROR, "get_last_error", IREG, NONE, NONE)
index 861ab5cf437789a04e5926d4b14a3b4680fef364..36225e43a5fd315cbc9d7f6aa151ae45bc26e7f1 100644 (file)
@@ -1514,7 +1514,7 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                handle = mono_ldtoken_checked (patch_info->data.token->image,
                                                           patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
                if (!mono_error_ok (error))
-                       g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
+                       return NULL;
                mono_class_init (handle_class);
                mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
 
@@ -2779,6 +2779,9 @@ MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler)
        MonoException *exc;
        MONO_SIG_HANDLER_GET_CONTEXT;
 
+       if (mono_runtime_get_no_exec ())
+               exit (1);
+
        MONO_ENTER_GC_UNSAFE_UNBALANCED;
 
        exc = mono_get_exception_execution_engine ("SIGILL");
@@ -3053,6 +3056,17 @@ mini_init_delegate (MonoDelegate *del)
                del->extra_arg = mini_get_delegate_arg (del->method, del->method_ptr);
 }
 
+char*
+mono_get_delegate_virtual_invoke_impl_name (gboolean load_imt_reg, int offset)
+{
+       int abs_offset;
+
+       abs_offset = offset;
+       if (abs_offset < 0)
+               abs_offset = - abs_offset;
+       return g_strdup_printf ("delegate_virtual_invoke%s_%s%d", load_imt_reg ? "_imt" : "", offset < 0 ? "m_" : "", abs_offset / SIZEOF_VOID_P);
+}
+
 gpointer
 mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method)
 {
@@ -3104,12 +3118,7 @@ mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *met
 
        /* FIXME Support more cases */
        if (mono_aot_only) {
-               char tramp_name [256];
-               const char *imt = load_imt_reg ? "_imt" : "";
-               int ind = (load_imt_reg ? (-offset) : offset) / SIZEOF_VOID_P;
-
-               sprintf (tramp_name, "delegate_virtual_invoke%s_%d", imt, ind);
-               cache [idx] = (guint8 *)mono_aot_get_trampoline (tramp_name);
+               cache [idx] = (guint8 *)mono_aot_get_trampoline (mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset));
                g_assert (cache [idx]);
        } else {
                cache [idx] = (guint8 *)mono_arch_get_delegate_virtual_invoke_impl (sig, method, offset, load_imt_reg);
index fbc9674fb52702f0c2a3cc0100b36a9d93f35393..12be87a1fab52deee3d143b7202cbf665e572f47 100644 (file)
@@ -1304,15 +1304,19 @@ gpointer
 mono_create_handler_block_trampoline (void)
 {
        static gpointer code;
-       if (code) {
+
+       if (code)
+               return code;
+
+       if (mono_aot_only) {
+               gpointer tmp = mono_aot_get_trampoline ("handler_block_trampoline");
+               g_assert (tmp);
                mono_memory_barrier ();
+               code = tmp;
                return code;
        }
 
-       g_assert (!mono_aot_only);
-
        mono_trampolines_lock ();
-
        if (!code) {
                MonoTrampInfo *info;
                gpointer tmp;
index 8fc2c8b54236716d92170f1159820ade47d33718..aafc380d8f98af47218d0440dcaf78d9f6ca6161 100644 (file)
@@ -6050,10 +6050,7 @@ get_delegate_virtual_invoke_impl (MonoTrampInfo **info, gboolean load_imt_reg, i
        x86_jump_membase (code, X86_EAX, offset);
        mono_profiler_code_buffer_new (start, code - start, MONO_PROFILER_CODE_BUFFER_DELEGATE_INVOKE, NULL);
 
-       if (load_imt_reg)
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_imt_%d", - offset / sizeof (gpointer));
-       else
-               tramp_name = g_strdup_printf ("delegate_virtual_invoke_%d", offset / sizeof (gpointer));
+       tramp_name = mono_get_delegate_virtual_invoke_impl_name (load_imt_reg, offset);
        *info = mono_tramp_info_create (tramp_name, start, code - start, NULL, unwind_ops);
        g_free (tramp_name);
 
index 4c79621baf6b4de15d935abb7486c6c961fd112f..fff5ece8d5512e319ffe7c3a70bbaf25e5ba2b24 100644 (file)
@@ -1169,7 +1169,7 @@ mono_allocate_stack_slots2 (MonoCompile *cfg, gboolean backward, guint32 *stack_
                vars = g_list_prepend (vars, vmv);
        }
 
-       vars = g_list_sort (g_list_copy (vars), compare_by_interval_start_pos_func);
+       vars = g_list_sort (vars, compare_by_interval_start_pos_func);
 
        /* Sanity check */
        /*
@@ -1886,28 +1886,59 @@ mono_verify_cfg (MonoCompile *cfg)
                mono_verify_bblock (bb);
 }
 
+// This will free many fields in cfg to save
+// memory. Note that this must be safe to call
+// multiple times. It must be idempotent. 
+void
+mono_empty_compile (MonoCompile *cfg)
+{
+       mono_free_loop_info (cfg);
+
+       // These live in the mempool, and so must be freed
+       // first
+       for (GSList *l = cfg->headers_to_free; l; l = l->next) {
+               mono_metadata_free_mh ((MonoMethodHeader *)l->data);
+       }
+       cfg->headers_to_free = NULL;
+
+       if (cfg->mempool) {
+       //mono_mempool_stats (cfg->mempool);
+               mono_mempool_destroy (cfg->mempool);
+               cfg->mempool = NULL;
+       }
+
+       g_free (cfg->varinfo);
+       cfg->varinfo = NULL;
+
+       g_free (cfg->vars);
+       cfg->vars = NULL;
+
+       if (cfg->rs) {
+               mono_regstate_free (cfg->rs);
+               cfg->rs = NULL;
+       }
+}
+
 void
 mono_destroy_compile (MonoCompile *cfg)
 {
-       GSList *l;
+       mono_empty_compile (cfg);
 
        if (cfg->header)
                mono_metadata_free_mh (cfg->header);
-       //mono_mempool_stats (cfg->mempool);
-       mono_free_loop_info (cfg);
-       if (cfg->rs)
-               mono_regstate_free (cfg->rs);
+
        if (cfg->spvars)
                g_hash_table_destroy (cfg->spvars);
        if (cfg->exvars)
                g_hash_table_destroy (cfg->exvars);
-       for (l = cfg->headers_to_free; l; l = l->next)
-               mono_metadata_free_mh ((MonoMethodHeader *)l->data);
+
        g_list_free (cfg->ldstr_list);
-       g_hash_table_destroy (cfg->token_info_hash);
+
+       if (cfg->token_info_hash)
+               g_hash_table_destroy (cfg->token_info_hash);
+
        if (cfg->abs_patches)
                g_hash_table_destroy (cfg->abs_patches);
-       mono_mempool_destroy (cfg->mempool);
 
        mono_debug_free_method (cfg);
 
@@ -3368,6 +3399,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                                        //g_free (nm);
                                }
                                if (cfg->llvm_only) {
+                                       g_free (cfg->exception_message);
                                        cfg->disable_aot = TRUE;
                                        return cfg;
                                }
index 9039f491dabbbe5bc6c4c2c32cb99154be23d3a7..92671537280fefbc287bde55e987e6aa7468de70 100644 (file)
@@ -2428,6 +2428,7 @@ void      mono_global_regalloc              (MonoCompile *cfg);
 void      mono_create_jump_table            (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
 MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts, int aot_method_index);
 void      mono_destroy_compile              (MonoCompile *cfg);
+void      mono_empty_compile              (MonoCompile *cfg);
 MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode);
 void     mono_print_ins_index (int i, MonoInst *ins);
 void     mono_print_ins (MonoInst *ins);
@@ -2640,6 +2641,7 @@ void              mono_if_conversion (MonoCompile *cfg);
 /* Delegates */
 gpointer          mini_get_delegate_arg (MonoMethod *method, gpointer method_ptr);
 void              mini_init_delegate (MonoDelegate *del);
+char*             mono_get_delegate_virtual_invoke_impl_name (gboolean load_imt_reg, int offset);
 gpointer          mono_get_delegate_virtual_invoke_impl  (MonoMethodSignature *sig, MonoMethod *method);
 
 /* methods that must be provided by the arch-specific port */
index b89cc887ff15f21a57f676bad55f3ca7e51c5d79..a22c14b08ea8e9e4d89ffcde322238f4eac55f83 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/bash
 
-TEST_FILE=$1
-USE_AOT=$2
+DEFAULT_PROFILE=$1
+TEST_FILE=$2
+USE_AOT=$3
 
 TMP_FILE_PREFIX=$(basename $0).tmp
 BASEDIR=$(dirname $0)
@@ -11,7 +12,7 @@ case "$(uname -s)" in
        *) PLATFORM_PATH_SEPARATOR=':';;
 esac
 
-MONO_PATH=$BASEDIR/../../mcs/class/lib/net_4_x$PLATFORM_PATH_SEPARATOR$BASEDIR
+MONO_PATH=$BASEDIR/../../mcs/class/lib/$DEFAULT_PROFILE$PLATFORM_PATH_SEPARATOR$BASEDIR
 RUNTIME=$BASEDIR/../../runtime/mono-wrapper
 
 trap "rm -rf ${TMP_FILE_PREFIX}*" EXIT
index d9737fb8c52e948339da1868b78630a3a2005c34..b70924cced353fae1a7ac6223c76ea0dfb7340c5 100644 (file)
@@ -757,12 +757,11 @@ mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
        amd64_call_reg (code, AMD64_R11);
 }
 
-
-static void
-handler_block_trampoline_helper (gpointer *ptr)
+gpointer
+mono_amd64_handler_block_trampoline_helper (void)
 {
        MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
-       *ptr = jit_tls->handler_block_return_address;
+       return jit_tls->handler_block_return_address;
 }
 
 gpointer
@@ -774,8 +773,6 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops;
 
-       g_assert (!aot);
-
        code = buf = (guint8 *)mono_global_codeman_reserve (tramp_size);
 
        unwind_ops = mono_arch_get_cie_program ();
@@ -783,7 +780,7 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        /*
        This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
        */
-       if (mono_get_jit_tls_offset () != -1) {
+       if (!aot && mono_get_jit_tls_offset () != -1) {
                code = mono_amd64_emit_tls_get (code, MONO_AMD64_ARG_REG1, mono_get_jit_tls_offset ());
                amd64_mov_reg_membase (code, MONO_AMD64_ARG_REG1, MONO_AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoJitTlsData, handler_block_return_address), 8);
                /* Simulate a call */
@@ -791,14 +788,35 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
                mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
                amd64_jump_code (code, tramp);
        } else {
-               /*Slow path uses a c helper*/
-               amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, AMD64_RSP, 8);
-               amd64_mov_reg_imm (code, AMD64_RAX, tramp);
-               amd64_push_reg (code, AMD64_RAX);
-               mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 16);
+               /*
+                * We get here from the ret emitted by CEE_ENDFINALLY.
+                * The stack is misaligned.
+                */
+               /* Align the stack before the call */
+               amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 8);
+               if (aot) {
+                       code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_amd64_handler_block_trampoline_helper");
+                       amd64_call_reg (code, AMD64_R11);
+               } else {
+                       amd64_call_code (code, mono_amd64_handler_block_trampoline_helper);
+               }
+               /* Undo stack alignment */
+               amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, 8);
+               /* Save the result to the stack */
                amd64_push_reg (code, AMD64_RAX);
-               mono_add_unwind_op_def_cfa_offset (unwind_ops, code, buf, 24);
-               amd64_jump_code (code, handler_block_trampoline_helper);
+               if (aot) {
+                       char *name = g_strdup_printf ("trampoline_func_%d", MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD);
+                       code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, name);
+                       amd64_mov_reg_reg (code, AMD64_RAX, AMD64_R11, 8);
+               } else {
+                       amd64_mov_reg_imm (code, AMD64_RAX, tramp);
+               }
+               /* The stack is aligned */
+               amd64_call_reg (code, AMD64_RAX);
+               /* Load return address */
+               amd64_pop_reg (code, AMD64_RAX);
+               /* The stack is misaligned, thats what the code we branch to expects */
+               amd64_jump_reg (code, AMD64_RAX);
        }
 
        mono_arch_flush_icache (buf, code - buf);
index ef3c65a7f225790813dfa5ab71f9a5e11b8c8ed4..a2824292404979c4f6e76691edaf2ce99a723575 100644 (file)
@@ -375,13 +375,15 @@ mono_unwind_ops_encode_full (GSList *unwind_ops, guint32 *out_len, gboolean enab
                while (op->when > loc) {
                        if (op->when - loc > 65536) {
                                *p ++ = DW_CFA_advance_loc4;
-                               *(guint32*)p = (guint32)(op->when - loc);
+                               guint32 v = (guint32)(op->when - loc);
+                               memcpy (p, &v, 4);
                                g_assert (read32 (p) == (guint32)(op->when - loc));
                                p += 4;
                                loc = op->when;
                        } else if (op->when - loc > 256) {
                                *p ++ = DW_CFA_advance_loc2;
-                               *(guint16*)p = (guint16)(op->when - loc);
+                               guint16 v = (guint16)(op->when - loc);
+                               memcpy (p, &v, 2);
                                g_assert (read16 (p) == (guint32)(op->when - loc));
                                p += 2;
                                loc = op->when;
index b510a4fc43b77c222100da152262c457f507d79e..3dac1df3d8dfb82cc4c835eba8d0b59c4c5ad603 100644 (file)
@@ -3142,9 +3142,15 @@ sgen_gc_init (void)
 
        sgen_register_root (NULL, 0, sgen_make_user_root_descriptor (sgen_mark_normal_gc_handles), ROOT_TYPE_NORMAL, MONO_ROOT_SOURCE_GC_HANDLE, "normal gc handles");
 
-       sgen_init_bridge_processor();
-
        gc_initialized = 1;
+
+       sgen_init_bridge ();
+}
+
+gboolean
+sgen_gc_initialized ()
+{
+       return gc_initialized > 0;
 }
 
 NurseryClearPolicy
index d600efbe8da93d0296f4c1bde6f9ba5fd1bc4715..c08502dc55e2e0517bbf59df732619f56ae42748 100644 (file)
@@ -303,6 +303,8 @@ void sgen_check_section_scan_starts (GCMemSection *section);
 
 void sgen_conservatively_pin_objects_from (void **start, void **end, void *start_nursery, void *end_nursery, int pin_type);
 
+gboolean sgen_gc_initialized (void);
+
 /* Keep in sync with description_for_type() in sgen-internal.c! */
 enum {
        INTERNAL_MEM_PIN_QUEUE,
index 8b4f3cb612dd4370c6f96a04798abf26ec1cc6cb..6a20d0c57fad1e275e2ffc9e213c3bd385f94155 100644 (file)
@@ -1572,6 +1572,12 @@ ensure_block_is_checked_for_sweeping (guint32 block_index, gboolean wait, gboole
        }
 
  done:
+       /*
+        * Once the block is written back without the checking bit other threads are
+        * free to access it. Make sure the block state is visible before we write it
+        * back.
+        */
+       mono_memory_write_barrier ();
        *block_slot = tagged_block;
        return !!tagged_block;
 }
index 2bd8f5dff12e5266fa7c39893d1b5e7fdb1fec29..3f225f93cde330f8ed3b73251abc83a08e55b3be 100644 (file)
@@ -1,7 +1,13 @@
 SUBDIRS = assemblyresolve gc-descriptors
 
+if INSTALL_MOBILE_STATIC
+FEATUREFUL_RUNTIME_TEST =  
+else
+FEATUREFUL_RUNTIME_TEST = test-appdomain-unload
+endif
+
 check-local: assemblyresolve/test/asm.dll testjit test-generic-sharing test-type-load test-cattr-type-load test-reflection-load-with-context test_platform     \
-                test-console-output test-messages test-env-options test-unhandled-exception-2 test-appdomain-unload test-process-stress rm-empty-logs
+                test-console-output test-messages test-env-options test-unhandled-exception-2 $(FEATUREFUL_RUNTIME_TEST) test-process-stress rm-empty-logs
 check-full: test-sgen check-local
 check-parallel: compile-tests check-full
 
@@ -13,6 +19,13 @@ test-wrench: check-parallel
 
 aotcheck: testaot gshared-aot
 
+# Whenever running under CI
+# Can't use make conditionals since
+# automake doesn't support them
+# CI - Wrench
+# BUILD_URL = Jenkins
+RUNNING_ON_CI = $(CI)$(BUILD_URL)
+
 TEST_PROG = ../interpreter/mint
 
 JITTEST_PROG = $(if $(VALGRIND), valgrind $(VALGRIND_ARGS),) $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/mono/mini/mono)
@@ -28,6 +41,9 @@ else
 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
 endif
 
+TEST_RUNNER_ARGS += $(if $(RUNNING_ON_CI), --verbose,)
+TEST_RUNNER_ARGS += $(if $(V), --verbose,)
+
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
@@ -38,16 +54,27 @@ MKBUNDLE = \
        PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \
        $(RUNTIME) $(CLASS)/mkbundle.exe
 
+if INSTALL_MOBILE_STATIC
+PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_STATIC,MOBILE_LEGACY 
+endif
+
 MCS_NO_LIB = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -debug \
        -noconfig -nologo \
        -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \
        -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \
-       -nowarn:0197
+       -nowarn:0197 $(PROFILE_MCS_FLAGS)
 
 MCS = $(MCS_NO_LIB) -lib:$(CLASS)
 
 ILASM = $(RUNTIME) $(CLASS)/ilasm.exe
 
+if INSTALL_MOBILE_STATIC
+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)"
+endif
+
+
 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
 
 STRESS_TESTS_SRC=      \
@@ -65,9 +92,68 @@ STRESS_TESTS_SRC=    \
        process-stress.cs       \
        assembly-load-stress.cs
 
+BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED= \
+       remoting4.cs            # Needs remoting support \
+       remoting1.cs            # Needs remoting support \
+       remoting2.cs            # Needs remoting support \
+       remoting3.cs            # Needs remoting support \
+       remoting5.cs            # Needs remoting support \
+       appdomain.cs        # Needs appdomain support \
+       appdomain-client.cs     # Needs appdomain support \
+       appdomain-unload.cs # Needs appdomain support \
+       appdomain-async-invoke.cs       # Needs appdomain support \
+       appdomain-thread-abort.cs       # Needs appdomain support \
+       appdomain1.cs           # Needs appdomain support \
+       appdomain2.cs           # Needs appdomain support \
+       appdomain-exit.cs       # Needs appdomain support \
+       assemblyresolve_event2.2.cs     # Needs appdomain support \
+       appdomain-unload-callback.cs    # Needs appdomain support \
+       appdomain-unload-doesnot-raise-pending-events.cs        # Needs appdomain support \
+       unload-appdomain-on-shutdown.cs # Needs appdomain support \
+       bug-47295.cs # Needs SRE \
+       loader.cs # Needs SRE \
+       pinvoke2.cs # Needs SRE \
+       generic-type-builder.2.cs       # Needs SRE \
+       dynamic-generic-size.cs # Needs SRE \
+       cominterop.cs   # Needs COM \
+       dynamic-method-access.2.cs      # Need SRE \
+       dynamic-method-finalize.2.cs    # Need SRE \
+       dynamic-method-stack-traces.cs # Need SRE\
+       generic_type_definition.2.cs    # Need SRE \
+       bug-333798-tb.2.cs      # Need SRE \
+       bug-335131.2.cs # Need SRE \
+       bug-322722_patch_bx.2.cs        # Need SRE\
+       bug-322722_dyn_method_throw.2.cs        # Need SRE \
+       bug-389886-2.cs # Need SRE \
+       bug-349190.2.cs # Need SRE \
+       bug-389886-sre-generic-interface-instances.cs   # Need SRE \
+       bug-462592.cs   # Need SRE \
+       bug-575941.cs   # Need SRE \
+       bug-389886-3.cs # Need SRE \
+       dynamic-method-resurrection.cs  # Need SRE \
+       bug-80307.cs    # Need System.Web \
+       assembly_append_ordering.cs # Need SRE \
+       bug-544446.cs   # Needs AppDomains / TranparentProxy \
+       bug-36848.cs   # Needs AppDomains / TranparentProxy \
+       generic-marshalbyref.2.cs # Needs AppDomains \
+       stackframes-async.2.cs # Needs AppDomains \
+       transparentproxy.cs # Needs AppDomains / TranparentProxy \
+       bug-48015.cs # Needs AppDomains / TranparentProxy \
+       delegate9.cs # Needs AppDomains \
+       marshal-valuetypes.cs   # Needs AppDomains \
+       xdomain-threads.cs      # Needs AppDomains \
+       monitor.cs # Needs AppDomains \
+       generic-xdomain.2.cs # Needs AppDomains \
+       threadpool-exceptions7.cs # Needs AppDomains \
+       cross-domain.cs # Needs AppDomains \
+       generic-unloading.2.cs # Needs AppDomains \
+       thread6.cs # On MOBILE, ThreadAbortException doesn't have necessary field for this test
+
 # Disabled until ?mcs is fixed
 #      bug-331958.cs
-BASE_TEST_CS_SRC=              \
+BASE_TEST_CS_SRC_UNIVERSAL=            \
+       generic-unloading-sub.2.cs      \
+       create-instance.cs      \
        bug-2907.cs             \
        array-init.cs           \
        arraylist.cs            \
@@ -77,7 +163,6 @@ BASE_TEST_CS_SRC=            \
        assemblyresolve_event4.cs       \
        checked.cs              \
        char-isnumber.cs        \
-       create-instance.cs      \
        field-layout.cs         \
        pack-layout.cs          \
        pack-bug.cs             \
@@ -114,7 +199,6 @@ BASE_TEST_CS_SRC=           \
        typeof-ptr.cs           \
        static-constructor.cs   \
        pinvoke.cs              \
-       pinvoke2.cs             \
        pinvoke3.cs             \
        pinvoke11.cs            \
        pinvoke13.cs            \
@@ -180,13 +264,6 @@ BASE_TEST_CS_SRC=          \
        jit-float.cs            \
        pop.cs                  \
        time.cs                 \
-       appdomain.cs        \
-       appdomain1.cs           \
-       appdomain2.cs           \
-       appdomain-client.cs     \
-       appdomain-unload.cs \
-       appdomain-async-invoke.cs       \
-       loader.cs       \
        pointer.cs              \
        hashcode.cs             \
        delegate1.cs            \
@@ -196,16 +273,10 @@ BASE_TEST_CS_SRC=         \
        delegate6.cs            \
        delegate7.cs            \
        delegate8.cs            \
-       delegate9.cs            \
        delegate10.cs           \
        delegate11.cs           \
        delegate12.cs           \
        delegate13.cs           \
-       remoting1.cs            \
-       remoting2.cs            \
-       remoting3.cs            \
-       remoting4.cs            \
-       remoting5.cs            \
        largeexp.cs             \
        largeexp2.cs            \
        marshalbyref1.cs        \
@@ -226,11 +297,9 @@ BASE_TEST_CS_SRC=          \
        marshal8.cs             \
        marshal9.cs             \
        marshalbool.cs          \
-       marshal-valuetypes.cs   \
        test-byval-in-struct.cs \
        thread.cs               \
        thread5.cs              \
-       thread6.cs              \
        thread-static.cs        \
        thread-static-init.cs   \
        context-static.cs       \
@@ -250,12 +319,9 @@ BASE_TEST_CS_SRC=          \
        threadpool-exceptions4.cs \
        threadpool-exceptions5.cs \
        threadpool-exceptions6.cs \
-       threadpool-exceptions7.cs \
        base-definition.cs      \
        bug-27420.cs            \
-       bug-47295.cs            \
        bug-46781.cs            \
-       bug-48015.cs            \
        bug-42136.cs            \
        bug-59286.cs            \
        bug-70561.cs            \
@@ -266,8 +332,6 @@ BASE_TEST_CS_SRC=           \
        bug-323114.cs           \
        bug-Xamarin-5278.cs     \
        interlocked.cs          \
-       cross-domain.cs         \
-       appdomain-exit.cs       \
        delegate-async-exit.cs  \
        delegate-delegate-exit.cs       \
        delegate-exit.cs        \
@@ -284,16 +348,13 @@ BASE_TEST_CS_SRC=         \
        main-returns.cs         \
        subthread-exit.cs       \
        desweak.cs              \
-       cominterop.cs           \
        exists.cs               \
        handleref.cs    \
-       transparentproxy.cs \
        dbnull-missing.cs       \
        test-type-ctor.cs       \
        soft-float-tests.cs     \
        thread-exit.cs          \
        finalize-parent.cs      \
-       assemblyresolve_event2.2.cs     \
        interlocked-2.2.cs      \
        pinvoke-2.2.cs          \
        bug-78431.2.cs          \
@@ -301,7 +362,6 @@ BASE_TEST_CS_SRC=           \
        catch-generics.2.cs     \
        event-get.2.cs          \
        safehandle.2.cs         \
-       stackframes-async.2.cs          \
        module-cctor-loader.2.cs        \
        generics-invoke-byref.2.cs      \
        generic-signature-compare.2.cs  \
@@ -323,14 +383,10 @@ BASE_TEST_CS_SRC=         \
        generic-virtual2.2.cs   \
        generic-valuetype-interface.2.cs        \
        generic-getgenericarguments.2.cs        \
-       generic-type-builder.2.cs       \
        generic-synchronized.2.cs       \
        generic-delegate-ctor.2.cs      \
        generic-array-iface-set.2.cs    \
        generic-typedef.2.cs    \
-       generic-marshalbyref.2.cs       \
-       generic-xdomain.2.cs    \
-       dynamic-generic-size.cs \
        bug-431413.2.cs \
        bug-459285.2.cs \
        generic-virtual-invoke.2.cs     \
@@ -346,27 +402,17 @@ BASE_TEST_CS_SRC=         \
        bug-479763.2.cs \
        bug-616463.cs   \
        bug-80392.2.cs          \
-       dynamic-method-access.2.cs      \
-       dynamic-method-finalize.2.cs    \
-       dynamic-method-stack-traces.cs  \
        bug-82194.2.cs  \
        anonarray.2.cs  \
        ienumerator-interfaces.2.cs     \
        array-enumerator-ifaces.2.cs    \
        generic_type_definition_encoding.2.cs \
-       generic_type_definition.2.cs    \
        bug-333798.2.cs         \
-       bug-333798-tb.2.cs              \
-       bug-335131.2.cs         \
-       bug-322722_patch_bx.2.cs                \
        bug-348522.2.cs         \
        bug-340662_bug.cs       \
-       bug-322722_dyn_method_throw.2.cs        \
-       bug-389886-2.cs \
        bug-325283.2.cs \
        thunks.cs \
        winx64structs.cs \
-       bug-349190.2.cs \
        nullable_boxing.2.cs    \
        valuetype-equals.cs     \
        custom-modifiers.2.cs   \
@@ -375,44 +421,30 @@ BASE_TEST_CS_SRC=         \
        bug-324535.cs   \
        modules.cs      \
        bug-81673.cs    \
-       bug-36848.cs    \
        bug-81691.cs    \
-       bug-80307.cs    \
        bug-415577.cs   \
        filter-stack.cs \
        vararg2.cs      \
-       bug-389886-sre-generic-interface-instances.cs   \
        bug-461867.cs   \
        bug-461941.cs   \
        bug-461261.cs   \
        bug-400716.cs   \
-       bug-462592.cs   \
        bug-459094.cs   \
-       generic-unloading.2.cs  \
-       generic-unloading-sub.2.cs      \
        bug-467456.cs   \
-       appdomain-unload-callback.cs    \
        bug-508538.cs   \
        bug-472692.2.cs         \
        gchandles.cs    \
        interlocked-3.cs        \
        interlocked-4.2.cs      \
-       appdomain-thread-abort.cs \
-       xdomain-threads.cs      \
        w32message.cs   \
-       bug-544446.cs   \
        gc-altstack.cs  \
        large-gc-bitmap.cs      \
        bug-561239.cs   \
        bug-562150.cs   \
-       bug-575941.cs   \
        bug-599469.cs   \
-       bug-389886-3.cs \
-       monitor.cs      \
        monitor-resurrection.cs \
        monitor-wait-abort.cs   \
        monitor-abort.cs        \
-       dynamic-method-resurrection.cs  \
        bug-666008.cs   \
        bug-685908.cs   \
        sgen-long-vtype.cs      \
@@ -424,13 +456,10 @@ BASE_TEST_CS_SRC=         \
        bug-bxc-795.cs  \
        bug-3903.cs     \
        async-with-cb-throws.cs \
-       appdomain-unload-doesnot-raise-pending-events.cs        \
        bug-6148.cs     \
-       assembly_append_ordering.cs     \
        bug-10127.cs    \
        bug-18026.cs    \
        allow-synchronous-major.cs      \
-       unload-appdomain-on-shutdown.cs \
        block_guard_restore_aligment_on_exit.cs \
        thread_static_gc_layout.cs \
        sleep.cs \
@@ -445,6 +474,15 @@ BASE_TEST_CS_SRC=          \
        bug-29585.cs    \
        priority.cs
 
+if INSTALL_MOBILE_STATIC
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+else
+BASE_TEST_CS_SRC= \
+       $(BASE_TEST_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(BASE_TEST_CS_SRC_UNIVERSAL)
+endif
+
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
        async-exc-compilation.cs \
@@ -598,6 +636,52 @@ else
 COOP_DISABLED_TESTS= 
 endif
 
+if INSTALL_MOBILE_STATIC
+# Tests which rely on TypeLoadExceptions
+# In full-aot mode, these cause the relevant methods to be not AOTed.
+PROFILE_DISABLED_TESTS = \
+       typeload-unaligned.exe \
+       field-access.exe \
+       invalid_generic_instantiation.exe \
+       bug-481403.exe \
+       array_ldelema.exe \
+       array_load_exception.exe \
+       bug445361.exe \
+       generic-type-load-exception.2.exe \
+       invalid-token.exe \
+       call_missing_method.exe \
+       call_missing_class.exe \
+       ldfld_missing_field.exe \
+       ldfld_missing_class.exe \
+       vt-sync-method.exe
+
+# Tests which rely on remoting
+PROFILE_DISABLED_TESTS += \
+       context-static.exe \
+       bug-415577.exe \
+       generic-marshalbyref.2.exe \
+       unhandled-exception-7.exe
+
+# Tests which use unsupported pinvoke+full aot
+# functionality
+PROFILE_DISABLED_TESTS += \
+       marshal.exe \
+       marshal2.exe \
+       marshal6.exe \
+       marshal7.exe \
+       marshal8.exe \
+       pinvoke-2.2.exe \
+       pinvoke3.exe \
+       thunks.exe
+
+# Tests which load assemblies which are not
+# in the mobile_static profile
+PROFILE_DISABLED_TESTS += \
+       assembly-load-remap.exe
+else
+PROFILE_DISABLED_TESTS=
+endif
+
 # The two finalizer tests only work under sgen
 # gc-altstack.exe fails under boehm because it has no support for altstack
 # bug-459094.exe creates an extremely deep directory tree
@@ -612,7 +696,8 @@ DISABLED_TESTS=                     \
        bug-Xamarin-5278.exe \
        $(PLATFORM_DISABLED_TESTS) \
        $(EXTRA_DISABLED_TESTS) \
-       $(COOP_DISABLED_TESTS)
+       $(COOP_DISABLED_TESTS) \
+       $(PROFILE_DISABLED_TESTS)
 
 DISABLED_TESTS_WRENCH= \
        $(DISABLED_TESTS)       \
@@ -632,7 +717,14 @@ AOT_DISABLED_TESTS=constraints-load.exe
 TEST_CSC_SRC=                  \
        vararg.cs
 
-TEST_IL_SRC=                   \
+# constraints-load.il: 
+# Failed to load method 0x6000007 from '..../mono/tests/constraints-load.exe' due to 
+# Could not resolve type with token 01000002 assembly:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.BrokenIComparable`1 member:<none>.
+IL_SRC_MOBILE_STATIC_NOT_SUPPORTED=    \
+       constraints-load.il \
+       bug-515884.il
+
+TEST_IL_SRC_UNIVERSAL=                 \
        field-access.il         \
        method-access.il        \
        ldftn-access.il         \
@@ -691,17 +783,23 @@ TEST_IL_SRC=                      \
        bug-463303.il   \
        bug469742.2.il  \
        bug-528055.il   \
-       constraints-load.il     \
        array_load_exception.il \
        bug-481403.il   \
        interface-with-static-method.il \
-       bug-515884.il   \
        bug-633291.il   \
        delegate-with-null-target.il    \
        bug-318677.il   \
        gsharing-valuetype-layout.il    \
        invalid_generic_instantiation.il
 
+if INSTALL_MOBILE_STATIC
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_UNIVERSAL)
+else
+TEST_IL_SRC= \
+       $(TEST_IL_SRC_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(TEST_IL_SRC_UNIVERSAL)
+endif
 
 # pre-requisite test sources: files that are not test themselves
 # but that need to be compiled
@@ -717,14 +815,33 @@ TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
 TESTBS=$(BENCHSRC:.cs=.exe)
 STRESS_TESTS=$(STRESS_TESTS_SRC:.cs=.exe)
 
+PREREQSI_IL_AOT=$(PREREQ_IL_SRC:.il=.exe$(PLATFORM_AOT_SUFFIX))
+PREREQSI_CS_AOT=$(PREREQ_CS_SRC:.cs=.exe$(PLATFORM_AOT_SUFFIX))
+
 EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \
        $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl $(PREREQ_IL_SRC) $(PREREQ_CS_SRC)
 
 %.exe: %.il
        $(ILASM) -out:$@ $<
 
-%.exe: %.cs TestDriver.dll
-       $(MCS) -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:TestDriver.dll -r:Mono.Posix.dll -out:$@ $<
+if !INSTALL_MOBILE_STATIC
+TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll
+endif
+
+if INSTALL_MOBILE_STATIC
+TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX)
+else
+TEST_DRIVER_DEPEND=TestDriver.dll
+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:$@ $<
+
+%.exe$(PLATFORM_AOT_SUFFIX): %.exe 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
+
+%.dll$(PLATFORM_AOT_SUFFIX): %.dll 
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $<
 
 # mkbundle works on ppc, but the pkg-config POC doesn't when run with make test
 if POWERPC
@@ -748,8 +865,22 @@ test_platform: test-eglib-remap
 endif
 endif
 
+AOT_EXTRA_LIBS =       \
+bug-382986-lib.dll$(PLATFORM_AOT_SUFFIX)       \
+bug-324535-il.dll$(PLATFORM_AOT_SUFFIX)        \
+bug-36848-a.dll$(PLATFORM_AOT_SUFFIX)  \
+bug-81691-b.dll$(PLATFORM_AOT_SUFFIX)  \
+bug-327438.2.exe$(PLATFORM_AOT_SUFFIX) \
+bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX)
+
+if INSTALL_MOBILE_STATIC
+prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+else
+prereqs: $(PREREQSI_IL) $(PREREQSI_CS)
+endif
+
 # Target to precompile the test executables
-tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) $(GSHARED_TESTS)
+tests: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la prereqs $(GSHARED_TESTS)
 
 #
 # Test that no symbols are missed in eglib-remap.h
@@ -787,6 +918,9 @@ test-sgen : sgen-tests
 # Precompile the test assemblies in parallel
 compile-tests:
        $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
+if INSTALL_MOBILE_STATIC
+       $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS)
+endif
 
 # Remove empty .stdout and .stderr files for wrench
 rm-empty-logs:
@@ -797,7 +931,7 @@ assemblyresolve/test/asm.dll:
        $(MAKE) -C assemblyresolve prereq
 
 TestDriver.dll:
-       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
+       $(MCS) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs $(srcdir)/../mini/TestHelpers.cs
 
 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
@@ -874,11 +1008,11 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS
 
 runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
        @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
-       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS)
        @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \
-       $(RUNTIME) --debug ./test-runner.exe $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
+       $(RUNTIME) --debug $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j 1 --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL)
 
 testjit:
        @if test x$(M) != x0; then $(MAKE) runtest-managed; else $(MAKE) runtest; fi
@@ -928,7 +1062,7 @@ testbundle: console.exe
        @- rm -rf a.out
 
 EXTRA_DIST += load-missing.il t-missing.cs load-exceptions.cs
-test-type-load: TestDriver.dll
+test-type-load: $(TEST_DRIVER_DEPEND)
        @$(ILASM) /dll /output:load-missing.dll $(srcdir)/load-missing.il > /dev/null
        @$(MCS) -t:library -out:t.dll -d:FOUND $(srcdir)/t-missing.cs
        @$(MCS) -r:TestDriver.dll -r:load-missing.dll -r:t.dll -out:load-exceptions.exe $(srcdir)/load-exceptions.cs
@@ -937,7 +1071,7 @@ test-type-load: TestDriver.dll
        @$(RUNTIME) load-exceptions.exe > load-exceptions.exe.stdout 2> load-exceptions.exe.stderr
 
 EXTRA_DIST += custom-attr-errors.cs custom-attr-errors-lib.cs
-test-cattr-type-load: TestDriver.dll custom-attr-errors.cs custom-attr-errors-lib.cs
+test-cattr-type-load: $(TEST_DRIVER_DEPEND) custom-attr-errors.cs custom-attr-errors-lib.cs
        $(MCS) -D:WITH_MEMBERS /t:library $(srcdir)/custom-attr-errors-lib.cs
        $(MCS) -r:TestDriver.dll -r:custom-attr-errors-lib.dll  $(srcdir)/custom-attr-errors.cs
        $(MCS) /t:library $(srcdir)/custom-attr-errors-lib.cs
@@ -971,13 +1105,15 @@ if !S390X
        $(MAKE) sgen-bridge2-tests
 endif
 
-SGEN_REGULAR_TESTS =   \
+SGEN_REGULAR_TESTS_MOBILE_STATIC_NOT_SUPPORTED =       \
+       sgen-domain-unload.exe  \
+       sgen-domain-unload-2.exe
+
+SGEN_REGULAR_TESTS_UNIVERSAL = \
        finalizer-wait.exe      \
        critical-finalizers.exe \
        sgen-descriptors.exe    \
        sgen-gshared-vtype.exe  \
-       sgen-domain-unload.exe  \
-       sgen-domain-unload-2.exe        \
        sgen-weakref-stress.exe \
        sgen-cementing-stress.exe       \
        sgen-case-23400.exe     \
@@ -986,6 +1122,15 @@ SGEN_REGULAR_TESTS =      \
        gc-graystack-stress.exe \
        bug-17590.exe
 
+if INSTALL_MOBILE_STATIC
+SGEN_REGULAR_TESTS= \
+       $(SGEN_REGULAR_TESTS_UNIVERSAL)
+else
+SGEN_REGULAR_TESTS= \
+       $(SGEN_REGULAR_TESTS_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(SGEN_REGULAR_TESTS_UNIVERSAL)
+endif
+
 sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-plain
        $(MAKE) sgen-regular-tests-ms-conc
@@ -997,21 +1142,21 @@ sgen-regular-tests: $(SGEN_REGULAR_TESTS)
        $(MAKE) sgen-regular-tests-ms-split-clear-at-gc
 
 sgen-regular-tests-plain: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split-95: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-plain-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-conc-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 sgen-regular-tests-ms-split-clear-at-gc: $(SGEN_REGULAR_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_REGULAR_TESTS)
 
 SGEN_TOGGLEREF_TESTS=  \
        sgen-toggleref.exe
@@ -1027,21 +1172,21 @@ sgen-toggleref-tests: $(SGEN_TOGGLEREF_TESTS)
        $(MAKE) sgen-toggleref-tests-ms-split-clear-at-gc
 
 sgen-toggleref-tests-plain: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-95: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="" MONO_GC_PARAMS="toggleref-test,minor=split,alloc-ratio=95" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-plain-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-conc-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 sgen-toggleref-tests-ms-split-clear-at-gc: $(SGEN_TOGGLEREF_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="clear-at-gc" MONO_GC_PARAMS="toggleref-test,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_TOGGLEREF_TESTS)
 
 SGEN_BRIDGE_TESTS=     \
        sgen-bridge.exe \
@@ -1058,21 +1203,21 @@ sgen-bridge-tests: $(SGEN_BRIDGE_TESTS)
        $(MAKE) sgen-bridge-tests-ms-split-tarjan-bridge
 
 sgen-bridge-tests-plain: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-conc-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-new-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-plain-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 sgen-bridge-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE_TESTS)
 
 SGEN_BRIDGE2_TESTS=    \
        sgen-bridge-xref.exe
@@ -1088,22 +1233,21 @@ sgen-bridge2-tests: $(SGEN_BRIDGE2_TESTS)
        $(MAKE) sgen-bridge2-tests-ms-split-tarjan-bridge
 
 sgen-bridge2-tests-plain: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-conc-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-new-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-plain-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 sgen-bridge2-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE2_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
-
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=2Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE2_TESTS)
 
 SGEN_BRIDGE3_TESTS=    \
        sgen-bridge-gchandle.exe
@@ -1119,21 +1263,21 @@ sgen-bridge3-tests: $(SGEN_BRIDGE3_TESTS)
        $(MAKE) sgen-bridge3-tests-ms-split-tarjan-bridge
 
 sgen-bridge3-tests-plain: $(SGEN_bridge3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-conc-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,major=marksweep-conc" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-new-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=new,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-plain-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 sgen-bridge3-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
-       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) ./test-runner.exe --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
+       MONO_ENV_OPTIONS="--gc=sgen" MONO_GC_DEBUG="bridge=3Bridge" MONO_GC_PARAMS="bridge-implementation=tarjan,minor=split" $(RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --timeout 900 $(SGEN_BRIDGE3_TESTS)
 
 
 AOT_CONFIGURATIONS=    \
@@ -1177,19 +1321,23 @@ test-aot:
 
 # Generated tests for runtime invoke
 EXTRA_DIST += gen-runtime-invoke.cs
-runtime-invoke.gen.exe: TestDriver.dll gen-runtime-invoke.exe
+runtime-invoke.gen.exe: $(TEST_DRIVER_DEPEND) gen-runtime-invoke.exe
        $(RUNTIME) gen-runtime-invoke.exe > runtime-invoke.gen.cs
        $(MCS) -out:runtime-invoke.gen.exe -r:TestDriver.dll runtime-invoke.gen.cs
 
 EXTRA_DIST += make-imt-test.cs
-imt_big_iface_test.exe: TestDriver.dll make-imt-test.exe
+imt_big_iface_test.exe: $(TEST_DRIVER_DEPEND) make-imt-test.exe
        $(RUNTIME) make-imt-test.exe > imt_big_iface_test.cs
        $(MCS) -out:imt_big_iface_test.exe -r:TestDriver.dll imt_big_iface_test.cs
 
 EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs
-test-inline-call-stack-library.dll: TestDriver.dll $(srcdir)/test-inline-call-stack-library.cs
+test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-call-stack-library.cs
        $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs
-test-inline-call-stack.exe: TestDriver.dll test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack.cs
+if INSTALL_MOBILE_STATIC
+       $(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
 
 EXTRA_DIST += unhandled-exception-base-configuration.config
@@ -1232,12 +1380,18 @@ bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-8167
        $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
        $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs
        $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs
+if INSTALL_MOBILE_STATIC
+       $(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
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs
        $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs
        $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs /define:WITH_STOP
+if INSTALL_MOBILE_STATIC
+       $(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
@@ -1250,24 +1404,37 @@ bug-81691.exe: bug-81691-b.dll
 EXTRA_DIST += bug-81466-lib.il
 bug-81466-lib.dll: bug-81466-lib.il
        $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il
+if INSTALL_MOBILE_STATIC
+       $(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
 
 EXTRA_DIST += bug-324535-il.il
 bug-324535-il.dll : bug-324535-il.il
        $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il
+if INSTALL_MOBILE_STATIC
+       $(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
 
 EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il
 custom-modifiers-lib.dll: custom-modifiers-lib.il
        $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il
+if INSTALL_MOBILE_STATIC
+       $(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
 
 EXTRA_DIST += bug-382986-lib.cs
 bug-382986-lib.dll: bug-382986-lib.cs
        $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs
+if INSTALL_MOBILE_STATIC
+       $(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
 
@@ -1291,10 +1458,16 @@ test-coreclr-security : coreclr-security.exe
 EXTRA_DIST += generic-unboxing.2.il
 generic-unboxing.2.dll : generic-unboxing.2.il
        $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-boxing.2.il
 generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
        $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
+if INSTALL_MOBILE_STATIC
+       $(RUNTIME) $(AOT_BUILD_FLAGS) $@
+endif
 
 EXTRA_DIST += generic-unbox.2.cs
 generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
@@ -1307,6 +1480,9 @@ generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
 EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il
 generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
        $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il
+if INSTALL_MOBILE_STATIC
+       $(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
 
@@ -1318,7 +1494,10 @@ gshared: test-generic-sharing
 gshared-aot:
        @$(MAKE) AOT=1 gshared
 
-GSHARED_TESTS = \
+GSHARED_TESTS_MOBILE_STATIC_NOT_SUPPORTED = \
+               generic-type-builder.2.exe
+
+GSHARED_TESTS_UNIVERSAL = \
                generics-sharing.2.exe shared-generic-methods.2.exe     \
                shared-generic-synchronized.2.exe generic-initobj.2.exe         \
                generics-sharing-other-exc.2.exe generic-box.2.exe              \
@@ -1334,7 +1513,7 @@ GSHARED_TESTS = \
                generic-exceptions.2.exe generic-delegate2.2.exe                \
                generic-virtual2.2.exe generic-valuetype-interface.2.exe        \
                generic-valuetype-newobj.2.exe generic-valuetype-newobj2.2.exe  \
-               generic-getgenericarguments.2.exe generic-type-builder.2.exe    \
+               generic-getgenericarguments.2.exe       \
                generic-synchronized.2.exe generic-delegate-ctor.2.exe          \
                generic-constrained.2.exe bug-431413.2.exe                      \
                generic-virtual-invoke.2.exe generic-typedef.2.exe              \
@@ -1346,6 +1525,15 @@ GSHARED_TESTS = \
                generic-type-load-exception.2.exe bug-616463.exe        \
                bug-1147.exe
 
+if INSTALL_MOBILE_STATIC
+GSHARED_TESTS= \
+       $(GSHARED_TESTS_UNIVERSAL)
+else
+GSHARED_TESTS= \
+       $(GSHARED_TESTS_MOBILE_STATIC_NOT_SUPPORTED) \
+       $(GSHARED_TESTS_UNIVERSAL)
+endif
+
 test-generic-sharing-normal: $(GSHARED_TESTS)
        @for fn in $+ ; do      \
                echo "Testing $$fn ...";        \
@@ -1357,7 +1545,7 @@ test-generic-sharing-normal: $(GSHARED_TESTS)
        done
 
 test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
-       @$(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
+       @$(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(GSHARED_TESTS)
 
 if NACL_CODEGEN
 test-generic-sharing:
@@ -1376,7 +1564,7 @@ test-async-exceptions : async-exceptions.exe
 EXTRA_DIST += modules.cs modules-m1.cs
 modules-m1.netmodule: modules-m1.cs
        $(MCS) -out:$@ /target:module $(srcdir)/modules-m1.cs
-modules.exe: modules.cs modules-m1.netmodule TestDriver.dll
+modules.exe: modules.cs modules-m1.netmodule $(TEST_DRIVER_DEPEND) 
        $(MCS) -out:$@ /addmodule:modules-m1.netmodule -r:TestDriver.dll $(srcdir)/modules.cs
 
 # Useful if mono is compiled with --enable-shared=no
@@ -1434,13 +1622,13 @@ test-unhandled-exception-2: $(UNHANDLED_EXCEPTION_1_TESTS) $(UNHANDLED_EXCEPTION
        $(MAKE) test-unhandled-exception-2-255-without-managed-handler
 
 test-unhandled-exception-2-1-with-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-1-without-managed-handler: $(UNHANDLED_EXCEPTION_1_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 1 $(UNHANDLED_EXCEPTION_1_TESTS)
 test-unhandled-exception-2-255-with-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 test-unhandled-exception-2-255-without-managed-handler: $(UNHANDLED_EXCEPTION_255_TESTS) test-runner.exe
-       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
+       TEST_UNHANDLED_EXCEPTION_HANDLER=1 $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) -j a --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --expected-exit-code 255 $(UNHANDLED_EXCEPTION_255_TESTS)
 
 endif
 
@@ -1465,7 +1653,7 @@ PROCESS_STRESS_TESTS=     \
                process-leak.exe
 
 test-process-stress: $(PROCESS_STRESS_TESTS) test-runner.exe
-       $(RUNTIME) ./test-runner.exe $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
+       $(RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --timeout 600 $(PROCESS_STRESS_TESTS)
 
 coreclr-gcstress:
        $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress
index dac89cabea949deb3b7423d5cacd7d0537d774e4..b198b753750d45cbbae3d34791451642e171bc2d 100644 (file)
@@ -2,10 +2,14 @@ CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
 with_mono_path = MONO_PATH=$(CLASS)
 
-RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper --debug
-MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -debug:full -target:library
+RUNTIME = $(top_builddir)/runtime/mono-wrapper --debug
+MCS = $(with_mono_path) $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -debug:full -target:library
 
+if INSTALL_MOBILE_STATIC
+prereq: aot
+else
 prereq: test/asm.dll
+endif
 
 test/.dirstamp deps/.dirstamp:
        -mkdir $(@D)
@@ -27,3 +31,10 @@ EXTRA_DIST = asm.cs Test.cs TestBase.cs
 
 clean:
        rm -f deps/*.dll test/*.dll
+
+.PHONY: aot
+aot: test/asm.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) deps/test.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) deps/TestBase.dll
+       MONO_PATH="deps:$(CLASS)" $(RUNTIME) $(AOT_BUILD_FLAGS) test/asm.dll
+
index eb2d89d63b4206474ce007028465218fedfbac73..39290ab1eae4b85a7e0c83f4a8d4f54d2804a5c8 100644 (file)
@@ -1,12 +1,18 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 namespace TestApp
 {
        public delegate char MyDelegate(int x);
 
     class Driver
     {
+               [MonoPInvokeCallbackAttribute (typeof (MyDelegate))]
                static char Test (int x) { return (char)x; }
 
                static int Main()
index aadf7adf7438f77b1ae5730d66532a7695dffc2f..1213f8c5cbf6ec4746c6d26c5157f403ef680bb1 100644 (file)
@@ -8,12 +8,18 @@ using System.Runtime.InteropServices;
 
 public class Tests {
 
+       [AttributeUsage (AttributeTargets.Method)]
+       sealed class MonoPInvokeCallbackAttribute : Attribute {
+               public MonoPInvokeCallbackAttribute (Type t) {}
+       }
+
        public static int Main (string[] args) {
                return TestDriver.RunTests (typeof (Tests), args);
        }
 
        public delegate int SimpleDelegate (int a);
 
+       [MonoPInvokeCallback (typeof (SimpleDelegate))]
        public static int delegate_test (int a)
        {
                return a + 1;
index 7a22bbf40454bbc4a329358604d2f354b0307dd4..f19059435939a60dfc0eafec50e2c05d152b8594 100644 (file)
@@ -5,6 +5,11 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 public class Marshal1 : ICustomMarshaler
 {
        int param;
@@ -232,10 +237,12 @@ public class Tests
        [DllImport ("libtest")]
        private static extern int mono_test_marshal_pass_return_custom_null_in_delegate (pass_return_int_delegate del);
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_int (object i) {
                return (int)i;
        }
 
+       [MonoPInvokeCallback (typeof (pass_return_int_delegate))]
        private static object pass_return_null (object i) {
                return (i == null) ? null : new Object ();
        }
@@ -431,7 +438,8 @@ public class Tests
 
                return 0;
        }
-       
+
+       [MonoPInvokeCallback (typeof (custom_out_param_delegate))]
        private static void custom_out_param (out object i) 
        {
                i = new object();       
index 263dd16a134b06399f58dfa11ffe23c8b5e6d714..67cf19636328e473993d78d75f13ea12f257f72a 100644 (file)
@@ -3,6 +3,11 @@ using System.Runtime.InteropServices;
 
 public class marshalbool
 {
+       [AttributeUsage (AttributeTargets.Method)]
+       sealed class MonoPInvokeCallbackAttribute : Attribute {
+               public MonoPInvokeCallbackAttribute (Type t) {}
+       }
+
        [DllImport ("libtest")]
        static extern int mono_test_marshal_bool_in (int arg, uint expected,
                                                     bool bDefaultMarsh,
@@ -596,7 +601,7 @@ public class marshalbool
 
        public static int test_0_Default_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (1, 0, 0, fcn);
@@ -613,7 +618,7 @@ public class marshalbool
 
        public static int test_0_Bool_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (2, 0, 0, fcn);
@@ -630,7 +635,7 @@ public class marshalbool
 
        public static int test_0_I1_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (3, 0, 0, fcn);
@@ -647,7 +652,7 @@ public class marshalbool
 
        public static int test_0_U1_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (4, 0, 0, fcn);
@@ -664,7 +669,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_In_Managed ()
        {
-               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper);
+               MarshalBoolInDelegate fcn = new MarshalBoolInDelegate (MarshalBoolInHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_in (5, 0, 0, fcn);
@@ -681,7 +686,7 @@ public class marshalbool
 
        public static int test_0_Default_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_out (1, 0, 0, fcn);
@@ -698,7 +703,7 @@ public class marshalbool
 
        public static int test_0_Bool_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (2, 0, 0, fcn);
@@ -715,7 +720,7 @@ public class marshalbool
 
        public static int test_0_I1_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (3, 0, 0, fcn);
@@ -732,7 +737,7 @@ public class marshalbool
 
        public static int test_0_U1_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (4, 0, 0, fcn);
@@ -749,7 +754,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_Out_Managed ()
        {
-               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper);
+               MarshalBoolOutDelegate fcn = new MarshalBoolOutDelegate (MarshalBoolOutHelper);
                int ret;
                
                ret = mono_test_managed_marshal_bool_out (5, 0, 0, fcn);
@@ -766,7 +771,7 @@ public class marshalbool
 
        public static int test_0_Default_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (1, 0, 0, 0, 0, fcn);
@@ -795,7 +800,7 @@ public class marshalbool
 
        public static int test_0_Bool_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (2, 0, 0, 0, 0, fcn);
@@ -824,7 +829,7 @@ public class marshalbool
 
        public static int test_0_I1_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (3, 0, 0, 0, 0, fcn);
@@ -853,7 +858,7 @@ public class marshalbool
 
        public static int test_0_U1_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (4, 0, 0, 0, 0, fcn);
@@ -882,7 +887,7 @@ public class marshalbool
 
        public static int test_0_VariantBool_Ref_Managed ()
        {
-               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper);
+               MarshalBoolRefDelegate fcn = new MarshalBoolRefDelegate (MarshalBoolRefHelper);
                int ret;
 
                ret = mono_test_managed_marshal_bool_ref (5, 0, 0, 0, 0, fcn);
@@ -911,8 +916,9 @@ public class marshalbool
 
 ///////////////////////////////////////////////////////////////////
 
-       unsafe int MarshalBoolInHelper (int arg, uint expected, bool bDefaultMarsh, bool bBoolCustMarsh, bool bI1CustMarsh,
-                                       bool bU1CustMarsh, bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolInDelegate))]
+       unsafe static int MarshalBoolInHelper (int arg, uint expected, bool bDefaultMarsh, bool bBoolCustMarsh, bool bI1CustMarsh,
+                                                                                  bool bU1CustMarsh, bool bVBCustMarsh)
        {
                bool* ptestVal;
                switch (arg) {
@@ -947,8 +953,9 @@ public class marshalbool
                return 0;
        }
 
-       unsafe int MarshalBoolOutHelper (int arg, uint testVal, out bool bDefaultMarsh, out bool bBoolCustMarsh,
-                                        out bool bI1CustMarsh, out bool bU1CustMarsh, out bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolOutDelegate))]
+       unsafe static int MarshalBoolOutHelper (int arg, uint testVal, out bool bDefaultMarsh, out bool bBoolCustMarsh,
+                                                                                       out bool bI1CustMarsh, out bool bU1CustMarsh, out bool bVBCustMarsh)
        {
                bDefaultMarsh = bBoolCustMarsh = bI1CustMarsh = bU1CustMarsh = bVBCustMarsh = false;
                switch (arg) {
@@ -988,8 +995,9 @@ public class marshalbool
                return 0;
        }
 
-       unsafe int MarshalBoolRefHelper (int arg, uint expected, uint testVal, ref bool bDefaultMarsh, ref bool bBoolCustMarsh,
-                                        ref bool bI1CustMarsh, ref bool bU1CustMarsh, ref bool bVBCustMarsh)
+       [MonoPInvokeCallback (typeof (MarshalBoolRefDelegate))]
+       unsafe static int MarshalBoolRefHelper (int arg, uint expected, uint testVal, ref bool bDefaultMarsh, ref bool bBoolCustMarsh,
+                                                                                       ref bool bI1CustMarsh, ref bool bU1CustMarsh, ref bool bVBCustMarsh)
        {
                switch (arg) {
                case 1:
index 143f4ece3e51bdbe7028275c719c75b002f22880..69a2ecf43341d8da6b5e9f3acfb59093e6157cb1 100644 (file)
@@ -27,7 +27,7 @@ namespace ToManyOpenHandles
 
                private static void RunStuffMode()
                {
-                       for (int i = 0; i < 1000; i++)
+                       for (int i = 0; i < 100; i++)
                        {
                                Execute(Assembly.GetExecutingAssembly().Location, i.ToString());
                        }
index f4f2df11555816c07308e4935012b020ea486dd1..9e5738078fe4d4a2b8a6d8d8028fa2e969229660 100644 (file)
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Threading;
 using System.Runtime.InteropServices;
 using System.Runtime.CompilerServices;
+using MonoTests.Helpers;
 
 public class Toggleref {
        public int __test;
@@ -60,9 +61,7 @@ class Driver {
        static int test_0_root_keeps_child ()
        {
                Console.WriteLine ("test_0_root_keeps_child");
-               var t = new Thread (SetupLinks);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks);
                
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -113,9 +112,7 @@ class Driver {
        {
                Console.WriteLine ("test_0_child_goes_away");
 
-               var t = new Thread (SetupLinks2);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks2);
 
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -161,9 +158,7 @@ class Driver {
        {
                Console.WriteLine ("test_0_CWT_keep_child_alive");
 
-               var t = new Thread (SetupLinks3);
-               t.Start ();
-               t.Join ();
+               FinalizerHelpers.PerformNoPinAction (SetupLinks3);
 
                GC.Collect ();
                GC.WaitForPendingFinalizers ();
@@ -207,4 +202,4 @@ class Driver {
                return TestDriver.RunTests (typeof (Driver), args);
        }
 
-}
\ No newline at end of file
+}
index 8a0d2a96a05a3a5671d84819c2ec813ecf23e1ea..cf62e2d1689ecabb3db43859db72cf2ab5c44a91 100644 (file)
 using System;
 using System.IO;
 using System.Threading;
-using System.Text;
 using System.Diagnostics;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Xml;
+using System.Text;
 using System.Text.RegularExpressions;
+
+#if !MOBILE_STATIC
 using Mono.Unix.Native;
+#endif
 
 //
 // This is a simple test runner with support for parallel execution
@@ -27,6 +30,7 @@ public class TestRunner
 {
        const string TEST_TIME_FORMAT = "mm\\:ss\\.fff";
        const string ENV_TIMEOUT = "TEST_DRIVER_TIMEOUT_SEC";
+       const string MONO_PATH = "MONO_PATH";
 
        class ProcessData {
                public string test;
@@ -43,16 +47,19 @@ public class TestRunner
                int concurrency = 1;
                int timeout = 2 * 60; // in seconds
                int expectedExitCode = 0;
+               bool verbose = false;
                string testsuiteName = null;
                string inputFile = null;
 
-               // FIXME: Add support for runtime arguments + env variables
-
                string disabled_tests = null;
                string runtime = "mono";
                string config = null;
+               string mono_path = null;
                var opt_sets = new List<string> ();
 
+               string aot_run_flags = null;
+               string aot_build_flags = null;
+
                // Process options
                int i = 0;
                while (i < args.Length) {
@@ -124,6 +131,38 @@ public class TestRunner
                                        }
                                        inputFile = args [i + 1];
                                        i += 2;
+                               } else if (args [i] == "--runtime") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --runtime command line option.");
+                                               return 1;
+                                       }
+                                       runtime = args [i + 1];
+                                       i += 2;
+                               } else if (args [i] == "--mono-path") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --mono-path command line option.");
+                                               return 1;
+                                       }
+                                       mono_path = args [i + 1].Substring(0, args [i + 1].Length);
+
+                                       i += 2;
+                               } else if (args [i] == "--aot-run-flags") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --aot-run-flags command line option.");
+                                               return 1;
+                                       }
+                                       aot_run_flags = args [i + 1].Substring(0, args [i + 1].Length);
+                                       i += 2;
+                               } else if (args [i] == "--aot-build-flags") {
+                                       if (i + 1 >= args.Length) {
+                                               Console.WriteLine ("Missing argument to --aot-build-flags command line option.");
+                                               return 1;
+                                       }
+                                       aot_build_flags = args [i + 1].Substring(0, args [i + 1].Length);
+                                       i += 2;
+                               } else if (args [i] == "--verbose") {
+                                       verbose = true;
+                                       i ++;
                                } else {
                                        Console.WriteLine ("Unknown command line option: '" + args [i] + "'.");
                                        return 1;
@@ -182,6 +221,65 @@ public class TestRunner
                                output_width = Math.Min (120, ti.test.Length);
                }
 
+               if (aot_build_flags != null)  {
+                       Console.WriteLine("AOT compiling tests");
+
+                       object aot_monitor = new object ();
+                       var aot_queue = new Queue<String> (tests); 
+
+                       List<Thread> build_threads = new List<Thread> (concurrency);
+
+                       for (int j = 0; j < concurrency; ++j) {
+                               Thread thread = new Thread (() => {
+                                       while (true) {
+                                               String test_name;
+
+                                               lock (aot_monitor) {
+                                                       if (aot_queue.Count == 0)
+                                                               break;
+                                                       test_name = aot_queue.Dequeue ();
+                                               }
+
+                                               string test_bitcode_output = test_name + "_bitcode_tmp";
+                                               string test_bitcode_arg = ",temp-path=" + test_bitcode_output;
+                                               string aot_args = aot_build_flags + test_bitcode_arg + " " + test_name;
+
+                                               Directory.CreateDirectory(test_bitcode_output);
+
+                                               ProcessStartInfo job = new ProcessStartInfo (runtime, aot_args);
+                                               job.UseShellExecute = false;
+                                               job.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
+                                               job.EnvironmentVariables[MONO_PATH] = mono_path;
+                                               Process compiler = new Process ();
+                                               compiler.StartInfo = job;
+
+                                               compiler.Start ();
+
+                                               if (!compiler.WaitForExit (timeout * 1000)) {
+                                                       try {
+                                                               compiler.Kill ();
+                                                       } catch {
+                                                       }
+                                                       throw new Exception(String.Format("Timeout AOT compiling tests, output in {0}", test_bitcode_output));
+                                               } else if (compiler.ExitCode != 0) {
+                                                       throw new Exception(String.Format("Error AOT compiling tests, output in {0}", test_bitcode_output));
+                                               } else {
+                                                       Directory.Delete (test_bitcode_output, true);
+                                               }
+                                       }
+                               });
+
+                               thread.Start ();
+
+                               build_threads.Add (thread);
+                       }
+
+                       for (int j = 0; j < build_threads.Count; ++j)
+                               build_threads [j].Join ();
+
+                       Console.WriteLine("Done compiling");
+               }
+
                List<Thread> threads = new List<Thread> (concurrency);
 
                DateTime test_start_time = DateTime.UtcNow;
@@ -202,14 +300,26 @@ public class TestRunner
                                        string test = ti.test;
                                        string opt_set = ti.opt_set;
 
-                                       output.Write (String.Format ("{{0,-{0}}} ", output_width), test);
+                                       if (verbose) {
+                                               output.Write (String.Format ("{{0,-{0}}} ", output_width), test);
+                                       } else {
+                                               Console.Write (".");
+                                       }
+
+                                       string test_invoke;
+
+                                       if (aot_run_flags != null)
+                                               test_invoke = aot_run_flags + " " + test;
+                                       else
+                                               test_invoke = test;
 
                                        /* Spawn a new process */
                                        string process_args;
                                        if (opt_set == null)
-                                               process_args = test;
+                                               process_args = test_invoke;
                                        else
-                                               process_args = "-O=" + opt_set + " " + test;
+                                               process_args = "-O=" + opt_set + " " + test_invoke;
+
                                        ProcessStartInfo info = new ProcessStartInfo (runtime, process_args);
                                        info.UseShellExecute = false;
                                        info.RedirectStandardOutput = true;
@@ -217,6 +327,8 @@ public class TestRunner
                                        info.EnvironmentVariables[ENV_TIMEOUT] = timeout.ToString();
                                        if (config != null)
                                                info.EnvironmentVariables["MONO_CONFIG"] = config;
+                                       if (mono_path != null)
+                                               info.EnvironmentVariables[MONO_PATH] = mono_path;
                                        Process p = new Process ();
                                        p.StartInfo = info;
 
@@ -257,14 +369,18 @@ public class TestRunner
                                                        timedout.Add (data);
                                                }
 
+#if !MOBILE_STATIC
                                                // Force the process to print a thread dump
                                                try {
                                                        Syscall.kill (p.Id, Signum.SIGQUIT);
                                                        Thread.Sleep (1000);
                                                } catch {
                                                }
+#endif
 
-                                               output.Write ($"timed out ({timeout}s)");
+                                               if (verbose) {
+                                                       output.Write ($"timed out ({timeout}s)");
+                                               }
 
                                                try {
                                                        p.Kill ();
@@ -277,7 +393,8 @@ public class TestRunner
                                                        failed.Add (data);
                                                }
 
-                                               output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode);
+                                               if (verbose)
+                                                       output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode);
                                        } else {
                                                var end = DateTime.UtcNow;
 
@@ -285,13 +402,15 @@ public class TestRunner
                                                        passed.Add (data);
                                                }
 
-                                               output.Write ("passed, time: {0}", (end - start).ToString (TEST_TIME_FORMAT));
+                                               if (verbose)
+                                                       output.Write ("passed, time: {0}", (end - start).ToString (TEST_TIME_FORMAT));
                                        }
 
                                        p.Close ();
 
                                        lock (monitor) {
-                                               Console.WriteLine (output.ToString ());
+                                               if (verbose)
+                                                       Console.WriteLine (output.ToString ());
                                        }
                                }
                        });
@@ -432,12 +551,17 @@ public class TestRunner
                        writer.WriteEndDocument ();
                }
 
-               Console.WriteLine ();
-               Console.WriteLine ("Time: {0}", test_time.ToString (TEST_TIME_FORMAT));
-               Console.WriteLine ();
-               Console.WriteLine ("{0,4} test(s) passed", npassed);
-               Console.WriteLine ("{0,4} test(s) failed", nfailed);
-               Console.WriteLine ("{0,4} test(s) timed out", ntimedout);
+               if (verbose) {
+                       Console.WriteLine ();
+                       Console.WriteLine ("Time: {0}", test_time.ToString (TEST_TIME_FORMAT));
+                       Console.WriteLine ();
+                       Console.WriteLine ("{0,4} test(s) passed", npassed);
+                       Console.WriteLine ("{0,4} test(s) failed", nfailed);
+                       Console.WriteLine ("{0,4} test(s) timed out", ntimedout);
+               } else {
+                       Console.WriteLine ();
+                       Console.WriteLine (String.Format ("{0} test(s) passed, {1} test(s) did not pass.", npassed, nfailed));
+               }
 
                if (nfailed > 0) {
                        Console.WriteLine ();
index 527c29be754e5e0820e6c70bb76ab465e0eed486..0148fb4a4df0bf5cb1ba89b3b0f06b52f931dd64 100644 (file)
@@ -1,6 +1,11 @@
 using System;
 using System.Runtime.InteropServices;
 
+[AttributeUsage (AttributeTargets.Method)]
+sealed class MonoPInvokeCallbackAttribute : Attribute {
+       public MonoPInvokeCallbackAttribute (Type t) {}
+}
+
 [StructLayout (LayoutKind.Sequential)]
 struct winx64_struct1
 {
@@ -450,6 +455,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct1_delegate))]
        public static int managed_struct1_test (winx64_struct1 var)
        {
                if (var.a != 5)
@@ -458,6 +464,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct5_delegate))]
        public static int managed_struct5_test (winx64_struct5 var)
        {
                if (var.a != 5)
@@ -470,6 +477,7 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (managed_struct1_struct5_delegate))]
        public static int managed_struct1_struct5_test (winx64_struct1 var1, winx64_struct5 var2,
                                                        winx64_struct1 var3, winx64_struct5 var4,
                                                        winx64_struct1 var5, winx64_struct5 var6)
@@ -487,11 +495,13 @@ class winx64structs
                return 0;
        }
 
+       [MonoPInvokeCallback (typeof (mono_test_Winx64_struct1_ret_delegate))]
        public static winx64_struct1 mono_test_Winx64_struct1_ret_test ()
        {
                return new winx64_struct1 (0x45);
        }
 
+       [MonoPInvokeCallback (typeof (mono_test_Winx64_struct5_ret_delegate))]
        public static winx64_struct5 mono_test_Winx64_struct5_ret_test ()
        {
                return new winx64_struct5 (0x12, 0x34, 0x56);
index 1317b0b462d385037b2347d881a954dfc201785d..b82b968a0262f1fe8b9791aa4c204cf6ceb80fc6 100644 (file)
 
 G_BEGIN_DECLS
 
+#ifndef MONO_INFINITE_WAIT
+#define MONO_INFINITE_WAIT ((guint32) 0xFFFFFFFF)
+#endif
+
+
 #if !defined(HOST_WIN32)
 
 typedef pthread_mutex_t mono_mutex_t;
@@ -118,7 +123,7 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
        gint64 usecs;
        int res;
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
+       if (timeout_ms == MONO_INFINITE_WAIT)
                return mono_os_cond_wait (cond, mutex);
 
        /* ms = 10^-3, us = 10^-6, ns = 10^-9 */
index 16e3d463b8b7377ab0dfb6ec22b8adcc15b76f66..6282457e13e87fe673753909f197c1d6118eb102 100644 (file)
 #define NSEC_PER_SEC (1000 * 1000 * 1000)
 #endif
 
+#ifndef MONO_INFINITE_WAIT
+#define MONO_INFINITE_WAIT ((guint32) 0xFFFFFFFF)
+#endif
+
 G_BEGIN_DECLS
 
 typedef enum {
@@ -85,7 +89,7 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
        struct timeval start, current;
        int res = 0;
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
+       if (timeout_ms == MONO_INFINITE_WAIT)
                return mono_os_sem_wait (sem, flags);
 
        ts.tv_sec = timeout_ms / 1000;
@@ -188,7 +192,7 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
                return res != 0 ? -1 : 0;
        }
 
-       if (timeout_ms == (guint32) 0xFFFFFFFF)
+       if (timeout_ms == MONO_INFINITE_WAIT)
                return mono_os_sem_wait (sem, flags);
 
        gettimeofday (&t, NULL);
index 6ebe007a3c6d583db8d05fd2a724a81e10b76cc8..07d7b26ce0185b966074e577a5810dd4d4143fd2 100644 (file)
@@ -76,11 +76,11 @@ static gboolean unified_suspend_enabled;
 #define mono_thread_info_run_state(info) (((MonoThreadInfo*)info)->thread_state & THREAD_STATE_MASK)
 
 /*warn at 50 ms*/
-#define SLEEP_DURATION_BEFORE_WARNING (10)
-/*abort at 1 sec*/
-#define SLEEP_DURATION_BEFORE_ABORT 200
+#define SLEEP_DURATION_BEFORE_WARNING (50)
+/*never aborts */
+#define SLEEP_DURATION_BEFORE_ABORT MONO_INFINITE_WAIT
 
-static long sleepWarnDuration = SLEEP_DURATION_BEFORE_WARNING,
+static guint32 sleepWarnDuration = SLEEP_DURATION_BEFORE_WARNING,
            sleepAbortDuration = SLEEP_DURATION_BEFORE_ABORT;
 
 static int suspend_posts, resume_posts, abort_posts, waits_done, pending_ops;
@@ -359,6 +359,7 @@ register_thread (MonoThreadInfo *info, gpointer baseptr)
        if (threads_callbacks.thread_register) {
                if (threads_callbacks.thread_register (info, baseptr) == NULL) {
                        // g_warning ("thread registation failed\n");
+                       mono_native_tls_set_value (thread_info_key, NULL);
                        g_free (info);
                        return NULL;
                }
@@ -642,7 +643,7 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        gboolean res;
        threads_callbacks = *callbacks;
        thread_info_size = info_size;
-       char *sleepLimit;
+       const char *sleepLimit;
 #ifdef HOST_WIN32
        res = mono_native_tls_alloc (&thread_info_key, NULL);
        res = mono_native_tls_alloc (&thread_exited_key, NULL);
@@ -661,6 +662,7 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        unified_suspend_enabled = g_getenv ("MONO_ENABLE_UNIFIED_SUSPEND") != NULL || mono_threads_is_coop_enabled ();
        
        if ((sleepLimit = g_getenv ("MONO_SLEEP_ABORT_LIMIT")) != NULL) {
+               errno = 0;
                long threshold = strtol(sleepLimit, NULL, 10);
                if ((errno == 0) && (threshold >= 40))  {
                        sleepAbortDuration = threshold;
index 223b73852dcbf3762ccd27934beb22ddf5e87687..068bb1d3dc0269bc87633813b76bae786ca0ac63 100644 (file)
@@ -109,10 +109,20 @@ cur_dir_cmd = pwd
 PLATFORM_PATH_SEPARATOR = :
 endif
 
+if INSTALL_MOBILE_STATIC
+#  ILASM.exe has features which a mobile_static runtime will not support.
+#  It is invoked with an external mono when used in the runtime.
+#  We skip it here because otherwise it will fail to verify.
+MOBILE_STATIC_FILTER=grep -v ilasm
+else
+MOBILE_STATIC_FILTER=echo
+endif
+
 # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable.
 # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode.
 # Skip binary_reference_assemblies because they contain metadata only
 mcs-compileall: mono-wrapper etc/mono/config
+       export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' | $(MOBILE_STATIC_FILTER)` ; \
        save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \
        for profile in $(test_profiles); do \
          if [ "binary_reference_assemblies" = "$$profile" ]; then \
@@ -126,7 +136,9 @@ mcs-compileall: mono-wrapper etc/mono/config
                  MONO_PATH="$$mcs_topdir/class/lib/$$profile$(PLATFORM_PATH_SEPARATOR)$$save_MONO_PATH"; \
          fi; \
          export MONO_PATH; \
-         for i in $(mcs_topdir)/class/lib/$$profile/*.{dll,exe}; do \
+         for stub in $$verifiable_files; do \
+         i=$(mcs_topdir)/class/lib/$$profile/$$stub ; \
+         echo $$i ; \
                if [ ! -f $$i ] ; then \
                        continue ; \
                fi ;  \
index 168fd8ca49a51279f92bd78bd31a21d04a014f7b..6fab181aa309f0abf55c28305e0d302851969b39 100755 (executable)
@@ -13,8 +13,6 @@ ${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V
 ${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
 ${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
 ${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check
-${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test
-${TESTCMD} --label=compiler-errors --timeout=30m make -w -C mcs/errors run-test
 ${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test
 ${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test
 ${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test
index 3d429b80eac02769064d67bc5e5e8d36cf519f01..899e368877ef129e10d447b8d7bbad7bd2b55a7a 100644 (file)
@@ -1,9 +1,8 @@
 #
 # This is a python script and a set of make targets to implement support for conditional submodules
-# There should be a SUBMODULES.json file which contains information about the submodules.
+# Set the SUBMODULES_CONFIG_FILE make variable to the srcdir path of a SUBMODULES.json file which contains information about the submodules.
 #
 
-CONFIG=SUBMODULES.json
 SCRIPT=$(top_srcdir)/scripts/submodules/versions.py
 
 # usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name))
@@ -11,11 +10,11 @@ SCRIPT=$(top_srcdir)/scripts/submodules/versions.py
 
 define ValidateVersionTemplate
 #$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)"))
-#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) get-dir $(1)))
+#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1)))
 #$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2))))
-#$(eval MODULE_$(2):=$(shell python $(SCRIPT) get-url $(1)))
-#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) get-rev $(1)))
-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) get-remote-branch $(1)))
+#$(eval MODULE_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1)))
+#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1)))
+#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1)))
 
 #$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
 
@@ -107,17 +106,17 @@ reset:
 
 __bump-version-%:
        @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV=<ref>"; exit 1; fi
-       python $(SCRIPT) set-rev $* $(REV)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV)
+       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
 
 __bump-branch-%:
        @if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
        @if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH=<branch> REMOTE_BRANCH=<remote branch>"; exit 1; fi
-       python $(SCRIPT) set-branch $* $(BRANCH)
-       python $(SCRIPT) set-remote-branch $* $(REMOTE_BRANCH)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH)
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH)
+       @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
 
 __bump-current-version-%:
        REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \
-       python $(SCRIPT) set-rev $* $$REV; \
-       if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(CONFIG); fi
+       python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \
+       if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(SUBMODULES_CONFIG_FILE); fi
index 35ded0c0fcd74c3aa017682864890a6e501c885c..5252ee58306a6b9f77b257c92a5f0b391fd430db 100755 (executable)
@@ -12,38 +12,38 @@ def find_module(submodules, name):
     sys.exit(1)
 
 
-if len(sys.argv) < 2:
-    print("Usage: versions.py <command>")
+if len(sys.argv) < 3:
+    print("Usage: versions.py <path to SUBMODULES.json> <command>")
     sys.exit(1)
 
-CONFIG_FILE = "SUBMODULES.json"
-command = sys.argv[1]
+CONFIG_FILE = sys.argv[1]
+command = sys.argv[2]
 
 submodules = json.load(open(CONFIG_FILE))
 
 if command == "get-rev":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["rev"])
 elif command == "get-url":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["url"])
 elif command == "get-dir":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["directory"])
 elif command == "get-remote-branch":
-    mod = find_module(submodules, sys.argv[2])
+    mod = find_module(submodules, sys.argv[3])
     print(mod["remote-branch"])
 elif command == "set-rev":
-    mod = find_module(submodules, sys.argv[2])
-    mod["rev"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["rev"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "set-branch":
-    mod = find_module(submodules, sys.argv[2])
-    mod["branch"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["branch"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "set-remote-branch":
-    mod = find_module(submodules, sys.argv[2])
-    mod["remote-branch"] = sys.argv[3]
+    mod = find_module(submodules, sys.argv[3])
+    mod["remote-branch"] = sys.argv[4]
     json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
 elif command == "cat":
     print(json.dumps(submodules, indent = 2))