Enable selecting the sgen major mode (#1546)
* [mmp/mtouch] Add option for concurrent sgen * [msbuild] Add support for concurrent sgen properties * [mmp] Test for concurrent sgen option
This commit is contained in:
Родитель
0b37471271
Коммит
cd9292ffdd
|
@ -58,6 +58,9 @@ namespace Xamarin.Mac.Tasks
|
||||||
|
|
||||||
public bool IsAppExtension { get; set; }
|
public bool IsAppExtension { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public bool EnableSGenConc { get; set; }
|
||||||
|
|
||||||
public bool UseXamMacFullFramework { get; set; }
|
public bool UseXamMacFullFramework { get; set; }
|
||||||
|
|
||||||
public string ApplicationName { get; set; }
|
public string ApplicationName { get; set; }
|
||||||
|
@ -150,6 +153,9 @@ namespace Xamarin.Mac.Tasks
|
||||||
if (Profiling)
|
if (Profiling)
|
||||||
args.Add ("/profiling");
|
args.Add ("/profiling");
|
||||||
|
|
||||||
|
if (EnableSGenConc)
|
||||||
|
args.Add ("/sgen-conc");
|
||||||
|
|
||||||
switch ((LinkMode ?? string.Empty).ToLower ()) {
|
switch ((LinkMode ?? string.Empty).ToLower ()) {
|
||||||
case "full":
|
case "full":
|
||||||
break;
|
break;
|
||||||
|
@ -240,6 +246,7 @@ namespace Xamarin.Mac.Tasks
|
||||||
Log.LogTaskProperty ("Architecture", Architecture);
|
Log.LogTaskProperty ("Architecture", Architecture);
|
||||||
Log.LogTaskProperty ("ArchiveSymbols", ArchiveSymbols);
|
Log.LogTaskProperty ("ArchiveSymbols", ArchiveSymbols);
|
||||||
Log.LogTaskProperty ("Debug", Debug);
|
Log.LogTaskProperty ("Debug", Debug);
|
||||||
|
Log.LogTaskProperty ("EnableSGenConc", EnableSGenConc);
|
||||||
Log.LogTaskProperty ("ExplicitReferences", ExplicitReferences);
|
Log.LogTaskProperty ("ExplicitReferences", ExplicitReferences);
|
||||||
Log.LogTaskProperty ("ExtraArguments", ExtraArguments);
|
Log.LogTaskProperty ("ExtraArguments", ExtraArguments);
|
||||||
Log.LogTaskProperty ("FrameworkRoot", FrameworkRoot);
|
Log.LogTaskProperty ("FrameworkRoot", FrameworkRoot);
|
||||||
|
|
|
@ -54,6 +54,7 @@ Copyright (C) 2013-2014 Xamarin. All rights reserved.
|
||||||
<MonoMacResourcePrefix Condition="'$(MonoMacResourcePrefix)' == ''">Resources</MonoMacResourcePrefix>
|
<MonoMacResourcePrefix Condition="'$(MonoMacResourcePrefix)' == ''">Resources</MonoMacResourcePrefix>
|
||||||
<XamMacResourcePrefix Condition="'$(XamMacResourcePrefix)' == ''">$(MonoMacResourcePrefix)</XamMacResourcePrefix>
|
<XamMacResourcePrefix Condition="'$(XamMacResourcePrefix)' == ''">$(MonoMacResourcePrefix)</XamMacResourcePrefix>
|
||||||
<IsAppExtension Condition="'$(IsAppExtension)' == ''">False</IsAppExtension>
|
<IsAppExtension Condition="'$(IsAppExtension)' == ''">False</IsAppExtension>
|
||||||
|
<EnableSGenConc Condition="'$(EnableSGenConc)' == ''">false</EnableSGenConc>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -536,7 +536,8 @@ Copyright (C) 2014 Xamarin. All rights reserved.
|
||||||
IntermediateOutputPath="$(IntermediateOutputPath)mmp-cache"
|
IntermediateOutputPath="$(IntermediateOutputPath)mmp-cache"
|
||||||
AppManifest="$(_AppManifest)"
|
AppManifest="$(_AppManifest)"
|
||||||
SdkVersion="$(MacOSXSdkVersion)"
|
SdkVersion="$(MacOSXSdkVersion)"
|
||||||
IsAppExtension="$(IsAppExtension)">
|
IsAppExtension="$(IsAppExtension)"
|
||||||
|
EnableSGenConc="$(EnableSGenConc)">
|
||||||
<Output TaskParameter="NativeLibraries" ItemName="_NativeLibrary" />
|
<Output TaskParameter="NativeLibraries" ItemName="_NativeLibrary" />
|
||||||
</Mmp>
|
</Mmp>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
|
@ -106,6 +106,9 @@ namespace Xamarin.iOS.Tasks
|
||||||
|
|
||||||
public ITaskItem[] LinkDescriptions { get; set; }
|
public ITaskItem[] LinkDescriptions { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public bool EnableSGenConc { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public bool LinkerDumpDependencies { get; set; }
|
public bool LinkerDumpDependencies { get; set; }
|
||||||
|
|
||||||
|
@ -400,6 +403,9 @@ namespace Xamarin.iOS.Tasks
|
||||||
if (LinkerDumpDependencies)
|
if (LinkerDumpDependencies)
|
||||||
args.Add ("--linkerdumpdependencies");
|
args.Add ("--linkerdumpdependencies");
|
||||||
|
|
||||||
|
if (EnableSGenConc)
|
||||||
|
args.Add ("--sgen-conc");
|
||||||
|
|
||||||
switch (LinkMode.ToLowerInvariant ()) {
|
switch (LinkMode.ToLowerInvariant ()) {
|
||||||
case "sdkonly": args.Add ("--linksdkonly"); break;
|
case "sdkonly": args.Add ("--linksdkonly"); break;
|
||||||
case "none": args.Add ("--nolink"); break;
|
case "none": args.Add ("--nolink"); break;
|
||||||
|
@ -638,6 +644,7 @@ namespace Xamarin.iOS.Tasks
|
||||||
Log.LogTaskProperty ("CompiledEntitlements", CompiledEntitlements);
|
Log.LogTaskProperty ("CompiledEntitlements", CompiledEntitlements);
|
||||||
Log.LogTaskProperty ("Debug", Debug);
|
Log.LogTaskProperty ("Debug", Debug);
|
||||||
Log.LogTaskProperty ("EnableGenericValueTypeSharing", EnableGenericValueTypeSharing);
|
Log.LogTaskProperty ("EnableGenericValueTypeSharing", EnableGenericValueTypeSharing);
|
||||||
|
Log.LogTaskProperty ("EnableSGenConc", EnableSGenConc);
|
||||||
Log.LogTaskProperty ("Entitlements", Entitlements);
|
Log.LogTaskProperty ("Entitlements", Entitlements);
|
||||||
Log.LogTaskProperty ("ExecutableName", ExecutableName);
|
Log.LogTaskProperty ("ExecutableName", ExecutableName);
|
||||||
Log.LogTaskProperty ("ExtraArgs", ExtraArgs);
|
Log.LogTaskProperty ("ExtraArgs", ExtraArgs);
|
||||||
|
|
|
@ -49,6 +49,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
|
||||||
<MtouchEnableBitcode Condition="'$(MtouchEnableBitcode)' == ''">False</MtouchEnableBitcode>
|
<MtouchEnableBitcode Condition="'$(MtouchEnableBitcode)' == ''">False</MtouchEnableBitcode>
|
||||||
<MtouchUseThumb Condition="'$(MtouchUseThumb)' == ''">False</MtouchUseThumb>
|
<MtouchUseThumb Condition="'$(MtouchUseThumb)' == ''">False</MtouchUseThumb>
|
||||||
<MtouchProjectDirectory>$(MSBuildProjectDirectory)</MtouchProjectDirectory>
|
<MtouchProjectDirectory>$(MSBuildProjectDirectory)</MtouchProjectDirectory>
|
||||||
|
<MtouchEnableSGenConc Condition="'$(MtouchEnableSGenConc)' == ''">False</MtouchEnableSGenConc>
|
||||||
|
|
||||||
<IsMacEnabled>true</IsMacEnabled>
|
<IsMacEnabled>true</IsMacEnabled>
|
||||||
<MtouchTargetsEnabled>$(IsMacEnabled)</MtouchTargetsEnabled>
|
<MtouchTargetsEnabled>$(IsMacEnabled)</MtouchTargetsEnabled>
|
||||||
|
|
|
@ -747,6 +747,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
|
||||||
UseFloat32="$(MtouchFloat32)"
|
UseFloat32="$(MtouchFloat32)"
|
||||||
UseThumb="$(MtouchUseThumb)"
|
UseThumb="$(MtouchUseThumb)"
|
||||||
EnableBitcode="$(MtouchEnableBitcode)"
|
EnableBitcode="$(MtouchEnableBitcode)"
|
||||||
|
EnableSGenConc="$(MtouchEnableSGenConc)"
|
||||||
AppExtensionReferences="@(_ResolvedAppExtensionReferences)"
|
AppExtensionReferences="@(_ResolvedAppExtensionReferences)"
|
||||||
ArchiveSymbols="$(MonoSymbolArchive)"
|
ArchiveSymbols="$(MonoSymbolArchive)"
|
||||||
Verbosity="$(MtouchVerbosity)"
|
Verbosity="$(MtouchVerbosity)"
|
||||||
|
|
|
@ -427,6 +427,17 @@ namespace Xamarin.MMP.Tests
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Unified_SgenConcurrent_Test ()
|
||||||
|
{
|
||||||
|
RunMMPTest (tmpDir => {
|
||||||
|
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) {
|
||||||
|
CSProjConfig = "<MonoBundlingExtraArgs>--sgen-conc</MonoBundlingExtraArgs>"
|
||||||
|
};
|
||||||
|
TI.TestUnifiedExecutable (test);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Unified_ShouldGenerateMachineConfigInBundle_WithEmptyOption ()
|
public void Unified_ShouldGenerateMachineConfigInBundle_WithEmptyOption ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace Xamarin.Bundler {
|
||||||
public Mono.Linker.I18nAssemblies I18n;
|
public Mono.Linker.I18nAssemblies I18n;
|
||||||
|
|
||||||
public bool? EnableCoopGC;
|
public bool? EnableCoopGC;
|
||||||
|
public bool EnableSGenConc;
|
||||||
public MarshalObjectiveCExceptionMode MarshalObjectiveCExceptions;
|
public MarshalObjectiveCExceptionMode MarshalObjectiveCExceptions;
|
||||||
public MarshalManagedExceptionMode MarshalManagedExceptions;
|
public MarshalManagedExceptionMode MarshalManagedExceptions;
|
||||||
public bool IsDefaultMarshalManagedExceptionMode;
|
public bool IsDefaultMarshalManagedExceptionMode;
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace Xamarin.Bundler {
|
||||||
static void AddSharedOptions (Application app, Mono.Options.OptionSet options)
|
static void AddSharedOptions (Application app, Mono.Options.OptionSet options)
|
||||||
{
|
{
|
||||||
options.Add ("coop:", "If the GC should run in cooperative mode.", v => { app.EnableCoopGC = ParseBool (v, "coop"); }, hidden: true);
|
options.Add ("coop:", "If the GC should run in cooperative mode.", v => { app.EnableCoopGC = ParseBool (v, "coop"); }, hidden: true);
|
||||||
|
options.Add ("sgen-conc", "Enable the concurrent garbage collector.", v => { app.EnableSGenConc = true; });
|
||||||
options.Add ("marshal-objectivec-exceptions:", "Specify how Objective-C exceptions should be marshalled. Valid values: default, unwindmanagedcode, throwmanagedexception, abort and disable. The default depends on the target platform (on watchOS the default is 'throwmanagedexception', while on all other platforms it's 'disable').", v => {
|
options.Add ("marshal-objectivec-exceptions:", "Specify how Objective-C exceptions should be marshalled. Valid values: default, unwindmanagedcode, throwmanagedexception, abort and disable. The default depends on the target platform (on watchOS the default is 'throwmanagedexception', while on all other platforms it's 'disable').", v => {
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case "default":
|
case "default":
|
||||||
|
|
|
@ -1080,6 +1080,11 @@ namespace Xamarin.Bundler {
|
||||||
if (App.EnableDebug)
|
if (App.EnableDebug)
|
||||||
sw.WriteLine ("\txamarin_debug_mode = TRUE;");
|
sw.WriteLine ("\txamarin_debug_mode = TRUE;");
|
||||||
|
|
||||||
|
if (App.EnableSGenConc)
|
||||||
|
sw.WriteLine ("\tsetenv (\"MONO_GC_PARAMS\", \"major=marksweep-conc\", 1);");
|
||||||
|
else
|
||||||
|
sw.WriteLine ("\tsetenv (\"MONO_GC_PARAMS\", \"major=marksweep\", 1);");
|
||||||
|
|
||||||
if (aot.IsAOT)
|
if (aot.IsAOT)
|
||||||
sw.WriteLine ("\txamarin_mac_aot = TRUE;");
|
sw.WriteLine ("\txamarin_mac_aot = TRUE;");
|
||||||
|
|
||||||
|
|
|
@ -242,16 +242,18 @@ namespace Xamarin.Bundler {
|
||||||
public string MonoGCParams {
|
public string MonoGCParams {
|
||||||
get {
|
get {
|
||||||
// Configure sgen to use a small nursery
|
// Configure sgen to use a small nursery
|
||||||
if (IsTodayExtension) {
|
string ret = "nursery-size=512k";
|
||||||
return "nursery-size=512k,soft-heap-limit=8m";
|
if (IsTodayExtension || Platform == ApplePlatform.WatchOS) {
|
||||||
} else if (Platform == ApplePlatform.WatchOS) {
|
|
||||||
// A bit test shows different behavior
|
// A bit test shows different behavior
|
||||||
// Sometimes apps are killed with ~100mb allocated,
|
// Sometimes apps are killed with ~100mb allocated,
|
||||||
// but I've seen apps allocate up to 240+mb as well
|
// but I've seen apps allocate up to 240+mb as well
|
||||||
return "nursery-size=512k,soft-heap-limit=8m";
|
ret += ",soft-heap-limit=8m";
|
||||||
} else {
|
|
||||||
return "nursery-size=512k";
|
|
||||||
}
|
}
|
||||||
|
if (EnableSGenConc)
|
||||||
|
ret += ",major=marksweep-conc";
|
||||||
|
else
|
||||||
|
ret += ",major=marksweep";
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче