Merge pull request #3092 from alexanderkyte/mobile_static_fix_runtime_tests
authorAlexander Kyte <alexmkyte@gmail.com>
Mon, 18 Jul 2016 23:38:50 +0000 (19:38 -0400)
committerGitHub <noreply@github.com>
Mon, 18 Jul 2016 23:38:50 +0000 (19:38 -0400)
[mobile_static] Get mono/tests running on mobile_static

12 files changed:
external/buildtools
mcs/class/Makefile
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/GetReferenceAssemblyPaths.cs
mcs/class/Microsoft.Build.Utilities/Mono.XBuild.Utilities/ReservedNameUtils.cs
mcs/tools/xbuild/Makefile
mono/metadata/sgen-os-posix.c
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/method-to-ir.c
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm-cpp.h
mono/mini/mini-llvm.c

index a446ae466ce729b6732133f9b359590ae12030e6..a7dbffc17d029f2d66f56ddc9f50349a1bc0dcfe 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a446ae466ce729b6732133f9b359590ae12030e6
+Subproject commit a7dbffc17d029f2d66f56ddc9f50349a1bc0dcfe
index e2403865aac0e3d9a597c1a6a8bb45ec8fb170c1..1b16375f3fa099563acfb64fca80ad44a351ace4 100644 (file)
@@ -325,7 +325,7 @@ include ../build/rules.make
 
 SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS)
 
-DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs)
+DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks
 
 # No new makefiles for: System.Messaging, System.Web.Mobile,
 # System.ServiceProcess
index b74e26ab43eb365ea8c2f8fae31138aa8dd3041c..40f04ad996adbd6d817d6b0a944b26f193f123f9 100644 (file)
@@ -142,7 +142,9 @@ namespace Microsoft.Build.Tasks
                                        framework_dir = Path.Combine (redistlist_dir, framework_dir);
 
                                var directories = new List<string> ();
-                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir));
+
+                               //MSBuild has a trailing slash on this value
+                               directories.Add (MSBuildUtils.FromMSBuildPath (framework_dir) + Path.DirectorySeparatorChar);
 
                                string include = xr.GetAttribute ("IncludeFramework");
                                if (!String.IsNullOrEmpty (include)) {
index 6789cfbd9283a577f38482fde1387b546529dc8d..36f81236c243a64f347a18dcf2db231a8da9f210 100644 (file)
@@ -100,7 +100,7 @@ namespace Mono.XBuild.Utilities {
                                else
                                        return String.Empty;
                        case "identity":
-                               return Path.Combine (Path.GetDirectoryName (itemSpec), Path.GetFileName (itemSpec));
+                               return itemSpec;
                        case "modifiedtime":
                                if (File.Exists (itemSpec))
                                        return File.GetLastWriteTime (itemSpec).ToString ();
index ada65c60500f3fd4aae049be6573f7ebecff33c3..9d6e914532dad6265dc577dd2bbe6c0e176d5895 100644 (file)
@@ -161,6 +161,7 @@ EXTRA_DISTFILES = \
        frameworks/net_4.5.2.xml \
        frameworks/net_4.6.xml \
        frameworks/net_4.6.1.xml \
+       targets/Microsoft.WebApplication.targets        \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props       \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets      \
        $(NUGET_BUILDTASKS_REPO_DIR)/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets \
index 5a9bae85b6db35d7c95d81b19ad82a6c2e921a65..1016841f535149e796fa8ea8f8afe89e868d633c 100644 (file)
@@ -46,6 +46,7 @@ suspend_thread (SgenThreadInfo *info, void *context)
        gpointer stack_start;
 
        info->client_info.stopped_domain = mono_domain_get ();
+       info->client_info.stack_start = NULL;
        info->client_info.signal = 0;
        stop_count = sgen_global_stop_count;
        /* duplicate signal */
index 37b7e41201137966c43f0af255f9e3866dc8fd4b..e1ed7ce2c8341520031a84329904c969a5f9c501 100755 (executable)
@@ -595,12 +595,12 @@ libmini_la_CFLAGS = $(mono_CFLAGS)
 libmonoboehm_2_0_la_SOURCES =
 libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
 libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 libmonosgen_2_0_la_SOURCES =
 libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
 libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF)
-libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
+libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags)
 
 #
 # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain
index 04e779766c77145293d5287c544e0aeeb2cd238a..5279d5e4e887cf3d004baf5a8d31e782393e9c89 100644 (file)
@@ -8242,7 +8242,7 @@ emit_llvm_file (MonoAotCompile *acfg)
                opts = g_strdup ("");
        else
 #if LLVM_API_VERSION > 100
-               opts = g_strdup ("-O2");
+               opts = g_strdup ("-O2 -disable-tail-calls");
 #else
                opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
 #endif
index 59ad7712d378ca86cb80f6a09ca87b3b8ace7559..c7ca275b134fe12dccc3803d1958b81a1bad99b7 100644 (file)
@@ -7080,7 +7080,8 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        GHashTable *prev_cbb_hash;
        MonoBasicBlock **prev_cil_offset_to_bb;
        MonoBasicBlock *prev_cbb;
-       unsigned char* prev_cil_start;
+       const unsigned char *prev_ip;
+       unsigned char *prev_cil_start;
        guint32 prev_cil_offset_to_bb_len;
        MonoMethod *prev_current_method;
        MonoGenericContext *prev_generic_context;
@@ -7156,6 +7157,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        prev_cil_offset_to_bb = cfg->cil_offset_to_bb;
        prev_cil_offset_to_bb_len = cfg->cil_offset_to_bb_len;
        prev_cil_start = cfg->cil_start;
+       prev_ip = cfg->ip;
        prev_cbb = cfg->cbb;
        prev_current_method = cfg->current_method;
        prev_generic_context = cfg->generic_context;
@@ -7175,6 +7177,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
        cfg->cil_offset_to_bb = prev_cil_offset_to_bb;
        cfg->cil_offset_to_bb_len = prev_cil_offset_to_bb_len;
        cfg->cil_start = prev_cil_start;
+       cfg->ip = prev_ip;
        cfg->locals = prev_locals;
        cfg->args = prev_args;
        cfg->arg_types = prev_arg_types;
index 4753f66ca6d882ec24a1110495a0ee5cbc5c5589..1bf14393db25142339add6f35a4e311d3ccbc728 100644 (file)
@@ -229,6 +229,14 @@ mono_llvm_set_call_preserveall_cc (LLVMValueRef func)
        unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
 }
 
+void
+mono_llvm_set_call_notail (LLVMValueRef func)
+{
+#if LLVM_API_VERSION > 100
+       //unwrap<CallInst>(func)->setTailCallKind (CallInst::TailCallKind::TCK_NoTail);
+#endif
+}
+
 #if LLVM_API_VERSION > 100
 
 void*
index 50e89e858eac7599384ee9a87b9561f61c354884..f969274e4a7f6bfb211b13063d73dea5f51a61a2 100644 (file)
@@ -89,6 +89,9 @@ mono_llvm_set_preserveall_cc (LLVMValueRef func);
 void
 mono_llvm_set_call_preserveall_cc (LLVMValueRef call);
 
+void
+mono_llvm_set_call_notail (LLVMValueRef call);
+
 _Unwind_Reason_Code 
 mono_debug_personality (int a, _Unwind_Action b,
        uint64_t c, struct _Unwind_Exception *d, struct _Unwind_Context *e);
index 9af6360a09b94d13952c603cea9496106dbedc1b..6031df370c283e4be3816e4640b24b6528739bb4 100644 (file)
@@ -1138,8 +1138,19 @@ static LLVMValueRef
 emit_volatile_load (EmitContext *ctx, int vreg)
 {
        MonoType *t;
+       LLVMValueRef v;
 
-       LLVMValueRef v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#ifdef TARGET_ARM64
+       // FIXME: This hack is required because we pass the rgctx in a callee saved
+       // register on arm64 (x15), and llvm might keep the value in that register
+       // even through the register is marked as 'reserved' inside llvm.
+       if (ctx->cfg->rgctx_var && ctx->cfg->rgctx_var->dreg == vreg)
+               v = mono_llvm_build_load (ctx->builder, ctx->addresses [vreg], "", TRUE);
+       else
+               v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#else
+       v = LLVMBuildLoad (ctx->builder, ctx->addresses [vreg], "");
+#endif
        t = ctx->vreg_cli_types [vreg];
        if (t && !t->byref) {
                /* 
@@ -5780,12 +5791,13 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                        if (!var) {
                                LLVMValueRef indexes [16];
 
-                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME");
+                               LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), strlen (name) + 1), "@OBJC_METH_VAR_NAME_");
                                LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, strlen (name) + 1));
                                LLVMSetLinkage (name_var, LLVMPrivateLinkage);
                                LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals");
+                               mark_as_used (ctx->module, name_var);
 
-                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES");
+                               LLVMValueRef ref_var = LLVMAddGlobal (ctx->lmodule, LLVMPointerType (LLVMInt8Type (), 0), "@OBJC_SELECTOR_REFERENCES_");
 
                                indexes [0] = LLVMConstInt (LLVMInt32Type (), 0, 0);
                                indexes [1] = LLVMConstInt (LLVMInt32Type (), 0, 0);
@@ -5794,6 +5806,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                LLVMSetExternallyInitialized (ref_var, TRUE);
                                LLVMSetSection (ref_var, "__DATA, __objc_selrefs, literal_pointers, no_dead_strip");
                                LLVMSetAlignment (ref_var, sizeof (mgreg_t));
+                               mark_as_used (ctx->module, ref_var);
 
                                g_hash_table_insert (ctx->module->objc_selector_to_var, g_strdup (name), ref_var);
                                var = ref_var;