Merge pull request #3112 from akoeplinger/test-runner-nofile
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 7 Jun 2016 22:18:39 +0000 (00:18 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 7 Jun 2016 22:18:39 +0000 (00:18 +0200)
[test-runner] Write stdout/stderr into StringBuilder instead of an intermediate file

60 files changed:
acceptance-tests/Makefile.am
acceptance-tests/versions.mk
acceptance-tests/versions.py [deleted file]
configure.ac
llvm/.gitignore [new file with mode: 0644]
llvm/Makefile.am [new file with mode: 0644]
llvm/SUBMODULES.json [new file with mode: 0644]
man/mono.1
mcs/build/rules.make
mcs/class/System.Web.Http/System.Web.Http-net_4_x.csproj
mcs/class/System.Web.WebPages.Deployment/System.Web.WebPages.Deployment-net_4_x.csproj
mcs/class/System.Web.WebPages.Razor/System.Web.WebPages.Razor-net_4_x.csproj
mcs/class/System.Web.WebPages/System.Web.WebPages-net_4_x.csproj
mcs/class/corlib/Test/System/AppDomainTest.cs
mono/metadata/appdomain.c
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/exception-internals.h
mono/metadata/exception.c
mono/metadata/exception.h
mono/metadata/icall.c
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/reflection.c
mono/mini/aot-compiler.c
mono/mini/jit-icalls.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-trampolines.c
mono/mini/mini.h
mono/profiler/Makefile.am
mono/sgen/sgen-array-list.c
mono/sgen/sgen-array-list.h
mono/sgen/sgen-descriptor.c
mono/sgen/sgen-descriptor.h
mono/sgen/sgen-gc.h
mono/sgen/sgen-internal.c
mono/utils/Makefile.am
mono/utils/mono-error-internals.h
mono/utils/mono-error.c
mono/utils/mono-error.h
mono/utils/mono-log-common.c [deleted file]
mono/utils/mono-log-posix.c [deleted file]
mono/utils/mono-log-windows.c [deleted file]
mono/utils/mono-logger.c
mono/utils/mono-logger.h
mono/utils/mono-threads.c
msvc/libmonoutils.vcxproj
msvc/scripts/System.Web.Http.pre [new file with mode: 0644]
msvc/scripts/System.Web.WebPages.Deployment.pre [new file with mode: 0644]
msvc/scripts/TODO [deleted file]
msvc/scripts/TODO.md
net_4_x.sln
scripts/Makefile.am
scripts/ci/run-jenkins.sh
scripts/submodules/versions.mk [new file with mode: 0644]
scripts/submodules/versions.py [new file with mode: 0755]
tools/offsets-tool/MonoAotOffsetsDumper.cs
tools/sgen/gcpausevis.py

index 1b1612f9fb1713372babffcb76dc15a9b7f8f0e1..522cb36c9ea47999dfd6dbe7474f11567a1aa1b8 100644 (file)
@@ -4,7 +4,7 @@ CORECLR_PATH=$(ACCEPTANCE_TESTS_PATH)/coreclr
 MSTESTSUITE_PATH=$(ACCEPTANCE_TESTS_PATH)/ms-test-suite
 
 CLEANFILES = *.dll *.exe *.mdb
-EXTRA_DIST=README.md SUBMODULES.json versions.mk versions.py roslyn.mk coreclr.mk ms-test-suite.mk
+EXTRA_DIST=README.md SUBMODULES.json versions.mk roslyn.mk coreclr.mk ms-test-suite.mk
 
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
 
index 9cf7d89bbea89f5c5cd3f6fb3067f484fc53eb3c..491b67e11ce18921c10b7d20e73767d5eb3db52a 100644 (file)
 .PHONY: validate-versions reset-versions
 
-CONFIG=SUBMODULES.json
-
-# usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name))
-# usage $(call ValidateVersionTemplate (mono,MONO,mono))
-
-define ValidateVersionTemplate
-#$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)"))
-#$(eval DIRECTORY_$(2):=$(shell python versions.py get-dir $(1)))
-#$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2))))
-#$(eval MODULE_$(2):=$(shell python versions.py get-url $(1)))
-#$(eval NEEDED_$(2)_VERSION:=$(shell python versions.py get-rev $(1)))
-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python versions.py get-remote-branch $(1)))
-
-#$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
-
-#$(eval NEEDED_$(2)_BRANCH:=$(word 2, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
-#$(eval NEEDED_$(2)_REMOTE:=$(word 1, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
-#$(eval $(2)_BRANCH:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git symbolic-ref --short HEAD 2>/dev/null))
-
-validate-$(1)::
-       @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \
-           if test ! -d $($(2)_PATH); then \
-                       if test x$$(RESET_VERSIONS) != "x"; then \
-                               $(MAKE) reset-$(1) || exit 1; \
-                       else \
-                               echo "Your $(1) checkout is missing, please run 'make reset-$(1)'"; \
-                               touch .validate-versions-failure; \
-                       fi; \
-           else \
-                       if test "x$($(2)_VERSION)" != "x$(NEEDED_$(2)_VERSION)" ; then \
-                               if test x$$(RESET_VERSIONS) != "x"; then \
-                                       $(MAKE) reset-$(1) || exit 1; \
-                               else \
-                                   echo "Your $(1) version is out of date, please run 'make reset-$(1)' (found $($(2)_VERSION), expected $(NEEDED_$(2)_VERSION))"; \
-                                   test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \
-                               touch .validate-versions-failure; \
-                               fi; \
-               elif test "x$($(2)_BRANCH)" != "x$(NEEDED_$(2)_BRANCH)" ; then \
-                               if test x$$(RESET_VERSIONS) != "x"; then \
-                                       test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \
-                                       $(MAKE) reset-$(1) || exit 1; \
-                               else \
-                                   echo "Your $(1) branch is out of date, please run 'make reset-$(1)' (found $($(2)_BRANCH), expected $(NEEDED_$(2)_BRANCH))"; \
-                               touch .validate-versions-failure; \
-                               fi; \
-              fi; \
-           fi; \
-       fi
-
-test-$(1)::
-       @echo $(1)
-       @echo "   REPOSITORY_$(2)=$(REPOSITORY_$(2))"
-       @echo "   DIRECTORY_$(2)=$(DIRECTORY_$(2))"
-       @echo "   MODULE_$(2)=$(MODULE_$(2))"
-       @echo "   NEEDED_$(2)_VERSION=$(NEEDED_$(2)_VERSION)"
-       @echo "   $(2)_VERSION=$($(2)_VERSION)"
-       @echo "   $(2)_BRANCH_AND_REMOTE=$($(2)_BRANCH_AND_REMOTE)"
-       @echo "   NEEDED_$(2)_BRANCH=$(NEEDED_$(2)_BRANCH)"
-       @echo "   NEEDED_$(2)_REMOTE=$(NEEDED_$(2)_REMOTE)"
-       @echo "   $(2)_BRANCH=$($(2)_BRANCH)"
-       @echo "   $(2)_PATH=$($(2)_PATH) => $(abspath $($(2)_PATH))"
-
-reset-$(1)::
-       @if test -d $($(2)_PATH); then \
-               if ! (cd $($(2)_PATH) && git show $(NEEDED_$(2)_VERSION) >/dev/null 2>&1 && git log -1 $(NEEDED_$(2)_REMOTE) >/dev/null 2>&1) ; then \
-                       echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \
-               fi;  \
-       else \
-               echo "*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \
-       fi
-       @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \
-               echo "*** [$(1)] git checkout -f" $(NEEDED_$(2)_BRANCH) && (cd $($(2)_PATH) ; git checkout -f $(NEEDED_$(2)_BRANCH) || git checkout -f -b $($(2)_BRANCH_AND_REMOTE)); \
-               echo "*** [$(1)] git reset --hard $(NEEDED_$(2)_VERSION)" && (cd $($(2)_PATH) && git reset --hard $(NEEDED_$(2)_VERSION)); \
-       fi
-       @echo "*** [$(1)] git submodule update --init --recursive" && (cd $($(2)_PATH) && git submodule update --init --recursive)
-
-print-$(1)::
-       @printf "*** %-16s %-45s %s (%s)\n" "$(DIRECTORY_$(2))" "$(MODULE_$(2))" "$(NEEDED_$(2)_VERSION)" "$(NEEDED_$(2)_BRANCH)"
-
-.PHONY: validate-$(1) reset-$(1) print-$(1)
-
-reset-versions:: reset-$(1)
-validate-versions:: Validate-$(1)
-print-versions:: print-$(1)
-
-endef
+include $(top_srcdir)/scripts/submodules/versions.mk
 
 $(eval $(call ValidateVersionTemplate,roslyn,ROSLYN))
 $(eval $(call ValidateVersionTemplate,coreclr,CORECLR))
 $(eval $(call ValidateVersionTemplate,ms-test-suite,MSTESTSUITE))
 
-reset-versions::
-
-validate-versions::
-       @if test -e .validate-versions-failure; then  \
-               rm .validate-versions-failure; \
-               echo One or more modules needs update;  \
-               exit 1; \
-       else \
-               echo All dependent modules up to date;  \
-       fi
-
-reset:
-       @$(MAKE) validate-versions RESET_VERSIONS=1
-
-__bump-version-%:
-       @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV=<ref>"; exit 1; fi
-       python versions.py set-rev $* $(REV)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[acceptance-tests] Bump $* to pick up $(REV)." | git commit -F - $(CONFIG); 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 versions.py set-branch $* $(BRANCH)
-       python versions.py set-remote-branch $* $(REMOTE_BRANCH)
-       @if [ "$(COMMIT)" = "1" ]; then echo "[acceptance-tests] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(CONFIG); fi
-
-__bump-current-version-%:
-       REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \
-       python versions.py set-rev $* $$REV; \
-       if [ "$(COMMIT)" = "1" ]; then echo "[acceptance-tests] Bump $* to pick up $$REV:" | git commit -F - $(CONFIG); fi
-
 # Bump the given submodule to the revision given by the REV make variable
 # If COMMIT is 1, commit the change
 bump-roslyn: __bump-version-roslyn
diff --git a/acceptance-tests/versions.py b/acceptance-tests/versions.py
deleted file mode 100755 (executable)
index 35ded0c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import json
-
-def find_module(submodules, name):
-    for item in submodules:
-        if item["name"] == name:
-            return item
-
-    print("Not found")
-    sys.exit(1)
-
-
-if len(sys.argv) < 2:
-    print("Usage: versions.py <command>")
-    sys.exit(1)
-
-CONFIG_FILE = "SUBMODULES.json"
-command = sys.argv[1]
-
-submodules = json.load(open(CONFIG_FILE))
-
-if command == "get-rev":
-    mod = find_module(submodules, sys.argv[2])
-    print(mod["rev"])
-elif command == "get-url":
-    mod = find_module(submodules, sys.argv[2])
-    print(mod["url"])
-elif command == "get-dir":
-    mod = find_module(submodules, sys.argv[2])
-    print(mod["directory"])
-elif command == "get-remote-branch":
-    mod = find_module(submodules, sys.argv[2])
-    print(mod["remote-branch"])
-elif command == "set-rev":
-    mod = find_module(submodules, sys.argv[2])
-    mod["rev"] = sys.argv[3]
-    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]
-    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]
-    json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
-elif command == "cat":
-    print(json.dumps(submodules, indent = 2))
-else:
-    print("Unknown command "" + command + "".")
-    sys.exit(1)
index 523390309a0fa3ad80bbd27f63c29f9239709f61..96616f87fc23a27e5d698e09a683a338554d1fd8 100644 (file)
@@ -968,71 +968,75 @@ AC_ARG_WITH(libgc,   [  --with-gc=included,none  Controls the Boehm GC config, d
 AC_ARG_ENABLE(boehm, [  --disable-boehm            Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
 AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
 
-AC_ARG_ENABLE(parallel-mark, [  --enable-parallel-mark     Enables Boehm GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
-if test x$enable_parallel_mark = xyes; then
-       libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
-fi
+if test "x$support_boehm" = "xyes"; then
 
-gc_msg=""
-LIBGC_CPPFLAGS=
-LIBGC_LIBS=
-LIBGC_STATIC_LIBS=
-libgc_dir=
-case "x$libgc" in
-       xincluded)
-               if test "x$support_boehm" = "xyes"; then
-                       libgc_dir=libgc
-               fi
+       AC_ARG_ENABLE(parallel-mark, [  --enable-parallel-mark     Enables Boehm GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
+       if test x$enable_parallel_mark = xyes; then
+               libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
+       fi
 
-               LIBGC_CPPFLAGS='-I$(top_srcdir)/libgc/include'
-               LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
-               LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
+       gc_msg=""
+       LIBGC_CPPFLAGS=
+       LIBGC_LIBS=
+       LIBGC_STATIC_LIBS=
+       libgc_dir=
+       case "x$libgc" in
+               xincluded)
+                       if test "x$support_boehm" = "xyes"; then
+                               libgc_dir=libgc
+                       fi
 
-               BOEHM_DEFINES="-DHAVE_BOEHM_GC"
+                       LIBGC_CPPFLAGS='-I$(top_srcdir)/libgc/include'
+                       LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
+                       LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
 
-               if test x$target_win32 = xyes; then
-                       BOEHM_DEFINES="$BOEHM_DEFINES -DGC_NOT_DLL"
-                       CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DGC_BUILD -DGC_NOT_DLL"
-               fi
+                       BOEHM_DEFINES="-DHAVE_BOEHM_GC"
 
-               gc_msg="Included Boehm GC with typed GC"
-               if test x$enable_parallel_mark = xyes; then
-                       AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
-                       gc_msg="$gc_msg and parallel mark"
-               else
-                       AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC)", [GC description])
-               fi
-               ;;
+                       if test x$target_win32 = xyes; then
+                               BOEHM_DEFINES="$BOEHM_DEFINES -DGC_NOT_DLL"
+                               CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DGC_BUILD -DGC_NOT_DLL"
+                       fi
 
-       xboehm|xbohem|xyes)
-               AC_MSG_WARN("External Boehm is no longer supported")
-               ;;
+                       gc_msg="Included Boehm GC with typed GC"
+                       if test x$enable_parallel_mark = xyes; then
+                               AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
+                               gc_msg="$gc_msg and parallel mark"
+                       else
+                               AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC)", [GC description])
+                       fi
+                       ;;
 
-       xsgen)
-               AC_MSG_WARN("Use --with-sgen instead, --with-gc= controls Boehm configuration")
-               ;;
+               xboehm|xbohem|xyes)
+                       AC_MSG_WARN("External Boehm is no longer supported")
+                       ;;
 
-       xnone)
-               AC_MSG_WARN("Compiling mono without GC.")
-               AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "none", [GC description])
-               AC_DEFINE(HAVE_NULL_GC,1,[No GC support.])
-               gc_msg="none"
-               ;;
-       *)
-               AC_MSG_ERROR([Invalid argument to --with-gc.])
-               ;;
-esac
+               xsgen)
+                       AC_MSG_WARN("Use --with-sgen instead, --with-gc= controls Boehm configuration")
+                       ;;
 
