Skip to content

Commit 664631a

Browse files
authored
Merge branch 'main' into dev/ema/perf-no-input
2 parents 9e96e3b + 680630d commit 664631a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1402
-709
lines changed

eng/Version.Details.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This file is auto-generated by the Maestro dependency flow system.
4+
Do not edit it manually, as it will get overwritten by automation.
5+
This file should be imported by eng/Versions.props
6+
-->
7+
<Project>
8+
<!-- will get filled in the next maestro bump -->
9+
</Project>

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@
8787
</Dependency>
8888
</ProductDependencies>
8989
<ToolsetDependencies>
90-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="9.0.0-beta.25366.1">
90+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="9.0.0-beta.25380.1">
9191
<Uri>https://github.com/dotnet/arcade</Uri>
92-
<Sha>1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f</Sha>
92+
<Sha>7e67a7b4b62513a475afe46c4cd74d54b68f65c9</Sha>
9393
</Dependency>
9494
<Dependency Name="Microsoft.TemplateEngine.Tasks" Version="7.0.100-alpha.1.21601.1">
9595
<Uri>https://github.com/dotnet/templating</Uri>
@@ -99,9 +99,9 @@
9999
<Uri>https://github.com/dotnet/xharness</Uri>
100100
<Sha>889949a0c734be07795cedf04690f959b0cf00bc</Sha>
101101
</Dependency>
102-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25366.1">
102+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25380.1">
103103
<Uri>https://github.com/dotnet/arcade</Uri>
104-
<Sha>1a2e280a031aaed0dca606ec8c59c6fe0f9bfc7f</Sha>
104+
<Sha>7e67a7b4b62513a475afe46c4cd74d54b68f65c9</Sha>
105105
<SourceBuild RepoName="arcade" ManagedOnly="true" />
106106
</Dependency>
107107
</ToolsetDependencies>

eng/Versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<MicrosoftNETSdkPackageVersion>9.0.109-servicing.25365.26</MicrosoftNETSdkPackageVersion>
66
<MicrosoftNETILLinkTasksPackageVersion>9.0.7</MicrosoftNETILLinkTasksPackageVersion>
77
<MicrosoftNETILLinkPackageVersion>9.0.0-alpha.1.23556.4</MicrosoftNETILLinkPackageVersion>
8-
<MicrosoftDotNetBuildTasksFeedPackageVersion>9.0.0-beta.25366.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
8+
<MicrosoftDotNetBuildTasksFeedPackageVersion>9.0.0-beta.25380.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
99
<MicrosoftDotNetSharedFrameworkSdkVersion>8.0.0-beta.24413.2</MicrosoftDotNetSharedFrameworkSdkVersion>
1010
<MicrosoftNETCoreAppRefPackageVersion>9.0.7</MicrosoftNETCoreAppRefPackageVersion>
1111
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-rtm.23511.3</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
1212
<MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>9.0.0-rc.2.24462.10</MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>
1313
<MicrosoftTemplateEngineTasksVersion>7.0.100-alpha.1.21601.1</MicrosoftTemplateEngineTasksVersion>
1414
<MicrosoftDotNetCecilPackageVersion>0.11.5-alpha.25275.2</MicrosoftDotNetCecilPackageVersion>
1515
<MicrosoftDotNetXHarnessiOSSharedPackageVersion>10.0.0-prerelease.25381.1</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
16-
<MicrosoftDotNetArcadeSdkPackageVersion>9.0.0-beta.25366.1</MicrosoftDotNetArcadeSdkPackageVersion>
16+
<MicrosoftDotNetArcadeSdkPackageVersion>9.0.0-beta.25380.1</MicrosoftDotNetArcadeSdkPackageVersion>
1717
<!-- Manually updated versions -->
1818
<Emscriptennet7WorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version)</Emscriptennet7WorkloadVersion>
1919
<EmscriptenWorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version)</EmscriptenWorkloadVersion>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"dotnet": "9.0.109-servicing.25365.26"
77
},
88
"msbuild-sdks": {
9-
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25366.1"
9+
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25380.1"
1010
}
1111
}

