diff options
author | Alexander Kyte <alexmkyte@fastmail.com> | 2016-01-14 02:13:51 +0300 |
---|---|---|
committer | Alexander Kyte <alexmkyte@fastmail.com> | 2016-01-27 23:10:18 +0300 |
commit | f7010e65a9a72b5ace227b4cff1aa0484eb32b82 (patch) | |
tree | e5d00fc49d6a8bf2dec95e81e27f1119113a5a2f | |
parent | 1f5d985270df9390f9cb558656763ea428c14e2c (diff) |
[aot/bcl] Add Makefile configuration to build the bcl with aot, use it in mobile_static.
-rw-r--r-- | mcs/build/library.make | 12 | ||||
-rw-r--r-- | mcs/build/profiles/mobile_static.make | 14 | ||||
-rw-r--r-- | mcs/build/rules.make | 63 | ||||
-rw-r--r-- | mcs/build/tests.make | 22 | ||||
-rw-r--r-- | mcs/class/Facades/Makefile | 3 | ||||
-rw-r--r-- | mcs/class/I18N/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/Makefile | 2 | ||||
-rw-r--r-- | mcs/tools/nunit-lite/Makefile | 2 | ||||
-rw-r--r-- | mcs/tools/nunit-lite/nunit-lite-console/Makefile | 4 |
9 files changed, 101 insertions, 23 deletions
diff --git a/mcs/build/library.make b/mcs/build/library.make index c9c01246717..5954ba2e316 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -295,17 +295,13 @@ library_CLEAN_FILES += $(PROFILE)_aot.log ifdef PLATFORM_AOT_SUFFIX Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";) -$(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib) - $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version --debug $(the_lib) -endif - -ifdef ENABLE_AOT -ifneq (,$(filter $(AOT_IN_PROFILES), $(PROFILE))) -all-local: $(the_lib)$(PLATFORM_AOT_SUFFIX) +$(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib) + $(Q_AOT) MONO_PATH='$(the_libdir_base)' > $(PROFILE)_$(LIBRARY_NAME)_aot.log 2>&1 $(RUNTIME) $(AOT_BUILD_FLAGS) --debug $(the_lib) +all-local-aot: $(the_lib)$(PLATFORM_AOT_SUFFIX) endif -endif + makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).makefrag library_CLEAN_FILES += $(makefrag) diff --git a/mcs/build/profiles/mobile_static.make b/mcs/build/profiles/mobile_static.make index 03e20ed74ad..13e076a3081 100644 --- a/mcs/build/profiles/mobile_static.make +++ b/mcs/build/profiles/mobile_static.make @@ -44,3 +44,17 @@ NO_VTS_TEST = yes # Note need for trailing comma. If you add, keep it PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking, +ifndef MONO_DISABLE_GSHAREDVT +GSHAREDVT_FLAG = -O=gsharedvt +endif + +ifeq ($(MONO_LLVMONLY),TRUE) +AOT_BUILD_FLAGS_PREFIX = $(GSHAREDVT_FLAG) --aot=llvmonly, +AOT_RUN_FLAGS = --llvmonly +else +AOT_BUILD_FLAGS_PREFIX = $(GSHAREDVT_FLAG) --aot=full, +AOT_RUN_FLAGS = --full-aot +endif + +ALWAYS_AOT = yes + diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 966351c446b..7ff27755ec1 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -130,14 +130,62 @@ endif # Make sure propagates export TEST_HARNESS +# start aot config + +# We set the prefix of the aot build flags +# in the profile. This determines the aot type, +# whether it be llvmonly or full. To this we append the +# options which do not change between them, the INVARIANT_AOT_OPTIONS +ifndef AOT_BUILD_FLAGS_PREFIX +AOT_BUILD_FLAGS_PREFIX = --aot= +endif + +# Set the options for building and running AOT +# The trampoline numbers are provisional, they are what is required +# to run the corlib test suite. They should be considered a lower bound. +INVARIANT_AOT_OPTIONS=bind-to-runtime-version,nimt-trampolines=900,ntrampolines=8000 + +ifndef MONO_DISABLE_GSHAREDVT +INVARIANT_AOT_OPTIONS:=$(INVARIANT_AOT_OPTIONS),ngsharedvt-trampolines=900 +endif + +AOT_BUILD_FLAGS = $(AOT_BUILD_FLAGS_PREFIX)$(INVARIANT_AOT_OPTIONS) + +# end AOT config + ifdef BCL_OPTIMIZE PROFILE_MCS_FLAGS += -optimize endif +# Design: +# Problem: We want to be able to build aot +# assemblies as part of the build system. +# +# For this to be done safely, we really need two passes. This +# ensures that all of the .dlls are compiled before trying to +# aot them. Because we want this to be the +# default target for some profiles(mobile_static) we have a +# two-level build system. The do-all-aot target is what +# gets invoked at the top-level when someone tries to build with aot. +# It will invoke the do-all target, and will set TOP_LEVEL_DO for this +# recursive make call in order to prevent this recursive call from trying +# to build aot in each of the subdirs. After this is done, we will aot +# everything that our building produced by aoting everything in +# mcs/class/lib/$(PROFILE)/ +ifndef TOP_LEVEL_DO + +ifdef ALWAYS_AOT +TOP_LEVEL_DO = do-all-aot +else +TOP_LEVEL_DO = do-all +endif # ALWAYS_AOT + +endif # !TOP_LEVEL_DO + ifdef OVERRIDE_TARGET_ALL all: all.override else -all: do-all +all: $(TOP_LEVEL_DO) endif ifdef NO_INSTALL @@ -151,6 +199,19 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update $(STD_TARGETS): %: do-% +ifdef PLATFORM_AOT_SUFFIX +Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] AOT All Assemblies";) +LIST_ALL_PROFILE_ASSEMBLIES = find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml' +COMPILE_ALL_PROFILE_ASSEMBLIES = $(LIST_ALL_PROFILE_ASSEMBLIES) | MONO_PATH="./" xargs -I '{}' $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) '{}' + +do-all-aot: + $(MAKE) do-all TOP_LEVEL_DO=do-all + $(MAKE) aot-all-profile + +aot-all-profile: + $(Q_AOT) cd $(topdir)/class/lib/$(PROFILE)/ && $(COMPILE_ALL_PROFILE_ASSEMBLIES) &> $(PROFILE)-aot.log +endif + do-run-test: ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok diff --git a/mcs/build/tests.make b/mcs/build/tests.make index 82fa11f0035..e8d52d00332 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -124,10 +124,19 @@ ifdef TESTNAME TESTNAME_ARG = -run=MonoTests.$(TESTNAME) endif +ifdef ALWAYS_AOT +test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp + PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) $(test_assemblies) + +else +test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp + +endif # ALWAYS_AOT + ## FIXME: i18n problem in the 'sed' command below -run-test-lib: test-local +run-test-lib: test-local test-local-aot-compile ok=:; \ - PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) $(NUNIT_XML_FLAG)TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \ + PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) $(NUNIT_XML_FLAG)TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \ if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \ $(TEST_HARNESS_POSTPROC) ; $$ok @@ -154,16 +163,11 @@ $(test_lib): $(the_assembly) $(test_response) $(test_nunit_dep) test_response_preprocessed = $(test_response)_preprocessed -ifdef HAVE_SOURCE_EXCLUDES +# This handles .excludes/.sources pairs, as well as resolving the +# includes that occur in .sources files $(test_response_preprocessed): $(test_sourcefile) $(SHELL) $(topdir)/build/gensources.sh $@ '$(test_sourcefile)' '$(test_sourcefile_excludes)' -else -$(test_response_preprocessed): $(test_sourcefile) - cp $(test_sourcefile) $(test_response_preprocessed) - -endif # HAVE_SOURCE_EXCLUDES - $(test_response): $(test_response_preprocessed) # @echo Creating $@ ... @sed -e '/^$$/d' -e 's,^,Test/,' $(test_response_preprocessed) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@ diff --git a/mcs/class/Facades/Makefile b/mcs/class/Facades/Makefile index 2f8847d707a..12f045eebd8 100644 --- a/mcs/class/Facades/Makefile +++ b/mcs/class/Facades/Makefile @@ -38,3 +38,6 @@ doc-update-recursive: @echo "do not recurse the Facades folder" System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML System.ComponentModel.Composition System.ServiceModel System.Xml.Linq: + +all-local-aot: + diff --git a/mcs/class/I18N/Makefile b/mcs/class/I18N/Makefile index d6fa41fe65b..b7d4788608e 100644 --- a/mcs/class/I18N/Makefile +++ b/mcs/class/I18N/Makefile @@ -12,6 +12,6 @@ DISTFILES = \ tools/ucm2cp.c \ tools/uni2tab.c -all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local: +all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local all-local-aot: dist-local: dist-default diff --git a/mcs/class/Makefile b/mcs/class/Makefile index a0dd126efac..60048068cf2 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -334,6 +334,8 @@ DISTFILES = \ all-local $(STD_TARGETS:=-local): @: +all-local-aot: + # Files needed to bootstrap C# compiler basic_files = basic.exe mscorlib.dll System.dll System.Xml.dll Mono.Security.dll System.Core.dll System.Security.dll System.Configuration.dll monolite_files = $(basic_files:%=lib/monolite/%) diff --git a/mcs/tools/nunit-lite/Makefile b/mcs/tools/nunit-lite/Makefile index 87a82157ae7..078a7ebdc0e 100644 --- a/mcs/tools/nunit-lite/Makefile +++ b/mcs/tools/nunit-lite/Makefile @@ -2,3 +2,5 @@ thisdir = tools/nunit-lite SUBDIRS = NUnitLite nunit-lite-console include ../../build/rules.make +all-local-aot: + diff --git a/mcs/tools/nunit-lite/nunit-lite-console/Makefile b/mcs/tools/nunit-lite/nunit-lite-console/Makefile index 5694be3b16d..920f74d29a5 100644 --- a/mcs/tools/nunit-lite/nunit-lite-console/Makefile +++ b/mcs/tools/nunit-lite/nunit-lite-console/Makefile @@ -7,7 +7,3 @@ LOCAL_MCS_FLAGS = /r:nunitlite.dll include ../../../build/executable.make -all-local-aot: - $(TEST_RUNTIME) $(AOT_BUILD) ../../class/lib/$(PROFILE)/nunit-lite-console.exe - - |