[test-runner] Write stdout/stderr into StringBuilder instead of an intermediate file
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)
.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
+++ /dev/null
-#!/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)
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
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)
Makefile
mono-uninstalled.pc
acceptance-tests/Makefile
+llvm/Makefile
scripts/mono-find-provides
scripts/mono-find-requires
mono/Makefile
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+#
+# 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
--- /dev/null
+[
+ {
+ "name": "llvm",
+ "url": "git://github.com/mono/llvm.git",
+ "rev": "9f79399f87282524fee099b328bd8cbf07929daf",
+ "remote-branch": "origin/master",
+ "branch": "master",
+ "directory": "llvm"
+ }
+]
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:
# 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)
-->\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' ">
-->\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' ">
-->\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' ">
-->\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' ">
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 ();
{
return obj;
}
+
+ public string LoadAndGetName (string assemblyName)
+ {
+ var assembly = Assembly.Load (assemblyName);
+ return assembly.GetName ().CodeBase;
+ }
}
[Serializable ()]
#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>
* 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);
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)
{
}
}
+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:
*
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))
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
*/
#include <glib.h>
+#include <config.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/exception-internals.h>
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);
}
/**
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);
}
/**
{
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;
}
/**
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;
}
/**
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;
}
/**
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;
}
/**
{
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;
}
/**
{
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;
}
/**
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);
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);
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 *
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)
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:
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);
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);
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;
}
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;
}
}
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;
}
}
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;
}
}
} 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;
}
}
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
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;
}
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;
}
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;
}
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=")) {
#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>
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*
* 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;
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)
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
* 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);
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) {
}
// 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);
{
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;
}
/*
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;
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;
cfg->compile_aot && !cfg->llvm_only) {
MonoInst *pi;
MonoJumpInfoToken *ji;
- MonoString *s;
+ char *s;
// FIXME: llvmonly
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;
}
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];
}
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);
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;
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;
}
* 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;
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)
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 };
/*
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;
}
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;
* return TRUE for methods used in IMT calls too.
*/
if (virtual_ && is_generic_method_definition (m)) {
- MonoError error;
MonoGenericContext context = { NULL, NULL };
MonoMethod *declaring;
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))) {
}
if (method_inst || m->wrapper_type) {
- MonoError error;
MonoGenericContext context = { NULL, NULL };
if (m->is_inflated)
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);
}
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);
$(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
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
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)
$(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 \
}
}
+/*
+ * 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)
{
#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);
#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
#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];
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;
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);
}
/*
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
} 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)); \
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;
INTERNAL_MEM_BINARY_PROTOCOL,
INTERNAL_MEM_TEMPORARY,
INTERNAL_MEM_LOG_ENTRY,
+ INTERNAL_MEM_COMPLEX_DESCRIPTORS,
INTERNAL_MEM_FIRST_CLIENT
};
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");
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 \
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);
*/
#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>
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)
{
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 {
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 {
}
}
- 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 {
}
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);
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);
}
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.
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
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:
*
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"));
}
}
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);
}
/**
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;
}
/**
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:
*
* 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
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);
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
/*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
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));
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);
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);
<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
--- /dev/null
+@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
--- /dev/null
+@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
+++ /dev/null
-Tasks as of February 12th 2011 that are needed:
-
- Missing nostdlib
-
- Missing: -codepage:xxx
-
[ ] 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"
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}"
{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
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
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
--- /dev/null
+#
+# 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
--- /dev/null
+#!/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)
"MonoException",
"MonoTypedRef",
"MonoThreadsSync",
- "SgenThreadInfo"
+ "SgenThreadInfo",
+ "SgenClientThreadInfo"
};
DumpClasses(writer, ctx, types);
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
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)