Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@ -134,30 +134,33 @@ namespace System.Reflection.Emit {
private static extern void create_dynamic_method (DynamicMethod m);
private void CreateDynMethod () {
if (mhandle.Value == IntPtr.Zero) {
if (ilgen == null || ilgen.ILOffset == 0)
throw new InvalidOperationException ("Method '" + name + "' does not have a method body.");
// Clearing of ilgen in create_dynamic_method is not yet synchronized for multiple threads
lock (this) {
if (mhandle.Value == IntPtr.Zero) {
if (ilgen == null || ilgen.ILOffset == 0)
throw new InvalidOperationException ("Method '" + name + "' does not have a method body.");
ilgen.label_fixup (this);
ilgen.label_fixup (this);
// Have to create all DynamicMethods referenced by this one
try {
// Used to avoid cycles
creating = true;
if (refs != null) {
for (int i = 0; i < refs.Length; ++i) {
if (refs [i] is DynamicMethod) {
DynamicMethod m = (DynamicMethod)refs [i];
if (!m.creating)
m.CreateDynMethod ();
// Have to create all DynamicMethods referenced by this one
try {
// Used to avoid cycles
creating = true;
if (refs != null) {
for (int i = 0; i < refs.Length; ++i) {
if (refs [i] is DynamicMethod) {
DynamicMethod m = (DynamicMethod)refs [i];
if (!m.creating)
m.CreateDynMethod ();
}
}
}
} finally {
creating = false;
}
} finally {
creating = false;
create_dynamic_method (this);
ilgen = null;
}
create_dynamic_method (this);
}
}