-AC_ARG_WITH(large-heap, [  --with-large-heap=yes,no       Enable support for GC heaps larger than 3GB (defaults to no)], [large_heap=$withval], [large_heap=no])
-if test "x$large_heap" = "xyes"; then
-   CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
-fi
+               xnone)
+                       AC_MSG_WARN("Compiling mono without GC.")
+                       AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "none", [GC description])
+                       AC_DEFINE(HAVE_NULL_GC,1,[No GC support.])
+                       gc_msg="none"
+                       ;;
+               *)
+                       AC_MSG_ERROR([Invalid argument to --with-gc.])
+                       ;;
+       esac
+
+       AC_ARG_WITH(large-heap, [  --with-large-heap=yes,no       Enable support for GC heaps larger than 3GB (defaults to no)], [large_heap=$withval], [large_heap=no])
+       if test "x$large_heap" = "xyes"; then
+          CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
+       fi
 
-AC_SUBST(LIBGC_CPPFLAGS)
-AC_SUBST(LIBGC_LIBS)
-AC_SUBST(LIBGC_STATIC_LIBS)
-AC_SUBST(libgc_dir)
-AC_SUBST(BOEHM_DEFINES)
+       AC_SUBST(LIBGC_CPPFLAGS)
+       AC_SUBST(LIBGC_LIBS)
+       AC_SUBST(LIBGC_STATIC_LIBS)
+       AC_SUBST(libgc_dir)
+       AC_SUBST(BOEHM_DEFINES)
+
+fi
 
 dnl
 dnl End of Boehm GC Configuration
@@ -3262,7 +3266,11 @@ AC_ARG_WITH(sgen, [  --with-sgen=yes,no             Extra Generational GC, defau
 if test x$buildsgen = xyes; then
    AC_DEFINE(HAVE_MOVING_COLLECTOR, 1, [Moving collector])
    SGEN_DEFINES="-DHAVE_SGEN_GC"
-   gc_msg="sgen and $gc_msg"
+   if test "x$gc_msg" = "x"; then
+      gc_msg="sgen"
+   else
+      gc_msg="sgen and $gc_msg"
+   fi
 fi
 AC_SUBST(SGEN_DEFINES)
 AM_CONDITIONAL(SUPPORT_SGEN, test x$buildsgen = xyes)
@@ -3915,6 +3923,7 @@ AC_OUTPUT([
 Makefile
 mono-uninstalled.pc
 acceptance-tests/Makefile
+llvm/Makefile
 scripts/mono-find-provides
 scripts/mono-find-requires
 mono/Makefile
diff --git a/llvm/.gitignore b/llvm/.gitignore
new file mode 100644 (file)
index 0000000..b336cc7
--- /dev/null
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/llvm/Makefile.am b/llvm/Makefile.am
new file mode 100644 (file)
index 0000000..e8004bf
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# Conditional submodule for llvm
+#
+# make reset-llvm will checkout a version of llvm which is suitable for this version of mono
+# into $top_srcdir/llvm/llvm.
+#
+
+LLVM_PATH=llvm
+
+include $(top_srcdir)/scripts/submodules/versions.mk
+
+$(eval $(call ValidateVersionTemplate,llvm,LLVM))
+
+# Bump the given submodule to the revision given by the REV make variable
+# If COMMIT is 1, commit the change
+bump-llvm: __bump-version-llvm
+
+# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
+# If COMMIT is 1, commit the change
+bump-branch-llvm: __bump-branch-llvm
+
+# Bump the given submodule to its current GIT version
+# If COMMIT is 1, commit the change
+bump-current-llvm: __bump-current-version-llvm
+
+clean-local:
+       $(RM) -r $(LLVM_PATH)
+
+EXTRA_DIST=SUBMODULES.json
diff --git a/llvm/SUBMODULES.json b/llvm/SUBMODULES.json
new file mode 100644 (file)
index 0000000..e4fbbb0
--- /dev/null
@@ -0,0 +1,10 @@
+[
+  {
+      "name": "llvm", 
+      "url": "git://github.com/mono/llvm.git",
+      "rev": "9f79399f87282524fee099b328bd8cbf07929daf",
+      "remote-branch": "origin/master", 
+      "branch": "master", 
+      "directory": "llvm"
+  }
+]
index 7bd449dd4559c7c9d8e1ca61432ef8a5b0340577..e2eff1620e7697a20a9d28a36db3a4e0eaf6479d 100644 (file)
@@ -1732,16 +1732,6 @@ messages for a certain component. You can use multiple masks by comma
 separating them. For example to see config file messages and assembly loader
 messages set you mask to "asm,cfg".
 .TP
-\fBMONO_LOG_DEST\fR
-Controls where trace log messages are written. If not set then the messages go to stdout. 
-If set, the string either specifies a path to a file that will have messages appended to
-it, or the string "syslog" in which case the messages will be written to the system log.
-Under Windows, this is simulated by writing to a file called "mono.log". 
-\fBMONO_LOG_HEADER\fR
-Controls whether trace log messages not directed to syslog have the id, timestamp, and
-pid as the prefix to the log message. To enable a header this environment variable need
-just be non-null. 
-.TP
 \fBMONO_TRACE\fR
 Used for runtime tracing of method calls. The format of the comma separated
 trace options is:
index 5fda8826d12968f30542b58a29219ceff5d11208..5e90cf8ddac60c76169f749959fabe51e0fe4484 100644 (file)
@@ -144,11 +144,11 @@ endif
 
 # Set the options for building and running AOT
 # The trampoline numbers are provisional, they are what is required
-# to run the corlib test suite. They should be considered a lower bound.
-INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000
+# 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=900
+INVARIANT_AOT_OPTIONS:=$(INVARIANT_AOT_OPTIONS),ngsharedvt-trampolines=2800
 endif
 
 AOT_BUILD_FLAGS = $(AOT_BUILD_FLAGS_PREFIX)$(INVARIANT_AOT_OPTIONS)
index 0f303359778863a701f5c3e2f823739e8f393984..dab06f09c1fe4e262fb15e4dcdc4f948c55cbdbf 100644 (file)
   -->\r
   <PropertyGroup>\r
     <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx $(ProjectDir)/System.Web.Http.Properties.CommonWebApiResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.Http/Properties/SRResources.resx $(ProjectDir)/System.Web.Http.Properties.SRResources.resx
 
     </PreBuildEvent>\r
     <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx $(ProjectDir)/System.Web.Http.Properties.CommonWebApiResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.Http/Properties/SRResources.resx $(ProjectDir)/System.Web.Http.Properties.SRResources.resx
 \r
     </PreBuildEvent>\r
     <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
index ac6617f5e2adbb68541ab9749ae949c96ccfc538..dc5c47f93869334c3c71d4a4221ba557e3c930bc 100644 (file)
   -->\r
   <PropertyGroup>\r
     <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages.Deployment/Resources/ConfigurationResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Resources.ConfigurationResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Common.CommonResources.resx
 
     </PreBuildEvent>\r
     <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages.Deployment/Resources/ConfigurationResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Resources.ConfigurationResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Common.CommonResources.resx
 \r
     </PreBuildEvent>\r
     <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
index d6ffdf0d747e53e2c86341149972cf05ecd47cfe..17d5bf27475358433f572ad70a510f43b1b3fb66 100644 (file)
   -->\r
   <PropertyGroup>\r
     <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Razor.Common.CommonResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages.Razor/Resources/RazorWebResources.resx $(ProjectDir)/System.Web.WebPages.Razor.Resources.RazorWebResources.resx
     </PreBuildEvent>\r
     <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Razor.Common.CommonResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages.Razor/Resources/RazorWebResources.resx $(ProjectDir)/System.Web.WebPages.Razor.Resources.RazorWebResources.resx\r
     </PreBuildEvent>\r
     <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
 
index 16d66dd9b1171e0d14673ca5e07756d4572751d2..2d7a70d2aa8802fe452930c29bfd4e54c1e54e6c 100644 (file)
   -->\r
   <PropertyGroup>\r
     <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
-
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Common.CommonResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages/Resources/WebPageResources.resx $(ProjectDir)/System.Web.WebPages.Resources.WebPageResources.resx
     </PreBuildEvent>\r
     <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">\r
-\r
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Common.CommonResources.resx
+cp $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages/Resources/WebPageResources.resx $(ProjectDir)/System.Web.WebPages.Resources.WebPageResources.resx\r
     </PreBuildEvent>\r
     <PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
 
index 03de187af3d953521b3b78452e6eff523b6be07a..34874b1f81f0bae8977486ef067eec0eceac7e71 100644 (file)
@@ -3115,6 +3115,26 @@ namespace MonoTests.System
                        tester.AssertLoadMissingAssemblyType ();
                }
 
+               [Test]
+               public void ShadowCopyDontChangeAssemblyCodeBase ()
+               {
+                       var setup = new AppDomainSetup ();
+                       setup.ApplicationBase = tempDir;
+                       setup.ApplicationName = "testdomain";
+                       setup.ShadowCopyFiles = "true";
+                       var ad = CreateTestDomain (setup, true);
+
+                       string assemblyFile = Path.Combine (tempDir, "TestAssembly.dll");
+                       AssemblyName aname = new AssemblyName ();
+                       aname.Name = "TestAssembly";
+                       GenerateAssembly (aname, assemblyFile);
+
+                       var tester = CreateCrossDomainTester (ad);
+                       var codeBaseFromShadowCopy = tester.LoadAndGetName ("TestAssembly");
+                       var expected = Assembly.LoadFrom (Path.Combine (tempDir, "TestAssembly.dll"));
+                       Assert.AreEqual (expected.GetName ().CodeBase, codeBaseFromShadowCopy);
+               }
+
                private static AppDomain CreateTestDomain (string baseDirectory, bool assemblyResolver)
                {
                        AppDomainSetup setup = new AppDomainSetup ();
@@ -3258,6 +3278,12 @@ namespace MonoTests.System
                        {
                                return obj;
                        }
+
+                       public string LoadAndGetName (string assemblyName)
+                       {
+                               var assembly = Assembly.Load (assemblyName);
+                               return assembly.GetName ().CodeBase;
+                       }
                }
 
                [Serializable ()]
index 32f0c9fd7b2a28bdd7c1d0c4059c7246386e8f04..eb3f68204036d2f79ab525c3995a8a3a689867e4 100644 (file)
@@ -39,6 +39,7 @@
 #include "mono/metadata/metadata-internals.h"
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/exception.h>
+#include <mono/metadata/exception-internals.h>
 #include <mono/metadata/threads.h>
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/metadata/socket-io.h>
@@ -189,16 +190,19 @@ create_domain_objects (MonoDomain *domain)
         * Create an instance early since we can't do it when there is no memory.
         */
        arg = mono_string_new (domain, "Out of memory");
-       domain->out_of_memory_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "OutOfMemoryException", arg, NULL);
+       domain->out_of_memory_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "OutOfMemoryException", arg, NULL, &error);
+       mono_error_assert_ok (&error);
 
        /* 
         * These two are needed because the signal handlers might be executing on
         * an alternate stack, and Boehm GC can't handle that.
         */
        arg = mono_string_new (domain, "A null value was found where an object instance was required");
-       domain->null_reference_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL);
+       domain->null_reference_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL, &error);
+       mono_error_assert_ok (&error);
        arg = mono_string_new (domain, "The requested operation caused a stack overflow.");
-       domain->stack_overflow_ex = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "StackOverflowException", arg, NULL);
+       domain->stack_overflow_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "StackOverflowException", arg, NULL, &error);
+       mono_error_assert_ok (&error);
 
        /*The ephemeron tombstone i*/
        domain->ephemeron_tombstone = mono_object_new_checked (domain, mono_defaults.object_class, &error);
index b8f4aca8f8e091ad0aad3cd9c60628a61c5a5327..b72657fda72f1e55b2195782581692a490447c74 100644 (file)
@@ -1443,6 +1443,9 @@ mono_class_load_from_name (MonoImage *image, const char* name_space, const char
 MonoClass*
 mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
 
+void
+mono_error_set_for_class_failure (MonoError *orerror, MonoClass *klass);
+
 static inline guint8
 mono_class_get_failure (MonoClass *klass)
 {
index 17da478b5e9c1f089d76de0bc275da6ab5e21077..39fc6e491df965cc8ba8e37d76072cb467533c3e 100644 (file)
@@ -1369,6 +1369,53 @@ mono_type_has_exceptions (MonoType *type)
        }
 }
 
+void
+mono_error_set_for_class_failure (MonoError *oerror, MonoClass *klass)
+{
+       gpointer exception_data = mono_class_get_exception_data (klass);
+
+       switch (mono_class_get_failure(klass)) {
+       case MONO_EXCEPTION_TYPE_LOAD: {
+               mono_error_set_type_load_class (oerror, klass, "Error Loading class");
+               return;
+       }
+       case MONO_EXCEPTION_MISSING_METHOD: {
+               char *class_name = (char *)exception_data;
+               char *member_name = class_name + strlen (class_name) + 1;
+
+               mono_error_set_method_load (oerror, klass, member_name, "Error Loading Method");
+               return;
+       }
+       case MONO_EXCEPTION_MISSING_FIELD: {
+               char *class_name = (char *)exception_data;
+               char *member_name = class_name + strlen (class_name) + 1;
+
+               mono_error_set_field_load (oerror, klass, member_name, "Error Loading Field");
+               return;
+       }
+       case MONO_EXCEPTION_FILE_NOT_FOUND: {
+               char *msg_format = (char *)exception_data;
+               char *assembly_name = msg_format + strlen (msg_format) + 1;
+               char *msg = g_strdup_printf (msg_format, assembly_name);
+
+               mono_error_set_assembly_load (oerror, assembly_name, msg);
+               return;
+       }
+       case MONO_EXCEPTION_BAD_IMAGE: {
+               mono_error_set_bad_image (oerror, NULL, (const char *)exception_data);
+               return;
+       }
+       case MONO_EXCEPTION_INVALID_PROGRAM: {
+               mono_error_set_invalid_program (oerror, (const char *)exception_data);
+               return;
+       }
+       default: {
+               g_assert_not_reached ();
+       }
+       }
+}
+
+
 /*
  * mono_class_alloc:
  *
@@ -8022,7 +8069,9 @@ gboolean
 mono_class_is_subclass_of (MonoClass *klass, MonoClass *klassc, 
                           gboolean check_interfaces)
 {
-/*FIXME test for interfaces with variant generic arguments*/
+       /* FIXME test for interfaces with variant generic arguments */
+       mono_class_init (klass);
+       mono_class_init (klassc);
        
        if (check_interfaces && MONO_CLASS_IS_INTERFACE (klassc) && !MONO_CLASS_IS_INTERFACE (klass)) {
                if (MONO_CLASS_IMPLEMENTS_INTERFACE (klass, klassc->interface_id))
index 60c2ae0bd19a28725cc9464e1dd3673ec0742836..4a9ad505798ee867cfab121d1afcf84069b6d44a 100644 (file)
@@ -15,4 +15,14 @@ mono_get_exception_reflection_type_load_checked (MonoArray *types, MonoArray *ex
 MonoException *
 mono_get_exception_runtime_wrapped_checked (MonoObject *wrapped_exception, MonoError *error);
 
-#endif
\ No newline at end of file
+MonoException *
+mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name_space,
+                                             const char *name, MonoString *a1, MonoString *a2,
+                                             MonoError *error);
+
+MonoException *
+mono_exception_from_token_two_strings_checked (MonoImage *image, uint32_t token,
+                                              MonoString *a1, MonoString *a2,
+                                              MonoError *error);
+
+#endif
index e2e162f702a1efeb69e0226a5a4ab8eedb4d52d4..2aff26dfd53788fe5080ef51e97cbaf0b9975045 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <glib.h>
+#include <config.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/exception-internals.h>
 
@@ -173,15 +174,39 @@ mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
                                      const char *name, MonoString *a1, MonoString *a2)
 {
        MonoError error;
-       MonoClass *klass;
        MonoException *ret;
 
-       klass = mono_class_load_from_name (image, name_space, name);
+       ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, &error);
+       mono_error_cleanup (&error);
+       return ret;
+}
 
-       ret = create_exception_two_strings (klass, a1, a2, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+/**
+ * mono_exception_from_name_two_strings_checked:
+ * @image: the Mono image where to look for the class
+ * @name_space: the namespace for the class
+ * @name: class name
+ * @a1: first string argument to pass
+ * @a2: second string argument to pass
+ * @error: set on error
+ *
+ * Creates an exception from a constructor that takes two string
+ * arguments.
+ *
+ * Returns: the initialized exception instance. On failure returns
+ * NULL and sets @error.
+ */
+MonoException *
+mono_exception_from_name_two_strings_checked (MonoImage *image, const char *name_space,
+                                             const char *name, MonoString *a1, MonoString *a2,
+                                             MonoError *error)
+{
+       MonoClass *klass;
 
-       return ret;
+       mono_error_init (error);
+       klass = mono_class_load_from_name (image, name_space, name);
+
+       return create_exception_two_strings (klass, a1, a2, error);
 }
 
 /**
@@ -220,16 +245,31 @@ mono_exception_from_token_two_strings (MonoImage *image, guint32 token,
                                                                           MonoString *a1, MonoString *a2)
 {
        MonoError error;
-       MonoClass *klass;
        MonoException *ret;
+       ret = mono_exception_from_token_two_strings_checked (image, token, a1, a2, &error);
+       mono_error_cleanup (&error);
+       return ret;
+}
 
-       klass = mono_class_get_checked (image, token, &error);
-       mono_error_assert_ok (&error); /* FIXME handle the error. */
+/**
+ * mono_exception_from_token_two_strings_checked:
+ *
+ *   Same as mono_exception_from_name_two_strings, but lookup the exception class using
+ * IMAGE and TOKEN.
+ */
+MonoException *
+mono_exception_from_token_two_strings_checked (MonoImage *image, guint32 token,
+                                              MonoString *a1, MonoString *a2,
+                                              MonoError *error)
+{
+       MonoClass *klass;
 
-       ret = create_exception_two_strings (klass, a1, a2, &error);
-       mono_error_raise_exception (&error); /* FIXME don't raise here */
+       mono_error_init (error);
 
-       return ret;
+       klass = mono_class_get_checked (image, token, error);
+       mono_error_assert_ok (error); /* FIXME handle the error. */
+
+       return create_exception_two_strings (klass, a1, a2, error);
 }
 
 /**
@@ -400,8 +440,11 @@ mono_get_exception_type_load (MonoString *class_name, char *assembly_name)
 {
        MonoString *s = assembly_name ? mono_string_new (mono_domain_get (), assembly_name) : mono_string_new (mono_domain_get (), "");
 
-       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
-                                                    "TypeLoadException", class_name, s);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System",
+                                                                  "TypeLoadException", class_name, s, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
@@ -441,8 +484,11 @@ mono_get_exception_missing_method (const char *class_name, const char *member_na
        MonoString *s1 = mono_string_new (mono_domain_get (), class_name);
        MonoString *s2 = mono_string_new (mono_domain_get (), member_name);
 
-       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
-                                                    "MissingMethodException", s1, s2);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System",
+                                                                          "MissingMethodException", s1, s2, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
@@ -458,8 +504,11 @@ mono_get_exception_missing_field (const char *class_name, const char *member_nam
        MonoString *s1 = mono_string_new (mono_domain_get (), class_name);
        MonoString *s2 = mono_string_new (mono_domain_get (), member_name);
 
-       return mono_exception_from_name_two_strings (mono_get_corlib (), "System",
-                                                    "MissingFieldException", s1, s2);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System",
+                                                                  "MissingFieldException", s1, s2, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
@@ -563,8 +612,11 @@ mono_get_exception_io (const char *msg)
 MonoException *
 mono_get_exception_file_not_found (MonoString *fname)
 {
-       return mono_exception_from_name_two_strings (
-               mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (
+               mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
@@ -579,8 +631,11 @@ mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
 {
        MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
 
-       return mono_exception_from_name_two_strings (
-               mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (
+               mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
@@ -699,8 +754,11 @@ mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname)
 {
        MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
 
-       return mono_exception_from_name_two_strings (
-               mono_get_corlib (), "System", "BadImageFormatException", s, fname);
+       MonoError error;
+       MonoException *ret = mono_exception_from_name_two_strings_checked (
+               mono_get_corlib (), "System", "BadImageFormatException", s, fname, &error);
+       mono_error_assert_ok (&error);
+       return ret;
 }
 
 /**
index b9b82dd7427943455cfdd4bd0c4a53638f57f262..3de5ae7ff57681981cf95a766105308ab2cacc79 100644 (file)
@@ -14,6 +14,7 @@ mono_exception_from_name               (MonoImage *image,
 MONO_API MonoException *
 mono_exception_from_token              (MonoImage *image, uint32_t token);
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoException *
 mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
                                      const char *name, MonoString *a1, MonoString *a2);
@@ -22,6 +23,7 @@ MONO_API MonoException *
 mono_exception_from_name_msg          (MonoImage *image, const char *name_space,
                                        const char *name, const char *msg);
 
+MONO_RT_EXTERNAL_ONLY
 MONO_API MonoException *
 mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
                                                   MonoString *a1, MonoString *a2);
index 5f9cabfc9e8d4a39ef68a917a57c7a06a64c5b23..636d7eab796547ce4fb7d2f79a42a5193f7cad71 100644 (file)
@@ -133,7 +133,7 @@ mono_class_init_checked (MonoClass *klass, MonoError *error)
        mono_error_init (error);
 
        if (!mono_class_init (klass))
-               mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+               mono_error_set_for_class_failure (error, klass);
 }
 
 ICALL_EXPORT MonoObject *
@@ -4320,9 +4320,8 @@ handle_parent:
 
 
 loader_error:
-       if (mono_class_has_failure (klass)) {
-               mono_error_set_exception_instance (&error, mono_class_get_exception_for_failure (klass));
-       }
+       if (mono_class_has_failure (klass))
+               mono_error_set_for_class_failure (&error, klass);
 
 failure:
        if (properties)
@@ -4469,9 +4468,8 @@ handle_parent:
        return res;
 
 loader_error:
-       if (mono_class_has_failure (klass)) {
-               mono_error_set_exception_instance (&error, mono_class_get_exception_for_failure (klass));
-       }
+       if (mono_class_has_failure (klass))
+               mono_error_set_for_class_failure (&error, klass);
 
 failure:
        
@@ -5634,15 +5632,20 @@ ICALL_EXPORT void
 ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
 {
        MonoError error;
-       gchar *absolute;
+       gchar *absolute, *dirname;
        MonoAssembly *mass = assembly->assembly;
 
+       /* XXX this is duplicated code to compute the codebase URI, unify it */
        if (g_path_is_absolute (mass->image->name)) {
-               fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, mass->image->name, TRUE, TRUE, TRUE, &error);
-               mono_error_set_pending_exception (&error);
-               return;
+               absolute = g_strdup (mass->image->name);
+               dirname = g_path_get_dirname (absolute);
+       } else {
+               absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
+               dirname = g_strdup (mass->basedir);
        }
-       absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
+
+       replace_shadow_path (mono_object_domain (assembly), dirname, &absolute);
+       g_free (dirname);
 
        fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, absolute, TRUE, TRUE, TRUE, &error);
        mono_error_set_pending_exception (&error);
index 3982fd8c05f1d3f4da834032c069eb9b4b56f5b8..3bab96e4e59d55be5a8e550fc4bfddd47e93a8bd 100644 (file)
@@ -1706,6 +1706,9 @@ mono_string_from_utf16_checked (mono_unichar2 *data, MonoError *error);
 MonoString *
 mono_string_from_utf32_checked (mono_unichar4 *data, MonoError *error);
 
+char*
+mono_ldstr_utf8 (MonoImage *image, guint32 idx, MonoError *error);
+
 gboolean
 mono_runtime_object_init_checked (MonoObject *this_obj, MonoError *error);
 
index 5da5f6bbf33833dae7f001d288074a710f02b6ae..a9006ac4889c277a88b4f44540d6556a6739b96f 100644 (file)
@@ -1905,7 +1905,7 @@ mono_class_vtable_full (MonoDomain *domain, MonoClass *klass, MonoError *error)
        g_assert (klass);
 
        if (mono_class_has_failure (klass)) {
-               mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+               mono_error_set_for_class_failure (error, klass);
                return NULL;
        }
 
@@ -1992,7 +1992,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
                if (!mono_class_init (klass) || mono_class_has_failure (klass)) {
                        mono_domain_unlock (domain);
                        mono_loader_unlock ();
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+                       mono_error_set_for_class_failure (error, klass);
                        return NULL;
                }
        }
@@ -2013,7 +2013,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
                                mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL);
                        mono_domain_unlock (domain);
                        mono_loader_unlock ();
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+                       mono_error_set_for_class_failure (error, klass);
                        return NULL;
                }
        }
@@ -2034,7 +2034,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
        if (mono_class_has_failure (klass)) {
                mono_domain_unlock (domain);
                mono_loader_unlock ();
-               mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+               mono_error_set_for_class_failure (error, klass);
                return NULL;
        }
 
@@ -4891,7 +4891,7 @@ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
                }
        } else {
                MonoObject *result = mono_runtime_try_invoke_array (method, obj, params, NULL, &error);
-               mono_error_raise_exception (&error); /* FIXME don't raise here */
+               mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */
                return result;
        }
 }
@@ -6813,6 +6813,48 @@ mono_ldstr_metadata_sig (MonoDomain *domain, const char* sig, MonoError *error)
        return interned;
 }
 
+/*
+ * mono_ldstr_utf8:
+ *
+ *   Same as mono_ldstr, but return a NULL terminated utf8 string instead
+ * of an object.
+ */
+char*
+mono_ldstr_utf8 (MonoImage *image, guint32 idx, MonoError *error)
+{
+       const char *str;
+       size_t len2;
+       long written = 0;
+       char *as;
+       GError *gerror = NULL;
+
+       mono_error_init (error);
+
+       if (!mono_verifier_verify_string_signature (image, idx, NULL))
+               return NULL; /*FIXME we should probably be raising an exception here*/
+       str = mono_metadata_user_string (image, idx);
+
+       len2 = mono_metadata_decode_blob_size (str, &str);
+       len2 >>= 1;
+
+       as = g_utf16_to_utf8 ((guint16*)str, len2, NULL, &written, &gerror);
+       if (gerror) {
+               mono_error_set_argument (error, "string", "%s", gerror->message);
+               g_error_free (gerror);
+               return NULL;
+       }
+       /* g_utf16_to_utf8  may not be able to complete the convertion (e.g. NULL values were found, #335488) */
+       if (len2 > written) {
+               /* allocate the total length and copy the part of the string that has been converted */
+               char *as2 = (char *)g_malloc0 (len2);
+               memcpy (as2, as, written);
+               g_free (as);
+               as = as2;
+       }
+
+       return as;
+}
+
 /**
  * mono_string_to_utf8:
  * @s: a System.String
index a9b46372aa63bdcd79e471571bbd63361b08624a..2dd53c18b14fa153f37d63e368fb6cfebefe366e 100644 (file)
@@ -8989,7 +8989,7 @@ mono_reflection_get_token_checked (MonoObject *obj, MonoError *error)
                return_val_if_nok (error, 0);
                MonoClass *mc = mono_class_from_mono_type (type);
                if (!mono_class_init (mc)) {
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (mc));
+                       mono_error_set_for_class_failure (error, mc);
                        return 0;
                }
 
@@ -9818,7 +9818,7 @@ reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, Mono
        domain = mono_object_domain (ref_method);
 
        if (!mono_class_init (method->klass)) {
-               mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (method->klass));
+               mono_error_set_for_class_failure (error, method->klass);
                goto leave;
        }
 
@@ -13952,7 +13952,7 @@ resolve_object (MonoImage *image, MonoObject *obj, MonoClass **handle_class, Mon
                return_val_if_nok (error, NULL);
                MonoClass *mc = mono_class_from_mono_type (type);
                if (!mono_class_init (mc)) {
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (mc));
+                       mono_error_set_for_class_failure (error, mc);
                        return NULL;
                }
 
index 5f5817b44a1cfc1ae84f7398e9c480537d68b4e6..95dc216d70e1be5c4068e4bbf0d600834c85e294 100644 (file)
@@ -7030,6 +7030,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        opts->ntrampolines = atoi (arg + strlen ("ntrampolines="));
                } else if (str_begins_with (arg, "nrgctx-trampolines=")) {
                        opts->nrgctx_trampolines = atoi (arg + strlen ("nrgctx-trampolines="));
+               } else if (str_begins_with (arg, "nrgctx-fetch-trampolines=")) {
+                       opts->nrgctx_fetch_trampolines = atoi (arg + strlen ("nrgctx-fetch-trampolines="));
                } else if (str_begins_with (arg, "nimt-trampolines=")) {
                        opts->nimt_trampolines = atoi (arg + strlen ("nimt-trampolines="));
                } else if (str_begins_with (arg, "ngsharedvt-trampolines=")) {
index 39abeb285497461e407cb5f3f1bfb3dd0fa96d7b..8651aa25ec497c574a6d492e6ae6e9b324be8e14 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "jit-icalls.h"
 #include <mono/utils/mono-error-internals.h>
+#include <mono/metadata/exception-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/reflection-internals.h>
 
@@ -1189,13 +1190,21 @@ mono_create_corlib_exception_0 (guint32 token)
 MonoException *
 mono_create_corlib_exception_1 (guint32 token, MonoString *arg)
 {
-       return mono_exception_from_token_two_strings (mono_defaults.corlib, token, arg, NULL);
+       MonoError error;
+       MonoException *ret = mono_exception_from_token_two_strings_checked (
+               mono_defaults.corlib, token, arg, NULL, &error);
+       mono_error_set_pending_exception (&error);
+       return ret;
 }
 
 MonoException *
 mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2)
 {
-       return mono_exception_from_token_two_strings (mono_defaults.corlib, token, arg1, arg2);
+       MonoError error;
+       MonoException *ret = mono_exception_from_token_two_strings_checked (
+               mono_defaults.corlib, token, arg1, arg2, &error);
+       mono_error_set_pending_exception (&error);
+       return ret;
 }
 
 MonoObject*
@@ -1487,15 +1496,15 @@ mono_fill_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, int index)
  * out parameter.
  */
 static gpointer
-resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer *out_arg, gboolean caller_gsharedvt)
+resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer *out_arg, gboolean caller_gsharedvt, MonoError *error)
 {
-       MonoError error;
        MonoVTable *vt;
        gpointer *imt, *vtable_slot;
        MonoMethod *impl_method, *generic_virtual = NULL, *variant_iface = NULL;
        gpointer addr, compiled_method, aot_addr;
        gboolean need_rgctx_tramp = FALSE, need_unbox_tramp = FALSE;
 
+       mono_error_init (error);
        if (!this_obj)
                /* The caller will handle it */
                return NULL;
@@ -1503,11 +1512,12 @@ resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method,
        vt = this_obj->vtable;
        imt = (gpointer*)vt - MONO_IMT_SIZE;
 
-       vtable_slot = mini_resolve_imt_method (vt, imt + imt_slot, imt_method, &impl_method, &aot_addr, &need_rgctx_tramp, &variant_iface);
+       vtable_slot = mini_resolve_imt_method (vt, imt + imt_slot, imt_method, &impl_method, &aot_addr, &need_rgctx_tramp, &variant_iface, error);
+       return_val_if_nok (error, NULL);
 
        // FIXME: This can throw exceptions
-       addr = compiled_method = mono_compile_method_checked (impl_method, &error);
-       mono_error_assert_ok (&error);
+       addr = compiled_method = mono_compile_method_checked (impl_method, error);
+       mono_error_assert_ok (error);
        g_assert (addr);
 
        if (imt_method->is_inflated && ((MonoMethodInflated*)imt_method)->context.method_inst)
@@ -1537,7 +1547,13 @@ resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method,
 gpointer
 mono_resolve_iface_call_gsharedvt (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer *out_arg)
 {
-       return resolve_iface_call (this_obj, imt_slot, imt_method, out_arg, TRUE);
+       MonoError error;
+       gpointer res = resolve_iface_call (this_obj, imt_slot, imt_method, out_arg, TRUE, &error);
+       if (!is_ok (&error)) {
+               MonoException *ex = mono_error_convert_to_exception (&error);
+               mono_llvm_throw_exception ((MonoObject*)ex);
+       }
+       return res;
 }
 
 static gboolean
@@ -1566,18 +1582,18 @@ is_generic_method_definition (MonoMethod *m)
  * out parameter.
  */
 static gpointer
-resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_arg, gboolean gsharedvt)
+resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_arg, gboolean gsharedvt, MonoError *error)
 {
-       MonoError error;
        MonoMethod *m, *generic_virtual = NULL;
        gpointer addr, compiled_method;
        gboolean need_unbox_tramp = FALSE;
 
+       mono_error_init (error);
        /* Same as in common_call_trampoline () */
 
        /* Avoid loading metadata or creating a generic vtable if possible */
-       addr = mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, slot, &error);
-       mono_error_raise_exception (&error); // FIXME: Don't raise here
+       addr = mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, slot, error);
+       return_val_if_nok (error, NULL);
        if (addr && !vt->klass->valuetype)
                return mono_create_ftnptr (mono_domain_get (), addr);
 
@@ -1602,8 +1618,8 @@ resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_a
                g_assert (generic_virtual->is_inflated);
                context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst;
 
-               m = mono_class_inflate_generic_method_checked (declaring, &context, &error);
-               mono_error_assert_ok (&error); /* FIXME don't swallow the error */
+               m = mono_class_inflate_generic_method_checked (declaring, &context, error);
+               mono_error_assert_ok (error); /* FIXME don't swallow the error */
        }
 
        if (generic_virtual) {
@@ -1615,8 +1631,8 @@ resolve_vcall (MonoVTable *vt, int slot, MonoMethod *imt_method, gpointer *out_a
        }
 
        // FIXME: This can throw exceptions
-       addr = compiled_method = mono_compile_method_checked (m, &error);
-       mono_error_assert_ok (&error);
+       addr = compiled_method = mono_compile_method_checked (m, error);
+       mono_error_assert_ok (error);
        g_assert (addr);
 
        addr = mini_add_method_wrappers_llvmonly (m, addr, gsharedvt, need_unbox_tramp, out_arg);
@@ -1638,7 +1654,13 @@ mono_resolve_vcall_gsharedvt (MonoObject *this_obj, int slot, MonoMethod *imt_me
 {
        g_assert (this_obj);
 
-       return resolve_vcall (this_obj->vtable, slot, imt_method, out_arg, TRUE);
+       MonoError error;
+       gpointer result = resolve_vcall (this_obj->vtable, slot, imt_method, out_arg, TRUE, &error);
+       if (!is_ok (&error)) {
+               MonoException *ex = mono_error_convert_to_exception (&error);
+               mono_llvm_throw_exception ((MonoObject*)ex);
+       }
+       return result;
 }
 
 /*
@@ -1720,7 +1742,11 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho
 
        imt = (gpointer*)vt - MONO_IMT_SIZE;
 
-       mini_resolve_imt_method (vt, imt + imt_slot, generic_virtual, &m, &aot_addr, &need_rgctx_tramp, &variant_iface);
+       mini_resolve_imt_method (vt, imt + imt_slot, generic_virtual, &m, &aot_addr, &need_rgctx_tramp, &variant_iface, &error);
+       if (!is_ok (&error)) {
+               MonoException *ex = mono_error_convert_to_exception (&error);
+               mono_llvm_throw_exception ((MonoObject*)ex);
+       }
 
        if (vt->klass->valuetype)
                need_unbox_tramp = TRUE;
@@ -1754,11 +1780,14 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho
 gpointer
 mono_init_vtable_slot (MonoVTable *vtable, int slot)
 {
+       MonoError error;
        gpointer arg = NULL;
        gpointer addr;
        gpointer *ftnptr;
 
-       addr = resolve_vcall (vtable, slot, NULL, &arg, FALSE);
+       addr = resolve_vcall (vtable, slot, NULL, &arg, FALSE, &error);
+       if (mono_error_set_pending_exception (&error))
+               return NULL;
        ftnptr = mono_domain_alloc0 (vtable->domain, 2 * sizeof (gpointer));
        ftnptr [0] = addr;
        ftnptr [1] = arg;
index 207816d1525a9493d0c732b58c638b8c9a9a0e34..b0ca01954dd0902a91f25a02e4eda756f68fef2d 100644 (file)
@@ -6807,7 +6807,7 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
                    cfg->compile_aot && !cfg->llvm_only) {
                        MonoInst *pi;
                        MonoJumpInfoToken *ji;
-                       MonoString *s;
+                       char *s;
 
                        // FIXME: llvmonly
 
@@ -6826,14 +6826,13 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
 
                        NULLIFY_INS (args [0]);
 
-                       // FIXME: Ugly
-                       s = mono_ldstr_checked (cfg->domain, ji->image, mono_metadata_token_index (ji->token), &cfg->error);
+                       s = mono_ldstr_utf8 (ji->image, mono_metadata_token_index (ji->token), &cfg->error);
                        return_val_if_nok (&cfg->error, NULL);
+
                        MONO_INST_NEW (cfg, ins, OP_OBJC_GET_SELECTOR);
                        ins->dreg = mono_alloc_ireg (cfg);
                        // FIXME: Leaks
-                       ins->inst_p0 = mono_string_to_utf8_checked (s, &cfg->error);
-                       return_val_if_nok (&cfg->error, NULL);
+                       ins->inst_p0 = s;
                        MONO_ADD_INS (cfg->cbb, ins);
                        return ins;
                }
index 9cdeae95394f60bf55d471ec28e3ab2cd9e5ca69..3e59c9da16d42fd0f6aae2165428f3ff2ba3d523 100644 (file)
@@ -2469,14 +2469,14 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g
        if (dinfo->cinfo->ret.storage == ArgValuetypeAddrInIReg || dinfo->cinfo->ret.storage == ArgGsharedvtVariableInReg)
                p->regs [greg ++] = PTR_TO_GREG(ret);
 
-       for (i = pindex; i < sig->param_count; i++) {
-               MonoType *t = mini_get_underlying_type (sig->params [i]);
+       for (; pindex < sig->param_count; pindex++) {
+               MonoType *t = mini_get_underlying_type (sig->params [pindex]);
                gpointer *arg = args [arg_index ++];
-               ArgInfo *ainfo = &dinfo->cinfo->args [i + sig->hasthis];
+               ArgInfo *ainfo = &dinfo->cinfo->args [pindex + sig->hasthis];
                int slot;
 
                if (ainfo->storage == ArgOnStack) {
-                       slot = PARAM_REGS + 1 + (ainfo->offset / sizeof (mgreg_t));
+                       slot = PARAM_REGS + (ainfo->offset / sizeof (mgreg_t));
                } else {
                        slot = param_reg_to_index [ainfo->reg];
                }
index 84c21c5890e9dfedf73e95a441857fc6875f370a..e1e2eb19b430c0040972a551caad3acf31f757a0 100644 (file)
@@ -862,7 +862,7 @@ class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_ty
        case MONO_RGCTX_INFO_STATIC_DATA: {
                MonoVTable *vtable = mono_class_vtable (domain, klass);
                if (!vtable) {
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+                       mono_error_set_for_class_failure (error, klass);
                        return NULL;
                }
                return mono_vtable_get_static_field_data (vtable);
@@ -874,7 +874,7 @@ class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_ty
        case MONO_RGCTX_INFO_VTABLE: {
                MonoVTable *vtable = mono_class_vtable (domain, klass);
                if (!vtable) {
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+                       mono_error_set_for_class_failure (error, klass);
                        return NULL;
                }
                return vtable;
@@ -1704,7 +1704,7 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
 
                vtable = mono_class_vtable (domain, method->method.method.klass);
                if (!vtable) {
-                       mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (method->method.method.klass));
+                       mono_error_set_for_class_failure (error, method->method.method.klass);
                        return NULL;
                }
 
index 68b5a8b0a47b5efbfa8421bb212c0f8d014e905a..27820c19f9fa6c19c7af17e34955d16675120698 100644 (file)
@@ -154,7 +154,7 @@ mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer addr)
  * Either IMPL_METHOD or OUT_AOT_ADDR will be set on return.
  */
 gpointer*
-mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_method, MonoMethod **impl_method, gpointer *out_aot_addr, gboolean *out_need_rgctx_tramp, MonoMethod **variant_iface)
+mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_method, MonoMethod **impl_method, gpointer *out_aot_addr, gboolean *out_need_rgctx_tramp, MonoMethod **variant_iface, MonoError *error)
 {
        MonoMethod *impl = NULL, *generic_virtual = NULL;
        gboolean lookup_aot, variance_used = FALSE, need_rgctx_tramp = FALSE;
@@ -166,6 +166,7 @@ mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_
 
        g_assert (imt_slot < MONO_IMT_SIZE);
 
+       mono_error_init (error);
        /* This has to be variance aware since imt_method can be from an interface that vt->klass doesn't directly implement */
        interface_offset = mono_class_interface_offset_with_variance (vt->klass, imt_method->klass, &variance_used);
        if (interface_offset < 0)
@@ -188,7 +189,6 @@ mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_
                mono_vtable_build_imt_slot (vt, mono_method_get_imt_slot (imt_method));
 
        if (imt_method->is_inflated && ((MonoMethodInflated*)imt_method)->context.method_inst) {
-               MonoError error;
                MonoGenericContext context = { NULL, NULL };
 
                /*
@@ -201,15 +201,14 @@ mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_
                if (impl->klass->generic_class)
                        context.class_inst = impl->klass->generic_class->context.class_inst;
                context.method_inst = ((MonoMethodInflated*)imt_method)->context.method_inst;
-               impl = mono_class_inflate_generic_method_checked (impl, &context, &error);
-               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+               impl = mono_class_inflate_generic_method_checked (impl, &context, error);
+               mono_error_assert_ok (error);
        } else {
-               MonoError error;
 
                /* Avoid loading metadata or creating a generic vtable if possible */
                if (lookup_aot && !vt->klass->valuetype) {
-                       aot_addr = (guint8 *)mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, interface_offset + mono_method_get_vtable_slot (imt_method), &error);
-                       mono_error_raise_exception (&error); // FIXME: Don't raise here
+                       aot_addr = (guint8 *)mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, interface_offset + mono_method_get_vtable_slot (imt_method), error);
+                       return_val_if_nok (error, NULL);
                } else {
                        aot_addr = NULL;
                }
@@ -562,7 +561,9 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                                need_rgctx_tramp = TRUE;
                        }
 
-                       vtable_slot = mini_resolve_imt_method (vt, vtable_slot, imt_method, &impl_method, &addr, &need_rgctx_tramp, &variant_iface);
+                       vtable_slot = mini_resolve_imt_method (vt, vtable_slot, imt_method, &impl_method, &addr, &need_rgctx_tramp, &variant_iface, error);
+                       return_val_if_nok (error, NULL);
+
                        /* This is the vcall slot which gets called through the IMT thunk */
                        vtable_slot_to_patch = vtable_slot;
 
@@ -585,7 +586,6 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
         * return TRUE for methods used in IMT calls too.
         */
        if (virtual_ && is_generic_method_definition (m)) {
-               MonoError error;
                MonoGenericContext context = { NULL, NULL };
                MonoMethod *declaring;
 
@@ -604,8 +604,8 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                g_assert (generic_virtual->is_inflated);
                context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst;
 
-               m = mono_class_inflate_generic_method_checked (declaring, &context, &error);
-               g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+               m = mono_class_inflate_generic_method_checked (declaring, &context, error);
+               mono_error_assert_ok (error);
                /* FIXME: only do this if the method is sharable */
                need_rgctx_tramp = TRUE;
        } else if ((context_used = mono_method_check_context_used (m))) {
@@ -658,7 +658,6 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                }
 
                if (method_inst || m->wrapper_type) {
-                       MonoError error;
                        MonoGenericContext context = { NULL, NULL };
 
                        if (m->is_inflated)
@@ -672,8 +671,8 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
                                context.class_inst = klass->generic_container->context.class_inst;
                        context.method_inst = method_inst;
 
-                       actual_method = mono_class_inflate_generic_method_checked (declaring, &context, &error);
-                       g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+                       actual_method = mono_class_inflate_generic_method_checked (declaring, &context, error);
+                       mono_error_assert_ok (error);
                } else {
                        actual_method = mono_class_get_method_generic (klass, m);
                }
index f0f76b0a6710ccd89eb0158dda78e298a5866430..48729fc2eeeac4601b3a06e59a30d06c120fabf4 100644 (file)
@@ -2572,7 +2572,8 @@ gpointer          mini_add_method_trampoline (MonoMethod *m, gpointer compiled_m
 gpointer          mini_add_method_wrappers_llvmonly (MonoMethod *m, gpointer compiled_method, gboolean caller_gsharedvt, gboolean add_unbox_tramp, gpointer *out_arg);
 gboolean          mini_jit_info_is_gsharedvt (MonoJitInfo *ji);
 gpointer*         mini_resolve_imt_method (MonoVTable *vt, gpointer *vtable_slot, MonoMethod *imt_method, MonoMethod **impl_method, gpointer *out_aot_addr,
-                                                                                  gboolean *out_need_rgctx_tramp, MonoMethod **variant_iface);
+                                          gboolean *out_need_rgctx_tramp, MonoMethod **variant_iface,
+                                          MonoError *error);
 MonoFtnDesc      *mini_create_llvmonly_ftndesc (MonoDomain *domain, gpointer addr, gpointer arg);
 
 gboolean          mono_running_on_valgrind (void);
index 41e62a8a1b528645239bdbadc8502e1d9cec55de..b215a3091c3c87d3da5aee213d6421f9fc3ac585 100644 (file)
@@ -36,6 +36,9 @@ lib_LTLIBRARIES = \
        $(vtune_shlibs) \
        $(vtune_stlibs)
 
+suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
+suppression_DATA = mono-profiler-log.suppression
+
 if PLATFORM_DARWIN
 prof_ldflags = -Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 endif
@@ -44,6 +47,13 @@ if PLATFORM_ANDROID
 prof_ldflags = -avoid-version
 endif
 
+# FIXME fix the profiler tests to work with coop.
+if !ENABLE_COOP
+if !NACL_CODEGEN
+check_targets = testlog
+endif
+endif
+
 endif
 endif
 endif
@@ -84,10 +94,6 @@ endif
 mprof_report_SOURCES = decode.c
 mprof_report_LDADD = $(Z_LIBS) $(GLIB_LIBS) $(LIBICONV)
 
-# FIXME fix the profiler tests to work with coop.
-if ENABLE_COOP
-DISABLE_PROFILER_TESTS=1
-endif
 PLOG_TESTS_SRC=test-alloc.cs test-busy.cs test-monitor.cs test-excleave.cs \
        test-heapshot.cs test-traces.cs
 PLOG_TESTS=$(PLOG_TESTS_SRC:.cs=.exe)
@@ -103,21 +109,9 @@ MCS = $(RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 -now
        $(MCS) -out:$@ $<
 
 testlog: $(PLOG_TESTS)
-       if [ "z$(DISABLE_PROFILER_TESTS)" != z1 ]; then \
-               $(with_mono_path) perl $(srcdir)/ptestrunner.pl $(top_builddir) ; \
-       else \
-               echo "Profiler tests disabled with cooperative GC" ; \
-       fi
-
+       $(with_mono_path) perl $(srcdir)/ptestrunner.pl $(top_builddir)
 
-if NACL_CODEGEN
-check-local:
-else
-check-local: testlog
-endif
-
-suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
-suppression_DATA = mono-profiler-log.suppression
+check-local: $(check_targets)
 
 EXTRA_DIST=utils.c utils.h proflog.h \
        $(PLOG_TESTS_SRC) ptestrunner.pl \
index f84868e0a6f5f8d8999ce2ffd4e7947884ad9d3a..09ac01dfd5e8ee88f365d618b551d1b9a84c5be4 100644 (file)
@@ -112,6 +112,32 @@ sgen_array_list_update_next_slot (SgenArrayList *array, guint32 new_index)
        }
 }
 
+/*
+ * Extension for the array list that allows fast allocation and index based fetching
+ * of long lived memory of various sizes, without the need of realloc. Not thread safe.
+ */
+guint32
+sgen_array_list_alloc_block (SgenArrayList *array, guint32 slots_to_add)
+{
+       guint32 new_index = array->next_slot;
+       guint32 old_capacity = array->capacity;
+
+       /* FIXME Don't allocate arrays that will be skipped */
+       /* There are no empty arrays between next_slot and capacity because we allocate incrementally */
+       while ((old_capacity - new_index) < slots_to_add) {
+               sgen_array_list_grow (array, old_capacity);
+               new_index = old_capacity;
+               old_capacity = array->capacity;
+       }
+
+       SGEN_ASSERT (0, sgen_array_list_index_bucket (new_index) == sgen_array_list_index_bucket (new_index + slots_to_add - 1),
+                       "We failed to allocate a continuous block of slots");
+
+       array->next_slot = new_index + slots_to_add;
+       /* The slot address will point to the allocated memory */
+       return new_index;
+}
+
 guint32
 sgen_array_list_add (SgenArrayList *array, gpointer ptr, int data, gboolean increase_size_before_set)
 {
index fb37009a67230fdd0c9d328cf300cb78fae3ce12..5b9291693363250e7ab4916b887d6849d5397b65 100644 (file)
@@ -129,6 +129,7 @@ sgen_array_list_get_slot (SgenArrayList *array, guint32 index)
 
 #define SGEN_ARRAY_LIST_END_FOREACH_SLOT_RANGE } }
 
+guint32 sgen_array_list_alloc_block (SgenArrayList *array, guint32 slots_to_add);
 guint32 sgen_array_list_add (SgenArrayList *array, gpointer ptr, int data, gboolean increase_size_before_set);
 guint32 sgen_array_list_find (SgenArrayList *array, gpointer ptr);
 void sgen_array_list_remove_nulls (SgenArrayList *array);
index 6ddea6d621301348aa2035c5f227994d8f695631..248b07b8f50fff935da561c90488a52af682ac17 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "mono/sgen/sgen-gc.h"
 #include "mono/sgen/gc-internal-agnostic.h"
+#include "mono/sgen/sgen-array-list.h"
 
 #define MAX_USER_DESCRIPTORS 16
 
@@ -40,9 +41,7 @@
 #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1))
 
 
-static gsize* complex_descriptors = NULL;
-static int complex_descriptors_size = 0;
-static int complex_descriptors_next = 0;
+static SgenArrayList complex_descriptors = SGEN_ARRAY_LIST_INIT (NULL, NULL, NULL, INTERNAL_MEM_COMPLEX_DESCRIPTORS);
 static SgenUserRootMarkFunc user_descriptors [MAX_USER_DESCRIPTORS];
 static int user_descriptors_next = 0;
 static SgenDescriptor all_ref_root_descrs [32];
@@ -56,43 +55,50 @@ static int
 alloc_complex_descriptor (gsize *bitmap, int numbits)
 {
        int nwords, res, i;
+       volatile gpointer *slot;
+       gsize *descriptor;
+
+       SGEN_ASSERT (0, sizeof (gsize) == sizeof (mword), "We expect gsize and mword to have same size");
 
        numbits = ALIGN_TO (numbits, GC_BITS_PER_WORD);
        nwords = numbits / GC_BITS_PER_WORD + 1;
 
        sgen_gc_lock ();
-       res = complex_descriptors_next;
        /* linear search, so we don't have duplicates with domain load/unload
         * this should not be performance critical or we'd have bigger issues
         * (the number and size of complex descriptors should be small).
         */
-       for (i = 0; i < complex_descriptors_next; ) {
-               if (complex_descriptors [i] == nwords) {
+       SGEN_ARRAY_LIST_FOREACH_SLOT (&complex_descriptors, slot) {
+               gsize first_word = *(gsize*)slot;
+               if (first_word == 0) {
+                       /* Unused slots should be 0 so we simply skip them */
+                       continue;
+               } else if (first_word == nwords) {
                        int j, found = TRUE;
                        for (j = 0; j < nwords - 1; ++j) {
-                               if (complex_descriptors [i + 1 + j] != bitmap [j]) {
+                               if (((gsize*)slot) [j + 1] != bitmap [j]) {
                                        found = FALSE;
                                        break;
                                }
                        }
                        if (found) {
                                sgen_gc_unlock ();
-                               return i;
+                               return __index;
                        }
                }
-               i += (int)complex_descriptors [i];
-       }
-       if (complex_descriptors_next + nwords > complex_descriptors_size) {
-               int new_size = complex_descriptors_size * 2 + nwords;
-               complex_descriptors = (gsize *)g_realloc (complex_descriptors, new_size * sizeof (gsize));
-               complex_descriptors_size = new_size;
-       }
-       SGEN_LOG (6, "Complex descriptor %d, size: %d (total desc memory: %d)", res, nwords, complex_descriptors_size);
-       complex_descriptors_next += nwords;
-       complex_descriptors [res] = nwords;
+               /* Skip the bitmap words */
+               __index += (guint32)(first_word - 1);
+               __offset += (guint32)(first_word - 1);
+       } SGEN_ARRAY_LIST_END_FOREACH_SLOT;
+
+       res = sgen_array_list_alloc_block (&complex_descriptors, nwords);
+
+       SGEN_LOG (6, "Complex descriptor %d, size: %d (total desc memory: %d)", res, nwords, complex_descriptors.capacity);
+       descriptor = (gsize*)sgen_array_list_get_slot (&complex_descriptors, res);
+       descriptor [0] = nwords;
        for (i = 0; i < nwords - 1; ++i) {
-               complex_descriptors [res + 1 + i] = bitmap [i];
-               SGEN_LOG (6, "\tvalue: %p", (void*)complex_descriptors [res + 1 + i]);
+               descriptor [1 + i] = bitmap [i];
+               SGEN_LOG (6, "\tvalue: %p", (void*)descriptor [1 + i]);
        }
        sgen_gc_unlock ();
        return res;
@@ -101,7 +107,7 @@ alloc_complex_descriptor (gsize *bitmap, int numbits)
 gsize*
 sgen_get_complex_descriptor (SgenDescriptor desc)
 {
-       return complex_descriptors + (desc >> LOW_TYPE_BITS);
+       return (gsize*) sgen_array_list_get_slot (&complex_descriptors, desc >> LOW_TYPE_BITS);
 }
 
 /*
@@ -311,7 +317,7 @@ sgen_make_user_root_descriptor (SgenUserRootMarkFunc marker)
 void*
 sgen_get_complex_descriptor_bitmap (SgenDescriptor desc)
 {
-       return complex_descriptors + (desc >> ROOT_DESC_TYPE_SHIFT);
+       return (void*) sgen_array_list_get_slot (&complex_descriptors, desc >> ROOT_DESC_TYPE_SHIFT);
 }
 
 SgenUserRootMarkFunc
index 2b1f9e4da49c2bf558145f09e1757c354f4b1d06..54e1b7681fbe3fbb48a3c5385888b8b0d3567922 100644 (file)
@@ -215,7 +215,7 @@ sgen_gc_descr_has_references (SgenDescriptor desc)
        } while (0)
 #endif
 
-#define OBJ_COMPLEX_FOREACH_PTR(vt,obj)        do {    \
+#define OBJ_COMPLEX_FOREACH_PTR(desc,obj)      do {    \
                /* there are pointers */        \
                void **_objptr = (void**)(obj); \
                gsize *bitmap_data = sgen_get_complex_descriptor ((desc)); \
index 3f61780452162b286a6056be27a731aa4e8575ff..9ebd40c0d315c92101c79aea2fa95c00c3c7fbb5 100644 (file)
@@ -116,40 +116,16 @@ extern guint64 stat_objects_copied_major;
                g_error (__VA_ARGS__);  \
 } } while (0)
 
-#ifndef HOST_WIN32
-# define LOG_TIMESTAMP  \
-       do {    \
-               time_t t;                                                                       \
-               struct tm tod;                                                                  \
-               time(&t);                                                                       \
-               localtime_r(&t, &tod);                                                          \
-               strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", &tod);                  \
-       } while (0)
-#else
-# define LOG_TIMESTAMP  \
-       do {    \
-               time_t t;                                                                       \
-               struct tm *tod;                                                                 \
-               time(&t);                                                                       \
-               tod = localtime(&t);                                                            \
-               strftime(logTime, sizeof(logTime), "%F %T", tod);                               \
-       } while (0)
-#endif
 
 #define SGEN_LOG(level, format, ...) do {      \
        if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {        \
-               char logTime[80];                                                               \
-               LOG_TIMESTAMP;                                                                  \
-               mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__);      \
+               mono_gc_printf (gc_debug_file, format "\n", ##__VA_ARGS__);     \
 } } while (0)
 
 #define SGEN_COND_LOG(level, cond, format, ...) do {   \
-       if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {                \
-               if (cond) {                                                                             \
-                       char logTime[80];                                                               \
-                       LOG_TIMESTAMP;                                                                  \
-                       mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__);      \
-               }                                                                                       \
+       if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) {        \
+               if (cond)       \
+                       mono_gc_printf (gc_debug_file, format "\n", ##__VA_ARGS__);     \
 } } while (0)
 
 extern int gc_debug_level;
@@ -340,6 +316,7 @@ enum {
        INTERNAL_MEM_BINARY_PROTOCOL,
        INTERNAL_MEM_TEMPORARY,
        INTERNAL_MEM_LOG_ENTRY,
+       INTERNAL_MEM_COMPLEX_DESCRIPTORS,
        INTERNAL_MEM_FIRST_CLIENT
 };
 
index 256e32b20a1b0108ae4c69d4328e7fe7fc0759ed..ccff562737ab4deac9515b83c266f95147ebf36d 100644 (file)
@@ -139,6 +139,8 @@ description_for_type (int type)
        case INTERNAL_MEM_CARDTABLE_MOD_UNION: return "cardtable-mod-union";
        case INTERNAL_MEM_BINARY_PROTOCOL: return "binary-protocol";
        case INTERNAL_MEM_TEMPORARY: return "temporary";
+       case INTERNAL_MEM_LOG_ENTRY: return "log-entry";
+       case INTERNAL_MEM_COMPLEX_DESCRIPTORS: return "complex-descriptors";
        default: {
                const char *description = sgen_client_description_for_internal_mem_type (type);
                SGEN_ASSERT (0, description, "Unknown internal mem type");
index 02d447ad511469067266123670983bb25e694c40..b62633307b46f43e5547e6957ca6d5d6c404b0fd 100644 (file)
@@ -27,9 +27,6 @@ monoutils_sources = \
        mono-dl-darwin.c        \
        mono-dl-posix.c         \
        mono-dl.h               \
-       mono-log-windows.c      \
-       mono-log-common.c       \
-       mono-log-posix.c        \
        mono-internal-hash.c    \
        mono-internal-hash.h    \
        mono-io-portability.c   \
index 23bd0648157e60c71ce4a416d5a59eafc17a1063..e143901748d710d2e2f8bce87d31b0bf32dbe102 100644 (file)
@@ -113,6 +113,9 @@ mono_error_set_invalid_operation (MonoError *error, const char *msg_format, ...)
 void
 mono_error_set_exception_instance (MonoError *error, MonoException *exc);
 
+void
+mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...);
+
 MonoException*
 mono_error_prepare_exception (MonoError *error, MonoError *error_out);
 
index 7488c9ca6c9f64df7ed65b17c3c911efc1f22968..7e186b6b717ce06b2f4103bb2ab3abe22e5ce2df 100644 (file)
@@ -8,10 +8,12 @@
  */
 #include <glib.h>
 
+#include <config.h>
 #include "mono-error.h"
 #include "mono-error-internals.h"
 
 #include <mono/metadata/exception.h>
+#include <mono/metadata/exception-internals.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/object-internals.h>
 
@@ -440,6 +442,17 @@ mono_error_set_invalid_operation (MonoError *oerror, const char *msg_format, ...
        va_end (args);
 }
 
+void
+mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...)
+{
+       MonoErrorInternal *error = (MonoErrorInternal*)oerror;
+
+       mono_error_prepare (error);
+       error->error_code = MONO_ERROR_INVALID_PROGRAM;
+
+       set_error_message ();
+}
+
 void
 mono_error_set_exception_instance (MonoError *oerror, MonoException *exc)
 {
@@ -562,7 +575,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                                break;
                        }
 
-                       exception = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "MissingMethodException", type_name, method_name);
+                       exception = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "MissingMethodException", type_name, method_name, error_out);
                        if (exception)
                                set_message_on_exception (exception, error, error_out);
                } else {
@@ -582,7 +595,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                                break;
                        }
                        
-                       exception = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "MissingFieldException", type_name, field_name);
+                       exception = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "MissingFieldException", type_name, field_name, error_out);
                        if (exception)
                                set_message_on_exception (exception, error, error_out);
                } else {
@@ -604,7 +617,7 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                                }
                        }
 
-                       exception = mono_exception_from_name_two_strings (mono_get_corlib (), "System", "TypeLoadException", type_name, assembly_name);
+                       exception = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", "TypeLoadException", type_name, assembly_name, error_out);
                        if (exception)
                                set_message_on_exception (exception, error, error_out);
                } else {
@@ -630,9 +643,9 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                        }
 
                        if (error->error_code == MONO_ERROR_FILE_NOT_FOUND)
-                               exception = mono_exception_from_name_two_strings (mono_get_corlib (), "System.IO", "FileNotFoundException", msg, assembly_name);
+                               exception = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System.IO", "FileNotFoundException", msg, assembly_name, error_out);
                        else
-                               exception = mono_exception_from_name_two_strings (mono_defaults.corlib, "System", "BadImageFormatException", msg, assembly_name);
+                               exception = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "BadImageFormatException", msg, assembly_name, error_out);
                } else {
                        if (error->error_code == MONO_ERROR_FILE_NOT_FOUND)
                                exception = mono_exception_from_name_msg (mono_get_corlib (), "System.IO", "FileNotFoundException", error->full_message);
@@ -687,6 +700,14 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
        case MONO_ERROR_CLEANUP_CALLED_SENTINEL:
                mono_error_set_execution_engine (error_out, "MonoError reused after mono_error_cleanup");
                break;
+
+       case MONO_ERROR_INVALID_PROGRAM: {
+               gboolean lacks_message = error->flags & MONO_ERROR_INCOMPLETE;
+               if (lacks_message)
+                       return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", "");
+               else
+                       return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", error->full_message);
+       }
        default:
                mono_error_set_execution_engine (error_out, "Invalid error-code %d", error->error_code);
        }
index 2a98d4839fc45f4ca02b7a8fa247f8bc642fff70..0aba0e1d61abb4219d6cfc15a9a8ead976c1ceaa 100644 (file)
@@ -26,6 +26,8 @@ enum {
        MONO_ERROR_ARGUMENT = 7,
        MONO_ERROR_ARGUMENT_NULL = 11,
        MONO_ERROR_NOT_VERIFIABLE = 8,
+       MONO_ERROR_INVALID_PROGRAM = 12,
+
        /*
         * This is a generic error mechanism is you need to raise an arbitrary corlib exception.
         * You must pass the exception name otherwise prepare_exception will fail with internal execution. 
diff --git a/mono/utils/mono-log-common.c b/mono/utils/mono-log-common.c
deleted file mode 100644 (file)
index 6565d4f..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * mono-log-common.c: Platform-independent interface to the logger
- *
- * This module contains the POSIX syslog logger interface
- *
- * Author:
- *    Neale Ferguson <neale@sinenomine.net>
- *
- */
-#include <config.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-#include <errno.h>
-#include <time.h>
-#ifndef HOST_WIN32
-#include <sys/time.h>
-#else
-#include <process.h>
-#endif
-#include "mono-logger.h"
-
-static FILE *logFile = NULL;
-static void *logUserData = NULL;
-
-/**
- * mapSyslogLevel:
- *     
- *     @level - GLogLevelFlags value
- *     @returns The equivalent character identifier
- */
-static inline char 
-mapLogFileLevel(GLogLevelFlags level) 
-{
-       if (level & G_LOG_LEVEL_ERROR)
-               return ('E');
-       if (level & G_LOG_LEVEL_CRITICAL)
-               return ('C');
-       if (level & G_LOG_LEVEL_WARNING)
-               return ('W');
-       if (level & G_LOG_LEVEL_MESSAGE)
-               return ('N');
-       if (level & G_LOG_LEVEL_INFO)
-               return ('I');
-       if (level & G_LOG_LEVEL_DEBUG)
-               return ('D');
-       return ('I');
-}
-
-/**
- * mono_log_open_logfile
- *     
- *     Open the logfile. If the path is not specified default to stdout. If the
- *     open fails issue a warning and use stdout as the log file destination.
- *
- *     @path - Path for log file
- *     @userData - Not used
- */
-void
-mono_log_open_logfile(const char *path, void *userData)
-{
-       if (path == NULL) {
-               logFile = stdout;
-       } else {
-#ifndef HOST_WIN32
-               logFile = fopen(path, "w");
-#else
-               gunichar2 *wPath = g_utf8_to_utf16(path, -1, 0, 0, 0);
-               if (wPath != NULL) {
-                       logFile = _wfopen((wchar_t *) wPath, L"w");
-                       g_free (wPath);
-               }
-#endif
-               if (logFile == NULL) {
-                       g_warning("opening of log file %s failed with %s - defaulting to stdout", 
-                                 path, strerror(errno));
-                       logFile = stdout;
-               }
-       }
-       logUserData = userData;
-}
-
-/**
- * mono_log_write_logfile
- *     
- *     Write data to the log file.
- *
- *     @domain - Identifier string
- *     @level - Logging level flags
- *     @format - Printf format string
- *     @vargs - Variable argument list
- */
-void
-mono_log_write_logfile(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
-{
-       time_t t;
-       char logTime[80],       
-            logMessage[512];
-       pid_t pid;
-       int iLog = 0;
-       size_t nLog;
-
-       if (logFile == NULL)
-               logFile = stdout;
-
-       if (hdr) {
-#ifndef HOST_WIN32
-               struct tm tod;
-               time(&t);
-               localtime_r(&t, &tod);
-               pid = getpid();
-               strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", &tod);
-#else
-               struct tm *tod;
-               time(&t);
-               tod = localtime(&t);
-               pid = _getpid();
-               strftime(logTime, sizeof(logTime), "%F %T", tod);
-#endif
-               iLog = snprintf(logMessage, sizeof(logMessage), "%s level[%c] mono[%d]: ",
-                               logTime,mapLogFileLevel(level),pid);
-       }
-       nLog = sizeof(logMessage) - iLog - 2;
-       iLog = vsnprintf(logMessage+iLog, nLog, format, args);
-       logMessage[iLog++] = '\n';
-       logMessage[iLog++] = '\0';
-       fputs(logMessage, logFile);
-       fflush(logFile);
-
-       if (level == G_LOG_FLAG_FATAL)
-               abort();
-}
-
-/**
- * mono_log_close_logfile
- *
- *     Close the log file
- */
-void
-mono_log_close_logfile()
-{
-       if (logFile) {
-               if (logFile != stdout)
-                       fclose(logFile);
-               logFile = NULL;
-       }
-}
diff --git a/mono/utils/mono-log-posix.c b/mono/utils/mono-log-posix.c
deleted file mode 100644 (file)
index 1ce111c..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * mono-log-posix.c: POSIX interface to the logger
- *
- * This module contains the POSIX syslog logger routines
- *
- * Author:
- *    Neale Ferguson <neale@sinenomine.net>
- *
- */
-#include <config.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if defined(_POSIX_VERSION) 
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-#include <syslog.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-#include "mono-logger.h"
-
-static void *logUserData = NULL;
-
-/**
- * mapSyslogLevel:
- *     
- *     @level - GLogLevelFlags value
- *     @returns The equivalent syslog priority value
- */
-static __inline__ int
-mapSyslogLevel(GLogLevelFlags level) 
-{
-       if (level & G_LOG_LEVEL_ERROR)
-               return (LOG_ERR);
-       if (level & G_LOG_LEVEL_CRITICAL)
-               return (LOG_CRIT);
-       if (level & G_LOG_LEVEL_WARNING)
-               return (LOG_WARNING);
-       if (level & G_LOG_LEVEL_MESSAGE)
-               return (LOG_NOTICE);
-       if (level & G_LOG_LEVEL_INFO)
-               return (LOG_INFO);
-       if (level & G_LOG_LEVEL_DEBUG)
-               return (LOG_DEBUG);
-       return (LOG_INFO);
-}
-
-/**
- * mono_log_open_logfile
- *     
- *     Open the syslog interface specifying that we want our PID recorded 
- *     and that we're using the LOG_USER facility.
- *
- *     @ident - Identifier: ignored
- *     @userData - Not used
- */
-void
-mono_log_open_syslog(const char *ident, void *userData)
-{
-       openlog("mono", LOG_PID, LOG_USER);
-       logUserData = userData;
-}
-
-/**
- * mono_log_write_logfile
- *     
- *     Write data to the log file.
- *
- *     @domain - Identifier string
- *     @level - Logging level flags
- *     @format - Printf format string
- *     @vargs - Variable argument list
- */
-void
-mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
-{
-       vsyslog(mapSyslogLevel(level), format, args);
-
-       if (level == G_LOG_FLAG_FATAL)
-               abort();
-}
-
-/**
- * mono_log_close_logfile
- *
- *     Close the log file
- */
-void
-mono_log_close_syslog()
-{
-       closelog();
-}
-#endif
diff --git a/mono/utils/mono-log-windows.c b/mono/utils/mono-log-windows.c
deleted file mode 100644 (file)
index c6ebc9e..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * mono-log-windows.c: Simplistic simulation of a syslog logger for Windows
- *
- * This module contains the Windows syslog logger interface
- *
- * Author:
- *    Neale Ferguson <neale@sinenomine.net>
- *
- */
-#include <config.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HOST_WIN32
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <glib.h>
-#include <errno.h>
-#include <time.h>
-#include <process.h>
-#include "mono-logger.h"
-
-static FILE *logFile = NULL;
-static void *logUserData = NULL;
-static wchar_t *logFileName = L".//mono.log";
-
-/**
- * mapSyslogLevel:
- *     
- *     @level - GLogLevelFlags value
- *     @returns The equivalent character identifier
- */
-static inline char 
-mapLogFileLevel(GLogLevelFlags level) 
-{
-       if (level & G_LOG_LEVEL_ERROR)
-               return ('E');
-       if (level & G_LOG_LEVEL_CRITICAL)
-               return ('C');
-       if (level & G_LOG_LEVEL_WARNING)
-               return ('W');
-       if (level & G_LOG_LEVEL_MESSAGE)
-               return ('N');
-       if (level & G_LOG_LEVEL_INFO)
-               return ('I');
-       if (level & G_LOG_LEVEL_DEBUG)
-               return ('D');
-       return ('I');
-}
-
-/**
- * mono_log_open_syslog
- *     
- *     Open the syslog file. If the open fails issue a warning and 
- *     use stdout as the log file destination.
- *
- *     @ident - Identifier: ignored
- *     @userData - Not used
- */
-void
-mono_log_open_syslog(const char *ident, void *userData)
-{
-       logFile = _wfopen(logFileName, L"w");
-       if (logFile == NULL) {
-               g_warning("opening of log file %s failed with %s",
-                         strerror(errno));
-               logFile = stdout;
-       }
-       logUserData = userData;
-}
-
-/**
- * mono_log_write_syslog
- *     
- *     Write data to the syslog file.
- *
- *     @domain - Identifier string
- *     @level - Logging level flags
- *     @format - Printf format string
- *     @vargs - Variable argument list
- */
-void
-mono_log_write_syslog(const char *domain, GLogLevelFlags level, mono_bool hdr, const char *format, va_list args)
-{
-       time_t t;
-       struct tm *tod;
-       char logTime[80],
-             logMessage[512];
-       pid_t pid;
-       int iLog = 0;
-       size_t nLog;
-
-       if (logFile == NULL)
-               mono_log_open_syslog(NULL, NULL);
-
-       time(&t);
-       tod = localtime(&t);
-       pid = _getpid();
-       strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", tod);
-       iLog = snprintf(logMessage, sizeof(logMessage), "%s level[%c] mono[%d]: ",
-                       logTime,mapLogFileLevel(level),pid);
-       nLog = sizeof(logMessage) - iLog - 2;
-       iLog = vsnprintf(logMessage+iLog, nLog, format, args);
-       logMessage[iLog++] = '\n';
-       logMessage[iLog++] = 0;
-       fputs(logMessage, logFile);
-       fflush(logFile);
-
-       if (level == G_LOG_FLAG_FATAL)
-               abort();
-}
-
-/**
- * mono_log_close_syslog
- *
- *     Close the syslog file
- */
-void
-mono_log_close_syslog()
-{
-       if (logFile) {
-               fclose(logFile);
-               logFile = NULL;
-       }
-}
-#endif
index 734a2fdbf33ab2bcd28173cde90e3271139c4fdc..7d0c9ce12a4f811d33e6d5a3bca405b2f564da03 100644 (file)
@@ -11,21 +11,13 @@ typedef struct {
        MonoTraceMask   mask;
 } MonoLogLevelEntry;
 
-GLogLevelFlags mono_internal_current_level     = INT_MAX;
-MonoTraceMask  mono_internal_current_mask      = MONO_TRACE_ALL;
-gboolean mono_trace_log_header                 = FALSE;
+GLogLevelFlags mono_internal_current_level             = INT_MAX;
+MonoTraceMask  mono_internal_current_mask              = MONO_TRACE_ALL;
 
 static GQueue          *level_stack            = NULL;
 static const char      *mono_log_domain        = "Mono";
 static MonoPrintCallback print_callback, printerr_callback;
 
-static MonoLogCallback logCallback = {
-       .opener = NULL,
-       .writer = NULL,
-       .closer = NULL,
-       .header = FALSE
-};
-
 /**
  * mono_trace_init:
  *
@@ -40,8 +32,6 @@ mono_trace_init (void)
 
                mono_trace_set_mask_string(g_getenv("MONO_LOG_MASK"));
                mono_trace_set_level_string(g_getenv("MONO_LOG_LEVEL"));
-               mono_trace_set_logheader_string(g_getenv("MONO_LOG_HEADER"));
-               mono_trace_set_logdest_string(g_getenv("MONO_LOG_DEST"));
        }
 }
 
@@ -81,13 +71,7 @@ mono_tracev_inner (GLogLevelFlags level, MonoTraceMask mask, const char *format,
                        return;
        }
 
-       if (logCallback.opener == NULL) {
-               logCallback.opener = mono_log_open_logfile;
-               logCallback.writer = mono_log_write_logfile;
-               logCallback.closer = mono_log_close_logfile;
-               logCallback.opener(NULL, NULL);
-       }
-       logCallback.writer(mono_log_domain, level, logCallback.header, format, args);
+       g_logv (mono_log_domain, level, format, args);
 }
 
 /**
@@ -123,55 +107,7 @@ mono_trace_set_mask (MonoTraceMask mask)
        if(level_stack == NULL)
                mono_trace_init();
 
-       mono_internal_current_mask = mask;
-}
-
-/**
- * mono_trace_set_logdest:
- *
- *     @dest: Destination for logging
- *
- * Sets the current logging destination. This can be a file or, if supported,
- * syslog.
- */
-void 
-mono_trace_set_logdest_string (const char *dest)
-{
-       MonoLogCallback logger;
-
-       if(level_stack == NULL)
-               mono_trace_init();
-
-       if ((dest == NULL) || (strcmp("syslog", dest) != 0)) {
-               logger.opener = mono_log_open_logfile;
-               logger.writer = mono_log_write_logfile;
-               logger.closer = mono_log_close_logfile;
-               mono_trace_set_log_handler(&logger, dest, NULL);
-       } else {
-               logger.opener = mono_log_open_syslog;
-               logger.writer = mono_log_write_syslog;
-               logger.closer = mono_log_close_syslog;
-               mono_trace_set_log_handler(&logger, mono_log_domain, NULL);
-       }
-}
-
-/**
- * mono_trace_set_logheader:
- *
- *     @head: Whether we want pid/date/time header on log messages
- *
- * Sets the current logging header option.
- */
-void 
-mono_trace_set_logheader_string(const char *head)
-{
-       MonoLogCallback logger;
-
-       if (head == NULL) {
-               mono_trace_log_header = FALSE;
-       } else {
-               mono_trace_log_header = TRUE;
-       }
+       mono_internal_current_mask      = mask;
 }
 
 /**
@@ -300,6 +236,28 @@ mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask)
        return (level <= mono_internal_current_level && mask & mono_internal_current_mask);
 }
 
+static MonoLogCallback log_callback;
+
+static const char*
+log_level_get_name (GLogLevelFlags log_level)
+{
+       switch (log_level & G_LOG_LEVEL_MASK) {
+       case G_LOG_LEVEL_ERROR: return "error";
+       case G_LOG_LEVEL_CRITICAL: return "critical";
+       case G_LOG_LEVEL_WARNING: return "warning";
+       case G_LOG_LEVEL_MESSAGE: return "message";
+       case G_LOG_LEVEL_INFO: return "info";
+       case G_LOG_LEVEL_DEBUG: return "debug";
+       default: return "unknown";
+       }
+}
+
+static void
+log_adapter (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
+{
+       log_callback (log_domain, log_level_get_name (log_level), message, log_level & G_LOG_LEVEL_ERROR, user_data);
+}
+
 /**
  * mono_trace_set_log_handler:
  *
@@ -311,14 +269,11 @@ mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask)
  * execution will not resume after a fatal error.
  */
 void
-mono_trace_set_log_handler (MonoLogCallback *callback, const char *dest, void *user_data)
+mono_trace_set_log_handler (MonoLogCallback callback, void *user_data)
 {
        g_assert (callback);
-       logCallback.opener = callback->opener;
-       logCallback.writer = callback->writer;
-       logCallback.closer = callback->closer;
-       logCallback.header = mono_trace_log_header;
-       logCallback.opener(dest, user_data);
+       log_callback = callback;
+       g_log_set_default_handler (log_adapter, user_data);
 }
 
 static void
index 3bb54a6886ed83219359716cd78936ac9b5a99aa..36f7714f2ed2dd946058e3c28a0b52c21e90e8f9 100644 (file)
@@ -10,27 +10,11 @@ mono_trace_set_level_string (const char *value);
 MONO_API void 
 mono_trace_set_mask_string (const char *value);
 
-MONO_API void 
-mono_trace_set_logdest_string (const char *value);
-
-MONO_API void 
-mono_trace_set_logheader_string (const char *value);
-
+typedef void (*MonoLogCallback) (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data);
 typedef void (*MonoPrintCallback) (const char *string, mono_bool is_stdout);
 
-typedef void (*MonoLoggerOpen) (const char *, void *);
-typedef void (*MonoLoggerWrite) (const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-typedef void (*MonoLoggerClose) (void);
-
-typedef struct _MonoLogCallback_ {
-       MonoLoggerOpen  opener;         /* Routine to open logging */
-       MonoLoggerWrite writer;         /* Routine to write log data */
-       MonoLoggerClose closer;         /* Routine to close logging */
-       mono_bool       header;         /* Whether we want pid/time/date in log message */
-} MonoLogCallback;
-
 MONO_API void
-mono_trace_set_log_handler (MonoLogCallback *callback, const char *dest, void *user_data);
+mono_trace_set_log_handler (MonoLogCallback callback, void *user_data);
 
 MONO_API void
 mono_trace_set_print_handler (MonoPrintCallback callback);
@@ -38,23 +22,6 @@ mono_trace_set_print_handler (MonoPrintCallback callback);
 MONO_API void
 mono_trace_set_printerr_handler (MonoPrintCallback callback);
 
-MONO_API void
-mono_log_open_syslog(const char *, void *);
-
-MONO_API void
-mono_log_write_syslog(const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-
-MONO_API void
-mono_log_close_syslog(void);
-
-MONO_API void
-mono_log_open_logfile(const char *, void *);
-
-MONO_API void
-mono_log_write_logfile(const char *, GLogLevelFlags, mono_bool, const char *, va_list);
-
-MONO_API void
-mono_log_close_logfile(void);
 
 MONO_END_DECLS
 
index 03c0aca8ddf3f749a801d1319ba4fa76585691b5..a92d250b290448698ece831e6809b4c99a8f3cdd 100644 (file)
@@ -80,9 +80,6 @@ static gboolean unified_suspend_enabled;
 /*abort at 1 sec*/
 #define SLEEP_DURATION_BEFORE_ABORT 200
 
-static long sleepWarnDuration = SLEEP_DURATION_BEFORE_WARNING,
-           sleepAbortDuration = SLEEP_DURATION_BEFORE_ABORT;
-
 static int suspend_posts, resume_posts, abort_posts, waits_done, pending_ops;
 
 void
@@ -238,14 +235,14 @@ mono_threads_wait_pending_operations (void)
                for (i = 0; i < pending_suspends; ++i) {
                        THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-WAITING]\n");
                        InterlockedIncrement (&waits_done);
-                       if (!mono_os_sem_timedwait (&suspend_semaphore, sleepAbortDuration, MONO_SEM_FLAGS_NONE))
+                       if (!mono_os_sem_timedwait (&suspend_semaphore, SLEEP_DURATION_BEFORE_ABORT, MONO_SEM_FLAGS_NONE))
                                continue;
                        mono_stopwatch_stop (&suspension_time);
 
                        dump_threads ();
 
                        MOSTLY_ASYNC_SAFE_PRINTF ("WAITING for %d threads, got %d suspended\n", (int)pending_suspends, i);
-                       g_error ("suspend_thread suspend took %d ms, which is more than the allowed %d ms", (int)mono_stopwatch_elapsed_ms (&suspension_time), sleepAbortDuration);
+                       g_error ("suspend_thread suspend took %d ms, which is more than the allowed %d ms", (int)mono_stopwatch_elapsed_ms (&suspension_time), SLEEP_DURATION_BEFORE_ABORT);
                }
                mono_stopwatch_stop (&suspension_time);
                THREADS_SUSPEND_DEBUG ("Suspending %d threads took %d ms.\n", (int)pending_suspends, (int)mono_stopwatch_elapsed_ms (&suspension_time));
@@ -642,7 +639,6 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        gboolean res;
        threads_callbacks = *callbacks;
        thread_info_size = info_size;
-       char *sleepLimit;
 #ifdef HOST_WIN32
        res = mono_native_tls_alloc (&thread_info_key, NULL);
        res = mono_native_tls_alloc (&thread_exited_key, NULL);
@@ -659,15 +655,6 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        g_assert (res);
 
        unified_suspend_enabled = g_getenv ("MONO_ENABLE_UNIFIED_SUSPEND") != NULL || mono_threads_is_coop_enabled ();
-       
-       if ((sleepLimit = g_getenv ("MONO_SLEEP_ABORT_LIMIT")) != NULL) {
-               long threshold = strtol(sleepLimit, NULL, 10);
-               if ((errno == 0) && (threshold >= 40))  {
-                       sleepAbortDuration = threshold;
-                       sleepWarnDuration = threshold / 20;
-               } else
-                       g_warning("MONO_SLEEP_ABORT_LIMIT must be a number >= 40");
-       }
 
        mono_os_sem_init (&global_suspend_semaphore, 1);
        mono_os_sem_init (&suspend_semaphore, 0);
index 7ef841f56d0aa72f6a19b58c3876b826db775ea6..5daad9472621c95d4b94c98809d6f0ab2a74ff50 100644 (file)
@@ -42,8 +42,6 @@
     <ClCompile Include="..\mono\utils\mono-io-portability.c" />\r
     <ClCompile Include="..\mono\utils\mono-linked-list-set.c" />\r
     <ClCompile Include="..\mono\utils\mono-logger.c" />\r
-    <ClCompile Include="..\mono\utils\mono-log-windows.c" />\r
-    <ClCompile Include="..\mono\utils\mono-log-common.c" />\r
     <ClCompile Include="..\mono\utils\mono-math.c" />\r
     <ClCompile Include="..\mono\utils\mono-md5.c" />\r
     <ClCompile Include="..\mono\utils\mono-mmap.c" />\r
diff --git a/msvc/scripts/System.Web.Http.pre b/msvc/scripts/System.Web.Http.pre
new file mode 100644 (file)
index 0000000..879ce63
--- /dev/null
@@ -0,0 +1,2 @@
+@COPY@ $(ProjectDir)/../../../external/aspnetwebstack/src/Common/CommonWebApiResources.resx $(ProjectDir)/System.Web.Http.Properties.CommonWebApiResources.resx
+@COPY@ $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.Http/Properties/SRResources.resx $(ProjectDir)/System.Web.Http.Properties.SRResources.resx
diff --git a/msvc/scripts/System.Web.WebPages.Deployment.pre b/msvc/scripts/System.Web.WebPages.Deployment.pre
new file mode 100644 (file)
index 0000000..5c61127
--- /dev/null
@@ -0,0 +1,2 @@
+@COPY@ $(ProjectDir)/../../../external/aspnetwebstack/src/System.Web.WebPages.Deployment/Resources/ConfigurationResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Resources.ConfigurationResources.resx
+@COPY@ $(ProjectDir)/../../../external/aspnetwebstack/src/CommonResources.resx $(ProjectDir)/System.Web.WebPages.Deployment.Common.CommonResources.resx
diff --git a/msvc/scripts/TODO b/msvc/scripts/TODO
deleted file mode 100644 (file)
index da7b5d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-Tasks as of February 12th 2011 that are needed:
-
-       Missing nostdlib
-
-       Missing: -codepage:xxx
-
index 7d195a3f4e07a92af8cbfc30f68ffe08be89fb3d..1836f7db2a117e42e61531a58a8150a1448fd66c 100644 (file)
@@ -9,3 +9,4 @@ These are the tasks that are pending in the MSVC scripts to fully roll it out:
 [ ] Eliminate the need for "build-libs.sh/build-libs.bat" at the toplevel with proper MSBuild idioms
 [ ] Integrate the "update-solution-files" with each build, so we auto-update the files on commits
 [ ] Make it work with MSBuild instead of xbuild
+[ ] Design a system for listing resources, so we avoid the ".pre" that runs resgen or copy by hand, because this ruins dependencies.  Alternatively, have @COPY@ be a "Copy if newer"
index ba17c5e4e215857005ff74c9b74f17746742998a..55750f27a09c017337d8d581cb0980efa79ee477 100644 (file)
@@ -23,10 +23,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security-net_4_x", "
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Core-net_4_x", "mcs/class/System.Core/System.Core-net_4_x.csproj", "{359142A1-D80F-401E-AA64-7167C9317649}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix-net_4_x", "mcs/class/Mono.Posix/Mono.Posix-net_4_x.csproj", "{66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.CompilerServices.SymbolWriter-net_4_x", "mcs/class/Mono.CompilerServices.SymbolWriter/Mono.CompilerServices.SymbolWriter-net_4_x.csproj", "{88177C4B-894F-485D-B95A-44199C06BE9F}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix-net_4_x", "mcs/class/Mono.Posix/Mono.Posix-net_4_x.csproj", "{66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Core-plaincore-net_4_x", "mcs/class/System.Core/System.Core-plaincore-net_4_x.csproj", "{1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}"
@@ -725,14 +725,14 @@ Global
                {359142A1-D80F-401E-AA64-7167C9317649}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {359142A1-D80F-401E-AA64-7167C9317649}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {359142A1-D80F-401E-AA64-7167C9317649}.Release|Any CPU.Build.0 = Release|Any CPU
-               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.Build.0 = Release|Any CPU
                {88177C4B-894F-485D-B95A-44199C06BE9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {88177C4B-894F-485D-B95A-44199C06BE9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {88177C4B-894F-485D-B95A-44199C06BE9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {88177C4B-894F-485D-B95A-44199C06BE9F}.Release|Any CPU.Build.0 = Release|Any CPU
+               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.Build.0 = Release|Any CPU
                {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Release|Any CPU.ActiveCfg = Release|Any CPU
index be4d6b164a009018668e73beac1c186eb1666e03..fa2d8378bbf8dc85dcc279bf8c1a0cadf5e9790b 100644 (file)
@@ -160,7 +160,9 @@ EXTRA_DIST =                        \
        mono-heapviz            \
        $(MDOC_COMPAT)          \
        get-cygwin-deps.sh      \
-       mono-configuration-crypto.in
+       mono-configuration-crypto.in    \
+       submodules/versions.mk  \
+       submodules/versions.py
 
 mono_interp = mono
 
index f6d49c64944f4c1ac6027ff62c8cf19a94238f93..ace325210599c89703974f27870db8aa7a672b84 100755 (executable)
@@ -10,7 +10,7 @@ if [[ ${CI_TAGS} == *'coop-gc'* ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} -
 if [[ ${label} == 'osx-i386' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --enable-nls=no --build=i386-apple-darwin11.2.0"; fi
 if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --enable-nls=no"; fi
 if [[ ${label} == 'w32' ]]; then PLATFORM=Win32; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=i686-w64-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\Win32\\\bin\\\Release_SGen\\\mono-sgen.exe`";fi
-if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=x86_64-w64-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\x64\\\bin\\\Release_SGen\\\mono-sgen.exe`"; fi
+if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=x86_64-w64-mingw32 --disable-boehm"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\x64\\\bin\\\Release_SGen\\\mono-sgen.exe`"; fi
 
 if [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]];
     then
diff --git a/scripts/submodules/versions.mk b/scripts/submodules/versions.mk
new file mode 100644 (file)
index 0000000..440476d
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# 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.
+#
+
+CONFIG=SUBMODULES.json
+SCRIPT=$(top_srcdir)/scripts/submodules/versions.py
+
+# usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name))
+# usage $(call ValidateVersionTemplate (mono,MONO,mono))
+
+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 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 $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD ))
+
+#$(eval NEEDED_$(2)_BRANCH:=$(word 2, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
+#$(eval NEEDED_$(2)_REMOTE:=$(word 1, $(subst /, ,$($(2)_BRANCH_AND_REMOTE))))
+#$(eval $(2)_BRANCH:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git symbolic-ref --short HEAD 2>/dev/null))
+
+validate-$(1)::
+       @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \
+           if test ! -d $($(2)_PATH); then \
+                       if test x$$(RESET_VERSIONS) != "x"; then \
+                               $(MAKE) reset-$(1) || exit 1; \
+                       else \
+                               echo "Your $(1) checkout is missing, please run 'make reset-$(1)'"; \
+                               touch .validate-versions-failure; \
+                       fi; \
+           else \
+                       if test "x$($(2)_VERSION)" != "x$(NEEDED_$(2)_VERSION)" ; then \
+                               if test x$$(RESET_VERSIONS) != "x"; then \
+                                       $(MAKE) reset-$(1) || exit 1; \
+                               else \
+                                   echo "Your $(1) version is out of date, please run 'make reset-$(1)' (found $($(2)_VERSION), expected $(NEEDED_$(2)_VERSION))"; \
+                                   test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \
+                               touch .validate-versions-failure; \
+                               fi; \
+               elif test "x$($(2)_BRANCH)" != "x$(NEEDED_$(2)_BRANCH)" ; then \
+                               if test x$$(RESET_VERSIONS) != "x"; then \
+                                       test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \
+                                       $(MAKE) reset-$(1) || exit 1; \
+                               else \
+                                   echo "Your $(1) branch is out of date, please run 'make reset-$(1)' (found $($(2)_BRANCH), expected $(NEEDED_$(2)_BRANCH))"; \
+                               touch .validate-versions-failure; \
+                               fi; \
+              fi; \
+           fi; \
+       fi
+
+test-$(1)::
+       @echo $(1)
+       @echo "   REPOSITORY_$(2)=$(REPOSITORY_$(2))"
+       @echo "   DIRECTORY_$(2)=$(DIRECTORY_$(2))"
+       @echo "   MODULE_$(2)=$(MODULE_$(2))"
+       @echo "   NEEDED_$(2)_VERSION=$(NEEDED_$(2)_VERSION)"
+       @echo "   $(2)_VERSION=$($(2)_VERSION)"
+       @echo "   $(2)_BRANCH_AND_REMOTE=$($(2)_BRANCH_AND_REMOTE)"
+       @echo "   NEEDED_$(2)_BRANCH=$(NEEDED_$(2)_BRANCH)"
+       @echo "   NEEDED_$(2)_REMOTE=$(NEEDED_$(2)_REMOTE)"
+       @echo "   $(2)_BRANCH=$($(2)_BRANCH)"
+       @echo "   $(2)_PATH=$($(2)_PATH) => $(abspath $($(2)_PATH))"
+
+reset-$(1)::
+       @if test -d $($(2)_PATH); then \
+               if ! (cd $($(2)_PATH) && git show $(NEEDED_$(2)_VERSION) >/dev/null 2>&1 && git log -1 $(NEEDED_$(2)_REMOTE) >/dev/null 2>&1) ; then \
+                       echo "*** git fetch `basename $$($(2)_PATH)`" && (cd $($(2)_PATH) && git fetch); \
+               fi;  \
+       else \
+               echo "*** git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2))" && (cd `dirname $($(2)_PATH)` && git clone $(MODULE_$(2)) --recursive $(DIRECTORY_$(2)) || exit 1 ); \
+       fi
+       @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \
+               echo "*** [$(1)] git checkout -f" $(NEEDED_$(2)_BRANCH) && (cd $($(2)_PATH) ; git checkout -f $(NEEDED_$(2)_BRANCH) || git checkout -f -b $($(2)_BRANCH_AND_REMOTE)); \
+               echo "*** [$(1)] git reset --hard $(NEEDED_$(2)_VERSION)" && (cd $($(2)_PATH) && git reset --hard $(NEEDED_$(2)_VERSION)); \
+       fi
+       @echo "*** [$(1)] git submodule update --init --recursive" && (cd $($(2)_PATH) && git submodule update --init --recursive)
+
+print-$(1)::
+       @printf "*** %-16s %-45s %s (%s)\n" "$(DIRECTORY_$(2))" "$(MODULE_$(2))" "$(NEEDED_$(2)_VERSION)" "$(NEEDED_$(2)_BRANCH)"
+
+.PHONY: validate-$(1) reset-$(1) print-$(1)
+
+reset-versions:: reset-$(1)
+validate-versions:: validate-$(1)
+print-versions:: print-$(1)
+
+endef
+
+reset-versions::
+
+validate-versions::
+       @if test -e .validate-versions-failure; then  \
+               rm .validate-versions-failure; \
+               echo One or more modules needs update;  \
+               exit 1; \
+       else \
+               echo All dependent modules up to date;  \
+       fi
+
+reset:
+       @$(MAKE) validate-versions RESET_VERSIONS=1
+
+__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
+
+__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
+
+__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
diff --git a/scripts/submodules/versions.py b/scripts/submodules/versions.py
new file mode 100755 (executable)
index 0000000..35ded0c
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+import sys
+import json
+
+def find_module(submodules, name):
+    for item in submodules:
+        if item["name"] == name:
+            return item
+
+    print("Not found")
+    sys.exit(1)
+
+
+if len(sys.argv) < 2:
+    print("Usage: versions.py <command>")
+    sys.exit(1)
+
+CONFIG_FILE = "SUBMODULES.json"
+command = sys.argv[1]
+
+submodules = json.load(open(CONFIG_FILE))
+
+if command == "get-rev":
+    mod = find_module(submodules, sys.argv[2])
+    print(mod["rev"])
+elif command == "get-url":
+    mod = find_module(submodules, sys.argv[2])
+    print(mod["url"])
+elif command == "get-dir":
+    mod = find_module(submodules, sys.argv[2])
+    print(mod["directory"])
+elif command == "get-remote-branch":
+    mod = find_module(submodules, sys.argv[2])
+    print(mod["remote-branch"])
+elif command == "set-rev":
+    mod = find_module(submodules, sys.argv[2])
+    mod["rev"] = sys.argv[3]
+    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]
+    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]
+    json.dump(submodules, open(CONFIG_FILE, "w"), indent = 2)
+elif command == "cat":
+    print(json.dumps(submodules, indent = 2))
+else:
+    print("Unknown command "" + command + "".")
+    sys.exit(1)
index a5320ba473b1d26bd6825f746255aab4dcbf3cb0..e83ea3e561c2945c7a7b3e08e3b13a5097870eeb 100644 (file)
@@ -764,7 +764,8 @@ namespace CppSharp
                 "MonoException",
                 "MonoTypedRef",
                 "MonoThreadsSync",
-                "SgenThreadInfo"
+                "SgenThreadInfo",
+                "SgenClientThreadInfo"
             };
 
             DumpClasses(writer, ctx, types);
index 52f0ab26ee3557c0b070fe2456c780d454bb5ebb..93251ef2bae707f156cf36eb9b132cca82ec48ff 100755 (executable)
@@ -129,7 +129,7 @@ class ConcurrentMajorGCEventGroup(MajorGCEventGroup):
 def parse_next_major_gc(data, i):
     assert i >= 0
     # Find start or full event.
-    while i < len(data) and data[i].gc_type not in ['start', 'full']:
+    while i < len(data) and data[i].gc_type not in ['start', 'full', 'nursery+update']:
         i += 1
     if i == len(data):
         return None
@@ -161,30 +161,47 @@ def parse_major_gcs(data):
         major_gc_events.append(event_group)
 
 if show_histogram:
-    minor_pausetimes = []
-    major_pausetimes = []
+    bin_data_minor = []
+    bin_data_both = []
+    bin_data_major = []
+    bin_names = []
 
     for rec in data:
         pause = rec.stop - rec.start
-        if rec.minor_work and rec.major_work and show_minor and show_major:
-            major_pausetimes.append (pause)
-        else:
-            if rec.minor_work:
-                minor_pausetimes.append (pause)
-            if rec.major_work:
-                major_pausetimes.append (pause)
+        for i in range(100):
+            time = (1.3)**(i+6)
+            prev_time = 0 if i==0 else (1.3)**(i+5)
+            if len(bin_names) <= i:
+                bin_data_minor.append(0)
+                bin_data_both.append(0)
+                bin_data_major.append(0)
+                bin_names.append('%d-%dms' % (int(prev_time), int(time)))
+            if pause <= time:
+                if rec.major_work:
+                    if rec.minor_work:
+                        bin_data_both[i] += pause
+                    else:
+                        bin_data_major[i] += pause
+                else:
+                    bin_data_minor[i] += pause
+                break
 
-    pausetimes = []
-    colors = []
-    if show_minor:
-        pausetimes.append(minor_pausetimes)
-        colors.append('blue')
-    if show_major:
-        pausetimes.append(major_pausetimes)
-        colors.append('red')
+    bin_data_minor=np.array(bin_data_minor)
+    bin_data_both=np.array(bin_data_both)
+    bin_data_major=np.array(bin_data_major)
 
-    plt.hist (pausetimes, 100, stacked=True, log=True, color=colors)
-    plt.xlabel ('Pause time in msec')
+    if show_minor:
+        plt.bar(range(len(bin_data_minor)), bin_data_minor, color='blue', label="minor")  #, align='center')
+        plt.bar(range(len(bin_data_both)), bin_data_both, bottom=bin_data_minor, color='purple', label="minor & major")
+        if show_major:
+            plt.bar(range(len(bin_data_major)), bin_data_major, bottom=(bin_data_minor+bin_data_both), color='red', label="only major")
+    else:
+        plt.bar(range(len(bin_data_major)), bin_data_major, color='red')
+    plt.xticks(range(len(bin_names)), bin_names)
+    plt.ylabel('Cumulative time spent in GC pauses (ms)')
+    plt.xlabel('GC pause length')
+    plt.xticks(rotation=60)
+    plt.legend(loc='upper left')
 else:
     major_gc_event_groups = parse_major_gcs(data)