runtime/exports.t4

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,26 +137,26 @@
137137
HasCoreCLRBridgeFunction = true,
138138
},
139139

140-
new Export ("uint32_t", "mono_gchandle_new",
140+
new Export ("GCHandle", "mono_gchandle_new_v2",
141141
"MonoObject *", "obj",
142142
"mono_bool", "pinned"
143143
) {
144144
XamarinRuntime = RuntimeMode.MonoVM,
145145
},
146146

147-
new Export ("MonoObject *", "mono_gchandle_get_target",
148-
"uint32_t", "gchandle"
147+
new Export ("MonoObject *", "mono_gchandle_get_target_v2",
148+
"GCHandle", "gchandle"
149149
) {
150150
XamarinRuntime = RuntimeMode.MonoVM,
151151
},
152152

153-
new Export ("void", "mono_gchandle_free",
154-
"uint32_t", "gchandle"
153+
new Export ("void", "mono_gchandle_free_v2",
154+
"GCHandle", "gchandle"
155155
) {
156156
XamarinRuntime = RuntimeMode.MonoVM,
157157
},
158158

159-
new Export ("uint32_t", "mono_gchandle_new_weakref",
159+
new Export ("GCHandle", "mono_gchandle_new_weakref_v2",
160160
"MonoObject *", "obj",
161161
"mono_bool", "track_resurrection"
162162
) {
@@ -603,15 +603,14 @@
603603
XamarinRuntime = RuntimeMode.MonoVM,
604604
},
605605

606-
new Export ("MonoDomain *", "mono_jit_init_version",
607-
"const char *", "root_domain_name",
608-
"const char *", "runtime_version"
606+
new Export ("MonoDomain *", "mono_jit_init",
607+
"const char *", "file"
609608
) {
610609
XamarinRuntime = RuntimeMode.MonoVM,
611610
},
612611

613-
new Export ("MonoDomain *", "mono_jit_init",
614-
"const char *", "file"
612+
new Export ("MonoDomain *", "mono_jit_cleanup",
613+
"MonoDomain *", "domain"
615614
) {
616615
XamarinRuntime = RuntimeMode.MonoVM,
617616
},

runtime/monovm-bridge.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
mono_install_unhandled_exception_hook (xamarin_unhandled_exception_handler, NULL);
7777
mono_install_ftnptr_eh_callback (xamarin_ftnptr_exception_handler);
7878

79-
mono_jit_init_version ("MonoTouch", "mobile");
79+
mono_jit_init ("RootDomain");
8080
/*
8181
As part of mono initialization a preload hook is added that overrides ours, so we need to re-instate it here.
8282
This is wasteful, but there's no way to manipulate the preload hook list except by adding to it.
@@ -88,6 +88,7 @@
8888
void
8989
xamarin_bridge_shutdown ()
9090
{
91+
mono_jit_cleanup (mono_domain_get ());
9192
}
9293

9394
static MonoClass *

runtime/runtime.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,7 +2813,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
28132813
#if defined (CORECLR_RUNTIME)
28142814
return xamarin_bridge_create_gchandle (obj == NULL ? INVALID_GCHANDLE : obj->gchandle, pinned ? XamarinGCHandleTypePinned : XamarinGCHandleTypeNormal);
28152815
#else
2816-
return GINT_TO_POINTER (mono_gchandle_new (obj, pinned));
2816+
return mono_gchandle_new_v2 (obj, pinned);
28172817
#endif
28182818
}
28192819

@@ -2823,7 +2823,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
28232823
#if defined (CORECLR_RUNTIME)
28242824
return xamarin_bridge_create_gchandle (obj == NULL ? INVALID_GCHANDLE : obj->gchandle, track_resurrection ? XamarinGCHandleTypeWeakTrackResurrection : XamarinGCHandleTypeWeak);
28252825
#else
2826-
return GINT_TO_POINTER (mono_gchandle_new_weakref (obj, track_resurrection));
2826+
return mono_gchandle_new_weakref_v2 (obj, track_resurrection);
28272827
#endif
28282828
}
28292829

@@ -2836,7 +2836,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
28362836
#if defined (CORECLR_RUNTIME)
28372837
return xamarin_bridge_get_monoobject (handle);
28382838
#else
2839-
return mono_gchandle_get_target (GPOINTER_TO_UINT (handle));
2839+
return mono_gchandle_get_target_v2 (handle);
28402840
#endif
28412841
}
28422842

@@ -2848,7 +2848,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
28482848
#if defined (CORECLR_RUNTIME)
28492849
xamarin_bridge_free_gchandle (handle);
28502850
#else
2851-
mono_gchandle_free (GPOINTER_TO_UINT (handle));
2851+
mono_gchandle_free_v2 (handle);
28522852
#endif
28532853
}
28542854

runtime/trampolines.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@
771771
#if defined(DEBUG_REF_COUNTING)
772772
PRINT ("xamarin_notify_dealloc (%p, %i)\n", self, gchandle);
773773
#endif
774-
xamarin_unregister_nsobject (self, GINT_TO_POINTER (gchandle), &exception_gchandle);
774+
xamarin_unregister_nsobject (self, gchandle, &exception_gchandle);
775775
xamarin_free_gchandle (self, gchandle);
776776

777777
MONO_THREAD_DETACH;

src/bgen/Generator.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5600,7 +5600,15 @@ public void Generate (Type type)
56005600
indent++;
56015601
}
56025602

5603-
WriteDocumentation (type);
5603+
if (!WriteDocumentation (type)) {
5604+
if (is_model && !AttributeManager.HasAttribute<SyntheticAttribute> (type)) {
5605+
print ($"/// <summary>");
5606+
print ($"/// <para>This is a class that implements the interface <see cref=\"I{TypeName}\" /> (for the protocol <c>{(protocol?.Name ?? objc_type_name)}</c>).</para>");
5607+
print ($"/// <para>Subclass this class to easily create a type that implements the protocol.</para>");
5608+
print ($"/// <para>An alternative is to create a subclass of <see cref=\"NSObject\" /> and then implemented the interface <see cref=\"I{TypeName}\" />.</para>");
5609+
print ($"/// </summary>");
5610+
}
5611+
}
56045612

56055613
bool core_image_filter = false;
56065614
string class_mod = null;

src/rgen/Microsoft.Macios.Generator/Attributes/ExportData.cs

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ namespace Microsoft.Macios.Generator.Attributes;
1616
/// <typeparam name="T">The configuration flags used on the exported element.</typeparam>
1717
readonly struct ExportData<T> : IEquatable<ExportData<T>> where T : Enum {
1818

19+
/// <summary>
20+
/// The initialization state of the struct.
21+
/// </summary>
22+
StructState State { get; init; } = StructState.Default;
23+
24+
/// <summary>
25+
/// Gets the default, uninitialized instance of <see cref="ExportData{T}"/>.
26+
/// </summary>
27+
public static ExportData<T> Default { get; } = new (StructState.Default);
28+
29+
/// <summary>
30+
/// Gets a value indicating whether the instance is the default, uninitialized instance.
31+
/// </summary>
32+
public bool IsNullOrDefault => State == StructState.Default;
33+
1934
/// <summary>
2035
/// The exported native selector.
2136
/// </summary>
@@ -24,7 +39,7 @@ namespace Microsoft.Macios.Generator.Attributes;
2439
/// <summary>
2540
/// The configuration flags used on the exported member.
2641
/// </summary>
27-
public T? Flags { get; init; }
42+
public T Flags { get; init; }
2843

2944
/// <summary>
3045
/// Argument semantics to use with the selector.
@@ -90,20 +105,50 @@ namespace Microsoft.Macios.Generator.Attributes;
90105
/// </summary>
91106
public TypeInfo StrongDictionaryKeyClass { get; init; } = TypeInfo.Default;
92107

93-
public ExportData () { }
108+
/// <summary>
109+
/// Initializes a new instance of the <see cref="ExportData{T}"/> struct.
110+
/// </summary>
111+
public ExportData () : this (StructState.Initialized) { }
94112

95-
public ExportData (string? selector)
113+
/// <summary>
114+
/// Initializes a new instance of the <see cref="ExportData{T}"/> struct.
115+
/// </summary>
116+
/// <param name="state">The initialization state.</param>
117+
public ExportData (StructState state)
118+
{
119+
State = state;
120+
Flags = default!;
121+
}
122+
123+
/// <summary>
124+
/// Initializes a new instance of the <see cref="ExportData{T}"/> struct.
125+
/// </summary>
126+
/// <param name="selector">The exported native selector.</param>
127+
public ExportData (string? selector) : this (StructState.Initialized)
96128
{
97129
Selector = selector;
130+
Flags = default!;
98131
}
99132

100-
public ExportData (string? selector, ArgumentSemantic argumentSemantic)
133+
/// <summary>
134+
/// Initializes a new instance of the <see cref="ExportData{T}"/> struct.
135+
/// </summary>
136+
/// <param name="selector">The exported native selector.</param>
137+
/// <param name="argumentSemantic">Argument semantics to use with the selector.</param>
138+
public ExportData (string? selector, ArgumentSemantic argumentSemantic) : this (StructState.Initialized)
101139
{
102140
Selector = selector;
103141
ArgumentSemantic = argumentSemantic;
142+
Flags = default!;
104143
}
105144

106-
public ExportData (string? selector, ArgumentSemantic argumentSemantic, T flags)
145+
/// <summary>
146+
/// Initializes a new instance of the <see cref="ExportData{T}"/> struct.
147+
/// </summary>
148+
/// <param name="selector">The exported native selector.</param>
149+
/// <param name="argumentSemantic">Argument semantics to use with the selector.</param>
150+
/// <param name="flags">The configuration flags used on the exported member.</param>
151+
public ExportData (string? selector, ArgumentSemantic argumentSemantic, T flags) : this (StructState.Initialized)
107152
{
108153
Selector = selector;
109154
ArgumentSemantic = argumentSemantic;
@@ -121,7 +166,7 @@ public static bool TryParse (AttributeData attributeData,
121166
{
122167
data = null;
123168
var count = attributeData.ConstructorArguments.Length;
124-
string? selector = null;
169+
string? selector;
125170
ArgumentSemantic argumentSemantic = ArgumentSemantic.None;
126171
T? flags = default;
127172

@@ -281,6 +326,8 @@ public static bool TryParse (AttributeData attributeData,
281326
/// <inheritdoc />
282327
public bool Equals (ExportData<T> other)
283328
{
329+
if (State == StructState.Default && other.State == StructState.Default)
330+
return true;
284331
if (Selector != other.Selector)
285332
return false;
286333
if (ArgumentSemantic != other.ArgumentSemantic)
@@ -305,7 +352,7 @@ public bool Equals (ExportData<T> other)
305352
(null, null) => true,
306353
(null, _) => false,
307354
(_, null) => false,
308-
(_, _) => Flags!.Equals (other.Flags)
355+
(_, _) => Flags.Equals (other.Flags)
309356
};
310357
}
311358

@@ -321,11 +368,23 @@ public override int GetHashCode ()
321368
return HashCode.Combine (Selector, Flags);
322369
}
323370

371+
/// <summary>
372+
/// Compares two <see cref="ExportData{T}"/> instances for equality.
373+
/// </summary>
374+
/// <param name="x">The first instance.</param>
375+
/// <param name="y">The second instance.</param>
376+
/// <returns><c>true</c> if the instances are equal, <c>false</c> otherwise.</returns>
324377
public static bool operator == (ExportData<T> x, ExportData<T> y)
325378
{
326379
return x.Equals (y);
327380
}
328381

382+
/// <summary>
383+
/// Compares two <see cref="ExportData{T}"/> instances for inequality.
384+
/// </summary>
385+
/// <param name="x">The first instance.</param>
386+
/// <param name="y">The second instance.</param>
387+
/// <returns><c>true</c> if the instances are not equal, <c>false</c> otherwise.</returns>
329388
public static bool operator != (ExportData<T> x, ExportData<T> y)
330389
{
331390
return !(x == y);

0 commit comments

Comments
 (0)